Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public MainForm()
        {
            try
            {
                Application.ThreadException += Application_ThreadException;
                InitializeComponent();
                SetFormPosSize();
                Instance = this;
                Hwnd     = Handle;
                mpv.Init();
                mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
                mpv.AfterShutdown    += Mpv_AfterShutdown;
                mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
                mpv.PlaybackRestart  += mpv_PlaybackRestart;

                ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault);
                CMS              = new ContextMenuStripEx(components);
                CMS.Opened      += CMS_Opened;
                ContextMenuStrip = CMS;
                BuildMenu();
            }
            catch (Exception e)
            {
                HandleException(e);
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        private void InitContentMenus()
        {
            try
            {
                var itemList = _contentMenuItems.FindAll(x => x.Type == (int)ListViewExContextMenuItemType.SelectNone
                                                         | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOrOne | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOrMany
                                                         | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOneOrMany);
                _contextMenuStripSelectNone              = new ContextMenuStripEx(true, itemList, _contentMenuItemsAnnexes);
                _contextMenuStripSelectNone.Name         = "contextMenuStripSelectNone";
                _contextMenuStripSelectNone.OnItemClick += new System.EventHandler(contextMenuItem_Click);

                itemList = _contentMenuItems.FindAll(x => x.Type == (int)ListViewExContextMenuItemType.SelectOne
                                                     | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOrOne | x.Type == (int)ListViewExContextMenuItemType.SelectOneOrMany
                                                     | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOneOrMany);
                _contextMenuStripSelectOne              = new ContextMenuStripEx(true, itemList, _contentMenuItemsAnnexes);
                _contextMenuStripSelectOne.Name         = "contextMenuStripSelectOne";
                _contextMenuStripSelectOne.OnItemClick += new System.EventHandler(contextMenuItem_Click);

                itemList = _contentMenuItems.FindAll(x => x.Type == (int)ListViewExContextMenuItemType.SelectMany
                                                     | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOrMany | x.Type == (int)ListViewExContextMenuItemType.SelectOneOrMany
                                                     | x.Type == (int)ListViewExContextMenuItemType.SelectNoneOneOrMany);
                _contextMenuStripSelectMany              = new ContextMenuStripEx(true, itemList, _contentMenuItemsAnnexes);
                _contextMenuStripSelectMany.Name         = "contextMenuStripSelectMany";
                _contextMenuStripSelectMany.OnItemClick += new System.EventHandler(contextMenuItem_Click);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + "." + "InitContentMenus Error: " + ex.Message);
            }
        }
Beispiel #6
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     CMS              = new ContextMenuStripEx(components);
     CMS.Opened      += CMS_Opened;
     ContextMenuStrip = CMS;
     BuildMenu();
     IgnoreDpiChanged = false;
 }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     if (App.IsDarkMode)
     {
         ToolStripRendererEx.ColorTheme = Color.Black;
     }
     ContextMenu          = new ContextMenuStripEx(components);
     ContextMenu.Opened  += ContextMenu_Opened;
     ContextMenu.Opening += ContextMenu_Opening;
     BuildMenu();
     ContextMenuStrip = ContextMenu;
     IgnoreDpiChanged = false;
     CheckUrlInClipboard();
 }
Beispiel #10
0
        /// <summary>
        /// Creates a context menu associated with nodes
        /// </summary>
        private void CreateContextMenu()
        {
            _contextMenu = new ContextMenuStripEx
            {
                ImageList  = LeftImageList,
                Style      = ContextMenuStripEx.ContextMenuStyle.Metro,
                RenderMode = ToolStripRenderMode.Professional
            };
            _contextMenu.Items.Add(TreeViewConstants.ContextAddToFavorite).ImageIndex      = TreeViewConstants.IconPlus;
            _contextMenu.Items.Add(TreeViewConstants.ContextRemoveFromFavorite).ImageIndex = TreeViewConstants.IconMinus;
            _contextMenu.Items.Add(new ToolStripSeparator());
            _contextMenu.Items.Add(TreeViewConstants.ContextShowProperties);

            foreach (ToolStripItem item in _contextMenu.Items)
            {
                item.Name = item.Text;
            }

            _contextMenu.ItemClicked += ContextMenuItemClicked;
        }
        private ContextMenuStrip CreateNewContextMenu(bool showImages, bool showKeys)
        {
            var mnu = new ContextMenuStripEx();

            mnu.AddToolStripMenuItem("&Undo",
                                     showImages ? Resources.sc_undo : null,
                                     (sender, e) => Undo(),
                                     showKeys ? Keys.Control | Keys.Z : Keys.None,
                                     CanUndo
                                     );

            mnu.AddToolStripMenuItem("&Redo",
                                     showImages ? Resources.sc_redo : null,
                                     (sender, e) => Redo(),
                                     showKeys ? Keys.Control | Keys.Y : Keys.None,
                                     CanRedo
                                     );

            mnu.AddToolStripSeparator();

            mnu.AddToolStripMenuItem("&Cut",
                                     showImages ? Resources.cut : null,
                                     (sender, e) => DoCut(),
                                     showKeys ? Keys.Control | Keys.X : Keys.None,
                                     CanCut
                                     );

            mnu.AddToolStripMenuItem("Cop&y",
                                     showImages ? Resources.sc_copy : null,
                                     (sender, e) => DoCopy(),
                                     showKeys ? Keys.Control | Keys.C : Keys.None,
                                     CanCopy
                                     );

            mnu.AddToolStripMenuItem("&Paste",
                                     showImages ? Resources.sc_paste : null,
                                     (sender, e) => DoPaste(),
                                     showKeys ? Keys.Control | Keys.V : Keys.None,
                                     CanPaste
                                     );

            mnu.AddToolStripSeparator();

            mnu.AddToolStripMenuItem("&Delete",
                                     showImages ? Resources.sc_cancel : null,
                                     (sender, e) => DoDelete(),
                                     showKeys ? Keys.Delete : Keys.None,
                                     CanDelete
                                     );

            mnu.AddToolStripMenuItem("&Select All",
                                     showImages ? Resources.sc_selectall : null,
                                     (sender, e) => DoSelectAll(),
                                     showKeys ? Keys.Control | Keys.A : Keys.None,
                                     CanSelectAll
                                     );

            mnu.AddToolStripMenuItem("&Find",
                                     showImages ? Resources.sc_searchdialog : null,
                                     (sender, e) => DoFind(),
                                     showKeys ? Keys.Control | Keys.F : Keys.None,
                                     CanFind
                                     );

            mnu.AddToolStripMenuItem("&Replace",
                                     showImages ? Resources.sc_replacedialog : null,
                                     (sender, e) => DoReplace(),
                                     showKeys ? Keys.Control | Keys.H : Keys.None,
                                     CanFind
                                     );

            return(mnu);
        }
Beispiel #12
0
        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);
            }
        }
Beispiel #13
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                Instance = this;
                Hwnd     = Handle;
                Core.Init();

                Core.Shutdown         += Core_Shutdown;
                Core.VideoSizeChanged += Core_VideoSizeChanged;
                Core.ScaleWindow      += Core_ScaleWindow;
                Core.WindowScale      += Core_WindowScale;
                Core.FileLoaded       += Core_FileLoaded;
                Core.Idle             += Core_Idle;
                Core.Seek             += () => UpdateProgressBar();

                Core.ObserveProperty("window-maximized", PropChangeWindowMaximized);
                Core.ObserveProperty("window-minimized", PropChangeWindowMinimized);

                Core.ObservePropertyBool("border", PropChangeBorder);
                Core.ObservePropertyBool("fullscreen", PropChangeFullscreen);
                Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value);
                Core.ObservePropertyBool("ontop", PropChangeOnTop);
                Core.ObservePropertyBool("pause", PropChangePause);

                Core.ObservePropertyString("sid", PropChangeSid);
                Core.ObservePropertyString("aid", PropChangeAid);
                Core.ObservePropertyString("vid", PropChangeVid);

                Core.ObservePropertyString("title", PropChangeTitle);

                Core.ObservePropertyInt("edition", PropChangeEdition);

                if (Core.GPUAPI != "vulkan")
                {
                    Core.ProcessCommandLine(false);
                }

                AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject);
                Application.ThreadException += (sender, e) => App.ShowException(e.Exception);

                TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");

                ContextMenu          = new ContextMenuStripEx(components);
                ContextMenu.Opened  += ContextMenu_Opened;
                ContextMenu.Opening += ContextMenu_Opening;

                if (Core.Screen > -1)
                {
                    int      targetIndex = Core.Screen;
                    Screen[] screens     = Screen.AllScreens;

                    if (targetIndex < 0)
                    {
                        targetIndex = 0;
                    }

                    if (targetIndex > screens.Length - 1)
                    {
                        targetIndex = screens.Length - 1;
                    }

                    Screen    screen = screens[Array.IndexOf(screens, screens[targetIndex])];
                    Rectangle target = screen.Bounds;
                    Left = target.X + (target.Width - Width) / 2;
                    Top  = target.Y + (target.Height - Height) / 2;
                }

                if (!Core.Border)
                {
                    FormBorderStyle = FormBorderStyle.None;
                }

                Point pos = App.Settings.WindowPosition;

                if ((pos.X != 0 || pos.Y != 0) && App.RememberWindowPosition)
                {
                    Left = pos.X - Width / 2;
                    Top  = pos.Y - Height / 2;

                    Point location = App.Settings.WindowLocation;

                    if (location.X == -1)
                    {
                        Left = pos.X;
                    }
                    if (location.X == 1)
                    {
                        Left = pos.X - Width;
                    }
                    if (location.Y == -1)
                    {
                        Top = pos.Y;
                    }
                    if (location.Y == 1)
                    {
                        Top = pos.Y - Height;
                    }
                }

                if (Core.WindowMaximized)
                {
                    SetFormPosAndSize(true);
                    WindowState = FormWindowState.Maximized;
                }

                if (Core.WindowMinimized)
                {
                    SetFormPosAndSize(true);
                    WindowState = FormWindowState.Minimized;
                }
            }
            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }
        }
Beispiel #14
0
        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);
            }
        }
Beispiel #15
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                Instance = this;
                Hwnd     = Handle;
                mp.Init();
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.ThreadException += Application_ThreadException;
                Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
                WPF.WPF.Init();
                System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
                Text += " " + Application.ProductVersion;

                object recent = RegHelp.GetObject(App.RegPath, "Recent");

                if (recent is string[] r)
                {
                    RecentFiles = new List <string>(r);
                }
                else
                {
                    RecentFiles = new List <string>();
                }

                var   wpfColor = WPF.WPF.ThemeColor;
                Color color    = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B);
                ToolStripRendererEx.InitColors(color, App.IsDarkMode);

                ContextMenu          = new ContextMenuStripEx(components);
                ContextMenu.Opened  += ContextMenu_Opened;
                ContextMenu.Opening += ContextMenu_Opening;

                App.ProcessCommandLineEarly();

                if (mp.Screen == -1)
                {
                    mp.Screen = Array.IndexOf(Screen.AllScreens, Screen.PrimaryScreen);
                }
                int      targetIndex = mp.Screen;
                Screen[] screens     = Screen.AllScreens;
                if (targetIndex < 0)
                {
                    targetIndex = 0;
                }
                if (targetIndex > screens.Length - 1)
                {
                    targetIndex = screens.Length - 1;
                }
                Screen    screen = screens[Array.IndexOf(screens, screens[targetIndex])];
                Rectangle target = screen.Bounds;
                Left = target.X + (target.Width - Width) / 2;
                Top  = target.Y + (target.Height - Height) / 2;

                int posX = RegHelp.GetInt(App.RegPath, "PosX");
                int posY = RegHelp.GetInt(App.RegPath, "PosY");

                if (posX != 0 && posY != 0 && App.RememberPosition)
                {
                    Left = posX - Width / 2;
                    Top  = posY - Height / 2;
                }

                mp.Shutdown         += Shutdown;
                mp.VideoSizeChanged += VideoSizeChanged;
                mp.FileLoaded       += FileLoaded;
                mp.Idle             += Idle;
                mp.VideoSizeAutoResetEvent.WaitOne(1500);
                if (Height < FontHeight * 4)
                {
                    SetFormPosAndSize();
                }
                mp.observe_property_bool("fullscreen", PropChangeFullscreen);
                mp.observe_property_bool("ontop", PropChangeOnTop);
                mp.observe_property_bool("border", PropChangeBorder);
                mp.observe_property_string("sid", PropChangeSid);
                mp.observe_property_string("aid", PropChangeAid);
                mp.observe_property_string("vid", PropChangeVid);
                mp.observe_property_int("edition", PropChangeEdition);
            }
            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }
        }
Beispiel #16
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                Instance = this;
                Hwnd     = Handle;
                mp.Init();

                mp.Shutdown         += Shutdown;
                mp.VideoSizeChanged += VideoSizeChanged;
                mp.FileLoaded       += FileLoaded;
                mp.Idle             += Idle;
                mp.Seek             += () => UpdateProgressBar();

                mp.observe_property_bool("pause", PropChangePause);
                mp.observe_property_bool("fullscreen", PropChangeFullscreen);
                mp.observe_property_bool("ontop", PropChangeOnTop);
                mp.observe_property_bool("border", PropChangeBorder);
                mp.observe_property_string("sid", PropChangeSid);
                mp.observe_property_string("aid", PropChangeAid);
                mp.observe_property_string("vid", PropChangeVid);
                mp.observe_property_int("edition", PropChangeEdition);

                if (mp.GPUAPI != "vulkan")
                {
                    mp.ProcessCommandLine(false);
                }

                AppDomain.CurrentDomain.UnhandledException += (sender, e) => Msg.ShowError(e.ExceptionObject.ToString());
                Application.ThreadException += (sender, e) => Msg.ShowException(e.Exception);
                Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
                Text           = "mpv.net " + Application.ProductVersion;
                TaskbarButtonCreatedMessage = Native.RegisterWindowMessage("TaskbarButtonCreated");

                object recent = RegHelp.GetObject(App.RegPath, "Recent");

                if (recent is string[] r)
                {
                    RecentFiles = new List <string>(r);
                }
                else
                {
                    RecentFiles = new List <string>();
                }

                ContextMenu          = new ContextMenuStripEx(components);
                ContextMenu.Opened  += ContextMenu_Opened;
                ContextMenu.Opening += ContextMenu_Opening;

                if (mp.Screen == -1)
                {
                    mp.Screen = Array.IndexOf(Screen.AllScreens, Screen.PrimaryScreen);
                }
                int      targetIndex = mp.Screen;
                Screen[] screens     = Screen.AllScreens;
                if (targetIndex < 0)
                {
                    targetIndex = 0;
                }
                if (targetIndex > screens.Length - 1)
                {
                    targetIndex = screens.Length - 1;
                }
                Screen    screen = screens[Array.IndexOf(screens, screens[targetIndex])];
                Rectangle target = screen.Bounds;
                Left = target.X + (target.Width - Width) / 2;
                Top  = target.Y + (target.Height - Height) / 2;

                int posX = RegHelp.GetInt(App.RegPath, "PosX");
                int posY = RegHelp.GetInt(App.RegPath, "PosY");

                if (posX != 0 && posY != 0 && App.RememberPosition)
                {
                    Left = posX - Width / 2;
                    Top  = posY - Height / 2;
                }

                if (App.Maximized)
                {
                    WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }
        }
Beispiel #17
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.richTextBox1        = new System.Windows.Forms.RichTextBox();
     this.contextMenuStripEx1 = new Syncfusion.Windows.Forms.Tools.ContextMenuStripEx();
     this.toolStripMenuItem1  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem2  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem3  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.toolStripTextBox1   = new System.Windows.Forms.ToolStripTextBox();
     this.toolStripComboBox1  = new System.Windows.Forms.ToolStripComboBox();
     this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
     this.toolStripMenuItem4  = new System.Windows.Forms.ToolStripMenuItem();
     this.label1       = new System.Windows.Forms.Label();
     this.label2       = new System.Windows.Forms.Label();
     this.panel1       = new System.Windows.Forms.Panel();
     this.panel2       = new System.Windows.Forms.Panel();
     this.panel3       = new System.Windows.Forms.Panel();
     this.comboBoxAdv1 = new Syncfusion.Windows.Forms.Tools.ComboBoxAdv();
     this.contextMenuStripEx1.SuspendLayout();
     this.panel1.SuspendLayout();
     this.panel2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv1)).BeginInit();
     this.SuspendLayout();
     //
     // richTextBox1
     //
     this.richTextBox1.ContextMenuStrip = this.contextMenuStripEx1;
     this.richTextBox1.Location         = new System.Drawing.Point(30, 71);
     this.richTextBox1.Name             = "richTextBox1";
     this.richTextBox1.Size             = new System.Drawing.Size(931, 507);
     this.richTextBox1.TabIndex         = 1;
     this.richTextBox1.Text             = resources.GetString("richTextBox1.Text");
     //
     // contextMenuStripEx1
     //
     this.contextMenuStripEx1.DropShadowEnabled = false;
     this.contextMenuStripEx1.ImageScalingSize  = new System.Drawing.Size(20, 20);
     this.contextMenuStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripMenuItem1,
         this.toolStripMenuItem2,
         this.toolStripMenuItem3,
         this.toolStripSeparator1,
         this.toolStripTextBox1,
         this.toolStripComboBox1,
         this.toolStripSeparator2,
         this.toolStripMenuItem4
     });
     this.contextMenuStripEx1.MetroColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(236)))), ((int)(((byte)(249)))));
     this.contextMenuStripEx1.Name       = "contextMenuStripEx1";
     this.contextMenuStripEx1.Size       = new System.Drawing.Size(182, 183);
     this.contextMenuStripEx1.Style      = Syncfusion.Windows.Forms.Tools.ContextMenuStripEx.ContextMenuStyle.Metro;
     this.contextMenuStripEx1.Text       = "Edit";
     //
     // toolStripMenuItem1
     //
     this.toolStripMenuItem1.Name        = "toolStripMenuItem1";
     this.toolStripMenuItem1.Size        = new System.Drawing.Size(181, 22);
     this.toolStripMenuItem1.Text        = "Cut";
     this.toolStripMenuItem1.ToolTipText = "Remove the selection and put it on the Clipboard so you can paste it somewhere el" +
                                           "se.";
     //
     // toolStripMenuItem2
     //
     this.toolStripMenuItem2.Name        = "toolStripMenuItem2";
     this.toolStripMenuItem2.Size        = new System.Drawing.Size(181, 22);
     this.toolStripMenuItem2.Text        = "Copy";
     this.toolStripMenuItem2.ToolTipText = "Put a copy of the selection on the Clipboard so you can paste it somewhere else.";
     //
     // toolStripMenuItem3
     //
     this.toolStripMenuItem3.Name        = "toolStripMenuItem3";
     this.toolStripMenuItem3.Size        = new System.Drawing.Size(181, 22);
     this.toolStripMenuItem3.Text        = "Paste";
     this.toolStripMenuItem3.ToolTipText = "Pick a paste option such as keeping formatting or pasting only content.";
     //
     // toolStripSeparator1
     //
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new System.Drawing.Size(178, 6);
     //
     // toolStripTextBox1
     //
     this.toolStripTextBox1.Margin = new System.Windows.Forms.Padding(2, 1, 1, 1);
     this.toolStripTextBox1.Name   = "toolStripTextBox1";
     this.toolStripTextBox1.Size   = new System.Drawing.Size(100, 23);
     this.toolStripTextBox1.Text   = "Font Family: ";
     //
     // toolStripComboBox1
     //
     this.toolStripComboBox1.Name        = "toolStripComboBox1";
     this.toolStripComboBox1.Size        = new System.Drawing.Size(121, 23);
     this.toolStripComboBox1.ToolTipText = "Pick a new font for your text";
     //
     // toolStripSeparator2
     //
     this.toolStripSeparator2.Name = "toolStripSeparator2";
     this.toolStripSeparator2.Size = new System.Drawing.Size(178, 6);
     //
     // toolStripMenuItem4
     //
     this.toolStripMenuItem4.Name        = "toolStripMenuItem4";
     this.toolStripMenuItem4.Size        = new System.Drawing.Size(181, 22);
     this.toolStripMenuItem4.Text        = "Exit";
     this.toolStripMenuItem4.ToolTipText = "Close the current context menu and back into the application.";
     //
     // label1
     //
     this.label1.Font     = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label1.Location = new System.Drawing.Point(8, 2);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(912, 89);
     this.label1.TabIndex = 0;
     this.label1.Text     = "This sample showcases ContextMenuStripEx control with bar items, separator and built -in context menu styles.";
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Font     = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label2.Location = new System.Drawing.Point(550, 25);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(99, 17);
     this.label2.TabIndex = 0;
     this.label2.Text     = "Choose Theme";
     //
     // panel1
     //
     this.panel1.Dock     = System.Windows.Forms.DockStyle.Top;
     this.panel1.Location = new System.Drawing.Point(2, 2);
     this.panel1.Name     = "panel1";
     this.panel1.Size     = new System.Drawing.Size(980, 34);
     this.panel1.TabIndex = 0;
     //
     // panel2
     //
     this.panel2.Controls.Add(this.panel3);
     this.panel2.Controls.Add(this.comboBoxAdv1);
     this.panel2.Controls.Add(this.richTextBox1);
     this.panel2.Controls.Add(this.label2);
     this.panel2.Location = new System.Drawing.Point(2, 65);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(970, 604);
     this.panel2.TabIndex = 1;
     //
     // panel3
     //
     this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
     this.panel3.Dock      = System.Windows.Forms.DockStyle.Top;
     this.panel3.Location  = new System.Drawing.Point(0, 0);
     this.panel3.Name      = "panel3";
     this.panel3.Size      = new System.Drawing.Size(970, 2);
     this.panel3.TabIndex  = 2;
     //
     // comboBoxAdv1
     //
     this.comboBoxAdv1.BeforeTouchSize = new System.Drawing.Size(182, 25);
     this.comboBoxAdv1.Items.AddRange(new object[] {
         "Default",
         "Metro",
         "Office2016Colorful",
         "Office2016White",
         "Office2016DarkGray",
         "Office2016Black"
     });
     this.comboBoxAdv1.Location = new System.Drawing.Point(668, 21);
     this.comboBoxAdv1.Name     = "comboBoxAdv1";
     this.comboBoxAdv1.Size     = new System.Drawing.Size(182, 25);
     this.comboBoxAdv1.TabIndex = 2;
     this.comboBoxAdv1.Text     = "Metro";
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(984, 686);
     this.Controls.Add(this.panel2);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.panel1);
     this.Font          = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.Margin        = new System.Windows.Forms.Padding(4, 5, 4, 5);
     this.MaximizeBox   = false;
     this.MaximumSize   = new System.Drawing.Size(1000, 725);
     this.MinimumSize   = new System.Drawing.Size(1000, 725);
     this.Name          = "Form1";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "Getting Started";
     this.contextMenuStripEx1.ResumeLayout(false);
     this.contextMenuStripEx1.PerformLayout();
     this.panel1.ResumeLayout(false);
     this.panel1.PerformLayout();
     this.panel2.ResumeLayout(false);
     this.panel2.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv1)).EndInit();
     this.ResumeLayout(false);
 }
Beispiel #18
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                object recent = RegistryHelp.GetValue(App.RegPath, "Recent");

                if (recent is string[] r)
                {
                    RecentFiles = new List <string>(r);
                }
                else
                {
                    RecentFiles = new List <string>();
                }

                Instance            = this;
                Hwnd                = Handle;
                ConsoleHelp.Padding = 60;
                core.Init();

                core.Shutdown         += Shutdown;
                core.VideoSizeChanged += VideoSizeChanged;
                core.ScaleWindow      += ScaleWindow;
                core.WindowScale      += WindowScale;
                core.FileLoaded       += FileLoaded;
                core.Idle             += Idle;
                core.Seek             += () => UpdateProgressBar();

                core.observe_property("window-maximized", PropChangeWindowMaximized);
                core.observe_property("window-minimized", PropChangeWindowMinimized);
                core.observe_property_bool("pause", PropChangePause);
                core.observe_property_bool("fullscreen", PropChangeFullscreen);
                core.observe_property_bool("ontop", PropChangeOnTop);
                core.observe_property_bool("border", PropChangeBorder);

                core.observe_property_string("sid", PropChangeSid);
                core.observe_property_string("aid", PropChangeAid);
                core.observe_property_string("vid", PropChangeVid);

                core.observe_property_string("title", PropChangeTitle);

                core.observe_property_int("edition", PropChangeEdition);

                if (core.GPUAPI != "vulkan")
                {
                    core.ProcessCommandLine(false);
                }

                AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject);
                Application.ThreadException += (sender, e) => App.ShowException(e.Exception);

                Msg.SupportURL = "https://github.com/stax76/mpv.net#support";

                TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");

                ContextMenu          = new ContextMenuStripEx(components);
                ContextMenu.Opened  += ContextMenu_Opened;
                ContextMenu.Opening += ContextMenu_Opening;

                if (core.Screen > -1)
                {
                    int      targetIndex = core.Screen;
                    Screen[] screens     = Screen.AllScreens;

                    if (targetIndex < 0)
                    {
                        targetIndex = 0;
                    }

                    if (targetIndex > screens.Length - 1)
                    {
                        targetIndex = screens.Length - 1;
                    }

                    Screen    screen = screens[Array.IndexOf(screens, screens[targetIndex])];
                    Rectangle target = screen.Bounds;
                    Left = target.X + (target.Width - Width) / 2;
                    Top  = target.Y + (target.Height - Height) / 2;
                }

                if (!core.Border)
                {
                    FormBorderStyle = FormBorderStyle.None;
                }

                int posX = RegistryHelp.GetInt("PosX");
                int posY = RegistryHelp.GetInt("PosY");

                if ((posX != 0 || posY != 0) && App.RememberPosition)
                {
                    Left = posX - Width / 2;
                    Top  = posY - Height / 2;

                    int horizontal = RegistryHelp.GetInt("HorizontalLocation");
                    int vertical   = RegistryHelp.GetInt("VerticalLocation");

                    if (horizontal == -1)
                    {
                        Left = posX;
                    }
                    if (horizontal == 1)
                    {
                        Left = posX - Width;
                    }
                    if (vertical == -1)
                    {
                        Top = posY;
                    }
                    if (vertical == 1)
                    {
                        Top = posY - Height;
                    }
                }

                if (core.WindowMaximized)
                {
                    SetFormPosAndSize(true);
                    WindowState = FormWindowState.Maximized;
                }

                if (core.WindowMinimized)
                {
                    SetFormPosAndSize(true);
                    WindowState = FormWindowState.Minimized;
                }
            }
            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }
        }
Beispiel #19
0
        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);
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.richTextBox1        = new System.Windows.Forms.RichTextBox();
     this.contextMenuStripEx1 = new Syncfusion.Windows.Forms.Tools.ContextMenuStripEx();
     this.toolStripMenuItem1  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem2  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem3  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.toolStripMenuItem4  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItem5  = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
     this.toolStripMenuItem6  = new System.Windows.Forms.ToolStripMenuItem();
     this.label1       = new System.Windows.Forms.Label();
     this.panel1       = new System.Windows.Forms.Panel();
     this.panel2       = new System.Windows.Forms.Panel();
     this.groupBox1    = new System.Windows.Forms.GroupBox();
     this.comboBoxAdv2 = new Syncfusion.Windows.Forms.Tools.ComboBoxAdv();
     this.label3       = new System.Windows.Forms.Label();
     this.checkBoxAdv5 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv();
     this.label2       = new System.Windows.Forms.Label();
     this.comboBoxAdv1 = new Syncfusion.Windows.Forms.Tools.ComboBoxAdv();
     this.checkBoxAdv4 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv();
     this.checkBoxAdv3 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv();
     this.checkBoxAdv2 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv();
     this.checkBoxAdv1 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv();
     this.panel3       = new System.Windows.Forms.Panel();
     this.contextMenuStripEx1.SuspendLayout();
     this.panel1.SuspendLayout();
     this.panel2.SuspendLayout();
     this.groupBox1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv2)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv5)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv4)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv3)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv2)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).BeginInit();
     this.SuspendLayout();
     //
     // richTextBox1
     //
     this.richTextBox1.ContextMenuStrip = this.contextMenuStripEx1;
     this.richTextBox1.Location         = new System.Drawing.Point(30, 18);
     this.richTextBox1.Name             = "richTextBox1";
     this.richTextBox1.Size             = new System.Drawing.Size(555, 615);
     this.richTextBox1.TabIndex         = 1;
     this.richTextBox1.Text             = resources.GetString("richTextBox1.Text");
     //
     // contextMenuStripEx1
     //
     this.contextMenuStripEx1.DropShadowEnabled = false;
     this.contextMenuStripEx1.ImageScalingSize  = new System.Drawing.Size(20, 20);
     this.contextMenuStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripMenuItem1,
         this.toolStripMenuItem2,
         this.toolStripMenuItem3,
         this.toolStripSeparator1,
         this.toolStripMenuItem4,
         this.toolStripMenuItem5,
         this.toolStripSeparator2,
         this.toolStripMenuItem6
     });
     this.contextMenuStripEx1.MetroColor       = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(236)))), ((int)(((byte)(249)))));
     this.contextMenuStripEx1.Name             = "contextMenuStripEx1";
     this.contextMenuStripEx1.ShowItemToolTips = false;
     this.contextMenuStripEx1.Size             = new System.Drawing.Size(189, 160);
     this.contextMenuStripEx1.Style            = Syncfusion.Windows.Forms.Tools.ContextMenuStripEx.ContextMenuStyle.Metro;
     //
     // toolStripMenuItem1
     //
     this.toolStripMenuItem1.Name        = "toolStripMenuItem1";
     this.toolStripMenuItem1.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem1.Text        = "Cut";
     this.toolStripMenuItem1.ToolTipText = "Remove the selection and put it on the Clipboard so you can paste it somewhere el" +
                                           "se.";
     //
     // toolStripMenuItem2
     //
     this.toolStripMenuItem2.Name        = "toolStripMenuItem2";
     this.toolStripMenuItem2.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem2.Text        = "Copy";
     this.toolStripMenuItem2.ToolTipText = "Put a copy of the selection on the Clipboard so you can paste it somewhere else.";
     //
     // toolStripMenuItem3
     //
     this.toolStripMenuItem3.Name        = "toolStripMenuItem3";
     this.toolStripMenuItem3.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem3.Text        = "Paste                   ";
     this.toolStripMenuItem3.ToolTipText = "Pick a paste option such as keeping formatting or pasting only content.";
     //
     // toolStripSeparator1
     //
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new System.Drawing.Size(185, 6);
     //
     // toolStripMenuItem4
     //
     this.toolStripMenuItem4.Name        = "toolStripMenuItem4";
     this.toolStripMenuItem4.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem4.Text        = "Undo";
     this.toolStripMenuItem4.ToolTipText = "To reverse your last action, just click the Undo option.";
     //
     // toolStripMenuItem5
     //
     this.toolStripMenuItem5.Name        = "toolStripMenuItem5";
     this.toolStripMenuItem5.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem5.Text        = "Redo";
     this.toolStripMenuItem5.ToolTipText = "To reverse your last Undo, just click the Redo option.";
     //
     // toolStripSeparator2
     //
     this.toolStripSeparator2.Name = "toolStripSeparator2";
     this.toolStripSeparator2.Size = new System.Drawing.Size(185, 6);
     //
     // toolStripMenuItem6
     //
     this.toolStripMenuItem6.Name        = "toolStripMenuItem6";
     this.toolStripMenuItem6.Size        = new System.Drawing.Size(188, 24);
     this.toolStripMenuItem6.Text        = "Exit";
     this.toolStripMenuItem6.ToolTipText = "Close the current context menu and back into the application.";
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Font     = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label1.Location = new System.Drawing.Point(6, 2);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(870, 60);
     this.label1.TabIndex = 0;
     this.label1.Text     = "This sample illustrates the additional features of ContextMenuStripEx such as auto close, tooltip, check/uncheck state, enable/disable menu items, RTL and appearance customization.";
     this.label1.AutoSize = false;
     //
     // panel1
     //
     this.panel1.Controls.Add(this.label1);
     this.panel1.Dock     = System.Windows.Forms.DockStyle.Top;
     this.panel1.Location = new System.Drawing.Point(2, 2);
     this.panel1.Name     = "panel1";
     this.panel1.Size     = new System.Drawing.Size(878, 45);
     this.panel1.TabIndex = 0;
     //
     // panel2
     //
     this.panel2.Controls.Add(this.groupBox1);
     this.panel2.Controls.Add(this.panel3);
     this.panel2.Controls.Add(this.richTextBox1);
     this.panel2.Location = new System.Drawing.Point(2, 50);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(878, 656);
     this.panel2.TabIndex = 1;
     //
     // groupBox1
     //
     this.groupBox1.Controls.Add(this.comboBoxAdv2);
     this.groupBox1.Controls.Add(this.label3);
     this.groupBox1.Controls.Add(this.checkBoxAdv5);
     this.groupBox1.Controls.Add(this.label2);
     this.groupBox1.Controls.Add(this.comboBoxAdv1);
     this.groupBox1.Controls.Add(this.checkBoxAdv4);
     this.groupBox1.Controls.Add(this.checkBoxAdv3);
     this.groupBox1.Controls.Add(this.checkBoxAdv2);
     this.groupBox1.Controls.Add(this.checkBoxAdv1);
     this.groupBox1.Location = new System.Drawing.Point(606, 8);
     this.groupBox1.Name     = "groupBox1";
     this.groupBox1.Size     = new System.Drawing.Size(255, 625);
     this.groupBox1.TabIndex = 3;
     this.groupBox1.TabStop  = false;
     this.groupBox1.Text     = "Options";
     //
     // comboBoxAdv2
     //
     this.comboBoxAdv2.BeforeTouchSize = new System.Drawing.Size(148, 29);
     this.comboBoxAdv2.Location        = new System.Drawing.Point(34, 330);
     this.comboBoxAdv2.Name            = "comboBoxAdv2";
     this.comboBoxAdv2.Size            = new System.Drawing.Size(148, 29);
     this.comboBoxAdv2.TabIndex        = 8;
     //
     // label3
     //
     this.label3.AutoSize = true;
     this.label3.Font     = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label3.Location = new System.Drawing.Point(30, 310);
     this.label3.Name     = "label3";
     this.label3.Size     = new System.Drawing.Size(148, 23);
     this.label3.TabIndex = 7;
     this.label3.Text     = "Background Color";
     //
     // checkBoxAdv5
     //
     this.checkBoxAdv5.BeforeTouchSize   = new System.Drawing.Size(150, 25);
     this.checkBoxAdv5.ImageCheckBoxSize = new System.Drawing.Size(16, 16);
     this.checkBoxAdv5.Location          = new System.Drawing.Point(30, 190);
     this.checkBoxAdv5.MetroColor        = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(89)))), ((int)(((byte)(91)))));
     this.checkBoxAdv5.Name          = "checkBoxAdv5";
     this.checkBoxAdv5.Size          = new System.Drawing.Size(150, 40);
     this.checkBoxAdv5.TabIndex      = 6;
     this.checkBoxAdv5.Text          = "Enable RTL";
     this.checkBoxAdv5.ThemesEnabled = false;
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Font     = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label2.Location = new System.Drawing.Point(30, 250);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(146, 23);
     this.label2.TabIndex = 5;
     this.label2.Text     = "Foreground Color";
     //
     // comboBoxAdv1
     //
     this.comboBoxAdv1.BeforeTouchSize = new System.Drawing.Size(148, 29);
     this.comboBoxAdv1.Location        = new System.Drawing.Point(34, 270);
     this.comboBoxAdv1.Name            = "comboBoxAdv1";
     this.comboBoxAdv1.Size            = new System.Drawing.Size(148, 29);
     this.comboBoxAdv1.TabIndex        = 4;
     //
     // checkBoxAdv4
     //
     this.checkBoxAdv4.BeforeTouchSize   = new System.Drawing.Size(150, 40);
     this.checkBoxAdv4.Checked           = true;
     this.checkBoxAdv4.CheckState        = System.Windows.Forms.CheckState.Checked;
     this.checkBoxAdv4.ImageCheckBoxSize = new System.Drawing.Size(16, 16);
     this.checkBoxAdv4.Location          = new System.Drawing.Point(30, 110);
     this.checkBoxAdv4.MetroColor        = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(89)))), ((int)(((byte)(91)))));
     this.checkBoxAdv4.Name          = "checkBoxAdv4";
     this.checkBoxAdv4.Size          = new System.Drawing.Size(150, 40);
     this.checkBoxAdv4.TabIndex      = 3;
     this.checkBoxAdv4.Text          = "Enable Menu Items";
     this.checkBoxAdv4.ThemesEnabled = false;
     //
     // checkBoxAdv3
     //
     this.checkBoxAdv3.BeforeTouchSize   = new System.Drawing.Size(150, 40);
     this.checkBoxAdv3.ImageCheckBoxSize = new System.Drawing.Size(16, 16);
     this.checkBoxAdv3.Location          = new System.Drawing.Point(30, 150);
     this.checkBoxAdv3.MetroColor        = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(89)))), ((int)(((byte)(91)))));
     this.checkBoxAdv3.Name          = "checkBoxAdv3";
     this.checkBoxAdv3.Size          = new System.Drawing.Size(150, 40);
     this.checkBoxAdv3.TabIndex      = 2;
     this.checkBoxAdv3.Text          = "Enable Check State";
     this.checkBoxAdv3.ThemesEnabled = false;
     //
     // checkBoxAdv2
     //
     this.checkBoxAdv2.BeforeTouchSize   = new System.Drawing.Size(150, 40);
     this.checkBoxAdv2.ImageCheckBoxSize = new System.Drawing.Size(16, 16);
     this.checkBoxAdv2.Location          = new System.Drawing.Point(30, 70);
     this.checkBoxAdv2.MetroColor        = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(89)))), ((int)(((byte)(91)))));
     this.checkBoxAdv2.Name          = "checkBoxAdv2";
     this.checkBoxAdv2.Size          = new System.Drawing.Size(150, 40);
     this.checkBoxAdv2.TabIndex      = 1;
     this.checkBoxAdv2.Text          = "Show Tooltip";
     this.checkBoxAdv2.ThemesEnabled = false;
     //
     // checkBoxAdv1
     //
     this.checkBoxAdv1.BeforeTouchSize   = new System.Drawing.Size(150, 40);
     this.checkBoxAdv1.Checked           = true;
     this.checkBoxAdv1.CheckState        = System.Windows.Forms.CheckState.Checked;
     this.checkBoxAdv1.ImageCheckBoxSize = new System.Drawing.Size(16, 16);
     this.checkBoxAdv1.Location          = new System.Drawing.Point(30, 30);
     this.checkBoxAdv1.MetroColor        = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(89)))), ((int)(((byte)(91)))));
     this.checkBoxAdv1.Name          = "checkBoxAdv1";
     this.checkBoxAdv1.Size          = new System.Drawing.Size(150, 40);
     this.checkBoxAdv1.TabIndex      = 0;
     this.checkBoxAdv1.Text          = "Auto Close";
     this.checkBoxAdv1.ThemesEnabled = false;
     //
     // panel3
     //
     this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
     this.panel3.Dock      = System.Windows.Forms.DockStyle.Top;
     this.panel3.Location  = new System.Drawing.Point(0, 0);
     this.panel3.Name      = "panel3";
     this.panel3.Size      = new System.Drawing.Size(878, 2);
     this.panel3.TabIndex  = 2;
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(882, 677);
     this.Controls.Add(this.panel1);
     this.Controls.Add(this.panel2);
     this.Font          = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.Margin        = new System.Windows.Forms.Padding(4, 5, 4, 5);
     this.MaximizeBox   = false;
     this.MaximumSize   = new System.Drawing.Size(885, 740);
     this.MinimumSize   = new System.Drawing.Size(885, 740);
     this.Name          = "Form1";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "Customization Demo";
     this.contextMenuStripEx1.ResumeLayout(false);
     this.panel1.ResumeLayout(false);
     this.panel1.PerformLayout();
     this.panel2.ResumeLayout(false);
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv2)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv5)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.comboBoxAdv1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv4)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv3)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv2)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).EndInit();
     this.ResumeLayout(false);
 }
Beispiel #21
0
        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);
            }
        }