// todo: check vs quizo's public static List <ToolStripItem> CreateRecentFilesItems() { List <ToolStripItem> ret = new List <ToolStripItem>(); List <string> toRemove = new List <string>(); if (StaticReg.ExecutedPathsList.Count > 0) { foreach (string path in StaticReg.ExecutedPathsList.Reverse()) { if (QTUtility2.IsNetworkPath(path) || File.Exists(path)) { QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path)), MenuGenre.RecentFile); item.Path = item.ToolTipText = path; item.SetImageReservationKey(path, Path.GetExtension(path)); ret.Add(item); } else { toRemove.Add(path); } } } foreach (string str in toRemove) { StaticReg.ExecutedPathsList.Remove(str); } return(ret); }
public static List <ToolStripItem> CreateRecentFilesItems() { List <ToolStripItem> list = new List <ToolStripItem>(); List <string> list2 = new List <string>(); if (QTUtility.ExecutedPathsList.Count > 0) { for (int i = QTUtility.ExecutedPathsList.Count - 1; i >= 0; i--) { string path = QTUtility.ExecutedPathsList[i]; if (path.StartsWith(@"\\") || File.Exists(path)) { bool flag; QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path), out flag), MenuGenre.RecentFile); item.Path = item.ToolTipText = path; item.SetImageReservationKey(path, Path.GetExtension(path)); list.Add(item); } else { list2.Add(path); } } } foreach (string str2 in list2) { QTUtility.ExecutedPathsList.Remove(str2); } return(list); }
private void DeleteFiles(bool fShiftKey) { List <string> lstPaths = new List <string>(); DropDownMenuDropTarget root = GetRoot(this); if (root != null) { GetCheckedItem(root, lstPaths, false, false); if (lstPaths.Count == 0) { foreach (ToolStripItem item in this.DisplayedItems) { if (item.Selected) { QMenuItem item2 = item as QMenuItem; if ((item2 != null) && !string.IsNullOrEmpty(item2.Path)) { lstPaths.Add(item2.Path); } break; } } } ShellMethods.DeleteFile(lstPaths, fShiftKey, this.hwndDialogParent); if (!QTUtility.IsVista) { root.Close(ToolStripDropDownCloseReason.ItemClicked); } } }
private void CopyCutFiles(bool fCut) { List <string> lstPaths = new List <string>(); DropDownMenuDropTarget root = GetRoot(this); if (root != null) { GetCheckedItem(root, lstPaths, fCut, true); if (lstPaths.Count == 0) { foreach (ToolStripItem item in this.DisplayedItems) { if (item.Selected) { QMenuItem item2 = item as QMenuItem; if ((item2 != null) && !string.IsNullOrEmpty(item2.Path)) { item2.IsCut = fCut; lstPaths.Add(item2.Path); } break; } } } if (ShellMethods.SetClipboardFileDropPaths(lstPaths, fCut, this.hwndDialogParent)) { fContainsFileDropList = true; } } }
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) { ToolStripMenuItem item = e.Item as ToolStripMenuItem; if ((item != null) && item.Checked) { Rectangle imageRectangle = e.ImageRectangle; imageRectangle.Inflate(1, 1); using (SolidBrush brush = new SolidBrush(Color.FromArgb(0x80, SystemColors.Highlight))) { e.Graphics.FillRectangle(brush, imageRectangle); e.Graphics.DrawRectangle(SystemPens.Highlight, imageRectangle); } } QMenuItem item2 = e.Item as QMenuItem; if (((item2 != null) && item2.IsCut) && ((e.ImageRectangle != Rectangle.Empty) && (e.Image != null))) { ColorMatrix newColorMatrix = new ColorMatrix(); using (ImageAttributes attributes = new ImageAttributes()) { newColorMatrix.Matrix33 = 0.5f; attributes.SetColorMatrix(newColorMatrix); Size size = e.Image.Size; e.Graphics.DrawImage(e.Image, e.ImageRectangle, 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, attributes); return; } } base.OnRenderItemImage(e); }
private static void GetCheckedItem(DropDownMenuDropTarget ddmdtRoot, List <string> lstPaths, bool fCut, bool fSetCut) { foreach (ToolStripItem item in ddmdtRoot.Items) { QMenuItem item2 = item as QMenuItem; if (item2 != null) { if (item2.Checked) { if (!string.IsNullOrEmpty(item2.Path)) { lstPaths.Add(item2.Path); if (fSetCut) { item2.IsCut = fCut; } } else if (fSetCut) { item2.IsCut = false; } continue; } if (fSetCut) { item2.IsCut = false; } if (item2.HasDropDownItems) { GetCheckedItem((DropDownMenuDropTarget)item2.DropDown, lstPaths, fCut, fSetCut); } } } }
// 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); } }
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); }
protected override void OnItemRemoved(ToolStripItemEventArgs e) { QMenuItem qmi = e.Item as QMenuItem; if (IsQmiResponds(qmi)) { lstQMIResponds.Remove(qmi); } base.OnItemRemoved(e); }
protected override void OnItemAdded(ToolStripItemEventArgs e) { QMenuItem qmi = e.Item as QMenuItem; if (IsQmiResponds(qmi)) { this.lstQMIResponds.Add(qmi); } base.OnItemAdded(e); }
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); } } }
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); } }
private static void virtualDirectory_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { QMenuItem clickedItem = e.ClickedItem as QMenuItem; if (clickedItem == null || clickedItem.Target != MenuTarget.File) { return; } MenuItemArguments mia = clickedItem.MenuItemArguments; AppsManager.Execute(mia.App, mia.ShellBrowser); }
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e) { switch(e.KeyCode) { case Keys.Prior: case Keys.Next: HandlePageKeys(e.KeyCode); e.IsInputKey = true; return; case Keys.End: case Keys.Home: if(fVirtualMode) { ScrollEndVirtual(e.KeyCode == Keys.Home); } goto Label_014F; case Keys.Right: if(!(OwnerItem is ToolStripDropDownButton)) { foreach(ToolStripItem item in Items) { if(item.Selected) { if((item is ToolStripMenuItem) && !((ToolStripMenuItem)item).HasDropDownItems) { e.IsInputKey = true; } break; } } } goto Label_014F; case Keys.Return: if(!fCancelClosingAncestors) { foreach(ToolStripItem item2 in Items) { if(item2.Selected) { QMenuItem item3 = item2 as QMenuItem; if((item3 != null) && item3.HasDropDownItems) { e.IsInputKey = true; item2.PerformClick(); } break; } } goto Label_014F; } e.IsInputKey = true; break; default: goto Label_014F; } return; Label_014F: base.OnPreviewKeyDown(e); }
private static void virtualDirectory_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { QMenuItem clickedItem = e.ClickedItem as QMenuItem; if ((clickedItem != null) && (clickedItem.Target == MenuTarget.File)) { if (!clickedItem.MenuItemArguments.TokenReplaced) { AppLauncher.ReplaceAllTokens(clickedItem.MenuItemArguments, string.Empty); } AppLauncher.Execute(clickedItem.MenuItemArguments, IntPtr.Zero); } }
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); }
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); }
public static QMenuItem CreateMenuItem(MenuItemArguments mia) { QMenuItem item = new QMenuItem(QTUtility2.MakePathDisplayText(mia.Path, false), mia); if (((mia.Genre == MenuGenre.Navigation) && mia.IsBack) && (mia.Index == 0)) { item.ImageKey = "current"; } else { item.SetImageReservationKey(mia.Path, null); } item.ToolTipText = QTUtility2.MakePathDisplayText(mia.Path, true); return(item); }
private void CloseAllDropDown() { foreach (ToolStripItem item in this.DisplayedItems) { QMenuItem item2 = item as QMenuItem; if ((item2 != null) && item2.Selected) { if (item2.HasDropDownItems && item2.DropDown.Visible) { item2.HideDropDown(); } this.miUnselect.Invoke(item2, null); break; } } }
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) { QMenuItem item = e.Item as QMenuItem; if (((item != null) && item.IsCut) && ((e.ImageRectangle != Rectangle.Empty) && (e.Image != null))) { ColorMatrix newColorMatrix = new ColorMatrix(); using (ImageAttributes attributes = new ImageAttributes()) { newColorMatrix.Matrix33 = 0.5f; attributes.SetColorMatrix(newColorMatrix); Size size = e.Image.Size; e.Graphics.DrawImage(e.Image, e.ImageRectangle, 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, attributes); return; } } base.OnRenderItemImage(e); }
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); }
// 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); }
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; } }
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(); } } }
private static void qmi_File_MouseMove(object sender, MouseEventArgs e) { if (QTUtility.CheckConfig(Settings.ShowTooltips)) { QMenuItem item = (QMenuItem)sender; if ((item.ToolTipText == null) && !string.IsNullOrEmpty(item.Path)) { string str = item.Path.StartsWith("::") ? item.Text : Path.GetFileName(item.Path); string shellInfoTipText = ShellMethods.GetShellInfoTipText(item.Path, false); if (shellInfoTipText != null) { if (str == null) { str = shellInfoTipText; } else { str = str + "\r\n" + shellInfoTipText; } } item.ToolTipText = str; } } }
private static void qmi_File_MouseMove(object sender, MouseEventArgs e) { QMenuItem item = (QMenuItem)sender; if (item.ToolTipText != null || string.IsNullOrEmpty(item.Path)) { return; } string str = item.Path.StartsWith("::") ? item.Text : Path.GetFileName(item.Path); string shellInfoTipText = ShellMethods.GetShellInfoTipText(item.Path, false); if (shellInfoTipText != null) { if (str == null) { str = shellInfoTipText; } else { str = str + "\r\n" + shellInfoTipText; } } item.ToolTipText = str; }
private void CopyFileNames(bool fPath) { List <string> lstPaths = new List <string>(); DropDownMenuDropTarget root = GetRoot(this); if (root != null) { GetCheckedItem(root, lstPaths, false, true); } if (lstPaths.Count == 0) { foreach (ToolStripItem item in this.DisplayedItems) { if (!item.Selected) { continue; } QMenuItem item2 = item as QMenuItem; if ((item2 != null) && !string.IsNullOrEmpty(item2.Path)) { string path = item2.Path; if (!fPath) { try { path = System.IO.Path.GetFileName(path); } catch { } } if (!string.IsNullOrEmpty(path)) { QTTabBarClass.SetStringClipboard(path); fContainsFileDropList = false; this.itemKeyInsertionMarkPrev = null; base.Invalidate(); } } break; } } else { string str = string.Empty; foreach (string str3 in lstPaths) { if (fPath) { str = str + str3 + Environment.NewLine; } else { try { str = str + System.IO.Path.GetFileName(str3) + Environment.NewLine; continue; } catch { continue; } } } if (str.Length > 0) { QTTabBarClass.SetStringClipboard(str); fContainsFileDropList = false; this.itemKeyInsertionMarkPrev = null; base.Invalidate(); } } }
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; }
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; }
private static bool IsQmiResponds(QMenuItem qmi) { return ((((qmi != null) && (qmi.Genre != MenuGenre.Application)) && (qmi.Genre != MenuGenre.RecentFile)) && (qmi.Target != MenuTarget.File)); }
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; } }
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; }
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; } }
public static List<ToolStripItem> CreateRecentFilesItems() { List<ToolStripItem> list = new List<ToolStripItem>(); List<string> list2 = new List<string>(); if(QTUtility.ExecutedPathsList.Count > 0) { for(int i = QTUtility.ExecutedPathsList.Count - 1; i >= 0; i--) { string path = QTUtility.ExecutedPathsList[i]; if(QTUtility2.IsNetworkPath(path) || File.Exists(path)) { bool flag; QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path), out flag), MenuGenre.RecentFile); item.Path = item.ToolTipText = path; item.SetImageReservationKey(path, Path.GetExtension(path)); list.Add(item); } else { list2.Add(path); } } } foreach(string str2 in list2) { QTUtility.ExecutedPathsList.Remove(str2); } return list; }
private void OnDesktopDblClicked(Point popUpPoint) { if(++iMainMenuShownCount > 0x40) { ClearThumbnailCache(); } contextMenu.SuspendLayout(); ddmrGroups.SuspendLayout(); ddmrHistory.SuspendLayout(); ddmrUserapps.SuspendLayout(); ddmrRecentFile.SuspendLayout(); if(fRequiredRefresh_MenuItems) { ClearMenuItems(); } RecreateUndoClosedItems(); if(contextMenu.Items.Count == 0) { string[] strArray = QTUtility.TextResourcesDic["TaskBar_Titles"]; labelGroupTitle.Text = groupsMenuItem.Text = strArray[0]; historyMenuItem.Text = labelHistoryTitle.Text = strArray[1]; userAppsMenuItem.Text = labelUserAppTitle.Text = strArray[2]; recentFileMenuItem.Text = labelRecentFileTitle.Text = strArray[3]; if((ConfigValues[2] & 0x80) == 0) { QTUtility.RefreshGroupsDic(); foreach(string str in QTUtility.GroupPathsDic.Keys) { string str2 = QTUtility.GroupPathsDic[str]; if(str2.Length == 0) { ToolStripSeparator separator = new ToolStripSeparator(); separator.Name = "groupSep"; GroupItemsList.Add(separator); continue; } string path = str2.Split(QTUtility.SEPARATOR_CHAR)[0]; QMenuItem item = new QMenuItem(str, MenuGenre.Group); item.SetImageReservationKey(path, null); if(QTUtility.StartUpGroupList.Contains(str)) { if(QTUtility.StartUpTabFont == null) { QTUtility.StartUpTabFont = new Font(item.Font, FontStyle.Underline); } item.Font = QTUtility.StartUpTabFont; } GroupItemsList.Add(item); } } if((ConfigValues[2] & 0x20) == 0) { UserappItemsList = MenuUtility.CreateAppLauncherItems(Handle, (ConfigValues[1] & 2) == 0, dropDownMenues_ItemRightClicked, subMenuItems_DoubleClick, true); } bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; for(int i = 0; i < 3; i++) { switch(Order_Root[i]) { case 0: if(!flag) { AddMenuItems_Group(); flag = true; } break; case 1: if(!flag2) { AddMenuItems_History(); flag2 = true; } break; case 2: if(!flag3) { AddMenuItems_UserApp(); flag3 = true; } break; case 3: if(!flag4) { AddMenuItems_Recent(); flag4 = true; } break; } } if(!flag) { AddMenuItems_Group(); } if(!flag2) { AddMenuItems_History(); } if(!flag3) { AddMenuItems_UserApp(); } if(!flag4) { AddMenuItems_Recent(); } } else { InsertMenuItems_History(); InsertMenuItems_Recent(); } ddmrUserapps.ResumeLayout(); ddmrHistory.ResumeLayout(); ddmrGroups.ResumeLayout(); ddmrRecentFile.ResumeLayout(); contextMenu.ResumeLayout(); if(contextMenu.Items.Count > 0) { if(!QTUtility.IsXP) { contextMenu.SendToBack(); } contextMenu.Show(popUpPoint); } }
public static QMenuItem CreateMenuItem(MenuItemArguments mia) { QMenuItem item = new QMenuItem(QTUtility2.MakePathDisplayText(mia.Path, false), mia); if(((mia.Genre == MenuGenre.Navigation) && mia.IsBack) && (mia.Index == 0)) { item.ImageKey = "current"; } else { item.SetImageReservationKey(mia.Path, null); } item.ToolTipText = QTUtility2.MakePathDisplayText(mia.Path, true); return item; }
private void dropTargetWrapper_DragFileOver(object sender, DragEventArgs e) { int iSourceState = -1; Point point = base.PointToClient(new Point(e.X, e.Y)); ToolStripItem itemAt = base.GetItemAt(point); bool flag = false; if (itemAt != null) { Rectangle bounds = itemAt.Bounds; bool flag2 = (bounds.Bottom - point.Y) >= (point.Y - bounds.Top); flag = this.fTop != flag2; this.fTop = flag2; } bool flag3 = ((this.fTop && (this.iItemDragOverRegion != 0)) || (!this.fTop && (this.iItemDragOverRegion != 1))) && (itemAt == this.Items[this.Items.Count - 1]); if ((itemAt != this.itemHover) || flag3) { if (itemAt != null) { this.iItemDragOverRegion = this.fTop ? 0 : 1; QMenuItem item2 = itemAt as QMenuItem; if (item2 != null) { bool flag4 = item2 is SubDirTipForm.ToolStripMenuItemEx; if ((flag3 && !this.fTop) && Directory.Exists(base.Path)) { this.fDrawDropTarget = false; this.strTargetPath = base.Path; iSourceState = this.MakeDragOverRetval(); if ((!flag4 && item2.HasDropDownItems) && !item2.DropDown.Visible) { this.OnMouseLeave(EventArgs.Empty); this.OnMouseMove(new MouseEventArgs(Control.MouseButtons, 0, point.X, point.Y, 0)); } } else if (flag4) { bool flag5; if (PathIsExecutable(item2.Path, out flag5)) { this.fDrawDropTarget = true; if (flag5) { iSourceState = -1; this.CloseAllDropDown(); } else { this.strTargetPath = item2.Path; item2.Select(); iSourceState = 2; } } else { this.fDrawDropTarget = false; if (Directory.Exists(base.Path)) { this.strTargetPath = base.Path; iSourceState = this.MakeDragOverRetval(); } this.CloseAllDropDown(); } } else if (Directory.Exists(item2.TargetPath)) { this.fDrawDropTarget = true; this.strTargetPath = item2.TargetPath; iSourceState = this.MakeDragOverRetval(); this.OnMouseLeave(EventArgs.Empty); this.OnMouseMove(new MouseEventArgs(Control.MouseButtons, 0, point.X, point.Y, 0)); } } } flag = true; } else { iSourceState = this.iDDRetval; } if (itemAt != null) { this.BeginScrollTimer(itemAt, point); } this.itemHover = itemAt; this.iDDRetval = iSourceState; if (flag) { base.Invalidate(); } if (iSourceState == -1) { this.strTargetPath = null; e.Effect = DragDropEffects.None; } else if (this.fDrivesContained) { e.Effect = DragDropEffects.Link; } else if (iSourceState == 2) { e.Effect = DragDropEffects.Copy; } else { e.Effect = DropTargetWrapper.MakeEffect(e.KeyState, iSourceState); } }
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e) { if (!fRespondModKeys) { base.OnPreviewKeyDown(e); return; } if (((fEnableShiftKey && e.Shift) || (e.Control || fChangeImageSelected)) && ((e.KeyCode == Keys.Down) || (e.KeyCode == Keys.Up))) { SuspendLayout(); try { int index; ToolStripItem item = Items.Cast <ToolStripItem>().FirstOrDefault(item2 => item2.Selected); if (item != null) { QMenuItem item3 = item as QMenuItem; if (item3 != null) { if ((item3.Genre == MenuGenre.Application) || (item3.Genre == MenuGenre.RecentFile)) { base.OnPreviewKeyDown(e); return; } item3.RestoreOriginalImage(); } index = Items.IndexOf(item); } else if (e.KeyCode == Keys.Down) { index = Items.Count - 1; } else { index = 0; } if (index != -1) { int num2; if (e.KeyCode == Keys.Down) { if (index == (Items.Count - 1)) { num2 = 0; } else { num2 = index + 1; } for (int i = 0; (Items[num2] is ToolStripSeparator) && (i < Items.Count); i++) { if (num2 == (Items.Count - 1)) { num2 = 0; } else { num2++; } } } else { if (index == 0) { num2 = Items.Count - 1; } else { num2 = index - 1; } for (int j = 0; (Items[num2] is ToolStripSeparator) && (j < Items.Count); j++) { if (num2 == 0) { num2 = Items.Count - 1; } else { num2--; } } } if (Items[num2].Enabled) { QMenuItem item4 = Items[num2] as QMenuItem; if (((item4 != null) && (item4.Genre != MenuGenre.Application)) && (item4.Target == MenuTarget.Folder)) { switch (ModifierKeys) { case Keys.Control: item4.ImageKey = "control"; goto Label_0254; case Keys.Shift: item4.ImageKey = "shift"; goto Label_0254; } item4.RestoreOriginalImage(false, item4.Genre == MenuGenre.Navigation); } } } } finally { ResumeLayout(false); } } Label_0254: base.OnPreviewKeyDown(e); }
private void PasteFiles() { string path = null; if (this.fKeyTargetIsThis) { path = base.Path; } else { foreach (ToolStripItem item in this.DisplayedItems) { if (!item.Selected) { continue; } QMenuItem item2 = item as QMenuItem; if (item2 != null) { if (item2 is SubDirTipForm.ToolStripMenuItemEx) { bool flag2; if (PathIsExecutable(item2.Path, out flag2) && !flag2) { StringCollection fileDropList = Clipboard.GetFileDropList(); if ((fileDropList != null) && (fileDropList.Count > 0)) { string str2 = string.Empty; foreach (string str3 in fileDropList) { str2 = str2 + "\"" + str3 + "\" "; } str2 = str2.Trim(); if (str2.Length > 0) { MenuItemArguments mia = new MenuItemArguments(item2.Path, MenuTarget.File, MenuGenre.Application); mia.Argument = str2; AppLauncher.Execute(mia, this.fIsRootMenu ? base.Handle : IntPtr.Zero); } } return; } } else if (Directory.Exists(item2.TargetPath)) { path = item2.TargetPath; } } break; } } if (!string.IsNullOrEmpty(path)) { ShellMethods.PasteFile(path, this.hwndDialogParent); if (!QTUtility.IsVista) { DropDownMenuDropTarget root = GetRoot(this); if (root != null) { root.Close(ToolStripDropDownCloseReason.ItemClicked); } } } }
protected override void WndProc(ref Message m) { try { QMenuItem ownerItem; if (!fRespondModKeys) { base.WndProc(ref m); return; } int wParam = (int)((long)m.WParam); switch (m.Msg) { case WM.KEYDOWN: break; case WM.KEYUP: if (fOnceKeyDown && ((wParam == 0x10) || (wParam == 0x11))) { bool flag2 = false; foreach (QMenuItem item4 in lstQMIResponds.Where(item4 => item4.Selected)) { if (item4.Enabled) { Keys modifierKeys = ModifierKeys; if (modifierKeys == Keys.Control) { item4.ImageKey = "control"; } else if (fEnableShiftKey && (modifierKeys == Keys.Shift)) { item4.ImageKey = "shift"; } else { item4.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = item4; } flag2 = true; break; } ownerItem = OwnerItem as QMenuItem; if (ownerItem != null) { DropDownMenuBase owner = ownerItem.Owner as DropDownMenuBase; if ((owner != null) && owner.Visible) { if (flag2) { PInvoke.SendMessage(owner.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero); } else { QTUtility2.SendCOPYDATASTRUCT(owner.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1); } } } } goto Label_07C2; case WM.MOUSEMOVE: goto Label_0562; case WM.MOUSELEAVE: goto Label_072E; case WM.PAINT: if (fSuspendPainting) { PInvoke.ValidateRect(m.HWnd, IntPtr.Zero); } else { base.WndProc(ref m); } return; case WM.COPYDATA: { COPYDATASTRUCT copydatastruct = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT)); ownerItem = GetItemAt(PointToClient(MousePosition)) as QMenuItem; if (!(copydatastruct.dwData == IntPtr.Zero)) { goto Label_04B6; } if (ownerItem == null) { goto Label_0462; } Keys keys3 = ModifierKeys; if ((wParam == 0x11) && ((keys3 & Keys.Shift) != Keys.Shift)) { ownerItem.ImageKey = "control"; } else if ((fEnableShiftKey && (wParam == 0x10)) && ((keys3 & Keys.Control) != Keys.Control)) { ownerItem.ImageKey = "shift"; } else { ownerItem.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = ownerItem; goto Label_07C2; } default: goto Label_07C2; } fOnceKeyDown = true; if ((((int)((long)m.LParam)) & 0x40000000) == 0) { if ((wParam == 0x10) || (wParam == 0x11)) { bool flag = false; foreach (QMenuItem item2 in lstQMIResponds.Where(item2 => item2.Selected)) { if (item2.Enabled) { Keys keys = ModifierKeys; if ((wParam == 0x11) && ((keys & Keys.Shift) != Keys.Shift)) { item2.ImageKey = "control"; } else if ((fEnableShiftKey && (wParam == 0x10)) && ((keys & Keys.Control) != Keys.Control)) { item2.ImageKey = "shift"; } else { item2.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = item2; } flag = true; break; } ownerItem = OwnerItem as QMenuItem; if (ownerItem != null) { DropDownMenuBase base2 = ownerItem.Owner as DropDownMenuBase; if ((base2 != null) && base2.Visible) { if (flag) { PInvoke.SendMessage(base2.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero); } else { QTUtility2.SendCOPYDATASTRUCT(base2.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero); } } } } else if ((wParam == 13) && ((fEnableShiftKey && (ModifierKeys == Keys.Shift)) || (ModifierKeys == Keys.Control))) { foreach (ToolStripItem item3 in Items) { if (item3.Selected) { if (item3.Enabled) { OnItemClicked(new ToolStripItemClickedEventArgs(item3)); } break; } } } } goto Label_07C2; Label_0462: ownerItem = OwnerItem as QMenuItem; if (ownerItem != null) { DropDownMenuBase base4 = ownerItem.Owner as DropDownMenuBase; if ((base4 != null) && base4.Visible) { QTUtility2.SendCOPYDATASTRUCT(base4.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero); } } goto Label_07C2; Label_04B6: if (ownerItem != null) { Keys keys4 = ModifierKeys; if (keys4 == Keys.Control) { ownerItem.ImageKey = "control"; } else if (fEnableShiftKey && (keys4 == Keys.Shift)) { ownerItem.ImageKey = "shift"; } else { ownerItem.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = ownerItem; } else { ownerItem = OwnerItem as QMenuItem; if (ownerItem != null) { DropDownMenuBase base5 = ownerItem.Owner as DropDownMenuBase; if ((base5 != null) && base5.Visible) { QTUtility2.SendCOPYDATASTRUCT(base5.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1); } } } goto Label_07C2; Label_0562: if ((m.WParam == IntPtr.Zero) && (m.LParam == lparamPreviousMouseMove)) { m.Result = IntPtr.Zero; return; } lparamPreviousMouseMove = m.LParam; if ((!fEnableShiftKey || ((wParam & 4) != 4)) && (((wParam & 8) != 8) && !fChangeImageSelected)) { goto Label_07C2; } ToolStripItem itemAt = GetItemAt(QTUtility2.PointFromLPARAM(m.LParam)); if (itemAt == null) { base.WndProc(ref m); return; } ownerItem = itemAt as QMenuItem; if (!IsQmiResponds(ownerItem)) { goto Label_06F8; } if (ownerItem == lastMouseActiveItem) { goto Label_07C2; } if (lstQMIResponds.Count > 0x1c) { fSuspendPainting = true; } SuspendLayout(); if (ownerItem.Enabled) { switch (wParam) { case 8: ownerItem.ImageKey = "control"; goto Label_06AB; case 4: ownerItem.ImageKey = "shift"; goto Label_06AB; } if (((ownerItem.Genre == MenuGenre.Navigation) && (ownerItem.MenuItemArguments != null)) && (!ownerItem.MenuItemArguments.IsBack || (ownerItem.MenuItemArguments.Index != 0))) { ownerItem.ImageKey = ownerItem.MenuItemArguments.IsBack ? "back" : "forward"; } else { ownerItem.RestoreOriginalImage(); } } Label_06AB: if (lastMouseActiveItem != null) { lastMouseActiveItem.RestoreOriginalImage(); } if ((ownerItem != lastKeyImageChangedItem) && (lastKeyImageChangedItem != null)) { lastKeyImageChangedItem.RestoreOriginalImage(); lastKeyImageChangedItem = null; } lastMouseActiveItem = ownerItem; fSuspendPainting = false; ResumeLayout(false); goto Label_07C2; Label_06F8: if (lastMouseActiveItem != null) { lastMouseActiveItem.RestoreOriginalImage(); lastMouseActiveItem = null; } if (lastKeyImageChangedItem != null) { lastKeyImageChangedItem.RestoreOriginalImage(); lastKeyImageChangedItem = null; } goto Label_07C2; Label_072E: ResetImageKeys(); lastMouseActiveItem = null; } catch (Exception exception) { QTUtility2.MakeErrorLog(exception, "MSG:" + m.Msg.ToString("X") + ", WPARAM:" + m.WParam.ToString("X") + ", LPARAM:" + m.LParam.ToString("X")); } Label_07C2: base.WndProc(ref m); fSuspendPainting = false; }
// todo: check vs quizo's public static List<ToolStripItem> CreateRecentFilesItems() { List<ToolStripItem> ret = new List<ToolStripItem>(); List<string> toRemove = new List<string>(); if(StaticReg.ExecutedPathsList.Count > 0) { foreach(string path in StaticReg.ExecutedPathsList.Reverse()) { if(QTUtility2.IsNetworkPath(path) || File.Exists(path)) { QMenuItem item = new QMenuItem(QTUtility2.MakeNameEllipsis(Path.GetFileName(path)), MenuGenre.RecentFile); item.Path = item.ToolTipText = path; item.SetImageReservationKey(path, Path.GetExtension(path)); ret.Add(item); } else { toRemove.Add(path); } } } foreach(string str in toRemove) { StaticReg.ExecutedPathsList.Remove(str); } return ret; }
protected override void WndProc(ref Message m) { try { QMenuItem ownerItem; if(!fRespondModKeys) { base.WndProc(ref m); return; } int wParam = (int)((long)m.WParam); switch(m.Msg) { case WM.KEYDOWN: break; case WM.KEYUP: if(fOnceKeyDown && ((wParam == 0x10) || (wParam == 0x11))) { bool flag2 = false; foreach(QMenuItem item4 in lstQMIResponds.Where(item4 => item4.Selected)) { if(item4.Enabled) { Keys modifierKeys = ModifierKeys; if(modifierKeys == Keys.Control) { item4.ImageKey = "control"; } else if(fEnableShiftKey && (modifierKeys == Keys.Shift)) { item4.ImageKey = "shift"; } else { item4.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = item4; } flag2 = true; break; } ownerItem = OwnerItem as QMenuItem; if(ownerItem != null) { DropDownMenuBase owner = ownerItem.Owner as DropDownMenuBase; if((owner != null) && owner.Visible) { if(flag2) { PInvoke.SendMessage(owner.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero); } else { QTUtility2.SendCOPYDATASTRUCT(owner.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1); } } } } goto Label_07C2; case WM.MOUSEMOVE: goto Label_0562; case WM.MOUSELEAVE: goto Label_072E; case WM.PAINT: if(fSuspendPainting) { PInvoke.ValidateRect(m.HWnd, IntPtr.Zero); } else { base.WndProc(ref m); } return; case WM.COPYDATA: { COPYDATASTRUCT copydatastruct = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT)); ownerItem = GetItemAt(PointToClient(MousePosition)) as QMenuItem; if(!(copydatastruct.dwData == IntPtr.Zero)) { goto Label_04B6; } if(ownerItem == null) { goto Label_0462; } Keys keys3 = ModifierKeys; if((wParam == 0x11) && ((keys3 & Keys.Shift) != Keys.Shift)) { ownerItem.ImageKey = "control"; } else if((fEnableShiftKey && (wParam == 0x10)) && ((keys3 & Keys.Control) != Keys.Control)) { ownerItem.ImageKey = "shift"; } else { ownerItem.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = ownerItem; goto Label_07C2; } default: goto Label_07C2; } fOnceKeyDown = true; if((((int)((long)m.LParam)) & 0x40000000) == 0) { if((wParam == 0x10) || (wParam == 0x11)) { bool flag = false; foreach(QMenuItem item2 in lstQMIResponds.Where(item2 => item2.Selected)) { if(item2.Enabled) { Keys keys = ModifierKeys; if((wParam == 0x11) && ((keys & Keys.Shift) != Keys.Shift)) { item2.ImageKey = "control"; } else if((fEnableShiftKey && (wParam == 0x10)) && ((keys & Keys.Control) != Keys.Control)) { item2.ImageKey = "shift"; } else { item2.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = item2; } flag = true; break; } ownerItem = OwnerItem as QMenuItem; if(ownerItem != null) { DropDownMenuBase base2 = ownerItem.Owner as DropDownMenuBase; if((base2 != null) && base2.Visible) { if(flag) { PInvoke.SendMessage(base2.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero); } else { QTUtility2.SendCOPYDATASTRUCT(base2.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero); } } } } else if((wParam == 13) && ((fEnableShiftKey && (ModifierKeys == Keys.Shift)) || (ModifierKeys == Keys.Control))) { foreach(ToolStripItem item3 in Items) { if(item3.Selected) { if(item3.Enabled) { OnItemClicked(new ToolStripItemClickedEventArgs(item3)); } break; } } } } goto Label_07C2; Label_0462: ownerItem = OwnerItem as QMenuItem; if(ownerItem != null) { DropDownMenuBase base4 = ownerItem.Owner as DropDownMenuBase; if((base4 != null) && base4.Visible) { QTUtility2.SendCOPYDATASTRUCT(base4.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero); } } goto Label_07C2; Label_04B6: if(ownerItem != null) { Keys keys4 = ModifierKeys; if(keys4 == Keys.Control) { ownerItem.ImageKey = "control"; } else if(fEnableShiftKey && (keys4 == Keys.Shift)) { ownerItem.ImageKey = "shift"; } else { ownerItem.RestoreOriginalImage(fChangeImageSelected, false); } lastKeyImageChangedItem = ownerItem; } else { ownerItem = OwnerItem as QMenuItem; if(ownerItem != null) { DropDownMenuBase base5 = ownerItem.Owner as DropDownMenuBase; if((base5 != null) && base5.Visible) { QTUtility2.SendCOPYDATASTRUCT(base5.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1); } } } goto Label_07C2; Label_0562: if((m.WParam == IntPtr.Zero) && (m.LParam == lparamPreviousMouseMove)) { m.Result = IntPtr.Zero; return; } lparamPreviousMouseMove = m.LParam; if((!fEnableShiftKey || ((wParam & 4) != 4)) && (((wParam & 8) != 8) && !fChangeImageSelected)) { goto Label_07C2; } ToolStripItem itemAt = GetItemAt(QTUtility2.PointFromLPARAM(m.LParam)); if(itemAt == null) { base.WndProc(ref m); return; } ownerItem = itemAt as QMenuItem; if(!IsQmiResponds(ownerItem)) { goto Label_06F8; } if(ownerItem == lastMouseActiveItem) { goto Label_07C2; } if(lstQMIResponds.Count > 0x1c) { fSuspendPainting = true; } SuspendLayout(); if(ownerItem.Enabled) { switch(wParam) { case 8: ownerItem.ImageKey = "control"; goto Label_06AB; case 4: ownerItem.ImageKey = "shift"; goto Label_06AB; } if(((ownerItem.Genre == MenuGenre.Navigation) && (ownerItem.MenuItemArguments != null)) && (!ownerItem.MenuItemArguments.IsBack || (ownerItem.MenuItemArguments.Index != 0))) { ownerItem.ImageKey = ownerItem.MenuItemArguments.IsBack ? "back" : "forward"; } else { ownerItem.RestoreOriginalImage(); } } Label_06AB: if(lastMouseActiveItem != null) { lastMouseActiveItem.RestoreOriginalImage(); } if((ownerItem != lastKeyImageChangedItem) && (lastKeyImageChangedItem != null)) { lastKeyImageChangedItem.RestoreOriginalImage(); lastKeyImageChangedItem = null; } lastMouseActiveItem = ownerItem; fSuspendPainting = false; ResumeLayout(false); goto Label_07C2; Label_06F8: if(lastMouseActiveItem != null) { lastMouseActiveItem.RestoreOriginalImage(); lastMouseActiveItem = null; } if(lastKeyImageChangedItem != null) { lastKeyImageChangedItem.RestoreOriginalImage(); lastKeyImageChangedItem = null; } goto Label_07C2; Label_072E: ResetImageKeys(); lastMouseActiveItem = null; } catch(Exception exception) { QTUtility2.MakeErrorLog(exception, "MSG:" + m.Msg.ToString("X") + ", WPARAM:" + m.WParam.ToString("X") + ", LPARAM:" + m.LParam.ToString("X")); } Label_07C2: base.WndProc(ref m); fSuspendPainting = false; }