public static void ReplaceAllTokens(MenuItemArguments mia, string strCurrentPath) { AppLauncher launcher = new AppLauncher(null, strCurrentPath); launcher.ReplaceTokens_WorkingDir(mia); launcher.ReplaceTokens_Arguments(mia); }
private void ReplaceTokens(IEnumerable lstItems, AppLauncher al, bool fInitialize) { foreach(ToolStripItem item in lstItems) { QMenuItem item2 = item as QMenuItem; if(item2 != null) { MenuItemArguments menuItemArguments = item2.MenuItemArguments; if(menuItemArguments != null) { if(menuItemArguments.Target == MenuTarget.File) { string name = item.Name; if(al.ReplaceTokens_WorkingDir(menuItemArguments)) { name = name + "*"; } int num = al.ReplaceTokens_Arguments(menuItemArguments); if(num > 0) { if((num == 1) && (al.iSelItemsCount == 1)) { name = name + " - " + Path.GetFileName(al.strSelObjs.Trim(new char[] { '"' })); } else if((num == 2) && (al.iSelFileCount == 1)) { name = name + " - " + Path.GetFileName(al.strSelFiles.Trim(new char[] { '"' })); } else if((num == 4) && (al.iSelDirsCount == 1)) { name = name + " - " + Path.GetFileName(al.strSelDirs.Trim(new char[] { '"' })); } else if(num == 8) { name = name + " - Current folder"; } else if(num != 10) { name = name + " - *"; } } if(fInitialize && AppLauncher.IsTokened(menuItemArguments)) { lstTokenedItems.Add(item2); } item.Text = name; continue; } if((menuItemArguments.Target == MenuTarget.VirtualFolder) && item2.HasDropDownItems) { ReplaceTokens(item2.DropDownItems, al, fInitialize); } } } } }
private bool HandleKEYDOWN(IntPtr wParam, bool fRepeat) { int key = ((int)wParam) | ((int)ModifierKeys); if(((int)wParam) == 0x10) { if(!fRepeat) { if(!QTUtility.CheckConfig(Settings.PreviewsWithShift)) { listView.HideThumbnailTooltip(); } if(!QTUtility.CheckConfig(Settings.NoShowSubDirTips) && !QTUtility.CheckConfig(Settings.SubDirTipsWithShift) && !listView.SubDirTipMenuIsShowing()) { listView.HideSubDirTip(); } } return false; } if(key == 0x71) { if(!QTUtility.CheckConfig(Settings.F2Selection)) { // TODO // QTTabBarClass.HandleF2(this.hwndListView); } return false; } key |= 0x100000; if(((key == QTUtility.ShortcutKeys[0x1b]) || (key == QTUtility.ShortcutKeys[0x1c])) || (((key == QTUtility.ShortcutKeys[0x1d]) || (key == QTUtility.ShortcutKeys[30])) || (key == QTUtility.ShortcutKeys[0x1f]))) { if(!fRepeat) { if(listView.SubDirTipMenuIsShowing()) { return false; } int index = 0; if(key == QTUtility.ShortcutKeys[0x1c]) { index = 1; } else if(key == QTUtility.ShortcutKeys[0x1d]) { index = 2; } else if(key == QTUtility.ShortcutKeys[30]) { index = 3; } else if(key == QTUtility.ShortcutKeys[0x1f]) { index = 4; } DoFileTools(index); } return true; } if(key == QTUtility.ShortcutKeys[0x26]) { if(!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if(!fRepeat) { DoFileTools(5); } return true; } } else { if(((ConfigValues[2] & 8) == 0) && QTUtility.dicUserAppShortcutKeys.ContainsKey(key)) { if(fRepeat) { goto Label_02D8; } MenuItemArguments mia = QTUtility.dicUserAppShortcutKeys[key]; try { Address[] list2 = (from wrapper in ShellBrowser.GetItems(true) where wrapper.Available && wrapper.HasPath && wrapper.IsFileSystem select wrapper.ToAddress()).ToArray(); if(list2.Length == 0) return false; AppLauncher launcher = new AppLauncher(list2, Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); launcher.ReplaceTokens_WorkingDir(mia); launcher.ReplaceTokens_Arguments(mia); AppLauncher.Execute(mia, IntPtr.Zero); return true; } catch(Exception exception) { QTUtility2.MakeErrorLog(exception); } finally { mia.RestoreOriginalArgs(); } } if(!fRepeat && QTUtility.dicGroupShortcutKeys.ContainsKey(key)) { Thread thread = new Thread(OpenGroup); thread.SetApartmentState(ApartmentState.STA); thread.IsBackground = true; thread.Start(new object[] { QTUtility.dicGroupShortcutKeys[key], Keys.None }); return true; } } Label_02D8: return false; }
private bool HandleKEYDOWN(IntPtr wParam, bool fRepeat) { int key = ((int)wParam) | ((int)Control.ModifierKeys); if(((int)wParam) == 0x10) { if(!fRepeat) { if(!QTUtility.CheckConfig(Settings.PreviewsWithShift)) { this.HideThumbnailTooltip(); } if(((!QTUtility.CheckConfig(Settings.NoShowSubDirTips) && !QTUtility.CheckConfig(Settings.SubDirTipsWithShift)) && ((this.subDirTip != null) && this.subDirTip.IsShowing)) && !this.subDirTip.MenuIsShowing) { this.HideSubDirTip(); } } return false; } if(key == 0x71) { if(!QTUtility.CheckConfig(Settings.F2Selection)) { // TODO // QTTabBarClass.HandleF2(this.hwndListView); } return false; } key |= 0x100000; if(((key == QTUtility.ShortcutKeys[0x1b]) || (key == QTUtility.ShortcutKeys[0x1c])) || (((key == QTUtility.ShortcutKeys[0x1d]) || (key == QTUtility.ShortcutKeys[30])) || (key == QTUtility.ShortcutKeys[0x1f]))) { if(!fRepeat) { if((this.subDirTip != null) && this.subDirTip.MenuIsShowing) { return false; } int index = 0; if(key == QTUtility.ShortcutKeys[0x1c]) { index = 1; } else if(key == QTUtility.ShortcutKeys[0x1d]) { index = 2; } else if(key == QTUtility.ShortcutKeys[30]) { index = 3; } else if(key == QTUtility.ShortcutKeys[0x1f]) { index = 4; } this.DoFileTools(index); } return true; } if(key == QTUtility.ShortcutKeys[0x26]) { if(!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if(!fRepeat) { this.DoFileTools(5); } return true; } } else { if(((this.ConfigValues[2] & 8) == 0) && QTUtility.dicUserAppShortcutKeys.ContainsKey(key)) { if(fRepeat) { goto Label_02D8; } MenuItemArguments mia = QTUtility.dicUserAppShortcutKeys[key]; if(this.folderView == null) { goto Label_02D8; } Guid riid = ExplorerGUIDs.IID_IEnumIDList; IEnumIDList ppv = null; try { try { int num3; List<Address> list2 = new List<Address>(); if(this.folderView.ItemCount(1, out num3) != 0) { return false; } if(((num3 != 0) && (this.folderView.Items(1, ref riid, out ppv) == 0)) && (ppv != null)) { IntPtr ptr; while(ppv.Next(1, out ptr, null) == 0) { using(IDLWrapper wrapper = new IDLWrapper(ptr)) { if((wrapper.Available && wrapper.HasPath) && wrapper.IsFileSystem) { list2.Add(new Address(ptr, wrapper.Path)); } continue; } } } AppLauncher launcher = new AppLauncher(list2.ToArray(), Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); launcher.ReplaceTokens_WorkingDir(mia); launcher.ReplaceTokens_Arguments(mia); AppLauncher.Execute(mia, IntPtr.Zero); return true; } catch(Exception exception) { QTUtility2.MakeErrorLog(exception, null); } goto Label_02D8; } finally { if(ppv != null) { Marshal.ReleaseComObject(ppv); ppv = null; } mia.RestoreOriginalArgs(); } } if(!fRepeat && QTUtility.dicGroupShortcutKeys.ContainsKey(key)) { Thread thread = new Thread(new ParameterizedThreadStart(this.OpenGroup)); thread.SetApartmentState(ApartmentState.STA); thread.IsBackground = true; thread.Start(new object[] { QTUtility.dicGroupShortcutKeys[key], Keys.None }); return true; } } Label_02D8: return false; }
private bool HandleKEYDOWN(IntPtr wParam, bool fRepeat) { Keys key = (Keys)((int)wParam); Keys mkey = (Keys)(((int)wParam) | ((int)ModifierKeys)); switch(key) { case Keys.Enter: return false; case Keys.Menu: if((!fRepeat && QTUtility.CheckConfig(Settings.ShowTabCloseButtons)) && QTUtility.CheckConfig(Settings.TabCloseBtnsWithAlt)) { tabControl1.ShowCloseButton(true); if(!QTUtility.IsXP) { return QTUtility.CheckConfig(Settings.HideMenuBar); } } return false; case Keys.ControlKey: if(!fRepeat && NowTabDragging && (DraggingTab != null) && tabControl1.GetTabMouseOn() == null) { Cursor = GetCursor(false); } break; case Keys.Tab: if(!QTUtility.CheckConfig(Settings.NoTabSwitcher) && (mkey & Keys.Control) != Keys.None) { return ShowTabSwitcher((mkey & Keys.Shift) != Keys.None, fRepeat); } break; } switch(mkey) { case Keys.Back: if(!QTUtility.IsXP) { if(listView.HasFocus()) { if(!fRepeat) { if(QTUtility.CheckConfig(Settings.BackspaceUpLevel)) { UpOneLevel(); } else { NavigateCurrentTab(true); } } return true; } } return false; case Keys.Alt | Keys.Left: NavigateCurrentTab(true); return true; case Keys.Alt | Keys.Right: NavigateCurrentTab(false); return true; case Keys.Alt | Keys.F4: if(!fRepeat) { WindowUtils.CloseExplorer(ExplorerHandle, 1); } return true; case Keys.F2: if(!QTUtility.CheckConfig(Settings.F2Selection)) { listView.HandleF2(); } return false; } if(((Keys.Control | Keys.NumPad0) <= mkey && mkey <= (Keys.Control | Keys.NumPad9)) || ((Keys.Control | Keys.D0) <= mkey && mkey <= (Keys.Control | Keys.D9))) { int num3; if(mkey >= (Keys.Control | Keys.NumPad0)) { num3 = (mkey - (Keys.Control | Keys.NumPad0)); } else { num3 = (mkey - (Keys.Control | Keys.D0)); } if(num3 == 0) { num3 = 10; } if(tabControl1.TabCount >= num3) { tabControl1.SelectTab((num3 - 1)); } return true; } int imkey = (int)mkey | 0x100000; if(imkey == QTUtility.ShortcutKeys[0]) { NavigateCurrentTab(true); return true; } if(imkey == QTUtility.ShortcutKeys[1]) { NavigateCurrentTab(false); return true; } if(imkey == QTUtility.ShortcutKeys[2]) { if(!fRepeat) { NavigateToFirstOrLast(true); } return true; } if(imkey == QTUtility.ShortcutKeys[3]) { if(!fRepeat) { NavigateToFirstOrLast(false); } return true; } if(imkey == QTUtility.ShortcutKeys[4]) { if(!fRepeat) { int selectedIndex = tabControl1.SelectedIndex; if(selectedIndex == (tabControl1.TabCount - 1)) { tabControl1.SelectedIndex = 0; } else { tabControl1.SelectedIndex = selectedIndex + 1; } } return true; } if(imkey == QTUtility.ShortcutKeys[5]) { if(!fRepeat) { int num5 = tabControl1.SelectedIndex; if(num5 == 0) { tabControl1.SelectedIndex = tabControl1.TabCount - 1; } else { tabControl1.SelectedIndex = num5 - 1; } } return true; } if(imkey == QTUtility.ShortcutKeys[6]) { if(!fRepeat && (tabControl1.TabCount > 0)) { tabControl1.SelectedIndex = 0; } return true; } if(imkey == QTUtility.ShortcutKeys[7]) { if(!fRepeat && (tabControl1.TabCount > 1)) { tabControl1.SelectedIndex = tabControl1.TabCount - 1; } return true; } if(imkey == QTUtility.ShortcutKeys[8]) { if(!fRepeat) { if(tabControl1.TabCount > 1) { CloseTab(CurrentTab); } else { WindowUtils.CloseExplorer(ExplorerHandle, 1); } } return true; } if(imkey == QTUtility.ShortcutKeys[9]) { if(!fRepeat && (tabControl1.TabCount > 1)) { CloseAllTabsExcept(CurrentTab); } return true; } if(imkey == QTUtility.ShortcutKeys[10]) { if(!fRepeat) { CloseLeftRight(true, -1); } return true; } if(imkey == QTUtility.ShortcutKeys[11]) { if(!fRepeat) { CloseLeftRight(false, -1); } return true; } if(imkey == QTUtility.ShortcutKeys[12]) { if(!fRepeat) { WindowUtils.CloseExplorer(ExplorerHandle, 1); } return true; } if(imkey == QTUtility.ShortcutKeys[13]) { if(!fRepeat) { RestoreLastClosed(); } return true; } if(imkey == QTUtility.ShortcutKeys[14]) { if(!fRepeat) { CloneTabButton(CurrentTab, null, true, -1); } return true; } if(imkey == QTUtility.ShortcutKeys[15]) { if(!fRepeat && (CurrentTab != null)) { using(IDLWrapper wrapper = new IDLWrapper(CurrentTab.CurrentIDL)) { OpenNewWindow(wrapper); } } return true; } if(imkey == QTUtility.ShortcutKeys[0x10]) { if(CurrentTab != null) { CurrentTab.TabLocked = !CurrentTab.TabLocked; } return true; } if(imkey != QTUtility.ShortcutKeys[0x11]) { if(imkey == QTUtility.ShortcutKeys[0x12]) { if(!fRepeat) { ChooseNewDirectory(); } return true; } if(imkey == QTUtility.ShortcutKeys[0x13]) { if(!fRepeat && (CurrentTab != null)) { CreateGroup(CurrentTab); } return true; } if(imkey == QTUtility.ShortcutKeys[20]) { if(!fRepeat) { OpenOptionsDialog(); } return true; } if(imkey == QTUtility.ShortcutKeys[0x15]) { if(!fRepeat) { Rectangle tabRect = tabControl1.GetTabRect(tabControl1.TabCount - 1, true); contextMenuSys.Show(PointToScreen(new Point(tabRect.Right + 10, tabRect.Bottom - 10))); } return true; } if(imkey == QTUtility.ShortcutKeys[0x16]) { if(!fRepeat) { int index = tabControl1.TabPages.IndexOf(CurrentTab); if(index != -1) { ContextMenuedTab = CurrentTab; Rectangle rectangle2 = tabControl1.GetTabRect(index, true); contextMenuTab.Show(PointToScreen(new Point(rectangle2.Right + 10, rectangle2.Bottom - 10))); } } return true; } if(((imkey == QTUtility.ShortcutKeys[0x17]) || (imkey == QTUtility.ShortcutKeys[0x18])) || (imkey == QTUtility.ShortcutKeys[0x19])) { if(!fRepeat) { IntPtr ptr2; int num7 = 3; if(imkey == QTUtility.ShortcutKeys[0x18]) { num7 = 4; } else if(imkey == QTUtility.ShortcutKeys[0x19]) { num7 = 5; } if(QTUtility.instanceManager.TryGetButtonBarHandle(ExplorerHandle, out ptr2)) { return (1 == ((int)QTUtility2.SendCOPYDATASTRUCT(ptr2, (IntPtr)4, "fromTab", (IntPtr)num7))); } } } else { if(imkey == QTUtility.ShortcutKeys[0x1a]) { WindowUtils.ShowMenuBar(QTUtility.CheckConfig(Settings.HideMenuBar), ReBarHandle); if(QTUtility.CheckConfig(Settings.HideMenuBar)) { QTUtility.ConfigValues[7] = (byte)(QTUtility.ConfigValues[7] & 0xf7); } else { QTUtility.ConfigValues[7] = (byte)(QTUtility.ConfigValues[7] | 8); } using(RegistryKey rkey = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) { rkey.SetValue("Config", QTUtility.ConfigValues); } return true; } if(((imkey == QTUtility.ShortcutKeys[0x1b]) || (imkey == QTUtility.ShortcutKeys[0x1c])) || (((imkey == QTUtility.ShortcutKeys[0x1d]) || (imkey == QTUtility.ShortcutKeys[30])) || (imkey == QTUtility.ShortcutKeys[0x1f]))) { if(!fRepeat) { int num8 = 0; if(imkey == QTUtility.ShortcutKeys[0x1c]) { num8 = 1; } else if(imkey == QTUtility.ShortcutKeys[0x1d]) { num8 = 2; } else if(imkey == QTUtility.ShortcutKeys[30]) { num8 = 3; } else if(imkey == QTUtility.ShortcutKeys[0x1f]) { num8 = 4; } if((num8 < 2) && ((listView.SubDirTipMenuIsShowing()) || ((subDirTip_Tab != null) && subDirTip_Tab.MenuIsShowing))) { return false; } DoFileTools(num8); } return true; } if(imkey == QTUtility.ShortcutKeys[0x20]) { ToggleTopMost(); SyncButtonBarCurrent(0x40); return true; } if((imkey == QTUtility.ShortcutKeys[0x21]) || (imkey == QTUtility.ShortcutKeys[0x22])) { int num9; int num10; byte num11; if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) { if(imkey == QTUtility.ShortcutKeys[0x21]) { return true; } PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_OR(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000)); PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, 0xff, 2); } if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num9, out num11, out num10)) { IntPtr ptr3; if(imkey == QTUtility.ShortcutKeys[0x21]) { if(num11 > 0xf3) { num11 = 0xff; } else { num11 = (byte)(num11 + 12); } } else if(num11 < 0x20) { num11 = 20; } else { num11 = (byte)(num11 - 12); } PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, num11, 2); if(QTUtility.instanceManager.TryGetButtonBarHandle(ExplorerHandle, out ptr3)) { QTUtility2.SendCOPYDATASTRUCT(ptr3, (IntPtr)7, "track", (IntPtr)num11); } if(num11 == 0xff) { PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0xfff7ffff)); } } return true; } if(imkey == QTUtility.ShortcutKeys[0x23]) { listView.SetFocus(); return true; } if(imkey == QTUtility.ShortcutKeys[0x24]) { if(!QTUtility.IsXP) { PInvoke.SetFocus(GetSearchBand_Edit()); return true; } } else if(imkey == QTUtility.ShortcutKeys[0x25]) { IntPtr ptr4; if(QTUtility.instanceManager.TryGetButtonBarHandle(ExplorerHandle, out ptr4) && PInvoke.IsWindow(ptr4)) { QTUtility2.SendCOPYDATASTRUCT(ptr4, (IntPtr)8, null, IntPtr.Zero); return true; } } else if(imkey == QTUtility.ShortcutKeys[0x26]) { if(!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if(!fRepeat) { listView.ShowAndClickSubDirTip(); } return true; } } else { if(imkey == QTUtility.ShortcutKeys[0x27]) { if(!fRepeat) { ShowTaskbarItem(ExplorerHandle, false); } return true; } if(imkey == QTUtility.ShortcutKeys[40]) { tabControl1.Focus(); tabControl1.FocusNextTab(false, true, false); return true; } if(Array.IndexOf(QTUtility.PluginShortcutKeysCache, imkey) != -1) { foreach(string str in QTUtility.dicPluginShortcutKeys.Keys) { int[] numArray = QTUtility.dicPluginShortcutKeys[str]; if(numArray != null) { for(int i = 0; i < numArray.Length; i++) { if(imkey == numArray[i]) { Plugin plugin; if(pluginManager.TryGetPlugin(str, out plugin)) { try { plugin.Instance.OnShortcutKeyPressed(i); } catch(Exception exception) { PluginManager.HandlePluginException(exception, ExplorerHandle, plugin.PluginInformation.Name, "On shortcut key pressed. Index is " + i); } return true; } return false; } } } } } else { if(!fRepeat && QTUtility.dicUserAppShortcutKeys.ContainsKey(imkey)) { MenuItemArguments mia = QTUtility.dicUserAppShortcutKeys[imkey]; try { using(IDLWrapper wrapper2 = GetCurrentPIDL()) { Address[] addressArray; string str2; if((wrapper2.Available && wrapper2.HasPath) && ShellBrowser.TryGetSelection(out addressArray, out str2, false)) { AppLauncher launcher = new AppLauncher(addressArray, wrapper2.Path); launcher.ReplaceTokens_WorkingDir(mia); launcher.ReplaceTokens_Arguments(mia); } } AppLauncher.Execute(mia, ExplorerHandle); } catch(Exception exception2) { QTUtility2.MakeErrorLog(exception2, null); } finally { mia.RestoreOriginalArgs(); } return true; } if(!fRepeat && QTUtility.dicGroupShortcutKeys.ContainsKey(imkey)) { OpenGroup(QTUtility.dicGroupShortcutKeys[imkey], false); return true; } } } } imkey -= 0x100000; return (imkey == 0x20057); } bool flag = tabControl1.TabPages.Cast<QTabItem>().All(item2 => item2.TabLocked); foreach(QTabItem item3 in tabControl1.TabPages) { item3.TabLocked = !flag; } return true; }