public void RefreshBG(bool fRebarBGCanceled) { if (fRebarBGCanceled && QTUtility.DefaultRebarCOLORREF != -1) { // Restore the default BG color PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)QTUtility.DefaultRebarCOLORREF); } else if (QTUtility.CheckConfig(Settings.ToolbarBGColor)) { // Save the default color and set the new one if (QTUtility.DefaultRebarCOLORREF == -1) { QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int c = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)c); } // Refresh the rebar IntPtr hWnd = PInvoke.GetWindowLongPtr(Handle, -8); if (hWnd != IntPtr.Zero) { PInvoke.RedrawWindow(hWnd, IntPtr.Zero, IntPtr.Zero, 0x289); } if (QTUtility.CheckConfig(Settings.RebarImage)) { CreateRebarImage(); } }
public override void RefreshSubDirTip(bool force = false) { if (!QTUtility.CheckConfig(Settings.NoShowSubDirTips) && !fDragging && Control.MouseButtons == MouseButtons.None) { if ((!QTUtility.CheckConfig(Settings.SubDirTipsWithShift) ^ (Control.ModifierKeys == Keys.Shift)) && hwndExplorer == PInvoke.GetForegroundWindow()) { int iItem = GetHotItem(); if (subDirTip != null && (subDirTip.MouseIsOnThis() || subDirTip.MenuIsShowing)) { return; } if (!force && subDirIndex == iItem && (!QTUtility.IsXP || (iItem != -1))) { return; } if (!QTUtility.IsXP) { subDirIndex = iItem; } if (iItem > -1 && ShowSubDirTip(iItem, false, false)) { if (QTUtility.IsXP) { subDirIndex = iItem; } return; } } HideSubDirTip(2); subDirIndex = -1; } }
public static List <ToolStripItem> CreateAppLauncherItems(IntPtr hwndParent, bool fReorderEnabled, ItemRightClickedEventHandler rightClickHandler, EventHandler dirDoubleClickEvent, bool fFromTaskBar) { QTUtility.RefreshUserAppDic(false); List <ToolStripItem> list = new List <ToolStripItem>(); EventPack ep = new EventPack(hwndParent, rightClickHandler, dirDoubleClickEvent, fFromTaskBar); foreach (string str in QTUtility.UserAppsDic.Keys) { string[] appVals = QTUtility.UserAppsDic[str]; if (appVals != null) { list.Add(CreateMenuItem_AppLauncher(str, appVals, ep)); } else { using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Quizo\QTTabBar\UserApps\" + str, false)) { if (key != null) { ToolStripItem item = CreateMenuItem_AppLauncher_Virtual(str, fReorderEnabled, key, ep); if (item != null) { list.Add(item); } } continue; } } } return(list); }
private void SetStyleFlags() { if (ShellBrowser.ViewMode != FVM.DETAILS) { return; } uint flags = 0; if (QTUtility.CheckConfig(Settings.DetailsGridLines)) { flags |= LVS_EX.GRIDLINES; } else { flags &= ~LVS_EX.GRIDLINES; } if (QTUtility.CheckConfig(Settings.ToggleFullRowSelect) ^ !QTUtility.IsXP) { flags |= LVS_EX.FULLROWSELECT; } else { flags &= ~LVS_EX.FULLROWSELECT; } const uint mask = LVS_EX.GRIDLINES | LVS_EX.FULLROWSELECT; PInvoke.SendMessage(Handle, LVM.SETEXTENDEDLISTVIEWSTYLE, (IntPtr)mask, (IntPtr)flags); }
protected void OnHotItemChanged(int iItem) { Keys modifierKeys = Control.ModifierKeys; if (QTUtility.CheckConfig(Settings.ShowTooltipPreviews)) { if ((thumbnailTooltip != null) && (thumbnailTooltip.IsShowing || fThumbnailPending)) { if (!QTUtility.CheckConfig(Settings.PreviewsWithShift) ^ (modifierKeys == Keys.Shift)) { if (iItem != thumbnailIndex) { if (iItem > -1 && IsTrackingItemName()) { if (ShowThumbnailTooltip(iItem, Control.MousePosition, false)) { return; } } if (thumbnailTooltip.HideToolTip()) { thumbnailIndex = -1; } } } else if (thumbnailTooltip.HideToolTip()) { thumbnailIndex = -1; } } } RefreshSubDirTip(); return; }
public static void InitializeMenuRenderer() { bool flag = false; if (QTUtility.CheckConfig(Settings.NonDefaultMenu)) { if (QTUtility.CheckConfig(Settings.XPStyleMenus)) { if (nCurrentRenderer != 1) { menuRenderer = new XPMenuRenderer(false); nCurrentRenderer = 1; flag = true; } } else if (nCurrentRenderer != 2) { menuRenderer = new VistaMenuRenderer(false); nCurrentRenderer = 2; flag = true; } } else if (nCurrentRenderer != 0) { menuRenderer = null; nCurrentRenderer = 0; flag = true; } if (flag && (menuRendererChanged != null)) { menuRendererChanged(null, EventArgs.Empty); } }
public PluginServer(QTTabBarClass tabBar) { BandObjectLib.Logging.Add_DEBUG("Constructor.log", "PluginServer"); this.tabBar = tabBar; shellBrowser = (BandObjectLib.Interop.QTPluginLib.IShellBrowser) this.tabBar.ShellBrowser.GetIShellBrowser(); dicLocalizingStrings = new Dictionary <string, string[]>(); foreach (string file in Config.Lang.PluginLangFiles) { if (file.Length <= 0 || !File.Exists(file)) { continue; } var dict = QTUtility.ReadLanguageFile(file); if (dict == null) { continue; } foreach (var pair in dict) { dicLocalizingStrings[pair.Key] = pair.Value; } } LoadStartupPlugins(); }
public override void HandleShiftKey() { if (!QTUtility.CheckConfig(Settings.PreviewsWithShift)) { HideThumbnailTooltip(5); } if (!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if (QTUtility.CheckConfig(Settings.SubDirTipsWithShift)) { if (MouseIsOverListView()) { // HandleShiftKey is called by a Hook callback, which apparently causes // problems with automation. Use PostMessage to update the SubDirTip later. hotElement = null; PInvoke.PostMessage(Handle, (uint)WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero); } } else if (!SubDirTipMenuIsShowing()) { HideSubDirTip(6); } } }
public static bool PathExists(string path) { if (String.IsNullOrEmpty(path)) { return(false); } path = path.ToLower(); if (path.StartsWith("::") || path.StartsWith(@"\\") || path.StartsWith("http://") || path.StartsWith("ftp://") || path.Contains("???")) { return(true); } if (Path.IsPathRooted(path)) { DriveInfo drive; try { drive = new DriveInfo(Path.GetPathRoot(path)); } catch { return(false); } switch (drive.DriveType) { case DriveType.Unknown: case DriveType.NoRootDirectory: return(false); case DriveType.Network: return(true); } } if (Directory.Exists(path)) { return(true); } if (File.Exists(path)) { string ext = Path.GetExtension(path).ToLower(); return(QTUtility.ExtIsCompressed(ext) || (!QTUtility.IsXP && (ext == ".search-ms"))); } if (QTUtility.IsXP || ((!path.Contains(@".zip\") && !path.Contains(@".cab\")) && !path.Contains(@".lzh\"))) { return(!Path.IsPathRooted(path)); } string str2 = String.Empty; if (path.Contains(@".zip\")) { str2 = @".zip\"; } else if (path.Contains(@".cab\")) { str2 = @".cab\"; } else if (path.Contains(@".lzh\")) { str2 = @".lzh\"; } return(File.Exists(path.Substring(0, path.IndexOf(str2) + 4))); }
/** * 设置字符串到剪贴板 */ internal static void SetStringClipboard(string str) { try { Clipboard.SetDataObject(str, true); QTUtility.AsteriskPlay(); } catch { QTUtility.SoundPlay(); } }
private static Image GetImage(PathData pathData) { string strImageKey = pathData.strImageKey; if (!QTUtility.ImageListGlobal.Images.ContainsKey(strImageKey)) { strImageKey = QTUtility.GetImageKey(pathData.strPath, null); } return(QTUtility.ImageListGlobal.Images[strImageKey]); }
public static void HandleReorder(IEnumerable <ToolStripItem> items) { int dummy; List <UserApp> reordered = new List <UserApp>(); ListFromNestedStructure(reordered, out dummy, items.OfType <QMenuItem>(), // todo: separators item => item.MenuItemArguments.App, item => item.MenuItemArguments.App.IsFolder ? item.DropDown.Items.Cast <QMenuItem>() : null); // Find the index of the first item in the level that was reordered. Stack <int> startIdx = new Stack <int>(); Stack <int> levelChildren = new Stack <int>(); startIdx.Push(0); int children = int.MaxValue; int i = 0; foreach (UserApp app in appList) { i++; while (children-- == 0) { children = levelChildren.Pop(); startIdx.Pop(); } if (app == reordered[0]) { break; } if (app.IsFolder) { levelChildren.Push(children); startIdx.Push(i); children = app.ChildrenCount; } } i = startIdx.Pop(); if (i + reordered.Count > appList.Count) { // This should never happen QTUtility.SoundPlay(); } else { for (int j = 0; j < reordered.Count; j++) { appList[i + j] = reordered[j]; } SaveApps(); } }
private bool IsHotTrackingEnabled() { if (thumbnailTooltip != null && (thumbnailTooltip.IsShowing || fThumbnailPending)) { return(true); } if (!fDragging && !QTUtility.CheckConfig(Settings.NoShowSubDirTips) && (!QTUtility.CheckConfig(Settings.SubDirTipsWithShift) || (Control.ModifierKeys & Keys.Shift) != 0) && Control.MouseButtons == MouseButtons.None && hwndExplorer == PInvoke.GetForegroundWindow()) { return(true); } return(false); }
private bool BreadcrumbController_MessageCaptured(ref Message msg) { if (msg.Msg == WM.MBUTTONUP) { if (!QTUtility.CheckConfig(Settings.NoCaptureMidClick) && hdpa != IntPtr.Zero && MiddleClicked != null) { int idx = HitTest(QTUtility2.PointFromLPARAM(msg.LParam)); if (idx >= 0 && idx <= ButtonCount()) { DoItemMiddleClick(IndexToCommand(idx), Control.ModifierKeys); } } } return(false); }
private void btnPluginAdd_Click(object sender, RoutedEventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = QTUtility.TextResourcesDic["FileFilters"][1] + "|*.xml"; ofd.RestoreDirectory = true; if (DialogResult.OK != ofd.ShowDialog()) { return; } var dict = QTUtility.ReadLanguageFile(ofd.FileName); if (dict != null) { PluginFiles.Add(ofd.FileName); } } }
private void UpdateContextMenu() { contextMenuNotifyIcon.Hide(); contextMenuNotifyIcon.SuspendLayout(); contextMenuNotifyIcon.Items.Clear(); foreach (var inst in dicNotifyIcon.Values) { StringBuilder lpString = new StringBuilder(260); PInvoke.GetWindowText(inst.ExplorerHandle, lpString, lpString.Capacity); ToolStripMenuItem item = new ToolStripMenuItem(lpString.ToString()); item.Tag = inst.TabBarHandle; if (inst.CurrentPath.Length > 0) { item.ToolTipText = QTUtility2.MakePathDisplayText(inst.CurrentPath, true); item.ImageKey = QTUtility.GetImageKey(inst.CurrentPath, null); } int j = Math.Min(inst.TabNames.Length, inst.TabPaths.Length); if (j > 1) { for (int i = 0; i < j; i++) { item.DropDownItems.Add(new ToolStripMenuItem(inst.TabNames[i]) { Tag = inst.TabBarHandle, ToolTipText = QTUtility2.MakePathDisplayText(inst.TabPaths[i], true), ImageKey = QTUtility.GetImageKey(inst.TabPaths[i], null) }); } if (item.DropDownItems.Count > 0) { item.DropDownItemClicked += contextMenuNotifyIcon_SubItems_DropDownItemClicked; item.DropDown.ImageList = QTUtility.ImageListGlobal; } } contextMenuNotifyIcon.Items.Add(item); } contextMenuNotifyIcon.Items.Add(new ToolStripSeparator()); contextMenuNotifyIcon.Items.Add(new ToolStripMenuItem("Restore all") { Tag = 0 }); contextMenuNotifyIcon.Items.Add(new ToolStripMenuItem("Close all") { Tag = 1 }); contextMenuNotifyIcon.ResumeLayout(); }
/** * 设置字符串到剪贴板 */ internal static string GetStringClipboard() { try { if (Clipboard.ContainsText(TextDataFormat.Text)) { string clipboardText = Clipboard.GetText(TextDataFormat.Text); QTUtility.AsteriskPlay(); return(clipboardText); } } catch { QTUtility.SoundPlay(); } return(""); }
protected virtual void OnDragOver(Point pt) { timer_HoverSubDirTipMenu.Enabled = false; if (!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if (QTUtility.CheckConfig(Settings.SubDirTipsWithShift)) { if (Control.ModifierKeys == Keys.Shift) { timer_HoverSubDirTipMenu_Tick(null, null); } } else { timer_HoverSubDirTipMenu.Enabled = true; } } }
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 string MakeVersionString() { if (QTUtility.IS_DEV_VERSION) { return("DevBuild: " + QTUtility.GetLinkerTimestamp()); } else { string str = QTUtility.CurrentVersion.ToString(); if (QTUtility.BetaRevision.Major > 0) { str = str + " Beta " + QTUtility.BetaRevision.Major; } else if (QTUtility.BetaRevision.Minor > 0) { str = str + " Alpha " + QTUtility.BetaRevision.Minor; } return(str); } }
protected bool OnKeyDown(Keys key) { if (QTUtility.CheckConfig(Settings.ShowTooltipPreviews)) { if (QTUtility.CheckConfig(Settings.PreviewsWithShift)) { if (key != Keys.ShiftKey) { HideThumbnailTooltip(2); } } else { HideThumbnailTooltip(2); } } if (!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if (QTUtility.CheckConfig(Settings.SubDirTipsWithShift)) { if (key != Keys.ShiftKey) { HideSubDirTip(3); } } else if (key != Keys.ControlKey) { HideSubDirTip(3); } } if (QTUtility.CheckConfig(Settings.CursorLoop) && Control.ModifierKeys == Keys.None) { if (key == Keys.Left || key == Keys.Right || key == Keys.Up || key == Keys.Down) { return(HandleCursorLoop(key)); } } return(false); }
public static void UpdateConfig(bool fBroadcast = true) { QTUtility.TextResourcesDic = Config.Lang.UseLangFile && File.Exists(Config.Lang.LangFile) ? QTUtility.ReadLanguageFile(Config.Lang.LangFile) : null; QTUtility.ValidateTextResources(); StaticReg.ClosedTabHistoryList.MaxCapacity = Config.Misc.TabHistoryCount; StaticReg.ExecutedPathsList.MaxCapacity = Config.Misc.FileHistoryCount; DropDownMenuBase.InitializeMenuRenderer(); ContextMenuStripEx.InitializeMenuRenderer(); PluginManager.RefreshPlugins(); InstanceManager.LocalTabBroadcast(tabbar => tabbar.RefreshOptions()); if (fBroadcast) { // SyncTaskBarMenu(); todo InstanceManager.StaticBroadcast(() => { ReadConfig(); UpdateConfig(false); }); } }
protected override void OnPaint(PaintEventArgs e) { if (!fImageLoaded) { fImageLoaded = true; if (imageReservationKey != null) { QTUtility.LoadReservedImage(imageReservationKey); } } if (!fVirtualQueried) { fVirtualQueried = true; if (QueryVirtualMenu != null) { QueryVirtualMenu(this, EventArgs.Empty); QueryVirtualMenu = null; } } base.OnPaint(e); }
public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) { this.tabbar = tabbar; this.bandObjectSite = bandObjectSite; ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2); Handle = hwndReBar; rebarController = new NativeWindowController(hwndReBar); rebarController.MessageCaptured += MessageCaptured; if (QTUtility.CheckConfig(Settings.ToolbarBGColor)) { if (QTUtility.DefaultRebarCOLORREF == -1) { QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero); } int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor); PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2); } EnsureMenuBarIsCorrect(); }
private void CreateNotifyIcon() { if (notifyIcon != null) { return; } Thread thread = new Thread(() => { // We need to make a new thread because we have to guarantee // contextMenuNotifyIcon is only accessed from a single thread. // InstanceManager could call us from many different threads. lock (dicNotifyIcon) { if (notifyIcon != null) { return; // double check to prevent race conditions } icoNotify = QTUtility.GetIcon(string.Empty, false); contextMenuNotifyIcon = new ContextMenuStripEx(null, false); contextMenuNotifyIcon.ImageList = QTUtility.ImageListGlobal; contextMenuNotifyIcon.ItemClicked += contextMenuNotifyIcon_ItemClicked; contextMenuNotifyIcon.EnsureHandleCreated(); notifyIcon = new NotifyIcon { Icon = icoNotify, ContextMenuStrip = contextMenuNotifyIcon, Visible = false }; notifyIcon.MouseDoubleClick += notifyIcon_MouseDoubleClick; Monitor.Pulse(dicNotifyIcon); } Application.Run(); }) { IsBackground = true }; lock (dicNotifyIcon) { thread.Start(); Monitor.Wait(dicNotifyIcon); } }
private bool ParentController_MessageCaptured(ref Message msg) { if (msg.Msg == WM_BREADCRUMBDPA) { hdpa = msg.LParam; return(true); } else if (msg.Msg == WM.COMMAND) { if (!QTUtility.CheckConfig(Settings.NoCaptureMidClick) && (Control.ModifierKeys & Keys.Shift) != 0 && hdpa != IntPtr.Zero && MiddleClicked != null) { int itemId = PInvoke.LoWord(msg.WParam.ToInt32()); int idx = CommandToIndex(itemId); if (idx >= 0 && idx < ButtonCount()) { DoItemMiddleClick(itemId, Control.ModifierKeys & (~Keys.Shift)); } return(true); } } return(false); }
public static bool InitializeMenuRenderer() { bool flag = false; bool fVista = false; if (QTUtility.CheckConfig(Settings.NonDefaultMenu)) { if (QTUtility.CheckConfig(Settings.XPStyleMenus)) { if (nCurrentRenderer != 1) { menuRenderer = new XPMenuRenderer(true); nCurrentRenderer = 1; flag = true; } } else if (nCurrentRenderer != 2) { menuRenderer = new VistaMenuRenderer(true); nCurrentRenderer = 2; flag = fVista = true; } } else if (nCurrentRenderer != 0) { menuRenderer = new DefaultMenuRenderer(); nCurrentRenderer = 0; flag = true; } if (flag) { SetImageMargin(fVista); if (menuRendererChanged != null) { menuRendererChanged(null, EventArgs.Empty); } } return(flag); }
protected bool OnGetInfoTip(int iItem, bool byKey) { if (QTUtility.CheckConfig(Settings.ShowTooltipPreviews) && (!QTUtility.CheckConfig(Settings.PreviewsWithShift) ^ (Control.ModifierKeys == Keys.Shift))) { if (((thumbnailTooltip != null) && thumbnailTooltip.IsShowing) && (iItem == thumbnailIndex)) { return(true); } else if (byKey) { Rectangle rect = GetFocusedItemRect(); Point pt = new Point(rect.Right - 32, rect.Bottom - 16); PInvoke.ClientToScreen(Handle, ref pt); return(ShowThumbnailTooltip(iItem, pt, true)); } else { return(ShowThumbnailTooltip(iItem, Control.MousePosition, false)); } } return(false); }
private void Update() { if (string.IsNullOrEmpty(SelectedPath)) { if (!txtLocation.IsFocused) { ShowWatermark(true); } imgIcon.Source = null; return; } ShowWatermark(false); IDLWrapper wrapper = SelectedIDL == null ? new IDLWrapper(SelectedPath) : new IDLWrapper(SelectedIDL as byte[] ?? SelectedIDL.ToArray()); using (wrapper) { if (!lockText) { string text; if (File || wrapper.IDL == null) { text = wrapper.Path; } else { bool b = File ? wrapper.IsFileSystemFile : wrapper.IsFileSystemFolder; text = b ? wrapper.Path : wrapper.DisplayName; } SetTextboxText(text); } Icon icon = QTUtility.GetIcon(wrapper.PIDL); imgIcon.Source = (ImageSource) new OptionsDialog.BitmapToImageSourceConverter().Convert(icon.ToBitmap(), null, null, null); } }
public override void HandleShiftKey() { if (!QTUtility.CheckConfig(Settings.PreviewsWithShift)) { HideThumbnailTooltip(5); } if (!QTUtility.CheckConfig(Settings.NoShowSubDirTips)) { if (QTUtility.CheckConfig(Settings.SubDirTipsWithShift)) { if (MouseIsOverListView()) { RefreshSubDirTip(); } } else if (!SubDirTipMenuIsShowing()) { HideSubDirTip(6); } } }