Пример #1
0
        public static List <ToolStripItem> CreateUndoClosedItems(ToolStripDropDownItem dropDownItem)
        {
            List <ToolStripItem> list = new List <ToolStripItem>();

            string[] strArray = QTUtility.ClosedTabHistoryList.ToArray();
            bool     flag     = dropDownItem != null;

            if (flag)
            {
                while (dropDownItem.DropDownItems.Count > 0)
                {
                    dropDownItem.DropDownItems[0].Dispose();
                }
            }
            if (strArray.Length > 0)
            {
                if (flag)
                {
                    dropDownItem.Enabled = true;
                }
                for (int i = strArray.Length - 1; i >= 0; i--)
                {
                    if (strArray[i].Length > 0)
                    {
                        if (!QTUtility2.PathExists(strArray[i]))
                        {
                            QTUtility.ClosedTabHistoryList.Remove(strArray[i]);
                        }
                        else
                        {
                            QMenuItem item = CreateMenuItem(new MenuItemArguments(strArray[i], MenuTarget.Folder, MenuGenre.History));
                            if (flag)
                            {
                                dropDownItem.DropDownItems.Add(item);
                            }
                            else
                            {
                                list.Add(item);
                            }
                        }
                    }
                }
                return(list);
            }
            if (flag)
            {
                dropDownItem.Enabled = false;
            }
            return(list);
        }
Пример #2
0
        // todo: check vs quizo's
        public static List <ToolStripItem> CreateUndoClosedItems(ToolStripDropDownItem dropDownItem)
        {
            List <ToolStripItem> ret = new List <ToolStripItem>();

            string[] reversedLog = StaticReg.ClosedTabHistoryList.Reverse().ToArray();
            if (dropDownItem != null)
            {
                while (dropDownItem.DropDownItems.Count > 0)
                {
                    dropDownItem.DropDownItems[0].Dispose();
                }
            }
            if (reversedLog.Length > 0)
            {
                if (dropDownItem != null)
                {
                    dropDownItem.Enabled = true;
                }
                foreach (string entry in reversedLog)
                {
                    if (entry.Length <= 0)
                    {
                        continue;
                    }
                    if (!QTUtility2.PathExists(entry))
                    {
                        StaticReg.ClosedTabHistoryList.Remove(entry);
                    }
                    else
                    {
                        QMenuItem item = CreateMenuItem(new MenuItemArguments(entry, MenuTarget.Folder, MenuGenre.History));
                        if (dropDownItem != null)
                        {
                            dropDownItem.DropDownItems.Add(item);
                        }
                        ret.Add(item);
                    }
                }
            }
            else if (dropDownItem != null)
            {
                dropDownItem.Enabled = false;
            }
            return(ret);
        }
Пример #3
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);
        }
Пример #4
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;
     }
 }