Exemplo n.º 1
0
 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);
         });
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private void InitializeComponent() {
     components = new Container();
     toolStrip = new ToolStripEx();
     contextMenu = new ContextMenuStripEx(components, true);
     menuCustomize = new ToolStripMenuItem(ResBBOption[9]);
     menuLockItem = new ToolStripMenuItem(ResBBOption[10]);
     menuLockToolbar = new ToolStripMenuItem(QTUtility.ResMain[0x20]);
     toolStrip.SuspendLayout();
     contextMenu.SuspendLayout();
     SuspendLayout();
     toolStrip.Dock = DockStyle.Fill;
     toolStrip.GripStyle = ToolStripGripStyle.Hidden;
     toolStrip.ImeMode = ImeMode.Disable;
     toolStrip.Renderer = new ToolbarRenderer();
     toolStrip.BackColor = Color.Transparent;
     toolStrip.ItemClicked += toolStrip_ItemClicked;
     toolStrip.GotFocus += toolStrip_GotFocus;
     toolStrip.MouseDoubleClick += toolStrip_MouseDoubleClick;
     toolStrip.MouseActivated += toolStrip_MouseActivated;
     toolStrip.PreviewKeyDown += toolStrip_PreviewKeyDown;
     menuLockItem.Checked = LockDropDownItems;
     contextMenu.Items.Add(menuCustomize);
     contextMenu.Items.Add(menuLockItem);
     contextMenu.Items.Add(menuLockToolbar);
     contextMenu.ShowImageMargin = false;
     contextMenu.Opening += contextMenu_Opening;
     contextMenu.ItemClicked += contextMenu_ItemClicked;
     Controls.Add(toolStrip);
     Height = BarHeight;
     MinSize = new Size(20, BarHeight);
     ContextMenuStrip = contextMenu;
     toolStrip.ResumeLayout(false);
     contextMenu.ResumeLayout(false);
     ResumeLayout();
 }
Exemplo n.º 4
0
        private void InitializeComponent()
        {
            // handle creation
            // todo: doesn't look necessary...
            hwndThis = Handle;

            bool reorderEnabled = !Config.Desktop.LockMenu;

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

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

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

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

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

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

            contextMenu.ResumeLayout(false);
            contextMenuForSetting.ResumeLayout(false);
            ResumeLayout(false);
        }
Exemplo n.º 5
0
 private void InitializeComponent() {
     bool flag = (ConfigValues[1] & 2) == 0;
     components = new Container();
     contextMenu = new DropDownMenuReorderable(components, true, false);
     contextMenuForSetting = new ContextMenuStripEx(components, true);
     labelGroupTitle = new TitleMenuItem(MenuGenre.Group, true);
     labelHistoryTitle = new TitleMenuItem(MenuGenre.History, true);
     labelUserAppTitle = new TitleMenuItem(MenuGenre.Application, true);
     labelRecentFileTitle = new TitleMenuItem(MenuGenre.RecentFile, true);
     contextMenu.SuspendLayout();
     contextMenuForSetting.SuspendLayout();
     SuspendLayout();
     contextMenu.ProhibitedKey.Add("historyItem");
     contextMenu.ProhibitedKey.Add("recentItem");
     contextMenu.ReorderEnabled = flag;
     contextMenu.MessageParent = Handle;
     contextMenu.ImageList = QTUtility.ImageListGlobal;
     contextMenu.ItemClicked += contextMenu_ItemClicked;
     contextMenu.Closing += contextMenu_Closing;
     contextMenu.ReorderFinished += contextMenu_ReorderFinished;
     contextMenu.ItemRightClicked += dropDownMenues_ItemRightClicked;
     ddmrGroups = new DropDownMenuReorderable(components, true, false);
     ddmrGroups.ReorderEnabled = flag;
     ddmrGroups.ReorderFinished += groupsMenuItem_ReorderFinished;
     ddmrGroups.ItemRightClicked += dropDownMenues_ItemRightClicked;
     groupsMenuItem = new TitleMenuItem(MenuGenre.Group, false);
     groupsMenuItem.DropDown = ddmrGroups;
     groupsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     groupsMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrHistory = new DropDownMenuReorderable(components, true, false);
     ddmrHistory.ReorderEnabled = false;
     ddmrHistory.MessageParent = Handle;
     ddmrHistory.ItemRightClicked += dropDownMenues_ItemRightClicked;
     historyMenuItem = new TitleMenuItem(MenuGenre.History, false);
     historyMenuItem.DropDown = ddmrHistory;
     historyMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     historyMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrUserapps = new DropDownMenuReorderable(components);
     ddmrUserapps.ReorderEnabled = flag;
     ddmrUserapps.MessageParent = Handle;
     ddmrUserapps.ReorderFinished += userAppsMenuItem_ReorderFinished;
     ddmrUserapps.ItemRightClicked += dropDownMenues_ItemRightClicked;
     userAppsMenuItem = new TitleMenuItem(MenuGenre.Application, false);
     userAppsMenuItem.DropDown = ddmrUserapps;
     userAppsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     userAppsMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     ddmrRecentFile = new DropDownMenuReorderable(components, false, false, false);
     ddmrRecentFile.MessageParent = Handle;
     ddmrRecentFile.ItemRightClicked += dropDownMenues_ItemRightClicked;
     recentFileMenuItem = new TitleMenuItem(MenuGenre.RecentFile, false);
     recentFileMenuItem.DropDown = ddmrRecentFile;
     recentFileMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     recentFileMenuItem.DropDownItemClicked += contextMenu_ItemClicked;
     contextMenuForSetting.ShowImageMargin = false;
     tsmiTaskBar = new ToolStripMenuItem();
     tsmiDesktop = new ToolStripMenuItem();
     tsmiLockItems = new ToolStripMenuItem();
     tsmiVSTitle = new ToolStripMenuItem();
     tsmiTaskBar.Checked = (ConfigValues[1] & 8) == 0;
     tsmiDesktop.Checked = (ConfigValues[1] & 4) == 0;
     tsmiLockItems.Checked = (ConfigValues[1] & 2) == 2;
     tsmiVSTitle.Checked = (ConfigValues[1] & 1) == 0;
     tsmiOnGroup = new ToolStripMenuItem();
     tsmiOnHistory = new ToolStripMenuItem();
     tsmiOnUserApps = new ToolStripMenuItem();
     tsmiOnRecentFile = new ToolStripMenuItem();
     tsmiOneClick = new ToolStripMenuItem();
     tsmiAppKeys = new ToolStripMenuItem();
     tsmiOnGroup.Checked = (ConfigValues[2] & 0x80) == 0;
     tsmiOnHistory.Checked = (ConfigValues[2] & 0x40) == 0;
     tsmiOnUserApps.Checked = (ConfigValues[2] & 0x20) == 0;
     tsmiOnRecentFile.Checked = (ConfigValues[2] & 1) == 0;
     tsmiOneClick.Checked = (ConfigValues[2] & 0x10) != 0;
     tsmiAppKeys.Checked = (ConfigValues[2] & 8) == 0;
     contextMenuForSetting.Items.AddRange(new ToolStripItem[] { tsmiTaskBar, tsmiDesktop, new ToolStripSeparator(), tsmiOnGroup, tsmiOnHistory, tsmiOnUserApps, tsmiOnRecentFile, new ToolStripSeparator(), tsmiLockItems, tsmiVSTitle, tsmiOneClick, tsmiAppKeys });
     contextMenuForSetting.ItemClicked += contextMenuForSetting_ItemClicked;
     contextMenuForSetting.Opening += contextMenuForSetting_Opening;
     ContextMenuStrip = contextMenuForSetting;
     Width = WidthOfBar;
     MinSize = new Size(30, 0x16);
     Dock = DockStyle.Fill;
     MouseClick += QTCoTaskBarClass_MouseClick;
     MouseDoubleClick += QTCoTaskBarClass_MouseDoubleClick;
     contextMenu.ResumeLayout(false);
     contextMenuForSetting.ResumeLayout(false);
     ResumeLayout(false);
 }
Exemplo n.º 6
0
 private void InitializeComponent() {
     this.components = new Container();
     this.toolStrip = new ToolStripEx();
     this.contextMenu = new ContextMenuStripEx(this.components, true);
     this.menuCustomize = new ToolStripMenuItem(ResBBOption[9]);
     this.menuLockItem = new ToolStripMenuItem(ResBBOption[10]);
     this.menuLockToolbar = new ToolStripMenuItem(QTUtility.ResMain[0x20]);
     this.toolStrip.SuspendLayout();
     this.contextMenu.SuspendLayout();
     base.SuspendLayout();
     this.toolStrip.Dock = DockStyle.Fill;
     this.toolStrip.GripStyle = ToolStripGripStyle.Hidden;
     this.toolStrip.ImeMode = ImeMode.Disable;
     this.toolStrip.Renderer = new ToolbarRenderer();
     this.toolStrip.BackColor = System.Drawing.Color.Transparent;
     this.toolStrip.ItemClicked += new ToolStripItemClickedEventHandler(this.toolStrip_ItemClicked);
     this.toolStrip.GotFocus += new EventHandler(this.toolStrip_GotFocus);
     this.toolStrip.MouseDoubleClick += new MouseEventHandler(this.toolStrip_MouseDoubleClick);
     this.toolStrip.MouseActivated += new EventHandler(this.toolStrip_MouseActivated);
     this.toolStrip.PreviewKeyDown += new PreviewKeyDownEventHandler(this.toolStrip_PreviewKeyDown);
     this.menuLockItem.Checked = LockDropDownItems;
     this.contextMenu.Items.Add(this.menuCustomize);
     this.contextMenu.Items.Add(this.menuLockItem);
     this.contextMenu.Items.Add(this.menuLockToolbar);
     this.contextMenu.ShowImageMargin = false;
     this.contextMenu.Opening += new CancelEventHandler(this.contextMenu_Opening);
     this.contextMenu.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     base.Controls.Add(this.toolStrip);
     base.Height = BarHeight;
     base.MinSize = new Size(20, BarHeight);
     this.ContextMenuStrip = this.contextMenu;
     this.toolStrip.ResumeLayout(false);
     this.contextMenu.ResumeLayout(false);
     base.ResumeLayout();
 }
Exemplo n.º 7
0
 private void InitializeComponent() {
     bool flag = (this.ConfigValues[1] & 2) == 0;
     this.components = new Container();
     this.contextMenu = new DropDownMenuReorderable(this.components, true, false);
     this.contextMenuForSetting = new ContextMenuStripEx(this.components, true);
     this.labelGroupTitle = new TitleMenuItem(MenuGenre.Group, true);
     this.labelHistoryTitle = new TitleMenuItem(MenuGenre.History, true);
     this.labelUserAppTitle = new TitleMenuItem(MenuGenre.Application, true);
     this.labelRecentFileTitle = new TitleMenuItem(MenuGenre.RecentFile, true);
     this.contextMenu.SuspendLayout();
     this.contextMenuForSetting.SuspendLayout();
     base.SuspendLayout();
     this.contextMenu.ProhibitedKey.Add("historyItem");
     this.contextMenu.ProhibitedKey.Add("recentItem");
     this.contextMenu.ReorderEnabled = flag;
     this.contextMenu.MessageParent = base.Handle;
     this.contextMenu.ImageList = QTUtility.ImageListGlobal;
     this.contextMenu.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.contextMenu.Closing += new ToolStripDropDownClosingEventHandler(this.contextMenu_Closing);
     this.contextMenu.ReorderFinished += new MenuReorderedEventHandler(this.contextMenu_ReorderFinished);
     this.contextMenu.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     if(QTUtility.IsVista) {
         IntPtr handle = this.contextMenu.Handle;
     }
     this.ddmrGroups = new DropDownMenuReorderable(this.components, true, false);
     this.ddmrGroups.ReorderEnabled = flag;
     this.ddmrGroups.ReorderFinished += new MenuReorderedEventHandler(this.groupsMenuItem_ReorderFinished);
     this.ddmrGroups.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.groupsMenuItem = new TitleMenuItem(MenuGenre.Group, false);
     this.groupsMenuItem.DropDown = this.ddmrGroups;
     this.groupsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.groupsMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrHistory = new DropDownMenuReorderable(this.components, true, false);
     this.ddmrHistory.ReorderEnabled = false;
     this.ddmrHistory.MessageParent = base.Handle;
     this.ddmrHistory.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.historyMenuItem = new TitleMenuItem(MenuGenre.History, false);
     this.historyMenuItem.DropDown = this.ddmrHistory;
     this.historyMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.historyMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrUserapps = new DropDownMenuReorderable(this.components);
     this.ddmrUserapps.ReorderEnabled = flag;
     this.ddmrUserapps.MessageParent = base.Handle;
     this.ddmrUserapps.ReorderFinished += new MenuReorderedEventHandler(this.userAppsMenuItem_ReorderFinished);
     this.ddmrUserapps.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.userAppsMenuItem = new TitleMenuItem(MenuGenre.Application, false);
     this.userAppsMenuItem.DropDown = this.ddmrUserapps;
     this.userAppsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.userAppsMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.ddmrRecentFile = new DropDownMenuReorderable(this.components, false, false, false);
     this.ddmrRecentFile.MessageParent = base.Handle;
     this.ddmrRecentFile.ItemRightClicked += new ItemRightClickedEventHandler(this.dropDownMenues_ItemRightClicked);
     this.recentFileMenuItem = new TitleMenuItem(MenuGenre.RecentFile, false);
     this.recentFileMenuItem.DropDown = this.ddmrRecentFile;
     this.recentFileMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal;
     this.recentFileMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(this.contextMenu_ItemClicked);
     this.contextMenuForSetting.ShowImageMargin = false;
     this.tsmiTaskBar = new ToolStripMenuItem();
     this.tsmiDesktop = new ToolStripMenuItem();
     this.tsmiLockItems = new ToolStripMenuItem();
     this.tsmiVSTitle = new ToolStripMenuItem();
     this.tsmiTaskBar.Checked = (this.ConfigValues[1] & 8) == 0;
     this.tsmiDesktop.Checked = (this.ConfigValues[1] & 4) == 0;
     this.tsmiLockItems.Checked = (this.ConfigValues[1] & 2) == 2;
     this.tsmiVSTitle.Checked = (this.ConfigValues[1] & 1) == 0;
     this.tsmiOnGroup = new ToolStripMenuItem();
     this.tsmiOnHistory = new ToolStripMenuItem();
     this.tsmiOnUserApps = new ToolStripMenuItem();
     this.tsmiOnRecentFile = new ToolStripMenuItem();
     this.tsmiOneClick = new ToolStripMenuItem();
     this.tsmiAppKeys = new ToolStripMenuItem();
     this.tsmiOnGroup.Checked = (this.ConfigValues[2] & 0x80) == 0;
     this.tsmiOnHistory.Checked = (this.ConfigValues[2] & 0x40) == 0;
     this.tsmiOnUserApps.Checked = (this.ConfigValues[2] & 0x20) == 0;
     this.tsmiOnRecentFile.Checked = (this.ConfigValues[2] & 1) == 0;
     this.tsmiOneClick.Checked = (this.ConfigValues[2] & 0x10) != 0;
     this.tsmiAppKeys.Checked = (this.ConfigValues[2] & 8) == 0;
     this.contextMenuForSetting.Items.AddRange(new ToolStripItem[] { this.tsmiTaskBar, this.tsmiDesktop, new ToolStripSeparator(), this.tsmiOnGroup, this.tsmiOnHistory, this.tsmiOnUserApps, this.tsmiOnRecentFile, new ToolStripSeparator(), this.tsmiLockItems, this.tsmiVSTitle, this.tsmiOneClick, this.tsmiAppKeys });
     this.contextMenuForSetting.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenuForSetting_ItemClicked);
     this.contextMenuForSetting.Opening += new CancelEventHandler(this.contextMenuForSetting_Opening);
     this.ContextMenuStrip = this.contextMenuForSetting;
     base.Width = this.WidthOfBar;
     base.MinSize = new Size(30, 0x16);
     this.Dock = DockStyle.Fill;
     base.MouseClick += new MouseEventHandler(this.QTCoTaskBarClass_MouseClick);
     base.MouseDoubleClick += new MouseEventHandler(this.QTCoTaskBarClass_MouseDoubleClick);
     this.contextMenu.ResumeLayout(false);
     this.contextMenuForSetting.ResumeLayout(false);
     base.ResumeLayout(false);
 }
Exemplo n.º 8
0
 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);
     }
 }
Exemplo n.º 9
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(treeViewWrapper != null) {
             treeViewWrapper.Dispose();
             treeViewWrapper = null;
         }
         if(listViewManager != null) {
             listViewManager.Dispose();
             listViewManager = null;
         }
         if(subDirTip_Tab != null) {
             subDirTip_Tab.Dispose();
             subDirTip_Tab = null;
         }
         if(IsShown) {
             if(pluginManager != null) {
                 pluginManager.Close(false);
                 pluginManager = null;
             }
             if(hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Key);
                 hHook_Key = IntPtr.Zero;
             }
             if(hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Mouse);
                 hHook_Mouse = IntPtr.Zero;
             }
             if(hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(hHook_Msg);
                 hHook_Msg = IntPtr.Zero;
             }
             if(explorerController != null) {
                 explorerController.ReleaseHandle();
                 explorerController = null;
             }
             if(rebarController != null) {
                 rebarController.ReleaseHandle();
                 rebarController = null;
             }
             if(!QTUtility.IsXP && (travelBtnController != null)) {
                 travelBtnController.ReleaseHandle();
                 travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(ExplorerHandle);
             }
             if((hwndNotifyIconParent == ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 string[] list = (from QTabItem item2 in tabControl1.TabPages
                         where item2.TabLocked
                         select item2.CurrentPath).ToArray();
                 QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                 key.SetValue("StartUpGroups", QTUtility.StartUpGroupList.StringJoin(";"));
                 if(QTUtility.instanceManager.RemoveInstance(ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             Cursor = Cursors.Default;
             if((curTabDrag != null) && (curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabDrag.Handle);
                 GC.SuppressFinalize(curTabDrag);
                 curTabDrag = null;
             }
             if((curTabCloning != null) && (curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(curTabCloning.Handle);
                 GC.SuppressFinalize(curTabCloning);
                 curTabCloning = null;
             }
             if(dropTargetWrapper != null) {
                 dropTargetWrapper.Dispose();
                 dropTargetWrapper = null;
             }
             if((optionsDialog != null) && fOptionDialogCreated) {
                 fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(tabSwitcher != null) {
                 tabSwitcher.Dispose();
                 tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(TravelLog != null) {
             Marshal.FinalReleaseComObject(TravelLog);
             TravelLog = null;
         }
         if(iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(iContextMenu2);
             iContextMenu2 = null;
         }
         if(ShellBrowser != null) {
             ShellBrowser.Dispose();
             ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         LogEntryDic.Clear();
         if(bmpRebar != null) {
             bmpRebar.Dispose();
             bmpRebar = null;
         }
         if(textureBrushRebar != null) {
             textureBrushRebar.Dispose();
             textureBrushRebar = null;
         }
         fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
Exemplo n.º 10
0
        protected override void WndProc(ref Message m) {
            try {
                bool flag;
                switch(m.Msg) {

                    case WM.APP + 1:
                        NowModalDialogShown = m.WParam != IntPtr.Zero;
                        return;

                    case WM.DROPFILES:
                        HandleFileDrop(m.WParam);
                        break;

                    case WM.DRAWITEM:
                    case WM.MEASUREITEM:
                    case WM.INITMENUPOPUP:
                        if((iContextMenu2 != null) && (m.HWnd == Handle)) {
                            try {
                                iContextMenu2.HandleMenuMsg(m.Msg, m.WParam, m.LParam);
                            }
                            catch {
                            }
                            return;
                        }
                        break;
                }
                if(m.Msg != WM.COPYDATA) {
                    base.WndProc(ref m);
                    return;
                }
                if(!NowModalDialogShown) {
                    COPYDATASTRUCT copydatastruct = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
                    int wParam = (int)m.WParam;
                    string str = "null";
                    byte[] destination = null;
                    switch(wParam) {
                        case 4:
                        case 0x40:
                            destination = new byte[copydatastruct.cbData];
                            Marshal.Copy(copydatastruct.lpData, destination, 0, copydatastruct.cbData);
                            break;

                        default:
                            str = Marshal.PtrToStringAuto(copydatastruct.lpData);
                            if(str == "null") {
                                str = string.Empty;
                            }
                            break;
                    }
                    if(wParam <= 0xf00) {
                        flag = false;
                        switch(wParam) {
                            case 0:
                            case 2: {
                                    if(string.IsNullOrEmpty(str)) {
                                        goto Label_0B07;
                                    }
                                    string[] strArray = str.Trim().Split(QTUtility.SEPARATOR_CHAR);
                                    if(wParam != 2) {
                                        foreach(string str2 in strArray) {
                                            OpenGroup(str2, false);
                                        }
                                        flag = true;
                                        goto Label_0B07;
                                    }
                                    NowOpenedByGroupOpener = true;
                                    new MethodInvoker(CallbackFirstNavComp).BeginInvoke(AsyncComplete, strArray);
                                    return;
                                }
                            case 1:
                                goto Label_0B07;

                            case 3:
                                OpenGroup(str, true);
                                goto Label_0B07;

                            case 4:
                            case 0x40: {
                                    bool flag2 = true;
                                    bool blockSelecting = false;
                                    if(wParam == 4) {
                                        switch(((Keys)((int)copydatastruct.dwData))) {
                                            case Keys.Control:
                                                flag2 = false;
                                                break;

                                            case Keys.Shift:
                                                blockSelecting = true;
                                                break;
                                        }
                                    }
                                    else {
                                        flag2 = copydatastruct.dwData == IntPtr.Zero;
                                    }
                                    using(IDLWrapper wrapper5 = new IDLWrapper(destination)) {
                                        if(wrapper5.Available) {
                                            if(flag2 && (!wrapper5.HasPath || !QTUtility2.TargetIsInNoCapture(IntPtr.Zero, wrapper5.Path))) {
                                                bool flag4 = OpenNewTab(wrapper5, blockSelecting, wParam == 0x40);
                                                if((wParam == 0x40) && !flag4) {
                                                    m.Result = (IntPtr)1;
                                                }
                                                flag = true;
                                            }
                                            else {
                                                OpenNewWindow(wrapper5);
                                            }
                                        }
                                        goto Label_0B07;
                                    }
                                }
                            case 9:
                                if(QTUtility.TMPTargetIDL != null) {
                                    Keys dwData = (Keys)((int)copydatastruct.dwData);
                                    if(dwData == Keys.Control) {
                                        using(IDLWrapper wrapper6 = new IDLWrapper(QTUtility.TMPTargetIDL)) {
                                            OpenNewWindow(wrapper6);
                                            return;
                                        }
                                    }
                                    bool flag5 = (dwData & Keys.Shift) != Keys.None;
                                    using(IDLWrapper wrapper7 = new IDLWrapper(QTUtility.TMPTargetIDL)) {
                                        if(wrapper7.HasPath && QTUtility2.TargetIsInNoCapture(IntPtr.Zero, wrapper7.Path)) {
                                            OpenNewWindow(wrapper7);
                                            return;
                                        }
                                        OpenNewTab(wrapper7, flag5, false);
                                    }
                                    foreach(byte[] buffer2 in QTUtility.TMPIDLList) {
                                        using(IDLWrapper wrapper8 = new IDLWrapper(buffer2)) {
                                            OpenNewTab(wrapper8, true, false);
                                            continue;
                                        }
                                    }
                                    if(flag5) {
                                        WindowUtils.BringExplorerToFront(ExplorerHandle);
                                    }
                                }
                                return;

                            case 15: {
                                    string[] strArray2 = str.Split(QTUtility.SEPARATOR_CHAR);
                                    if((strArray2.Length == 2) && (strArray2[1].Length > 0)) {
                                        QTUtility.PathToSelectInCommandLineArg = strArray2[1];
                                    }
                                    if(ModifierKeys != Keys.Control) {
                                        OpenNewTab(strArray2[0], false);
                                        flag = true;
                                    }
                                    else {
                                        using(IDLWrapper wrapper9 = new IDLWrapper(strArray2[0])) {
                                            OpenNewWindow(wrapper9);
                                        }
                                    }
                                    if(!QTUtility.CheckConfig(Settings.NoNewWndFolderTree)) {
                                        ShowFolderTree(true);
                                    }
                                    goto Label_0B07;
                                }
                            case 0x10:
                                if((QTUtility.CheckConfig(Settings.TrayOnClose) && (notifyIcon != null)) && (dicNotifyIcon != null)) {
                                    Dictionary<IntPtr, int> dictionary = new Dictionary<IntPtr, int>(dicNotifyIcon);
                                    foreach(IntPtr ptr in dictionary.Keys) {
                                        QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(ptr);
                                        if((tabBar != null) && (tabBar.CurrentAddress == str)) {
                                            ShowTaskbarItem(ptr, true);
                                            return;
                                        }
                                    }
                                }
                                OpenNewTab(str, false);
                                QTUtility.RegisterPrimaryInstance(ExplorerHandle, this);
                                flag = true;
                                goto Label_0B07;

                            case 0x11:
                                RefreshTabBar(copydatastruct.dwData != IntPtr.Zero);
                                return;

                            case 0x12:
                                RefreshPlugins(false);
                                return;

                            case 80:
                                ReplaceByGroup(str);
                                return;

                            case 0x20:
                                using(RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Quizo\QTTabBar", false)) {
                                    if(key != null) {
                                        string[] collection = ((string)key.GetValue("TabsOnLastClosedWindow", string.Empty)).Split(QTUtility.SEPARATOR_CHAR);
                                        if((collection.Length > 0) && (collection[0].Length > 0)) {
                                            if(copydatastruct.dwData == IntPtr.Zero) {
                                                QTUtility.TMPPathList = new List<string>(collection);
                                                using(IDLWrapper wrapper10 = new IDLWrapper(collection[0])) {
                                                    OpenNewWindow(wrapper10);
                                                    return;
                                                }
                                            }
                                            new MethodInvoker(CallbackFirstNavComp).BeginInvoke(AsyncComplete_MultiPath, new object[] { collection, 0 });
                                        }
                                    }
                                }
                                return;

                            case 0x30: {
                                    contextMenuNotifyIcon = new ContextMenuStripEx(null, false);
                                    contextMenuNotifyIcon.ImageList = QTUtility.ImageListGlobal;
                                    contextMenuNotifyIcon.ItemClicked += contextMenuNotifyIcon_ItemClicked;
                                    notifyIcon = new NotifyIcon();
                                    notifyIcon.Icon = icoNotify;
                                    notifyIcon.ContextMenuStrip = contextMenuNotifyIcon;
                                    notifyIcon.MouseDoubleClick += notifyIcon_MouseDoubleClick;
                                    hwndNotifyIconParent = ExplorerHandle;
                                    int count = dicNotifyIcon.Count;
                                    string str4 = count + " window" + ((count > 1) ? "s" : string.Empty);
                                    if(str4.Length > 0x40) {
                                        str4 = str4.Substring(0, 60) + "...";
                                    }
                                    notifyIcon.Text = str4;
                                    notifyIcon.Visible = true;
                                    CreateContextMenuItems_NotifyIcon(IntPtr.Zero, 0);
                                    m.Result = (IntPtr)1;
                                    return;
                                }
                        }
                        goto Label_0B07;
                    }
                    int num2 = wParam - 0xf00;
                    Keys modifierKeys = ModifierKeys;
                    switch(num2) {
                        case 1:
                            NavigateCurrentTab(true);
                            return;

                        case 2:
                            NavigateCurrentTab(false);
                            return;

                        case 3:
                            OpenGroup(str, modifierKeys == Keys.Control);
                            return;

                        case 4: {
                                if(copydatastruct.dwData == IntPtr.Zero) {
                                    OpenNewTab(str, false);
                                    return;
                                }
                                using(IDLWrapper wrapper3 = new IDLWrapper(str)) {
                                    OpenNewWindow(wrapper3);
                                    return;
                                }
                            }
                        case 5:
                        case 9:
                        case 0xf4:
                        case 0xf5:
                        case 0xf6:
                        case 0xf7:
                        case 0xf8:
                        case 0xf9:
                        case 0xfe:
                            return;

                        case 6: {
                                using(IDLWrapper wrapper4 = new IDLWrapper(CurrentTab.CurrentIDL)) {
                                    OpenNewWindow(wrapper4);
                                    return;
                                }
                            }
                        case 7:
                            CloneTabButton(CurrentTab, null, true, -1);
                            return;

                        case 8:
                            CurrentTab.TabLocked = !CurrentTab.TabLocked;
                            return;

                        case 10:
                            ToggleTopMost();
                            return;

                        case 11:
                            if(QTUtility.CheckConfig(Settings.NeverCloseWindow)) {
                                CloseTab(CurrentTab);
                                return;
                            }
                            CloseTab(CurrentTab, false);
                            if(tabControl1.TabCount == 0) {
                                WindowUtils.CloseExplorer(ExplorerHandle, 2);
                            }
                            return;

                        case 12:
                            if(tabControl1.TabCount > 1) {
                                CloseAllTabsExcept(CurrentTab);
                            }
                            return;

                        case 13:
                            WindowUtils.CloseExplorer(ExplorerHandle, 1);
                            return;

                        case 14:
                            CloseLeftRight(true, -1);
                            return;

                        case 15:
                            CloseLeftRight(false, -1);
                            return;

                        case 0x10:
                            UpOneLevel();
                            return;

                        case 0x11:
                            Explorer.Refresh();
                            return;

                        case 0x12:
                            ShowSearchBar(true);
                            return;

                        case 0x30: {
                                if(modifierKeys != Keys.Control) {
                                    OpenNewTab(str, false);
                                    return;
                                }
                                using(IDLWrapper wrapper2 = new IDLWrapper(str)) {
                                    OpenNewWindow(wrapper2);
                                    return;
                                }
                            }
                        case 0xf1:
                        case 0xf2: {
                                object[] tag = new object[] { str, num2 == 0xf1, (int)copydatastruct.dwData };
                                if(modifierKeys != Keys.Shift) {
                                    if(modifierKeys == Keys.Control) {
                                        using(IDLWrapper wrapper = new IDLWrapper(str)) {
                                            OpenNewWindow(wrapper);
                                            return;
                                        }
                                    }
                                    NavigateToHistory(tag);
                                    return;
                                }
                                CloneTabButton(CurrentTab, null, true, -1);
                                NavigateToHistory(tag);
                                return;
                            }
                        case 0xf3:
                            NavigateBranches(CurrentTab, (int)copydatastruct.dwData);
                            return;

                        case 250:
                            listView.HideSubDirTip(9);
                            listView.HideThumbnailTooltip(9);
                            return;

                        case 0xfb:
                            if(Directory.Exists(str)) {
                                OpenNewTab(str, false);
                            }
                            return;

                        case 0xfc:
                            if(!(copydatastruct.dwData == ((IntPtr)1))) {
                                contextMenuSys.Show(MousePosition);
                                return;
                            }
                            contextMenuSys.Show(PointToScreen(Point.Empty));
                            return;

                        case 0xfd:
                            OnMouseDoubleClick(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
                            return;

                        case 0xff:
                            SyncButtonBarCurrent(0x3f);
                            return;

                        default:
                            return;
                    }
                }
                return;
            Label_0B07:
                if(flag) {
                    bool flag6 = !QTUtility.IsXP && PInvoke.IsIconic(ExplorerHandle);
                    RestoreFromTray();
                    WindowUtils.BringExplorerToFront(ExplorerHandle);
                    if(flag6) {
                        foreach(QTabItem item2 in tabControl1.TabPages) {
                            item2.RefreshRectangle();
                        }
                        tabControl1.Refresh();
                    }
                }
            }
            catch(Exception ex) {
                QTUtility2.MakeErrorLog(ex, String.Format("Message: {0:x4}", m.Msg));
            }
        }
Exemplo n.º 11
0
 private static void ShowTaskbarItem(IntPtr hwndExplr, bool fShow) {
     lock(syncObj_NotifyIcon) {
         if(dicNotifyIcon == null) {
             dicNotifyIcon = new Dictionary<IntPtr, int>();
         }
         if(notifyIcon == null) {
             if(icoNotify == null) {
                 icoNotify = QTUtility.GetIcon(string.Empty, false);
             }
             contextMenuNotifyIcon = new ContextMenuStripEx(null, false);
             contextMenuNotifyIcon.ImageList = QTUtility.ImageListGlobal;
             contextMenuNotifyIcon.ItemClicked += contextMenuNotifyIcon_ItemClicked;
             notifyIcon = new NotifyIcon();
             notifyIcon.Icon = icoNotify;
             notifyIcon.MouseDoubleClick += notifyIcon_MouseDoubleClick;
             notifyIcon.ContextMenuStrip = contextMenuNotifyIcon;
             if(!fShow) {
                 notifyIcon.Visible = true;
             }
             hwndNotifyIconParent = hwndExplr;
         }
     }
     ITaskbarList o = null;
     try {
         object obj2;
         Guid rclsid = ExplorerGUIDs.CLSID_TaskbarList;
         Guid riid = ExplorerGUIDs.IID_ITaskbarList;
         PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj2);
         o = (ITaskbarList)obj2;
         o.HrInit();
         if(fShow) {
             int num;
             if(!dicNotifyIcon.TryGetValue(hwndExplr, out num)) {
                 num = 1;
             }
             o.AddTab(hwndExplr);
             PInvoke.ShowWindow(hwndExplr, num);
             PInvoke.SetForegroundWindow(hwndExplr);
             dicNotifyIcon.Remove(hwndExplr);
             if(dicNotifyIcon.Count == 0) {
                 notifyIcon.Visible = false;
             }
             CreateContextMenuItems_NotifyIcon(IntPtr.Zero, 0);
         }
         else {
             bool flag = PInvoke.IsZoomed(hwndExplr);
             PInvoke.ShowWindow(hwndExplr, 0);
             o.DeleteTab(hwndExplr);
             notifyIcon.Visible = true;
             CreateContextMenuItems_NotifyIcon(hwndExplr, flag ? 3 : 1);
         }
         if(notifyIcon.Visible) {
             int count = dicNotifyIcon.Count;
             string str = count + " window" + ((count > 1) ? "s" : string.Empty);
             if(str.Length > 64) {
                 str = str.Substring(0, 60) + "...";
             }
             notifyIcon.Text = str;
         }
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, null);
     }
     finally {
         if(o != null) {
             Marshal.ReleaseComObject(o);
         }
     }
 }
Exemplo n.º 12
0
 private void InitializeComponent() {
     components = new Container();
     buttonNavHistoryMenu = new ToolStripDropDownButton();
     tabControl1 = new QTabControl();
     CurrentTab = new QTabItem(string.Empty, string.Empty, tabControl1);
     contextMenuTab = new ContextMenuStripEx(components, false);
     contextMenuSys = new ContextMenuStripEx(components, false);
     tabControl1.SuspendLayout();
     contextMenuSys.SuspendLayout();
     contextMenuTab.SuspendLayout();
     SuspendLayout();
     bool flag = QTUtility.CheckConfig(Settings.ShowNavButtons);
     if(flag) {
         InitializeNavBtns(false);
     }
     buttonNavHistoryMenu.AutoSize = false;
     buttonNavHistoryMenu.DisplayStyle = ToolStripItemDisplayStyle.None;
     buttonNavHistoryMenu.Enabled = false;
     buttonNavHistoryMenu.Size = new Size(13, 0x15);
     buttonNavHistoryMenu.DropDown = new DropDownMenuBase(components, true, true, true);
     buttonNavHistoryMenu.DropDown.ItemClicked += NavigationButton_DropDownMenu_ItemClicked;
     buttonNavHistoryMenu.DropDownOpening += NavigationButtons_DropDownOpening;
     buttonNavHistoryMenu.DropDown.ImageList = QTUtility.ImageListGlobal;
     tabControl1.SetRedraw(false);
     tabControl1.TabPages.Add(CurrentTab);
     tabControl1.Dock = DockStyle.Fill;
     tabControl1.ContextMenuStrip = contextMenuTab;
     tabControl1.RefreshOptions(true);
     tabControl1.RowCountChanged += tabControl1_RowCountChanged;
     tabControl1.Deselecting += tabControl1_Deselecting;
     tabControl1.Selecting += tabControl1_Selecting;
     tabControl1.SelectedIndexChanged += tabControl1_SelectedIndexChanged;
     tabControl1.GotFocus += Controls_GotFocus;
     tabControl1.MouseEnter += tabControl1_MouseEnter;
     tabControl1.MouseLeave += tabControl1_MouseLeave;
     tabControl1.MouseDown += tabControl1_MouseDown;
     tabControl1.MouseUp += tabControl1_MouseUp;
     tabControl1.MouseMove += tabControl1_MouseMove;
     tabControl1.MouseDoubleClick += tabControl1_MouseDoubleClick;
     tabControl1.ItemDrag += tabControl1_ItemDrag;
     tabControl1.PointedTabChanged += tabControl1_PointedTabChanged;
     tabControl1.TabCountChanged += tabControl1_TabCountChanged;
     tabControl1.CloseButtonClicked += tabControl1_CloseButtonClicked;
     tabControl1.TabIconMouseDown += tabControl1_TabIconMouseDown;
     contextMenuTab.Items.Add(new ToolStripMenuItem());
     contextMenuTab.ShowImageMargin = false;
     contextMenuTab.ItemClicked += contextMenuTab_ItemClicked;
     contextMenuTab.Opening += contextMenuTab_Opening;
     contextMenuTab.Closed += contextMenuTab_Closed;
     contextMenuSys.Items.Add(new ToolStripMenuItem());
     contextMenuSys.ShowImageMargin = false;
     contextMenuSys.ItemClicked += contextMenuSys_ItemClicked;
     contextMenuSys.Opening += contextMenuSys_Opening;
     Controls.Add(tabControl1);
     if(flag) {
         Controls.Add(toolStrip);
     }
     MinSize = new Size(150, QTUtility.TabHeight + 2);
     Height = QTUtility.TabHeight + 2;
     ContextMenuStrip = contextMenuSys;
     MouseDoubleClick += QTTabBarClass_MouseDoubleClick;
     tabControl1.ResumeLayout(false);
     contextMenuSys.ResumeLayout(false);
     contextMenuTab.ResumeLayout(false);
     if(flag) {
         toolStrip.ResumeLayout(false);
         toolStrip.PerformLayout();
     }
     ResumeLayout(false);
 }
Exemplo n.º 13
0
 private void AppendUserApps(List<string> listDroppedPaths) {
     WindowUtils.BringExplorerToFront(ExplorerHandle);
     if(contextMenuDropped == null) {
         ToolStripMenuItem item = new ToolStripMenuItem();
         item.Tag = 1;
         contextMenuDropped = new ContextMenuStripEx(components, false);
         contextMenuDropped.SuspendLayout();
         contextMenuDropped.Items.Add(item);
         contextMenuDropped.Items.Add(new ToolStripMenuItem());
         contextMenuDropped.ShowImageMargin = false;
         contextMenuDropped.ItemClicked += contextMenuDropped_ItemClicked;
         contextMenuDropped.ResumeLayout(false);
     }
     string str = QTUtility.ResMain[0x15];
     str = str + ((listDroppedPaths.Count > 1) ? (listDroppedPaths.Count + QTUtility.ResMain[0x16]) : ("\"" + Path.GetFileName(listDroppedPaths[0]) + "\""));
     contextMenuDropped.SuspendLayout();
     contextMenuDropped.Items[0].Text = str;
     contextMenuDropped.Items[1].Text = QTUtility.ResMain[0x17];
     contextMenuDropped.Tag = listDroppedPaths;
     contextMenuDropped.ResumeLayout();
     contextMenuDropped.Show(MousePosition);
 }
Exemplo n.º 14
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(this.thumbnailTooltip != null) {
             this.thumbnailTooltip.Dispose();
             this.thumbnailTooltip = null;
         }
         if(this.subDirTip != null) {
             this.subDirTip.Dispose();
             this.subDirTip = null;
         }
         if(this.subDirTip_Tab != null) {
             this.subDirTip_Tab.Dispose();
             this.subDirTip_Tab = null;
         }
         if(this.IsShown) {
             if(this.pluginManager != null) {
                 this.pluginManager.Close(false);
                 this.pluginManager = null;
             }
             if(this.hHook_Key != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Key);
                 this.hHook_Key = IntPtr.Zero;
             }
             if(this.hHook_Mouse != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Mouse);
                 this.hHook_Mouse = IntPtr.Zero;
             }
             if(this.hHook_Msg != IntPtr.Zero) {
                 PInvoke.UnhookWindowsHookEx(this.hHook_Msg);
                 this.hHook_Msg = IntPtr.Zero;
             }
             if(this.explorerController != null) {
                 this.explorerController.ReleaseHandle();
                 this.explorerController = null;
             }
             if(this.shellViewController != null) {
                 this.shellViewController.ReleaseHandle();
                 this.shellViewController = null;
             }
             if(this.rebarController != null) {
                 this.rebarController.ReleaseHandle();
                 this.rebarController = null;
             }
             if(QTUtility.IsVista && (this.travelBtnController != null)) {
                 this.travelBtnController.ReleaseHandle();
                 this.travelBtnController = null;
             }
             if(dicNotifyIcon != null) {
                 dicNotifyIcon.Remove(this.ExplorerHandle);
             }
             if((hwndNotifyIconParent == this.ExplorerHandle) && (notifyIcon != null)) {
                 notifyIcon.Dispose();
                 notifyIcon = null;
                 contextMenuNotifyIcon.Dispose();
                 contextMenuNotifyIcon = null;
                 hwndNotifyIconParent = IntPtr.Zero;
                 if(dicNotifyIcon.Count > 0) {
                     foreach(IntPtr ptr in dicNotifyIcon.Keys) {
                         IntPtr tabBarHandle = QTUtility.instanceManager.GetTabBarHandle(ptr);
                         if(1 == ((int)QTUtility2.SendCOPYDATASTRUCT(tabBarHandle, (IntPtr)0x30, "createNI", IntPtr.Zero))) {
                             break;
                         }
                     }
                 }
             }
             using(RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar")) {
                 if(!QTUtility.CheckConfig(Settings.NoHistory)) {
                     foreach(QTabItem item in this.tabControl1.TabPages) {
                         AddToHistory(item);
                     }
                     QTUtility.SaveRecentlyClosed(key);
                 }
                 if(!QTUtility.CheckConfig(Settings.NoRecentFiles) && QTUtility.CheckConfig(Settings.AllRecentFiles)) {
                     QTUtility.SaveRecentFiles(key);
                 }
                 List<string> list = new List<string>();
                 foreach(QTabItem item2 in this.tabControl1.TabPages) {
                     if(item2.TabLocked) {
                         list.Add(item2.CurrentPath);
                     }
                 }
                 QTUtility2.WriteRegBinary<string>(list.ToArray(), "TabsLocked", key);
                 string str = string.Empty;
                 foreach(string str2 in QTUtility.StartUpGroupList) {
                     str = str + str2 + ";";
                 }
                 str = str.TrimEnd(QTUtility.SEPARATOR_CHAR);
                 key.SetValue("StartUpGroups", str);
                 if(QTUtility.instanceManager.RemoveInstance(this.ExplorerHandle, this)) {
                     QTUtility.instanceManager.NextInstanceExists();
                     QTUtility2.WriteRegHandle("Handle", key, QTUtility.instanceManager.CurrentHandle);
                 }
                 if(QTUtility.CheckConfig(Settings.SaveTransparency)) {
                     if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(this.ExplorerHandle, -20), 0x80000))) {
                         QTUtility.WindowAlpha = 0xff;
                     }
                     else {
                         byte num;
                         int num2;
                         int num3;
                         if(PInvoke.GetLayeredWindowAttributes(this.ExplorerHandle, out num2, out num, out num3)) {
                             QTUtility.WindowAlpha = num;
                         }
                         else {
                             QTUtility.WindowAlpha = 0xff;
                         }
                     }
                     key.SetValue("WindowAlpha", QTUtility.WindowAlpha);
                 }
                 IDLWrapper.SaveCache(key);
             }
             if((md5Form != null) && !md5Form.InvokeRequired) {
                 md5Form.SaveMD5FormStat();
                 md5Form.Dispose();
                 md5Form = null;
             }
             this.Cursor = Cursors.Default;
             if((this.curTabDrag != null) && (this.curTabDrag != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabDrag.Handle);
                 GC.SuppressFinalize(this.curTabDrag);
                 this.curTabDrag = null;
             }
             if((this.curTabCloning != null) && (this.curTabCloning != Cursors.Default)) {
                 PInvoke.DestroyIcon(this.curTabCloning.Handle);
                 GC.SuppressFinalize(this.curTabCloning);
                 this.curTabCloning = null;
             }
             if(this.dropTargetWrapper != null) {
                 this.dropTargetWrapper.Dispose();
                 this.dropTargetWrapper = null;
             }
             if((optionsDialog != null) && this.fOptionDialogCreated) {
                 this.fOptionDialogCreated = false;
                 try {
                     optionsDialog.Invoke(new MethodInvoker(this.odCallback_Close));
                 }
                 catch(Exception exception) {
                     QTUtility2.MakeErrorLog(exception, "optionDialogDisposing");
                 }
             }
             if(this.tabSwitcher != null) {
                 this.tabSwitcher.Dispose();
                 this.tabSwitcher = null;
             }
         }
         QTUtility.InstancesCount--;
         if(this.TravelLog != null) {
             Marshal.FinalReleaseComObject(this.TravelLog);
             this.TravelLog = null;
         }
         if(this.iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(this.iContextMenu2);
             this.iContextMenu2 = null;
         }
         if(this.ShellBrowser != null) {
             Marshal.FinalReleaseComObject(this.ShellBrowser);
             this.ShellBrowser = null;
         }
         foreach(ITravelLogEntry entry in this.LogEntryDic.Values) {
             if(entry != null) {
                 Marshal.FinalReleaseComObject(entry);
             }
         }
         this.LogEntryDic.Clear();
         if(this.bmpRebar != null) {
             this.bmpRebar.Dispose();
             this.bmpRebar = null;
         }
         if(this.textureBrushRebar != null) {
             this.textureBrushRebar.Dispose();
             this.textureBrushRebar = null;
         }
         base.fFinalRelease = true;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception2) {
         QTUtility2.MakeErrorLog(exception2, "tabbar closing");
     }
 }
Exemplo n.º 15
0
        private void AppendUserApps(IList<string> listDroppedPaths)
        {
            WindowUtils.BringExplorerToFront(ExplorerHandle);
            if(contextMenuDropped == null) {
                ToolStripMenuItem tsmiDropped = new ToolStripMenuItem { Tag = 1 };
                contextMenuDropped = new ContextMenuStripEx(components, false);
                contextMenuDropped.SuspendLayout();
                contextMenuDropped.Items.Add(tsmiDropped);
                contextMenuDropped.Items.Add(new ToolStripMenuItem());
                contextMenuDropped.ItemClicked += (sender, e) => {
                    if(e.ClickedItem.Tag != null)
                        AppsManager.CreateNewApp((List<string>)contextMenuDropped.Tag);
                };
                contextMenuDropped.ResumeLayout(false);
            }

            string strMenu = QTUtility.ResMain[21];
            strMenu += listDroppedPaths.Count > 1
                    ? listDroppedPaths.Count + QTUtility.ResMain[22] // "items"
                    : Path.GetFileName(listDroppedPaths[0]).Enquote();

            contextMenuDropped.SuspendLayout();
            contextMenuDropped.Items[0].Text = strMenu;
            contextMenuDropped.Items[1].Text = QTUtility.ResMain[23];			// Cancel
            contextMenuDropped.Tag = listDroppedPaths;
            contextMenuDropped.ResumeLayout();
            contextMenuDropped.Show(MousePosition);
        }