Exemplo n.º 1
0
        public static void GroupMenu_ItemRightClicked(object sender, ItemRightClickedEventArgs e)
        {
            DropDownMenuReorderable reorderable = (DropDownMenuReorderable)sender;
            string path = TrackGroupContextMenu(e.ClickedItem.Text, e.IsKey ? e.Point : Control.MousePosition, reorderable.Handle);

            if (!string.IsNullOrEmpty(path))
            {
                Action <QTTabBarClass> open = tabBar => {
                    using (IDLWrapper idlw = new IDLWrapper(path)) {
                        tabBar.OpenNewTabOrWindow(idlw);
                    }
                };
                QTTabBarClass threadBar = InstanceManager.GetThreadTabBar();
                if (threadBar != null)
                {
                    open(threadBar);
                }
                else
                {
                    InstanceManager.InvokeMain(open);
                }
            }
            else
            {
                e.HRESULT = 0xfffd;
            }
        }
Exemplo n.º 2
0
        private static ToolStripItem CreateMenuItem_AppLauncher_Virtual(string name, ToolStripItem[] items, bool fReorderEnabled, EventPack ep)
        {
            if (items.Length == 0)
            {
                return(null);
            }
            MenuItemArguments mia = new MenuItemArguments(name, MenuTarget.VirtualFolder, MenuGenre.Application)
            {
                App = new UserApp(name)
            };
            DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null)
            {
                ReorderEnabled = fReorderEnabled,
                MessageParent  = ep.MessageParentHandle,
                ImageList      = QTUtility.ImageListGlobal
            };

            reorderable.AddItemsRange(items, "userappItem");
            reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
            reorderable.ItemClicked      += virtualDirectory_DropDownItemClicked;
            reorderable.ReorderFinished  += virtualDirectory_ReorderFinished;
            return(new QMenuItem(name, mia)
            {
                ImageKey = "folder",
                Name = name,
                DropDown = reorderable
            });
        }
Exemplo n.º 3
0
        // TODO: this is absent from Quizo's sources.  Figure out why.
        private static void AddChildrenOnOpening(DirectoryMenuItem parentItem)
        {
            bool          fTruncated;
            DirectoryInfo info      = new DirectoryInfo(parentItem.Path);
            EventPack     eventPack = parentItem.EventPack;

            foreach (DirectoryInfo info2 in info.GetDirectories()
                     .Where(info2 => (info2.Attributes & FileAttributes.Hidden) == 0))
            {
                string text = QTUtility2.MakeNameEllipsis(info2.Name, out fTruncated);
                DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
                reorderable.MessageParent     = eventPack.MessageParentHandle;
                reorderable.ItemRightClicked += eventPack.ItemRightClickEventHandler;
                reorderable.ImageList         = QTUtility.ImageListGlobal;
                DirectoryMenuItem item = new DirectoryMenuItem(text);
                item.SetImageReservationKey(info2.FullName, null);
                item.Path         = info2.FullName;
                item.EventPack    = eventPack;
                item.ModifiedDate = info2.LastWriteTime;
                if (fTruncated)
                {
                    item.ToolTipText = info2.Name;
                }
                item.DropDown           = reorderable;
                item.DoubleClickEnabled = true;
                item.DropDownItems.Add(new ToolStripMenuItem());
                item.DropDownItemClicked += realDirectory_DropDownItemClicked;
                item.DropDownOpening     += realDirectory_DropDownOpening;
                item.DoubleClick         += eventPack.DirDoubleClickEventHandler;
                parentItem.DropDownItems.Add(item);
            }
            foreach (FileInfo info3 in info.GetFiles()
                     .Where(info3 => (info3.Attributes & FileAttributes.Hidden) == 0))
            {
                string fileNameWithoutExtension;
                string ext = info3.Extension.ToLower();
                switch (ext)
                {
                case ".lnk":
                case ".url":
                    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(info3.Name);
                    break;

                default:
                    fileNameWithoutExtension = info3.Name;
                    break;
                }
                string    str4  = fileNameWithoutExtension;
                QMenuItem item2 = new QMenuItem(QTUtility2.MakeNameEllipsis(fileNameWithoutExtension, out fTruncated), MenuTarget.File, MenuGenre.Application);
                item2.Path = info3.FullName;
                item2.SetImageReservationKey(info3.FullName, ext);
                item2.MouseMove += qmi_File_MouseMove;
                if (fTruncated)
                {
                    item2.ToolTipText = str4;
                }
                parentItem.DropDownItems.Add(item2);
            }
        }
Exemplo n.º 4
0
        private static ToolStripItem CreateMenuItem_AppLauncher(string key, string[] appVals, EventPack ep)
        {
            string name = appVals[0];

            try {
                name = Environment.ExpandEnvironmentVariables(name);
            }
            catch {
            }
            MenuItemArguments mia = new MenuItemArguments(name, appVals[1], appVals[2], 0, MenuGenre.Application);

            if ((appVals[0].Length == 0) || string.Equals(appVals[0], "separator", StringComparison.OrdinalIgnoreCase))
            {
                ToolStripSeparator separator = new ToolStripSeparator();
                separator.Name = "appSep";
                return(separator);
            }
            if (appVals.Length == 4)
            {
                int.TryParse(appVals[3], out mia.KeyShortcut);
            }
            if ((name.StartsWith(@"\\") || name.StartsWith("::")) || !Directory.Exists(name))
            {
                mia.Target = MenuTarget.File;
                QMenuItem item = new QMenuItem(key, mia);
                item.Name = key;
                item.SetImageReservationKey(name, Path.GetExtension(name));
                item.MouseMove += new MouseEventHandler(MenuUtility.qmi_File_MouseMove);
                if (!ep.FromTaskBar && (mia.KeyShortcut > 0x100000))
                {
                    int num = mia.KeyShortcut & -1048577;
                    item.ShortcutKeyDisplayString = QTUtility2.MakeKeyString((Keys)num).Replace(" ", string.Empty);
                }
                return(item);
            }
            mia.Target = MenuTarget.Folder;
            DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);

            reorderable.MessageParent     = ep.MessageParentHandle;
            reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
            reorderable.ImageList         = QTUtility.ImageListGlobal;
            DirectoryMenuItem item2 = new DirectoryMenuItem(key);

            item2.SetImageReservationKey(name, null);
            item2.Name = key;
            item2.Path = name;
            item2.MenuItemArguments  = mia;
            item2.EventPack          = ep;
            item2.ModifiiedDate      = Directory.GetLastWriteTime(name);
            item2.DropDown           = reorderable;
            item2.DoubleClickEnabled = true;
            item2.DropDownItems.Add(new ToolStripMenuItem());
            item2.DropDownItemClicked += new ToolStripItemClickedEventHandler(MenuUtility.realDirectory_DropDownItemClicked);
            item2.DropDownOpening     += new EventHandler(MenuUtility.realDirectory_DropDownOpening);
            item2.DoubleClick         += ep.DirDoubleClickEventHandler;
            return(item2);
        }
Exemplo n.º 5
0
        private static void AddChildrenOnOpening(DirectoryMenuItem parentItem) {
            bool flag;
            DirectoryInfo info = new DirectoryInfo(parentItem.Path);
            EventPack eventPack = parentItem.EventPack;
            foreach(DirectoryInfo info2 in info.GetDirectories()) {
                if((info2.Attributes & FileAttributes.Hidden) == 0) {
                    string text = QTUtility2.MakeNameEllipsis(info2.Name, out flag);
                    DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
                    reorderable.MessageParent = eventPack.MessageParentHandle;
                    reorderable.ItemRightClicked += eventPack.ItemRightClickEventHandler;
                    reorderable.ImageList = QTUtility.ImageListGlobal;
                    DirectoryMenuItem item = new DirectoryMenuItem(text);
                    item.SetImageReservationKey(info2.FullName, null);
                    item.Path = info2.FullName;
                    item.EventPack = eventPack;
                    item.ModifiiedDate = info2.LastWriteTime;
                    if(flag) {
                        item.ToolTipText = info2.Name;
                    }
                    item.DropDown = reorderable;
                    item.DoubleClickEnabled = true;
                    item.DropDownItems.Add(new ToolStripMenuItem());
                    item.DropDownItemClicked += new ToolStripItemClickedEventHandler(MenuUtility.realDirectory_DropDownItemClicked);
                    item.DropDownOpening += new EventHandler(MenuUtility.realDirectory_DropDownOpening);
                    item.DoubleClick += eventPack.DirDoubleClickEventHandler;
                    parentItem.DropDownItems.Add(item);
                }
            }
            foreach(FileInfo info3 in info.GetFiles()) {
                if((info3.Attributes & FileAttributes.Hidden) == 0) {
                    string fileNameWithoutExtension;
                    string ext = info3.Extension.ToLower();
                    switch(ext) {
                        case ".lnk":
                        case ".url":
                            fileNameWithoutExtension = Path.GetFileNameWithoutExtension(info3.Name);
                            break;

                        default:
                            fileNameWithoutExtension = info3.Name;
                            break;
                    }
                    string str4 = fileNameWithoutExtension;
                    QMenuItem item2 = new QMenuItem(QTUtility2.MakeNameEllipsis(fileNameWithoutExtension, out flag), MenuTarget.File, MenuGenre.Application);
                    item2.Path = info3.FullName;
                    item2.SetImageReservationKey(info3.FullName, ext);
                    item2.MouseMove += new MouseEventHandler(MenuUtility.qmi_File_MouseMove);
                    if(flag) {
                        item2.ToolTipText = str4;
                    }
                    parentItem.DropDownItems.Add(item2);
                }
            }
        }
Exemplo n.º 6
0
        private static ToolStripItem CreateMenuItem_AppLauncher(UserApp app, EventPack ep, ShellBrowserEx shellBrowser)
        {
            string path = app.Path;

            try {
                path = Environment.ExpandEnvironmentVariables(path);
            }
            catch {
            }
            MenuItemArguments mia = new MenuItemArguments(app, shellBrowser, MenuGenre.Application);

            if (path.StartsWith(@"\\") || path.StartsWith("::") || !Directory.Exists(path))
            {
                mia.Target = MenuTarget.File;
                QMenuItem item = new QMenuItem(app.Name, mia)
                {
                    Name = app.Name
                };
                item.SetImageReservationKey(path, Path.GetExtension(path));
                item.MouseMove += qmi_File_MouseMove;
                if (!ep.FromTaskBar && app.ShortcutKey != Keys.None)
                {
                    item.ShortcutKeyDisplayString = QTUtility2.MakeKeyString(app.ShortcutKey).Replace(" ", string.Empty);
                }
                return(item);
            }
            else
            {
                mia.Target = MenuTarget.Folder;
                DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null)
                {
                    MessageParent = ep.MessageParentHandle,
                    ImageList     = QTUtility.ImageListGlobal
                };
                reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
                DirectoryMenuItem item = new DirectoryMenuItem(app.Name)
                {
                    Name = app.Name,
                    Path = path,
                    MenuItemArguments  = mia,
                    EventPack          = ep,
                    ModifiedDate       = Directory.GetLastWriteTime(path),
                    DropDown           = reorderable,
                    DoubleClickEnabled = true
                };
                item.DropDownItems.Add(new ToolStripMenuItem());
                item.DropDownItemClicked += realDirectory_DropDownItemClicked;
                item.DropDownOpening     += realDirectory_DropDownOpening;
                item.DoubleClick         += ep.DirDoubleClickEventHandler;
                item.SetImageReservationKey(path, null);
                return(item);
            }
        }
 protected void CancelClosingAncestors(bool fCancel, bool fClose) {
     fCancelClosingAncestors = fCancel;
     DropDownMenuReorderable owner = null;
     if((OwnerItem != null) && (OwnerItem is ToolStripDropDownItem)) {
         owner = OwnerItem.Owner as DropDownMenuReorderable;
     }
     if(!fCancel && fClose) {
         Close(ToolStripDropDownCloseReason.ItemClicked);
     }
     if(owner != null) {
         owner.CancelClosingAncestors(fCancel, fClose);
     }
 }
Exemplo n.º 8
0
 private static ToolStripItem CreateMenuItem_AppLauncher_Virtual(string key, bool fReorderEnabled, RegistryKey rkSub, EventPack ep)
 {
     string[] valueNames = rkSub.GetValueNames();
     if ((valueNames != null) && (valueNames.Length > 0))
     {
         List <ToolStripItem> list = new List <ToolStripItem>();
         foreach (string str in valueNames)
         {
             string[] appVals = QTUtility2.ReadRegBinary <string>(str, rkSub);
             if (appVals != null)
             {
                 if ((appVals.Length == 3) || (appVals.Length == 4))
                 {
                     list.Add(CreateMenuItem_AppLauncher(str, appVals, ep));
                 }
             }
             else
             {
                 using (RegistryKey key2 = rkSub.OpenSubKey(str, false)) {
                     if (key2 != null)
                     {
                         ToolStripItem item = CreateMenuItem_AppLauncher_Virtual(str, fReorderEnabled, key2, ep);
                         if (item != null)
                         {
                             list.Add(item);
                         }
                     }
                 }
             }
         }
         if (list.Count > 0)
         {
             QMenuItem item2 = new QMenuItem(key, new MenuItemArguments(key, MenuTarget.VirtualFolder, MenuGenre.Application));
             item2.ImageKey = "folder";
             item2.Name     = key;
             DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
             reorderable.ReorderEnabled    = fReorderEnabled;
             reorderable.MessageParent     = ep.MessageParentHandle;
             reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
             reorderable.ImageList         = QTUtility.ImageListGlobal;
             reorderable.AddItemsRange(list.ToArray(), "userappItem");
             reorderable.ItemClicked     += new ToolStripItemClickedEventHandler(MenuUtility.virtualDirectory_DropDownItemClicked);
             reorderable.ReorderFinished += new MenuReorderedEventHandler(MenuUtility.virtualDirectory_ReorderFinished);
             string name = rkSub.Name;
             reorderable.Name = name.Substring(name.IndexOf(@"Software\Quizo\QTTabBar\UserApps\"));
             item2.DropDown   = reorderable;
             return(item2);
         }
     }
     return(null);
 }
Exemplo n.º 9
0
        public static void GroupMenu_ItemRightClicked(object sender, ItemRightClickedEventArgs e)
        {
            DropDownMenuReorderable reorderable = (DropDownMenuReorderable)sender;
            string str = TrackGroupContextMenu(e.ClickedItem.Text, e.IsKey ? e.Point : Control.MousePosition, reorderable.Handle);

            if (!string.IsNullOrEmpty(str))
            {
                QTUtility2.SendCOPYDATASTRUCT(QTUtility.instanceManager.CurrentHandle, (IntPtr)0xf30, str, IntPtr.Zero);
            }
            else
            {
                e.HRESULT = 0xfffd;
            }
        }
Exemplo n.º 10
0
        public static List <ToolStripItem> CreateGroupItems(ToolStripDropDownItem dropDownItem)
        {
            List <ToolStripItem>    ret      = new List <ToolStripItem>();
            DropDownMenuReorderable dropDown = null;

            if (dropDownItem != null)
            {
                dropDown = (DropDownMenuReorderable)dropDownItem.DropDown;
                while (dropDown.Items.Count > 0)
                {
                    dropDown.Items[0].Dispose();
                }
                dropDown.ItemsClear();
            }
            const string key = "groups";

            foreach (Group group in GroupsManager.Groups)
            {
                if (group.Paths.Count == 0 || !QTUtility2.PathExists(group.Paths[0]))
                {
                    continue;
                }
                QMenuItem item = new QMenuItem(group.Name, MenuGenre.Group);
                item.SetImageReservationKey(group.Paths[0], null);
                if (dropDown != null)
                {
                    dropDown.AddItem(item, key);
                }
                ret.Add(item);
                if (!group.Startup)
                {
                    continue;
                }
                if (StartUpTabFont == null)
                {
                    StartUpTabFont = new Font(item.Font, FontStyle.Underline);
                }
                item.Font = StartUpTabFont;
            }
            if (dropDownItem != null)
            {
                dropDownItem.Enabled = dropDown.Items.Count > 0;
            }
            return(ret);
        }
 protected override void OnMouseWheel(MouseEventArgs e) {
     if(fEnableScroll && fNowScrollButtonsRequired) {
         Point mousePosition = MousePosition;
         if(Bounds.Contains(mousePosition)) {
             ScrollMenu(e.Delta > 0, 3);
         }
         else {
             Control control = FromHandle(PInvoke.WindowFromPoint(mousePosition));
             if(control != null) {
                 DropDownMenuReorderable reorderable = control as DropDownMenuReorderable;
                 if(reorderable != null) {
                     reorderable.OnMouseWheel(e);
                 }
             }
         }
     }
     base.OnMouseWheel(e);
 }
Exemplo n.º 12
0
 public static void CreateGroupItems(ToolStripDropDownItem dropDownItem)
 {
     QTUtility.RefreshGroupsDic();
     if (QTUtility.GroupPathsDic.Count > 0)
     {
         dropDownItem.Enabled = true;
         DropDownMenuReorderable dropDown = (DropDownMenuReorderable)dropDownItem.DropDown;
         while (dropDown.Items.Count > 0)
         {
             dropDown.Items[0].Dispose();
         }
         dropDown.ItemsClear();
         string key = "groups";
         foreach (string str2 in QTUtility.GroupPathsDic.Keys)
         {
             string str3 = QTUtility.GroupPathsDic[str2];
             string path = str3.Split(QTUtility.SEPARATOR_CHAR)[0];
             if (str3.Length == 0)
             {
                 dropDown.AddItem(new ToolStripSeparator(), key);
             }
             else if (QTUtility2.PathExists(path))
             {
                 QMenuItem item = new QMenuItem(str2, MenuGenre.Group);
                 item.SetImageReservationKey(path, null);
                 dropDown.AddItem(item, key);
                 if (QTUtility.StartUpGroupList.Contains(str2))
                 {
                     if (QTUtility.StartUpTabFont == null)
                     {
                         QTUtility.StartUpTabFont = new Font(item.Font, FontStyle.Underline);
                     }
                     item.Font = QTUtility.StartUpTabFont;
                 }
             }
         }
     }
     else
     {
         dropDownItem.Enabled = false;
     }
 }
Exemplo n.º 13
0
        private static void virtualDirectory_ReorderFinished(object sender, ToolStripItemClickedEventArgs e)
        {
            DropDownMenuReorderable reorderable = (DropDownMenuReorderable)sender;

            using (RegistryKey key = Registry.CurrentUser.CreateSubKey(reorderable.Name)) {
                if (key != null)
                {
                    foreach (string str in key.GetValueNames())
                    {
                        key.DeleteValue(str, false);
                    }
                    int      num   = 1;
                    string[] array = new string[] { "separator", string.Empty, string.Empty };
                    foreach (ToolStripItem item in reorderable.Items)
                    {
                        if (item is ToolStripSeparator)
                        {
                            QTUtility2.WriteRegBinary <string>(array, "Separator" + num++, key);
                        }
                        else
                        {
                            QMenuItem item2 = item as QMenuItem;
                            if (item2 != null)
                            {
                                MenuItemArguments menuItemArguments = item2.MenuItemArguments;
                                if (menuItemArguments.Target == MenuTarget.VirtualFolder)
                                {
                                    key.SetValue(item.Name, new byte[0]);
                                    continue;
                                }
                                string[] strArray2 = new string[] { menuItemArguments.Path, menuItemArguments.OriginalArgument, menuItemArguments.OriginalWorkingDirectory, menuItemArguments.KeyShortcut.ToString() };
                                QTUtility2.WriteRegBinary <string>(strArray2, item.Name, key);
                            }
                        }
                    }
                    QTUtility.fRequiredRefresh_App = true;
                    QTTabBarClass.SyncTaskBarMenu();
                }
            }
        }
Exemplo n.º 14
0
 private static ToolStripItem CreateMenuItem_AppLauncher(string key, string[] appVals, EventPack ep) {
     string name = appVals[0];
     try {
         name = Environment.ExpandEnvironmentVariables(name);
     }
     catch {
     }
     MenuItemArguments mia = new MenuItemArguments(name, appVals[1], appVals[2], 0, MenuGenre.Application);
     if((appVals[0].Length == 0) || appVals[0].PathEquals("separator")) {
         ToolStripSeparator separator = new ToolStripSeparator();
         separator.Name = "appSep";
         return separator;
     }
     if(appVals.Length == 4) {
         int.TryParse(appVals[3], out mia.KeyShortcut);
     }
     if((name.StartsWith(@"\\") || name.StartsWith("::")) || !Directory.Exists(name)) {
         mia.Target = MenuTarget.File;
         QMenuItem item = new QMenuItem(key, mia);
         item.Name = key;
         item.SetImageReservationKey(name, Path.GetExtension(name));
         item.MouseMove += qmi_File_MouseMove;
         if(!ep.FromTaskBar && (mia.KeyShortcut > 0x100000)) {
             int num = mia.KeyShortcut & -1048577;
             item.ShortcutKeyDisplayString = QTUtility2.MakeKeyString((Keys)num).Replace(" ", string.Empty);
         }
         return item;
     }
     mia.Target = MenuTarget.Folder;
     DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
     reorderable.MessageParent = ep.MessageParentHandle;
     reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
     reorderable.ImageList = QTUtility.ImageListGlobal;
     DirectoryMenuItem item2 = new DirectoryMenuItem(key);
     item2.SetImageReservationKey(name, null);
     item2.Name = key;
     item2.Path = name;
     item2.MenuItemArguments = mia;
     item2.EventPack = ep;
     item2.ModifiiedDate = Directory.GetLastWriteTime(name);
     item2.DropDown = reorderable;
     item2.DoubleClickEnabled = true;
     item2.DropDownItems.Add(new ToolStripMenuItem());
     item2.DropDownItemClicked += realDirectory_DropDownItemClicked;
     item2.DropDownOpening += realDirectory_DropDownOpening;
     item2.DoubleClick += ep.DirDoubleClickEventHandler;
     return item2;
 }
Exemplo n.º 15
0
 private static ToolStripItem CreateMenuItem_AppLauncher_Virtual(string name, ToolStripItem[] items, bool fReorderEnabled, EventPack ep)
 {
     if(items.Length == 0) return null;
     MenuItemArguments mia = new MenuItemArguments(name, MenuTarget.VirtualFolder, MenuGenre.Application)
     { App = new UserApp(name) };
     DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null) {
         ReorderEnabled = fReorderEnabled,
         MessageParent = ep.MessageParentHandle,
         ImageList = QTUtility.ImageListGlobal
     };
     reorderable.AddItemsRange(items, "userappItem");
     reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
     reorderable.ItemClicked += virtualDirectory_DropDownItemClicked;
     reorderable.ReorderFinished += virtualDirectory_ReorderFinished;
     return new QMenuItem(name, mia) {
         ImageKey = "folder",
         Name = name,
         DropDown = reorderable
     };
 }
Exemplo n.º 16
0
        private void InitializeComponent()
        {
            // handle creation
            // todo: doesn't look necessary...
            hwndThis = Handle;

            bool reorderEnabled = !Config.Desktop.LockMenu;

            components = new System.ComponentModel.Container();
            contextMenu = new DropDownMenuReorderable(components, true, false);
            contextMenuForSetting = new ContextMenuStripEx(components, true); // todo: , false);
            tmiLabel_Group = new TitleMenuItem(MenuGenre.Group, true);
            tmiLabel_History = new TitleMenuItem(MenuGenre.History, true);
            tmiLabel_UserApp = new TitleMenuItem(MenuGenre.Application, true);
            tmiLabel_RecentFile = new TitleMenuItem(MenuGenre.RecentFile, true);

            contextMenu.SuspendLayout();
            contextMenuForSetting.SuspendLayout();
            SuspendLayout();
            //
            // contextMenu
            //
            contextMenu.ProhibitedKey.Add(MENUKEY_ITEM_HISTORY);
            contextMenu.ProhibitedKey.Add(MENUKEY_ITEM_RECENT);
            contextMenu.ReorderEnabled = reorderEnabled;
            contextMenu.MessageParent = Handle;
            contextMenu.ImageList = QTUtility.ImageListGlobal;
            contextMenu.ItemClicked += dropDowns_ItemClicked;
            contextMenu.Closing += contextMenu_Closing;
            contextMenu.ReorderFinished += contextMenu_ReorderFinished;
            contextMenu.ItemRightClicked += dropDowns_ItemRightClicked;
            if(!QTUtility.IsXP) {
                contextMenu.CreateControl();
            }
            //
            // ddmrGroups
            //
            ddmrGroups = new DropDownMenuReorderable(components, true, false);
            ddmrGroups.ReorderEnabled = reorderEnabled;
            ddmrGroups.ImageList = QTUtility.ImageListGlobal;
            ddmrGroups.ReorderFinished += dropDowns_ReorderFinished;
            ddmrGroups.ItemClicked += dropDowns_ItemClicked;
            ddmrGroups.ItemRightClicked += dropDowns_ItemRightClicked;
            //
            // tmiGroup
            //
            tmiGroup = new TitleMenuItem(MenuGenre.Group, false) {DropDown = ddmrGroups};
            //
            // ddmrHistory
            //
            ddmrHistory = new DropDownMenuReorderable(components, true, false);
            ddmrHistory.ReorderEnabled = false;
            ddmrHistory.ImageList = QTUtility.ImageListGlobal;
            ddmrHistory.MessageParent = Handle;
            ddmrHistory.ItemClicked += dropDowns_ItemClicked;
            ddmrHistory.ItemRightClicked += dropDowns_ItemRightClicked;
            //
            // tmiHistory
            //
            tmiHistory = new TitleMenuItem(MenuGenre.History, false);
            tmiHistory.DropDown = ddmrHistory;
            //
            // ddmrUserapps
            //
            ddmrUserapps = new DropDownMenuReorderable(components);
            ddmrUserapps.ReorderEnabled = reorderEnabled;
            ddmrUserapps.ImageList = QTUtility.ImageListGlobal;
            ddmrUserapps.MessageParent = Handle;
            ddmrUserapps.ReorderFinished += dropDowns_ReorderFinished;
            ddmrUserapps.ItemClicked += dropDowns_ItemClicked;
            ddmrUserapps.ItemRightClicked += dropDowns_ItemRightClicked;
            //
            // tmiUserApp
            //
            tmiUserApp = new TitleMenuItem(MenuGenre.Application, false);
            tmiUserApp.DropDown = ddmrUserapps;
            //
            // ddmrRecentFile
            //
            ddmrRecentFile = new DropDownMenuReorderable(components, false, false, false);
            ddmrRecentFile.ImageList = QTUtility.ImageListGlobal;
            ddmrRecentFile.MessageParent = Handle;
            ddmrRecentFile.ItemClicked += dropDowns_ItemClicked;
            ddmrRecentFile.ItemRightClicked += dropDowns_ItemRightClicked;
            //
            // tmiRecentFile
            //
            tmiRecentFile = new TitleMenuItem(MenuGenre.RecentFile, false);
            tmiRecentFile.DropDown = ddmrRecentFile;
            //
            // contextMenuForSetting
            //
            tsmiTaskBar = new ToolStripMenuItem();
            tsmiDesktop = new ToolStripMenuItem();
            tsmiLockItems = new ToolStripMenuItem();
            tsmiVSTitle = new ToolStripMenuItem();
            tsmiTaskBar.Checked = Config.Desktop.TaskBarDblClickEnabled;
            tsmiDesktop.Checked = Config.Desktop.DesktopDblClickEnabled;
            tsmiLockItems.Checked = Config.Desktop.LockMenu;
            tsmiVSTitle.Checked = Config.Desktop.TitleBackground;

            tsmiOnGroup = new ToolStripMenuItem();
            tsmiOnHistory = new ToolStripMenuItem();
            tsmiOnUserApps = new ToolStripMenuItem();
            tsmiOnRecentFile = new ToolStripMenuItem();
            tsmiOneClick = new ToolStripMenuItem();
            tsmiAppKeys = new ToolStripMenuItem();
            tsmiOnGroup.Checked = Config.Desktop.IncludeGroup;
            tsmiOnHistory.Checked = Config.Desktop.IncludeRecentTab;
            tsmiOnUserApps.Checked = Config.Desktop.IncludeApplication;
            tsmiOnRecentFile.Checked = Config.Desktop.IncludeRecentFile;
            tsmiOneClick.Checked = Config.Desktop.OneClickMenu;
            tsmiAppKeys.Checked = Config.Desktop.EnableAppShortcuts;

            tsmiExperimental = new ToolStripMenuItem(QTUtility.TextResourcesDic["Misc_Strings"][6]);
            tsmiExperimental.DropDown.Items.Add(new ToolStripMenuItem(QTUtility.TextResourcesDic["Misc_Strings"][7]));
            //TODO does this respect RTL settings?
            tsmiExperimental.DropDownDirection = ToolStripDropDownDirection.Left;
            tsmiExperimental.DropDownItemClicked += tsmiExperimental_DropDownItemClicked;
            tsmiExperimental.DropDownOpening += tsmiExperimental_DropDownOpening;

            contextMenuForSetting.Items.AddRange(new ToolStripItem[] {
                    tsmiTaskBar, tsmiDesktop, new ToolStripSeparator(),
                    tsmiOnGroup, tsmiOnHistory, tsmiOnUserApps, tsmiOnRecentFile,
                    new ToolStripSeparator(),
                    tsmiLockItems, tsmiVSTitle, tsmiOneClick, tsmiAppKeys, tsmiExperimental
            });
            contextMenuForSetting.ItemClicked += contextMenuForSetting_ItemClicked;
            RefreshStringResources();

            //
            // QTCoTaskBar
            //
            ContextMenuStrip = contextMenuForSetting;
            Width = Config.Desktop.Width;
            MinSize = new Size(8, 22);
            Dock = DockStyle.Fill;
            MouseClick += desktopTool_MouseClick;
            MouseDoubleClick += desktopTool_MouseDoubleClick;

            contextMenu.ResumeLayout(false);
            contextMenuForSetting.ResumeLayout(false);
            ResumeLayout(false);
        }
Exemplo n.º 17
0
 private void InitializeComponent() {
     bool flag = (this.ConfigValues[1] & 2) == 0;
     this.components = new Container();
     this.contextMenu = new DropDownMenuReorderable(this.components, true, false);
     this.contextMenuForSetting = new ContextMenuStripEx(this.components, true);
     this.labelGroupTitle = new TitleMenuItem(MenuGenre.Group, true);
     this.labelHistoryTitle = new TitleMenuItem(MenuGenre.History, true);
     this.labelUserAppTitle = new TitleMenuItem(MenuGenre.Application, true);
     this.labelRecentFileTitle = new TitleMenuItem(MenuGenre.RecentFile, true);
     this.contextMenu.SuspendLayout();
     this.contextMenuForSetting.SuspendLayout();
     base.SuspendLayout();
     this.contextMenu.ProhibitedKey.Add("historyItem");
     this.contextMenu.ProhibitedKey.Add("recentItem");
     this.contextMenu.ReorderEnabled = flag;
     this.contextMenu.MessageParent = base.Handle;
     this.contextMenu.ImageList = QTUtility.ImageListGlobal;
     this.contextMenu.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.contextMenu.Closing += new ToolStripDropDownClosingEventHandler(this.contextMenu_Closing);
     this.contextMenu.ReorderFinished += new MenuReorderedEventHandler(this.contextMenu_ReorderFinished);
     this.contextMenu.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     if(QTUtility.IsVista) {
         IntPtr handle = this.contextMenu.Handle;
     }
     this.ddmrGroups = new DropDownMenuReorderable(this.components, true, false);
     this.ddmrGroups.ReorderEnabled = flag;
     this.ddmrGroups.ReorderFinished += new MenuReorderedEventHandler(this.groupsMenuItem_ReorderFinished);
     this.ddmrGroups.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.groupsMenuItem = new TitleMenuItem(MenuGenre.Group, false);
     this.groupsMenuItem.DropDown = this.ddmrGroups;
     this.groupsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.groupsMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrHistory = new DropDownMenuReorderable(this.components, true, false);
     this.ddmrHistory.ReorderEnabled = false;
     this.ddmrHistory.MessageParent = base.Handle;
     this.ddmrHistory.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.historyMenuItem = new TitleMenuItem(MenuGenre.History, false);
     this.historyMenuItem.DropDown = this.ddmrHistory;
     this.historyMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.historyMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrUserapps = new DropDownMenuReorderable(this.components);
     this.ddmrUserapps.ReorderEnabled = flag;
     this.ddmrUserapps.MessageParent = base.Handle;
     this.ddmrUserapps.ReorderFinished += new MenuReorderedEventHandler(this.userAppsMenuItem_ReorderFinished);
     this.ddmrUserapps.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.userAppsMenuItem = new TitleMenuItem(MenuGenre.Application, false);
     this.userAppsMenuItem.DropDown = this.ddmrUserapps;
     this.userAppsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.userAppsMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrRecentFile = new DropDownMenuReorderable(this.components, false, false, false);
     this.ddmrRecentFile.MessageParent = base.Handle;
     this.ddmrRecentFile.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.recentFileMenuItem = new TitleMenuItem(MenuGenre.RecentFile, false);
     this.recentFileMenuItem.DropDown = this.ddmrRecentFile;
     this.recentFileMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.recentFileMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.contextMenuForSetting.ShowImageMargin = false;
     this.tsmiTaskBar = new ToolStripMenuItem();
     this.tsmiDesktop = new ToolStripMenuItem();
     this.tsmiLockItems = new ToolStripMenuItem();
     this.tsmiVSTitle = new ToolStripMenuItem();
     this.tsmiTaskBar.Checked = (this.ConfigValues[1] & 8) == 0;
     this.tsmiDesktop.Checked = (this.ConfigValues[1] & 4) == 0;
     this.tsmiLockItems.Checked = (this.ConfigValues[1] & 2) == 2;
     this.tsmiVSTitle.Checked = (this.ConfigValues[1] & 1) == 0;
     this.tsmiOnGroup = new ToolStripMenuItem();
     this.tsmiOnHistory = new ToolStripMenuItem();
     this.tsmiOnUserApps = new ToolStripMenuItem();
     this.tsmiOnRecentFile = new ToolStripMenuItem();
     this.tsmiOneClick = new ToolStripMenuItem();
     this.tsmiAppKeys = new ToolStripMenuItem();
     this.tsmiOnGroup.Checked = (this.ConfigValues[2] & 0x80) == 0;
     this.tsmiOnHistory.Checked = (this.ConfigValues[2] & 0x40) == 0;
     this.tsmiOnUserApps.Checked = (this.ConfigValues[2] & 0x20) == 0;
     this.tsmiOnRecentFile.Checked = (this.ConfigValues[2] & 1) == 0;
     this.tsmiOneClick.Checked = (this.ConfigValues[2] & 0x10) != 0;
     this.tsmiAppKeys.Checked = (this.ConfigValues[2] & 8) == 0;
     this.contextMenuForSetting.Items.AddRange(new ToolStripItem[] { this.tsmiTaskBar, this.tsmiDesktop, new ToolStripSeparator(), this.tsmiOnGroup, this.tsmiOnHistory, this.tsmiOnUserApps, this.tsmiOnRecentFile, new ToolStripSeparator(), this.tsmiLockItems, this.tsmiVSTitle, this.tsmiOneClick, this.tsmiAppKeys });
     this.contextMenuForSetting.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenuForSetting_ItemClicked);
     this.contextMenuForSetting.Opening += new CancelEventHandler(this.contextMenuForSetting_Opening);
     this.ContextMenuStrip = this.contextMenuForSetting;
     base.Width = this.WidthOfBar;
     base.MinSize = new Size(30, 0x16);
     this.Dock = DockStyle.Fill;
     base.MouseClick += new MouseEventHandler(this.QTCoTaskBarClass_MouseClick);
     base.MouseDoubleClick += new MouseEventHandler(this.QTCoTaskBarClass_MouseDoubleClick);
     this.contextMenu.ResumeLayout(false);
     this.contextMenuForSetting.ResumeLayout(false);
     base.ResumeLayout(false);
 }
Exemplo n.º 18
0
 private void InitializeSysMenu(bool fText) {
     bool flag = false;
     if(tsmiGroups == null) {
         flag = true;
         tsmiGroups = new ToolStripMenuItem(QTUtility.ResMain[12]);
         tsmiUndoClose = new ToolStripMenuItem(QTUtility.ResMain[13]);
         tsmiLastActiv = new ToolStripMenuItem(QTUtility.ResMain[14]);
         tsmiExecuted = new ToolStripMenuItem(QTUtility.ResMain[15]);
         tsmiBrowseFolder = new ToolStripMenuItem(QTUtility.ResMain[0x10] + "...");
         tsmiCloseAllButCurrent = new ToolStripMenuItem(QTUtility.ResMain[0x11]);
         tsmiCloseWindow = new ToolStripMenuItem(QTUtility.ResMain[0x12]);
         tsmiOption = new ToolStripMenuItem(QTUtility.ResMain[0x13]);
         tsmiLockToolbar = new ToolStripMenuItem(QTUtility.ResMain[0x20]);
         tsmiMergeWindows = new ToolStripMenuItem(QTUtility.ResMain[0x21]);
         tssep_Sys1 = new ToolStripSeparator();
         tssep_Sys2 = new ToolStripSeparator();
         contextMenuSys.SuspendLayout();
         contextMenuSys.Items[0].Dispose();
         contextMenuSys.Items.AddRange(new ToolStripItem[] { tsmiGroups, tsmiUndoClose, tsmiLastActiv, tsmiExecuted, tssep_Sys1, tsmiBrowseFolder, tsmiCloseAllButCurrent, tsmiCloseWindow, tsmiMergeWindows, tsmiLockToolbar, tssep_Sys2, tsmiOption });
         DropDownMenuReorderable reorderable = new DropDownMenuReorderable(components, true, false);
         reorderable.ReorderFinished += menuitemGroups_ReorderFinished;
         reorderable.ItemRightClicked += MenuUtility.GroupMenu_ItemRightClicked;
         reorderable.ItemMiddleClicked += ddrmrGroups_ItemMiddleClicked;
         reorderable.ImageList = QTUtility.ImageListGlobal;
         tsmiGroups.DropDown = reorderable;
         tsmiGroups.DropDownItemClicked += menuitemGroups_DropDownItemClicked;
         DropDownMenuReorderable reorderable2 = new DropDownMenuReorderable(components);
         reorderable2.ReorderEnabled = false;
         reorderable2.MessageParent = Handle;
         reorderable2.ImageList = QTUtility.ImageListGlobal;
         reorderable2.ItemRightClicked += ddmrUndoClose_ItemRightClicked;
         tsmiUndoClose.DropDown = reorderable2;
         tsmiUndoClose.DropDownItemClicked += menuitemUndoClose_DropDownItemClicked;
         DropDownMenuReorderable reorderable3 = new DropDownMenuReorderable(components);
         reorderable3.MessageParent = Handle;
         reorderable3.ItemRightClicked += menuitemExecuted_ItemRightClicked;
         reorderable3.ItemClicked += menuitemExecuted_DropDownItemClicked;
         reorderable3.ImageList = QTUtility.ImageListGlobal;
         tsmiExecuted.DropDown = reorderable3;
         tssep_Sys1.Enabled = false;
         tssep_Sys2.Enabled = false;
         contextMenuSys.ResumeLayout(false);
     }
     if(!flag && fText) {
         tsmiGroups.Text = QTUtility.ResMain[12];
         tsmiUndoClose.Text = QTUtility.ResMain[13];
         tsmiLastActiv.Text = QTUtility.ResMain[14];
         tsmiExecuted.Text = QTUtility.ResMain[15];
         tsmiBrowseFolder.Text = QTUtility.ResMain[0x10] + "...";
         tsmiCloseAllButCurrent.Text = QTUtility.ResMain[0x11];
         tsmiCloseWindow.Text = QTUtility.ResMain[0x12];
         tsmiOption.Text = QTUtility.ResMain[0x13];
         tsmiLockToolbar.Text = QTUtility.ResMain[0x20];
         tsmiMergeWindows.Text = QTUtility.ResMain[0x21];
     }
 }
Exemplo n.º 19
0
        private void CreatePluginItem(int buttonIndex)
        {
            QTTabBarClass tabbar = InstanceManager.GetThreadTabBar();
            if(tabbar == null) return;
            QTTabBarClass.PluginServer pluginServer = tabbar.pluginServer;
            if(pluginServer == null) return;
            string pluginID = Config.BBar.ActivePluginIDs[buttonIndex.HiWord() - 1];
            try {
                bool showText = Config.BBar.ShowButtonLabels;
                PluginInformation pi = PluginManager.PluginInformations.FirstOrDefault(info => info.PluginID == pluginID);
                if(pi == null || !pi.Enabled) return;
                Plugin plugin;
                pluginServer.TryGetPlugin(pluginID, out plugin);
                if(plugin == null) {
                    plugin = pluginServer.Load(pi, null);
                }
                if(plugin == null) return;

                ToolStripItem itemToAdd = null;
                if(plugin.Instance is IBarDropButton) {
                    IBarDropButton instance = (IBarDropButton)plugin.Instance;
                    instance.InitializeItem();
                    if(instance.IsSplitButton) {
                        itemToAdd = new ToolStripSplitButton(instance.Text) {
                                ImageScaling = ToolStripItemImageScaling.None,
                                DropDownButtonWidth = Config.BBar.LargeButtons ? 14 : 11,
                                DisplayStyle = showText
                                        ? ToolStripItemDisplayStyle.ImageAndText
                                        : ToolStripItemDisplayStyle.Image,
                                ToolTipText = instance.Text,
                                Image = instance.GetImage(Config.BBar.LargeButtons)
                        };
                        DropDownMenuReorderable reorder = new DropDownMenuReorderable(components);
                        reorder.ItemClicked += pluginDropDown_ItemClicked;
                        reorder.ItemRightClicked += pluginDropDown_ItemRightClicked;
                        ((ToolStripSplitButton)itemToAdd).DropDown = reorder;
                        ((ToolStripSplitButton)itemToAdd).DropDownOpening += pluginDropDown_DropDownOpening;
                        ((ToolStripSplitButton)itemToAdd).ButtonClick += pluginButton_ButtonClick;
                    }
                    else {
                        itemToAdd = new ToolStripDropDownButton(instance.Text) {
                                ImageScaling = ToolStripItemImageScaling.None,
                                DisplayStyle = showText
                                        ? ToolStripItemDisplayStyle.ImageAndText
                                        : ToolStripItemDisplayStyle.Image,
                                ToolTipText = instance.Text,
                                Image = instance.GetImage(Config.BBar.LargeButtons)
                        };
                        DropDownMenuReorderable reorder = new DropDownMenuReorderable(components);
                        reorder.ItemClicked += pluginDropDown_ItemClicked;
                        reorder.ItemRightClicked += pluginDropDown_ItemRightClicked;
                        ((ToolStripDropDownButton)itemToAdd).DropDown = reorder;
                        ((ToolStripDropDownButton)itemToAdd).DropDownOpening += pluginDropDown_DropDownOpening;
                    }
                }
                else if(plugin.Instance is IBarButton) {
                    IBarButton instance = (IBarButton)plugin.Instance;
                    instance.InitializeItem();
                    itemToAdd = new ToolStripButton(instance.Text) {
                            ImageScaling = ToolStripItemImageScaling.None,
                            DisplayStyle = showText
                                    ? ToolStripItemDisplayStyle.ImageAndText
                                    : ToolStripItemDisplayStyle.Image,
                            ToolTipText = instance.Text,
                            Image = instance.GetImage(Config.BBar.LargeButtons)
                    };
                    itemToAdd.Click += pluginButton_ButtonClick;
                }
                else if(plugin.Instance is IBarCustomItem) {
                    IBarCustomItem instance = (IBarCustomItem)plugin.Instance;
                    DisplayStyle displayStyle = showText ? DisplayStyle.ShowTextLabel : DisplayStyle.NoLabel;
                    itemToAdd = instance.CreateItem(Config.BBar.LargeButtons, displayStyle);
                    if(itemToAdd != null) {
                        itemToAdd.ImageScaling = ToolStripItemImageScaling.None;
                        lstPluginCustomItem.Add(itemToAdd);
                    }
                }
                else if(plugin.Instance is IBarMultipleCustomItems) {
                    IBarMultipleCustomItems instance = (IBarMultipleCustomItems)plugin.Instance;
                    if(buttonIndex.LoWord() >= instance.Count) return;
                    if(!plugin.BackgroundButtonEnabled) {
                        // This is to maintain backwards compatibility.
                        instance.Initialize(instance.Count.RangeSelect(i => i).ToArray());
                    }
                    DisplayStyle style = showText ? DisplayStyle.ShowTextLabel : DisplayStyle.NoLabel;
                    itemToAdd = instance.CreateItem(Config.BBar.LargeButtons, style, buttonIndex.LoWord());
                    if(itemToAdd != null) {
                        lstPluginCustomItem.Add(itemToAdd);
                    }
                }

                if(itemToAdd != null) {
                    itemToAdd.Tag = buttonIndex;
                    toolStrip.Items.Add(itemToAdd);
                    if(pi.PluginType == PluginType.Background || pi.PluginType == PluginType.BackgroundMultiple) {
                        plugin.BackgroundButtonEnabled = true;
                    }
                }
            }
            catch(Exception exception) {
                PluginManager.HandlePluginException(exception, ExplorerHandle, pluginID, "Loading plugin button.");
            }
        }
Exemplo n.º 20
0
 private static ToolStripItem CreateMenuItem_AppLauncher_Virtual(string key, bool fReorderEnabled, RegistryKey rkSub, EventPack ep) {
     string[] valueNames = rkSub.GetValueNames();
     if((valueNames != null) && (valueNames.Length > 0)) {
         List<ToolStripItem> list = new List<ToolStripItem>();
         foreach(string str in valueNames) {
             string[] appVals = QTUtility2.ReadRegBinary<string>(str, rkSub);
             if(appVals != null) {
                 if((appVals.Length == 3) || (appVals.Length == 4)) {
                     list.Add(CreateMenuItem_AppLauncher(str, appVals, ep));
                 }
             }
             else {
                 using(RegistryKey key2 = rkSub.OpenSubKey(str, false)) {
                     if(key2 != null) {
                         ToolStripItem item = CreateMenuItem_AppLauncher_Virtual(str, fReorderEnabled, key2, ep);
                         if(item != null) {
                             list.Add(item);
                         }
                     }
                 }
             }
         }
         if(list.Count > 0) {
             QMenuItem item2 = new QMenuItem(key, new MenuItemArguments(key, MenuTarget.VirtualFolder, MenuGenre.Application));
             item2.ImageKey = "folder";
             item2.Name = key;
             DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
             reorderable.ReorderEnabled = fReorderEnabled;
             reorderable.MessageParent = ep.MessageParentHandle;
             reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
             reorderable.ImageList = QTUtility.ImageListGlobal;
             reorderable.AddItemsRange(list.ToArray(), "userappItem");
             reorderable.ItemClicked += virtualDirectory_DropDownItemClicked;
             reorderable.ReorderFinished += virtualDirectory_ReorderFinished;
             string name = rkSub.Name;
             reorderable.Name = name.Substring(name.IndexOf(@"Software\Quizo\QTTabBar\UserApps\"));
             item2.DropDown = reorderable;
             return item2;
         }
     }
     return null;
 }
Exemplo n.º 21
0
 private void InitializeComponent() {
     bool flag = (ConfigValues[1] & 2) == 0;
     components = new Container();
     contextMenu = new DropDownMenuReorderable(components, true, false);
     contextMenuForSetting = new ContextMenuStripEx(components, true);
     labelGroupTitle = new TitleMenuItem(MenuGenre.Group, true);
     labelHistoryTitle = new TitleMenuItem(MenuGenre.History, true);
     labelUserAppTitle = new TitleMenuItem(MenuGenre.Application, true);
     labelRecentFileTitle = new TitleMenuItem(MenuGenre.RecentFile, true);
     contextMenu.SuspendLayout();
     contextMenuForSetting.SuspendLayout();
     SuspendLayout();
     contextMenu.ProhibitedKey.Add("historyItem");
     contextMenu.ProhibitedKey.Add("recentItem");
     contextMenu.ReorderEnabled = flag;
     contextMenu.MessageParent = Handle;
     contextMenu.ImageList = QTUtility.ImageListGlobal;
     contextMenu.ItemClicked += contextMenu_ItemClicked;
     contextMenu.Closing += contextMenu_Closing;
     contextMenu.ReorderFinished += contextMenu_ReorderFinished;
     contextMenu.ItemRightClicked += dropDownMenues_ItemRightClicked;
     ddmrGroups = new DropDownMenuReorderable(components, true, false);
     ddmrGroups.ReorderEnabled = flag;
     ddmrGroups.ReorderFinished += groupsMenuItem_ReorderFinished;
     ddmrGroups.ItemRightClicked += dropDownMenues_ItemRightClicked;
     groupsMenuItem = new TitleMenuItem(MenuGenre.Group, false);
     groupsMenuItem.DropDown = ddmrGroups;
     groupsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     groupsMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrHistory = new DropDownMenuReorderable(components, true, false);
     ddmrHistory.ReorderEnabled = false;
     ddmrHistory.MessageParent = Handle;
     ddmrHistory.ItemRightClicked += dropDownMenues_ItemRightClicked;
     historyMenuItem = new TitleMenuItem(MenuGenre.History, false);
     historyMenuItem.DropDown = ddmrHistory;
     historyMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     historyMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrUserapps = new DropDownMenuReorderable(components);
     ddmrUserapps.ReorderEnabled = flag;
     ddmrUserapps.MessageParent = Handle;
     ddmrUserapps.ReorderFinished += userAppsMenuItem_ReorderFinished;
     ddmrUserapps.ItemRightClicked += dropDownMenues_ItemRightClicked;
     userAppsMenuItem = new TitleMenuItem(MenuGenre.Application, false);
     userAppsMenuItem.DropDown = ddmrUserapps;
     userAppsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     userAppsMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrRecentFile = new DropDownMenuReorderable(components, false, false, false);
     ddmrRecentFile.MessageParent = Handle;
     ddmrRecentFile.ItemRightClicked += dropDownMenues_ItemRightClicked;
     recentFileMenuItem = new TitleMenuItem(MenuGenre.RecentFile, false);
     recentFileMenuItem.DropDown = ddmrRecentFile;
     recentFileMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     recentFileMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     contextMenuForSetting.ShowImageMargin = false;
     tsmiTaskBar = new ToolStripMenuItem();
     tsmiDesktop = new ToolStripMenuItem();
     tsmiLockItems = new ToolStripMenuItem();
     tsmiVSTitle = new ToolStripMenuItem();
     tsmiTaskBar.Checked = (ConfigValues[1] & 8) == 0;
     tsmiDesktop.Checked = (ConfigValues[1] & 4) == 0;
     tsmiLockItems.Checked = (ConfigValues[1] & 2) == 2;
     tsmiVSTitle.Checked = (ConfigValues[1] & 1) == 0;
     tsmiOnGroup = new ToolStripMenuItem();
     tsmiOnHistory = new ToolStripMenuItem();
     tsmiOnUserApps = new ToolStripMenuItem();
     tsmiOnRecentFile = new ToolStripMenuItem();
     tsmiOneClick = new ToolStripMenuItem();
     tsmiAppKeys = new ToolStripMenuItem();
     tsmiOnGroup.Checked = (ConfigValues[2] & 0x80) == 0;
     tsmiOnHistory.Checked = (ConfigValues[2] & 0x40) == 0;
     tsmiOnUserApps.Checked = (ConfigValues[2] & 0x20) == 0;
     tsmiOnRecentFile.Checked = (ConfigValues[2] & 1) == 0;
     tsmiOneClick.Checked = (ConfigValues[2] & 0x10) != 0;
     tsmiAppKeys.Checked = (ConfigValues[2] & 8) == 0;
     contextMenuForSetting.Items.AddRange(new ToolStripItem[] { tsmiTaskBar, tsmiDesktop, new ToolStripSeparator(), tsmiOnGroup, tsmiOnHistory, tsmiOnUserApps, tsmiOnRecentFile, new ToolStripSeparator(), tsmiLockItems, tsmiVSTitle, tsmiOneClick, tsmiAppKeys });
     contextMenuForSetting.ItemClicked += contextMenuForSetting_ItemClicked;
     contextMenuForSetting.Opening += contextMenuForSetting_Opening;
     ContextMenuStrip = contextMenuForSetting;
     Width = WidthOfBar;
     MinSize = new Size(30, 0x16);
     Dock = DockStyle.Fill;
     MouseClick += QTCoTaskBarClass_MouseClick;
     MouseDoubleClick += QTCoTaskBarClass_MouseDoubleClick;
     contextMenu.ResumeLayout(false);
     contextMenuForSetting.ResumeLayout(false);
     ResumeLayout(false);
 }
Exemplo n.º 22
0
        private ToolStripDropDownButton CreateDropDownButton(int index) {
            ToolStripDropDownButton button = new ToolStripDropDownButton();
            switch(index) {
                case -1:
                    if(NavDropDown == null) {
                        NavDropDown = new DropDownMenuBase(components, true, true, true);
                        NavDropDown.ImageList = QTUtility.ImageListGlobal;
                        NavDropDown.ItemClicked += dropDownButtons_DropDown_ItemClicked;
                        NavDropDown.Closed += dropDownButtons_DropDown_Closed;
                    }
                    button.DropDown = NavDropDown;
                    button.Tag = -1;
                    button.AutoToolTip = false;
                    break;

                case 3:
                    if(ddmrGroupButton == null) {
                        ddmrGroupButton = new DropDownMenuReorderable(components, true, false);
                        ddmrGroupButton.ImageList = QTUtility.ImageListGlobal;
                        ddmrGroupButton.ReorderEnabled = !LockDropDownItems;
                        ddmrGroupButton.ItemRightClicked += MenuUtility.GroupMenu_ItemRightClicked;
                        ddmrGroupButton.ItemMiddleClicked += ddmrGroupButton_ItemMiddleClicked;
                        ddmrGroupButton.ReorderFinished += dropDownButtons_DropDown_ReorderFinished;
                        ddmrGroupButton.ItemClicked += dropDownButtons_DropDown_ItemClicked;
                        ddmrGroupButton.Closed += dropDownButtons_DropDown_Closed;
                    }
                    button.DropDown = ddmrGroupButton;
                    button.Enabled = QTUtility.GroupPathsDic.Count > 0;
                    break;

                case 4:
                    if(ddmrRecentlyClosed == null) {
                        ddmrRecentlyClosed = new DropDownMenuReorderable(components, true, false);
                        ddmrRecentlyClosed.ImageList = QTUtility.ImageListGlobal;
                        ddmrRecentlyClosed.ReorderEnabled = false;
                        ddmrRecentlyClosed.MessageParent = Handle;
                        ddmrRecentlyClosed.ItemRightClicked += ddmr45_ItemRightClicked;
                        ddmrRecentlyClosed.ItemClicked += dropDownButtons_DropDown_ItemClicked;
                        ddmrRecentlyClosed.Closed += dropDownButtons_DropDown_Closed;
                    }
                    button.DropDown = ddmrRecentlyClosed;
                    button.Enabled = QTUtility.ClosedTabHistoryList.Count > 0;
                    break;

                case 5:
                    if(ddmrUserAppButton == null) {
                        ddmrUserAppButton = new DropDownMenuReorderable(components);
                        ddmrUserAppButton.ImageList = QTUtility.ImageListGlobal;
                        ddmrUserAppButton.ReorderEnabled = !LockDropDownItems;
                        ddmrUserAppButton.MessageParent = Handle;
                        ddmrUserAppButton.ItemRightClicked += ddmr45_ItemRightClicked;
                        ddmrUserAppButton.ReorderFinished += dropDownButtons_DropDown_ReorderFinished;
                        ddmrUserAppButton.ItemClicked += dropDownButtons_DropDown_ItemClicked;
                        ddmrUserAppButton.Closed += dropDownButtons_DropDown_Closed;
                    }
                    button.DropDown = ddmrUserAppButton;
                    button.Enabled = QTUtility.UserAppsDic.Count > 0;
                    break;
            }
            button.DropDownOpening += dropDownButtons_DropDownOpening;
            return button;
        }
Exemplo n.º 23
0
        protected virtual bool ListViewController_MessageCaptured(ref Message msg)
        {
            if (msg.Msg == WM_AFTERPAINT)
            {
                RefreshSubDirTip(true);
                return(true);
            }
            else if (msg.Msg == WM_REGISTERDRAGDROP)
            {
                IntPtr ptr = Marshal.ReadIntPtr(msg.WParam);
                if (dropTargetPassthrough != null)
                {
                    // If this is the RegisterDragDrop call from the constructor,
                    // don't mess it up!
                    if (dropTargetPassthrough.Pointer == ptr)
                    {
                        return(true);
                    }
                    dropTargetPassthrough.Dispose();
                }
                dropTargetPassthrough = TryMakeDTPassthrough(ptr);
                if (dropTargetPassthrough != null)
                {
                    Marshal.WriteIntPtr(msg.WParam, dropTargetPassthrough.Pointer);
                }
                return(true);
            }

            switch (msg.Msg)
            {
            case WM.DESTROY:
                HideThumbnailTooltip(7);
                HideSubDirTip(7);
                ListViewController.DefWndProc(ref msg);
                OnListViewDestroyed();
                return(true);

            case WM.PAINT:
                // It's very dangerous to do automation-related things
                // during WM_PAINT.  So, use PostMessage to do it later.
                PInvoke.PostMessage(ListViewController.Handle, WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero);
                break;

            case WM.MOUSEMOVE:
                ResetTrackMouseEvent();
                break;

            case WM.LBUTTONDBLCLK:
                if (DoubleClick != null)
                {
                    return(DoubleClick(QTUtility2.PointFromLPARAM(msg.LParam)));
                }
                break;

            case WM.MBUTTONUP:
                if (MiddleClick != null)
                {
                    MiddleClick(QTUtility2.PointFromLPARAM(msg.LParam));
                }
                break;

            case WM.MOUSEWHEEL: {
                IntPtr handle = PInvoke.WindowFromPoint(QTUtility2.PointFromLPARAM(msg.LParam));
                if (handle != IntPtr.Zero && handle != msg.HWnd)
                {
                    Control control = Control.FromHandle(handle);
                    if (control != null)
                    {
                        DropDownMenuReorderable reorderable = control as DropDownMenuReorderable;
                        if ((reorderable != null) && reorderable.CanScroll)
                        {
                            PInvoke.SendMessage(handle, WM.MOUSEWHEEL, msg.WParam, msg.LParam);
                        }
                    }
                }
                break;
            }

            case WM.MOUSELEAVE:
                fTrackMouseEvent = true;
                HideThumbnailTooltip(4);
                if (((subDirTip != null) && !subDirTip.MouseIsOnThis()) && !subDirTip.MenuIsShowing)
                {
                    HideSubDirTip(5);
                }
                break;
            }
            return(false);
        }
Exemplo n.º 24
0
 private static ToolStripItem CreateMenuItem_AppLauncher(UserApp app, EventPack ep, ShellBrowserEx shellBrowser)
 {
     string path = app.Path;
     try {
         path = Environment.ExpandEnvironmentVariables(path);
     }
     catch {
     }
     MenuItemArguments mia = new MenuItemArguments(app, shellBrowser, MenuGenre.Application);
     if(path.StartsWith(@"\\") || path.StartsWith("::") || !Directory.Exists(path)) {
         mia.Target = MenuTarget.File;
         QMenuItem item = new QMenuItem(app.Name, mia) { Name = app.Name };
         item.SetImageReservationKey(path, Path.GetExtension(path));
         item.MouseMove += qmi_File_MouseMove;
         if(!ep.FromTaskBar && app.ShortcutKey != Keys.None) {
             item.ShortcutKeyDisplayString = QTUtility2.MakeKeyString(app.ShortcutKey).Replace(" ", string.Empty);
         }
         return item;
     }
     else {
         mia.Target = MenuTarget.Folder;
         DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null) {
             MessageParent = ep.MessageParentHandle,
             ImageList = QTUtility.ImageListGlobal
         };
         reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
         DirectoryMenuItem item = new DirectoryMenuItem(app.Name) {
             Name = app.Name,
             Path = path,
             MenuItemArguments = mia,
             EventPack = ep,
             ModifiedDate = Directory.GetLastWriteTime(path),
             DropDown = reorderable,
             DoubleClickEnabled = true
         };
         item.DropDownItems.Add(new ToolStripMenuItem());
         item.DropDownItemClicked += realDirectory_DropDownItemClicked;
         item.DropDownOpening += realDirectory_DropDownOpening;
         item.DoubleClick += ep.DirDoubleClickEventHandler;
         item.SetImageReservationKey(path, null);
         return item;
     }
 }
Exemplo n.º 25
0
 private void CreatePluginItem() {
     if((pluginManager != null) && (PluginManager.ActivatedButtonsOrder.Count > iPluginCreatingIndex)) {
         string pluginID = string.Empty;
         try {
             int num = 0x10000 + iPluginCreatingIndex;
             pluginID = PluginManager.ActivatedButtonsOrder[iPluginCreatingIndex];
             bool flag = (ConfigValues[0] & 0x20) == 0x20;
             bool flag2 = (ConfigValues[0] & 0x10) == 0x10;
             PluginInformation pi = PluginManager.PluginInformations
                     .FirstOrDefault(info => info.PluginID == pluginID);
             if(pi != null) {
                 Plugin plugin;
                 pluginManager.TryGetPlugin(pluginID, out plugin);
                 if(plugin == null) {
                     plugin = pluginManager.Load(pi, null);
                 }
                 if(plugin != null) {
                     bool flag3 = false;
                     IBarDropButton instance = plugin.Instance as IBarDropButton;
                     if(instance != null) {
                         instance.InitializeItem();
                         if(instance.IsSplitButton) {
                             ToolStripSplitButton button2 = new ToolStripSplitButton(instance.Text);
                             button2.ImageScaling = ToolStripItemImageScaling.None;
                             button2.DropDownButtonWidth = LargeButton ? 14 : 11;
                             if(flag2) {
                                 button2.DisplayStyle = instance.ShowTextLabel ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             else {
                                 button2.DisplayStyle = flag ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             button2.ToolTipText = instance.Text;
                             button2.Image = instance.GetImage(LargeButton);
                             button2.Tag = num;
                             DropDownMenuReorderable reorderable = new DropDownMenuReorderable(components);
                             button2.DropDown = reorderable;
                             button2.DropDownOpening += pluginDropDown_DropDownOpening;
                             button2.ButtonClick += pluginButton_ButtonClick;
                             reorderable.ItemClicked += pluginDropDown_ItemClicked;
                             reorderable.ItemRightClicked += pluginDropDown_ItemRightClicked;
                             toolStrip.Items.Add(button2);
                         }
                         else {
                             ToolStripDropDownButton button3 = new ToolStripDropDownButton(instance.Text);
                             button3.ImageScaling = ToolStripItemImageScaling.None;
                             if(flag2) {
                                 button3.DisplayStyle = instance.ShowTextLabel ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             else {
                                 button3.DisplayStyle = flag ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             button3.ToolTipText = instance.Text;
                             button3.Image = instance.GetImage(LargeButton);
                             button3.Tag = num;
                             DropDownMenuReorderable reorderable2 = new DropDownMenuReorderable(components);
                             button3.DropDown = reorderable2;
                             button3.DropDownOpening += pluginDropDown_DropDownOpening;
                             reorderable2.ItemClicked += pluginDropDown_ItemClicked;
                             reorderable2.ItemRightClicked += pluginDropDown_ItemRightClicked;
                             toolStrip.Items.Add(button3);
                         }
                         flag3 = true;
                     }
                     else {
                         IBarButton button4 = plugin.Instance as IBarButton;
                         if(button4 != null) {
                             button4.InitializeItem();
                             ToolStripButton button5 = new ToolStripButton(button4.Text);
                             button5.ImageScaling = ToolStripItemImageScaling.None;
                             if(flag2) {
                                 button5.DisplayStyle = button4.ShowTextLabel ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             else {
                                 button5.DisplayStyle = flag ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image;
                             }
                             button5.ToolTipText = button4.Text;
                             button5.Image = button4.GetImage(LargeButton);
                             button5.Tag = num;
                             button5.Click += pluginButton_ButtonClick;
                             toolStrip.Items.Add(button5);
                             flag3 = true;
                         }
                         else {
                             IBarCustomItem item = plugin.Instance as IBarCustomItem;
                             if(item != null) {
                                 DisplayStyle displayStyle = flag2 ? DisplayStyle.SelectiveText : (flag ? DisplayStyle.ShowTextLabel : DisplayStyle.NoLabel);
                                 ToolStripItem item2 = item.CreateItem(LargeButton, displayStyle);
                                 if(item2 != null) {
                                     item2.ImageScaling = ToolStripItemImageScaling.None;
                                     item2.Tag = num;
                                     toolStrip.Items.Add(item2);
                                     flag3 = true;
                                     lstPluginCustomItem.Add(item2);
                                 }
                             }
                             else {
                                 IBarMultipleCustomItems items = plugin.Instance as IBarMultipleCustomItems;
                                 if(items != null) {
                                     DisplayStyle style2 = flag2 ? DisplayStyle.SelectiveText : (flag ? DisplayStyle.ShowTextLabel : DisplayStyle.NoLabel);
                                     int index = pluginManager.IncrementBackgroundMultiple(pi);
                                     if(index == 0) {
                                         List<int> list;
                                         int[] order = null;
                                         if(pluginManager.TryGetMultipleOrder(pi.PluginID, out list)) {
                                             order = list.ToArray();
                                         }
                                         items.Initialize(order);
                                     }
                                     ToolStripItem item3 = items.CreateItem(LargeButton, style2, index);
                                     if(item3 != null) {
                                         item3.Tag = num;
                                         toolStrip.Items.Add(item3);
                                         flag3 = true;
                                         lstPluginCustomItem.Add(item3);
                                     }
                                 }
                             }
                         }
                     }
                     if(flag3 && ((pi.PluginType == PluginType.Background) || (pi.PluginType == PluginType.BackgroundMultiple))) {
                         plugin.BackgroundButtonEnabled = true;
                     }
                 }
             }
         }
         catch(Exception exception) {
             PluginManager.HandlePluginException(exception, ExplorerHandle, pluginID, "Loading plugin button.");
         }
         finally {
             iPluginCreatingIndex++;
         }
     }
 }
Exemplo n.º 26
0
        protected virtual bool ListViewController_MessageCaptured(ref Message msg)
        {
            if (msg.Msg == WM_AFTERPAINT)
            {
                RefreshSubDirTip(true);
                return(true);
            }

            switch (msg.Msg)
            {
            case WM.DESTROY:
                HideThumbnailTooltip(7);
                HideSubDirTip(7);
                ListViewController.DefWndProc(ref msg);
                OnListViewDestroyed();
                return(true);

            case WM.PAINT:
                // It's very dangerous to do automation-related things
                // during WM_PAINT.  So, use PostMessage to do it later.
                PInvoke.PostMessage(ListViewController.Handle, (uint)WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero);
                break;

            case WM.MOUSEMOVE:
                ResetTrackMouseEvent();
                break;

            case WM.LBUTTONDBLCLK:
                if (DoubleClick != null)
                {
                    return(DoubleClick(QTUtility2.PointFromLPARAM(msg.LParam)));
                }
                break;

            case WM.MBUTTONUP:
                if (MiddleClick != null)
                {
                    MiddleClick(QTUtility2.PointFromLPARAM(msg.LParam));
                }
                break;

            case WM.MOUSEWHEEL: {
                IntPtr handle = PInvoke.WindowFromPoint(QTUtility2.PointFromLPARAM(msg.LParam));
                if (handle != IntPtr.Zero && handle != msg.HWnd)
                {
                    Control control = Control.FromHandle(handle);
                    if (control != null)
                    {
                        DropDownMenuReorderable reorderable = control as DropDownMenuReorderable;
                        if ((reorderable != null) && reorderable.CanScroll)
                        {
                            PInvoke.SendMessage(handle, WM.MOUSEWHEEL, msg.WParam, msg.LParam);
                        }
                    }
                }
                break;
            }

            case WM.MOUSELEAVE:
                fTrackMouseEvent = true;
                HideThumbnailTooltip(4);
                if (((subDirTip != null) && !subDirTip.MouseIsOnThis()) && !subDirTip.MenuIsShowing)
                {
                    HideSubDirTip(5);
                }
                break;
            }
            return(false);
        }