Beispiel #1
0
        protected override void WndProc(ref Message m) {
            int num3 = 0;
            int num4 = 0;
            switch(m.Msg) {
                case WM.INITMENUPOPUP:
                case WM.DRAWITEM:
                case WM.MEASUREITEM:
                    if((iContextMenu2 == null) || !(m.HWnd == Handle)) {
                        goto Label_08F8;
                    }
                    try {
                        iContextMenu2.HandleMenuMsg(m.Msg, m.WParam, m.LParam);
                    }
                    catch {
                    }
                    return;

                case WM.DROPFILES:
                    PInvoke.SendMessage(QTUtility.instanceManager.GetTabBarHandle(ExplorerHandle), 0x233, m.WParam, IntPtr.Zero);
                    return;

                case WM.APP:
                    m.Result = toolStrip.IsHandleCreated ? toolStrip.Handle : IntPtr.Zero;
                    return;

                case WM.COPYDATA: {
                        COPYDATASTRUCT copydatastruct = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
                        switch(((int)m.WParam)) {
                            case 1: {
                                    int num = ((int)copydatastruct.dwData) & 0xffff;
                                    int num2 = (((int)copydatastruct.dwData) >> 0x10) & 0xffff;
                                    if((num2 & 1) == 1) {
                                        EnableItemAt(3, (num & 1) == 1);
                                    }
                                    if((num2 & 2) == 2) {
                                        EnableItemAt(4, (num & 2) == 2);
                                    }
                                    if((num2 & 4) == 4) {
                                        EnableItemAt(5, (num & 4) == 4);
                                    }
                                    if((num2 & 8) == 8) {
                                        toolStrip.ShowItemToolTips = (num & 8) == 8;
                                    }
                                    if((num2 & 0x100) == 0x100) {
                                        ClearUserAppsMenu();
                                        CreateItems(false);
                                    }
                                    if((num2 & 0x200) == 0x200) {
                                        ClearUserAppsMenu();
                                    }
                                    return;
                                }
                            case 2:
                                num3 = ((int)copydatastruct.dwData) & 0xffff;
                                num4 = (((int)copydatastruct.dwData) >> 0x10) & 0xffff;
                                if((num4 & 1) == 1) {
                                    EnableItemAt(1, (num3 & 1) == 1);
                                }
                                if((num4 & 2) == 2) {
                                    EnableItemAt(2, (num3 & 2) == 2);
                                }
                                if(((num4 & 1) == 1) || ((num4 & 2) == 2)) {
                                    EnableItemAt(-1, ((num3 & 1) == 1) || ((num3 & 2) == 2));
                                }
                                if((num4 & 4) == 4) {
                                    EnableItemAt(14, (num3 & 4) == 4);
                                }
                                if((num4 & 8) == 8) {
                                    EnableItemAt(15, (num3 & 8) == 8);
                                }
                                if((num4 & 0x10) == 0x10) {
                                    EnableItemAt(12, (num3 & 0x10) == 0x10);
                                }
                                if((num4 & 0x20) == 0x20) {
                                    EnableItemAt(11, (num3 & 0x20) == 0x20);
                                }
                                if((num4 & 0x40) == 0x40) {
                                    foreach(ToolStripItem item in toolStrip.Items) {
                                        if((item.Tag != null) && (((int)item.Tag) == 10)) {
                                            ((ToolStripButton)item).Checked = (num3 & 0x40) == 0x40;
                                            break;
                                        }
                                    }
                                }
                                break;

                            case 3:
                            case 6:
                                return;

                            case 4:
                                if(DoItems((int)copydatastruct.dwData)) {
                                    m.Result = (IntPtr)1;
                                }
                                return;

                            case 5:
                                CreateItems(true);
                                menuLockItem.Checked = LockDropDownItems;
                                RefreshEnabledState(copydatastruct.dwData != IntPtr.Zero);
                                foreach(ToolStripItem item2 in toolStrip.Items) {
                                    if((item2.Tag != null) && (((int)item2.Tag) == 10)) {
                                        ((ToolStripButton)item2).Checked = PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 8) == new IntPtr(8);
                                        break;
                                    }
                                }
                                return;

                            case 7:
                                foreach(ToolStripItem item3 in toolStrip.Items) {
                                    if((item3.Tag != null) && (((int)item3.Tag) == 0x13)) {
                                        ((ToolStripTrackBar)item3).SetValueWithoutEvent((int)copydatastruct.dwData);
                                        break;
                                    }
                                }
                                return;

                            case 8:
                                if(searchBox != null) {
                                    searchBox.TextBox.Focus();
                                }
                                return;

                            case 9:
                                // TODO
                                RefreshSearchBox(false);
                                return;

                            case 10:
                                RefreshTexts();
                                return;

                            case 11:
                                if(pluginManager != null) {
                                    string pluginID = Marshal.PtrToStringAuto(copydatastruct.lpData);
                                    for(int i = 0; i < PluginManager.ActivatedButtonsOrder.Count; i++) {
                                        if(pluginID == PluginManager.ActivatedButtonsOrder[i]) {
                                            foreach(ToolStripItem item4 in toolStrip.Items) {
                                                if(((int)item4.Tag) == (0x10000 + i)) {
                                                    Plugin plugin;
                                                    int dwData = (int)copydatastruct.dwData;
                                                    bool flag = (dwData & 1) == 1;
                                                    bool flag2 = (dwData & 2) == 2;
                                                    item4.Enabled = flag;
                                                    if(!pluginManager.TryGetPlugin(pluginID, out plugin)) {
                                                        break;
                                                    }
                                                    IBarButton instance = plugin.Instance as IBarButton;
                                                    if(instance == null) {
                                                        break;
                                                    }
                                                    try {
                                                        item4.ToolTipText = instance.Text;
                                                        if(flag2) {
                                                            item4.Image = instance.GetImage(LargeButton);
                                                        }
                                                        break;
                                                    }
                                                    catch(Exception exception) {
                                                        PluginManager.HandlePluginException(exception, ExplorerHandle, plugin.PluginInformation.Name, "Refreshing plugin image and text.");
                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                return;

                            case 12:
                                contextMenu_ItemClicked(null, new ToolStripItemClickedEventArgs(menuCustomize));
                                return;

                            case 13:
                                if((iSearchResultCount > -1) && (iSearchResultCount != ((int)copydatastruct.dwData))) {
                                    RefreshSearchBox(true);
                                }
                                return;

                            case 14:
                                // TODO
                                if(iSearchResultCount > 0) {
                                    iSearchResultCount--;
                                }
                                return;

                            case 15:
                                if(searchBox != null) {
                                    searchBox.Width = SearchBoxWidth;
                                    toolStrip.RaiseOnResize();
                                }
                                return;

                            case 16: {
                                    if(searchBox == null) {
                                        m.Result = (IntPtr)1;
                                        return;
                                    }
                                    string str2 = Marshal.PtrToStringUni(copydatastruct.lpData);
                                    if(str2 == "null") {
                                        str2 = string.Empty;
                                    }
                                    searchBox.Focus();
                                    searchBox.Text = str2;
                                    m.Result = IntPtr.Zero;
                                    return;
                                }
                        }
                        break;
                    }
                case WM.CONTEXTMENU:
                    if((((ddmrGroupButton == null) || !ddmrGroupButton.Visible) && ((ddmrUserAppButton == null) || !ddmrUserAppButton.Visible)) && ((ddmrRecentlyClosed == null) || !ddmrRecentlyClosed.Visible)) {
                        Point p = QTUtility2.PointFromLPARAM(m.LParam);
                        if((p.X == -1) && (p.Y == -1)) {
                            QTUtility2.SendCOPYDATASTRUCT(QTUtility.instanceManager.GetTabBarHandle(ExplorerHandle), (IntPtr)0xffc, "btnCM", (IntPtr)1);
                            return;
                        }
                        if((toolStrip.GetItemAt(toolStrip.PointToClient(p)) != null) || (toolStrip.Items.Count == 0)) {
                            goto Label_08F8;
                        }
                        QTUtility2.SendCOPYDATASTRUCT(QTUtility.instanceManager.GetTabBarHandle(ExplorerHandle), (IntPtr)0xffc, "btnCM", IntPtr.Zero);
                    }
                    return;

                default:
                    goto Label_08F8;
            }
            if((num4 & 0x80) == 0x80) {
                EnableItemAt(0x10, (num3 & 0x80) == 0);
            }
            if(num4 == 0x100) {
                if(pluginManager == null) {
                    QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(ExplorerHandle);
                    if(tabBar != null) {
                        pluginManager = tabBar.PluginServerInstance;
                        if(pluginManager != null) {
                            pluginManager.AddRef();
                        }
                    }
                }
                CreateItems(false);
            }
            if((NavDropDown != null) && NavDropDown.Visible) {
                NavDropDown.Close(ToolStripDropDownCloseReason.AppClicked);
            }
            if((ddmrGroupButton != null) && ddmrGroupButton.Visible) {
                ddmrGroupButton.Close(ToolStripDropDownCloseReason.AppClicked);
            }
            if((ddmrRecentlyClosed != null) && ddmrRecentlyClosed.Visible) {
                ddmrRecentlyClosed.Close(ToolStripDropDownCloseReason.AppClicked);
            }
            if((ddmrUserAppButton != null) && ddmrUserAppButton.Visible) {
                ddmrUserAppButton.Close(ToolStripDropDownCloseReason.AppClicked);
            }
            return;
        Label_08F8:
            base.WndProc(ref m);
        }
 protected override void Dispose(bool disposing) {
     fntStartUpGroup.Dispose();
     sfPlugins.Dispose();
     cmsAddToken.Dispose();
     pluginManager = null;
     foreach(PluginAssembly assembly in lstPluginAssembliesUserAdded) {
         assembly.Dispose();
     }
     lstPluginAssembliesUserAdded.Clear();
     base.Dispose(disposing);
 }
 public OptionsDialog(PluginManager pluginManager, FormMethodInvoker callBack) {
     InitializeStaticFields();
     this.pluginManager = pluginManager;
     this.callBack = callBack;
     InitializeComponent();
     tabImageSetting = new TabImageSetting();
     propertyGrid1.SelectedObject = tabImageSetting;
     propertyGrid1.ExpandAllGridItems();
     fntStartUpGroup = new Font(treeViewGroup.Font, FontStyle.Underline);
     sfPlugins = new StringFormat(StringFormatFlags.NoWrap);
     sfPlugins.Alignment = StringAlignment.Near;
     sfPlugins.LineAlignment = StringAlignment.Center;
     SuspendLayout();
     lblVer.Text = "QTTabBar " + QTUtility2.MakeVersionString();
     tabPage1_Gnrl.Text = ResOpt_Genre[0];
     tabPage2_Tabs.Text = ResOpt_Genre[1];
     tabPage3_Wndw.Text = ResOpt_Genre[2];
     tabPage4_View.Text = ResOpt_Genre[3];
     tabPage5_Grps.Text = ResOpt_Genre[4];
     tabPage6_Apps.Text = ResOpt_Genre[5];
     tabPage7_Plug.Text = ResOpt_Genre[6];
     tabPage8_Keys.Text = ResOpt_Genre[7];
     tabPage9_Misc.Text = ResOpt_Genre[8];
     tabPageA_Path.Text = ResOpt_Genre[9];
     string[] strArray = QTUtility.TextResourcesDic["DialogButtons"];
     btnOK.Text = strArray[0];
     btnCancel.Text = strArray[1];
     btnApply.Text = strArray[2];
     chbActivateNew.Text = ResOpt[0];
     chbDontOpenSame.Text = ResOpt[1];
     chbCloseWhenGroup.Text = ResOpt[2];
     chbShowTooltip.Text = ResOpt[3];
     chbX1X2.Text = ResOpt[4];
     chbNavBtn.Text = ResOpt[5];
     chbNoHistory.Text = ResOpt[6];
     chbSaveExecuted.Text = ResOpt[7];
     chbDD.Text = ResOpt[8];
     lblLang.Text = ResOpt[9];
     lblNewTabLoc.Text = ResOpt[10];
     lblActvClose.Text = ResOpt[11];
     lblTabDblClk.Text = ResOpt[12];
     lblBGDblClik.Text = ResOpt[13];
     lblAction_BarDblClick.Text = ResOpt[14];
     lblMultiRows.Text = ResOpt[15];
     chbAutoSubText.Text = ResOpt[0x10];
     chbWhlClick.Text = ResOpt[0x11];
     chbNCADblClck.Text = ResOpt[0x12];
     chbWndUnresizable.Text = ResOpt[0x13];
     chbWndRestrAlpha.Text = ResOpt[20];
     chbBlockProcess.Text = ResOpt[0x15];
     chbFoldrTree.Text = ResOpt[0x16];
     chbNoTabFromOuteside.Text = ResOpt[0x17];
     chbHolizontalScroll.Text = ResOpt[0x18];
     chbWhlChangeView.Text = ResOpt[0x19];
     chbNeverCloseWindow.Text = ResOpt[0x1a];
     chbNeverCloseWndLocked.Text = ResOpt[0x1b];
     chbRestoreClosed.Text = ResOpt[0x1c];
     chbRestoreLocked.Text = ResOpt[0x1d];
     chbUseTabSkin.Text = ResOpt[30];
     btnHiliteClsc.Text = ResOpt[0x1f];
     lblTabSizeTitle.Text = ResOpt[0x20];
     lblTabWidth.Text = ResOpt[0x21];
     lblTabHeight.Text = ResOpt[0x22];
     lblTabWFix.Text = ResOpt_DropDown[0x18];
     lblTabWMax.Text = ResOpt[0x23];
     lblTabWMin.Text = ResOpt[0x24];
     lblTabFont.Text = ResOpt[0x25];
     btnTabFont.Text = ResOpt[0x25];
     chbBoldActv.Text = ResOpt[0x26];
     lblTabTxtClr.Text = ResOpt[0x27];
     btnActTxtClr.Text = ResOpt[40];
     btnShadowAct.Text = ResOpt[40];
     btnInactTxtClr.Text = ResOpt[0x29];
     btnShadowIna.Text = ResOpt[0x29];
     btnDefTxtClr.Text = ResOpt[0x2a];
     chbToolbarBGClr.Text = btnToolBarBGClr.Text = ResOpt[0x2b];
     chbFolderIcon.Text = ResOpt[0x2c];
     lblUserApps_Path.Text = ResOpt[0x2d] + ":";
     lblUserApps_Args.Text = ResOpt[0x2e] + ":";
     lblUserApps_Working.Text = ResOpt[0x2f] + ":";
     lblUserApps_Key.Text = ResOpt_Genre[7] + ":";
     lblGroupKey.Text = ResOpt_Genre[7] + ":";
     lblPluginLang.Text = ResOpt[0x30];
     chbHideMenu.Text = ResOpt[0x31];
     chbBSUpOneLvl.Text = ResOpt[50];
     chbNoFulRowSelect.Text = ResOpt[0x33];
     chbGridLine.Text = ResOpt[0x34];
     chbAlternateColor.Text = ResOpt[0x35];
     chbShowPreview.Text = ResOpt[0x36];
     chbPreviewMode.Text = ResOpt[0x37];
     chbSubDirTip.Text = ResOpt[0x38];
     chbSubDirTipMode.Text = ResOpt[0x37];
     chbSubDirTipModeHidden.Text = ResOpt[0x39];
     chbSubDirTipPreview.Text = ResOpt[0x36];
     chbSubDirTipModeFile.Text = ResOpt[0x3a];
     chbSelectWithoutExt.Text = ResOpt[0x3b];
     chbSubDirTipModeSystem.Text = ResOpt[60];
     chbSendToTray.Text = ResOpt[0x3d];
     lblPreviewWidth.Text = ResOpt[0x3e];
     lblPreviewHeight.Text = ResOpt[0x3f];
     chbRebarBGImage.Text = ResOpt[0x40];
     chbF2Selection.Text = ResOpt[0x41];
     chbTabCloseButton.Text = ResOpt[0x42];
     lblTabWhlClk.Text = ResOpt[0x43];
     chbSubDirTipOnTab.Text = ResOpt[0x44];
     clmnHeader_NoCapture.Text = ResOpt[0x45];
     chbTabCloseBtnAlt.Text = ResOpt[70];
     chbTabCloseBtnHover.Text = ResOpt[0x47];
     btnExportSettings.Text = ResOpt[0x48];
     chbCursorLoop.Text = ResOpt[0x49];
     lblNetworkTimeOut.Text = ResOpt[0x4a];
     chbSendToTrayOnMinimize.Text = ResOpt[0x4b];
     btnPreviewFont.Text = ResOpt[0x25];
     lblTabTextAlignment.Text = ResOpt[0x4c];
     lblMenuRenderer.Text = ResOpt[0x4d];
     string[] strArray2 = QTUtility.TextResourcesDic["TabBar_Option2"];
     chbTreeShftWhlTab.Text = strArray2[0];
     chbTabSwitcher.Text = strArray2[1];
     chbTabTitleShadow.Text = strArray2[2];
     chbAutoUpdate.Text = strArray2[3];
     chbRemoveOnSeparate.Text = strArray2[4];
     chbDriveLetter.Text = strArray2[5];
     chbPlaySound.Text = strArray2[6];
     btnBrowsePlugin.Text = strArray2[7];
     PluginView.BTN_OPTION = strArray2[8];
     PluginView.BTN_DISABLE = strArray2[9];
     PluginView.BTN_ENABLE = strArray2[10];
     PluginView.BTN_REMOVE = strArray2[11];
     PluginView.MNU_PLUGINABOUT = strArray2[12];
     RES_REMOVEPLGIN = strArray2[13];
     chbPreviewInfo.Text = strArray2[14];
     chbForceSysListView.Text = strArray2[15];
     chbAlwaysShowHeader.Text = strArray2[16];
     string[] strArray3 = QTUtility.TextResourcesDic["TabBar_Option_Buttons"];
     btnHistoryClear.Text = btnClearRecentFile.Text = strArray3[0];
     btnUp_Grp.Text = strArray3[1];
     btnUp_app.Text = strArray3[1];
     btnDown_Grp.Text = strArray3[2];
     btnDown_app.Text = strArray3[2];
     btnAddSep_Grp.Text = strArray3[3];
     btnAddSep_app.Text = strArray3[3];
     btnStartUpGrp.Text = strArray3[4];
     btnAlternateColor.Text = strArray3[6];
     btnAlternateColor_Text.Text = strArray3[7];
     btnAlternate_Default.Text = strArray3[8];
     btnDefaultTextExt.Text = strArray3[8];
     btnDefaultImgExt.Text = strArray3[8];
     btnPreviewFontDefault.Text = strArray3[8];
     btnAddTextExt.Text = strArray3[9];
     btnAddImgExt.Text = strArray3[9];
     btnDelTextExt.Text = strArray3[10];
     btnDelImgExt.Text = strArray3[10];
     btnCheckUpdates.Text = strArray3[11];
     btnCopyKeys.Text = strArray3[12];
     cmbNavBtn.Items.AddRange(new string[] { ResOpt_DropDown[0], ResOpt_DropDown[1] });
     cmbNewTabLoc.Items.AddRange(new string[] { ResOpt_DropDown[2], ResOpt_DropDown[3], ResOpt_DropDown[1], ResOpt_DropDown[0] });
     cmbActvClose.Items.AddRange(new string[] { ResOpt_DropDown[1], ResOpt_DropDown[0], ResOpt_DropDown[2], ResOpt_DropDown[3], ResOpt_DropDown[4] });
     cmbTabDblClck.Items.AddRange(new string[] { ResOpt_DropDown[5], ResOpt_DropDown[6], ResOpt_DropDown[7], ResOpt_DropDown[8], ResOpt_DropDown[9], ResOpt_DropDown[10], ResOpt_DropDown[11], ResOpt_DropDown[12], ResOpt_DropDown[13] });
     cmbBGDblClick.Items.AddRange(new string[] { ResOpt_DropDown[14], ResOpt_DropDown[5], ResOpt_DropDown[15], ResOpt_DropDown[0x10], ResOpt_DropDown[8], ResOpt_DropDown[0x11], ResOpt_DropDown[0x12], ResOpt_DropDown[0x13], ResOpt_DropDown[20], ResOpt_DropDown[0x16], ResOpt_DropDown[9], ResOpt_DropDown[4], ResOpt_DropDown[13] });
     cmbTabWhlClck.Items.AddRange(new string[] { ResOpt_DropDown[6], ResOpt_DropDown[5], ResOpt_DropDown[7], ResOpt_DropDown[8], ResOpt_DropDown[9], ResOpt_DropDown[10], ResOpt_DropDown[11], ResOpt_DropDown[12], ResOpt_DropDown[13] });
     cmbMultiRow.Items.AddRange(new string[] { ResOpt_DropDown[13], ResOpt_DropDown[0x15] + "1", ResOpt_DropDown[0x15] + "2" });
     cmbWhlClick.Items.AddRange(new string[] { ResOpt_DropDown[0x16], ResOpt_DropDown[9] });
     cmbTabSizeMode.Items.AddRange(new string[] { ResOpt_DropDown[0x17], ResOpt_DropDown[0x18], ResOpt_DropDown[0x19] });
     cmbTabTextAlignment.Items.AddRange(new string[] { ResOpt_DropDown[0x1d], ResOpt_DropDown[30] });
     cmbTextExts.Items.Add("(Text file)");
     cmbTextExts.Items.AddRange(QTUtility.PreviewExtsList_Txt.ToArray());
     cmbTextExts.SelectedIndex = 0;
     cmbImgExts.Items.Add("(Image & movie file)");
     cmbImgExts.Items.AddRange(QTUtility.PreviewExtsList_Img.ToArray());
     cmbImgExts.SelectedIndex = 0;
     cmbRebarBGImageMode.Items.AddRange(new string[] { ResOpt_DropDown[0x1a], ResOpt_DropDown[0x1b], ResOpt_DropDown[0x1c], ResOpt_DropDown[0x21] });
     cmbMenuRenderer.Items.AddRange(new string[] { ResOpt[0x2a], ResOpt_DropDown[0x1f], ResOpt_DropDown[0x20] });
     if(arrSpecialFolderCSIDLs == null) {
         if(!QTUtility.IsXP) {
             arrSpecialFolderCSIDLs = new int[] { 
     0x11, 0, 10, 3, 0x12, 0x31, 4, 5, 0x27, 13, 14, 6, 0x1a, 40, 0x20, 0x21, 
     8, 0x22
    };
         }
         else {
             arrSpecialFolderCSIDLs = new int[] { 0x11, 0, 10, 3, 0x12, 0x31, 4, 5, 0x27, 6, 0x1a, 40, 0x20, 0x21, 8, 0x22 };
         }
         arrSpecialFolderDipNms = new string[arrSpecialFolderCSIDLs.Length];
         for(int i = 0; i < arrSpecialFolderCSIDLs.Length; i++) {
             arrSpecialFolderDipNms[i] = ShellMethods.GetSpecialFolderCLSID(arrSpecialFolderCSIDLs[i], true);
         }
     }
     cmbSpclFol_NoCapture.Items.AddRange(arrSpecialFolderDipNms);
     cmbSpclFol_NoCapture.SelectedIndex = 0;
     cmbSpclFol_Grp.Items.AddRange(arrSpecialFolderDipNms);
     cmbSpclFol_Grp.SelectedIndex = 0;
     using(RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Quizo\QTTabBar")) {
         if(key != null) {
             int[] numArray = QTUtility2.ReadRegBinary<int>("OptionWindowBounds", key);
             if((numArray != null) && (numArray.Length == 4)) {
                 StartPosition = FormStartPosition.Manual;
                 SetDesktopBounds(numArray[0], numArray[1], numArray[2], numArray[3]);
             }
         }
     }
     SetValues();
     tabControl1.SelectedIndex = QTUtility.OptionsDialogTabIndex;
     ResumeLayout();
 }
 protected override void Dispose(bool disposing) {
     if(this.imageStripLarge != null) {
         this.imageStripLarge.Dispose();
         this.imageStripLarge = null;
     }
     if(this.imageStripSmall != null) {
         this.imageStripSmall.Dispose();
         this.imageStripSmall = null;
     }
     this.pluginManager = null;
     base.Dispose(disposing);
 }
 public ButtonBarOptionForm(int[] currentItemIndexes, bool fLargeIcon, string currentImagePath, PluginManager pluginManager) {
     this.InitializeComponent();
     this.fLargeIcon = fLargeIcon;
     this.pluginManager = pluginManager;
     this.ButtonItemsDisplayName = QTUtility.TextResourcesDic["ButtonBar_BtnName"];
     string[] strArray = QTUtility.TextResourcesDic["ButtonBar_Option"];
     string[] strArray2 = QTUtility.TextResourcesDic["DialogButtons"];
     this.buttonOK.Text = strArray2[0];
     this.buttonCancel.Text = strArray2[1];
     this.buttonRestoreDefault.Text = strArray[3];
     this.buttonUp.Text = strArray[4];
     this.buttonDown.Text = strArray[5];
     this.buttonBrowseImage.Text = strArray[6];
     this.buttonResetImage.Text = strArray[11];
     this.comboBoxImageSize.Items.AddRange(new string[] { strArray[7], strArray[8] });
     this.comboBoxImageText.Items.AddRange(new string[] { strArray[12], strArray[13], strArray[14] });
     this.chbLockSearchBox.Text = strArray[15];
     this.comboBoxImageSize.SelectedIndex = this.fLargeIcon ? 1 : 0;
     if((QTButtonBar.ConfigValues[0] & 0x20) == 0x20) {
         this.comboBoxImageText.SelectedIndex = ((QTButtonBar.ConfigValues[0] & 0x10) == 0x10) ? 1 : 0;
     }
     else {
         this.comboBoxImageText.SelectedIndex = 2;
     }
     this.comboBoxImageSize.SelectedIndexChanged += new EventHandler(this.comboBoxes_ImageSizeAndText_SelectedIndexChanged);
     this.comboBoxImageText.SelectedIndexChanged += new EventHandler(this.comboBoxes_ImageSizeAndText_SelectedIndexChanged);
     this.chbLockSearchBox.Checked = (QTButtonBar.ConfigValues[0] & 8) != 0;
     this.InitializeImages(currentImagePath, true);
     List<PluginInformation> list = new List<PluginInformation>();
     for(int i = 0; i < currentItemIndexes.Length; i++) {
         if(currentItemIndexes[i] >= 0x10000) {
             int count = list.Count;
             if(PluginManager.ActivatedButtonsOrder.Count > count) {
                 string key = PluginManager.ActivatedButtonsOrder[count];
                 foreach(PluginInformation information in PluginManager.PluginInformations) {
                     if(!(key == information.PluginID)) {
                         continue;
                     }
                     list.Add(information);
                     if(information.PluginType == PluginType.BackgroundMultiple) {
                         int num3;
                         if(this.dicActivePluginMulti.TryGetValue(key, out num3)) {
                             this.dicActivePluginMulti[key] = num3 + 1;
                         }
                         else {
                             this.dicActivePluginMulti[key] = 1;
                         }
                         this.listBoxCurrent.Items.Add(information.Clone(num3));
                     }
                     else {
                         this.listBoxCurrent.Items.Add(information);
                     }
                     break;
                 }
             }
         }
         else if(currentItemIndexes[i] != 0x15) {
             this.listBoxCurrent.Items.Add(currentItemIndexes[i]);
         }
     }
     this.listBoxPool.Items.Add(0);
     for(int j = 1; j < this.ButtonItemsDisplayName.Length; j++) {
         if(Array.IndexOf<int>(currentItemIndexes, j) == -1) {
             this.listBoxPool.Items.Add(j);
         }
     }
     foreach(PluginInformation information2 in PluginManager.PluginInformations) {
         if((information2.Enabled && (information2.PluginType == PluginType.Interactive)) && !list.Contains(information2)) {
             this.listBoxPool.Items.Add(information2);
         }
     }
     if(this.pluginManager != null) {
         foreach(Plugin plugin in this.pluginManager.Plugins) {
             if(plugin.PluginInformation.PluginType == PluginType.BackgroundMultiple) {
                 IBarMultipleCustomItems instance = plugin.Instance as IBarMultipleCustomItems;
                 if(instance != null) {
                     try {
                         int num5 = instance.Count;
                         if(num5 > 0) {
                             int num6;
                             this.dicActivePluginMulti.TryGetValue(plugin.PluginInformation.PluginID, out num6);
                             for(int k = 0; k < (num5 - num6); k++) {
                                 this.listBoxPool.Items.Add(plugin.PluginInformation.Clone(num6 + k));
                             }
                         }
                         else if(num5 == -1) {
                             this.listBoxPool.Items.Add(plugin.PluginInformation.Clone(-1));
                         }
                     }
                     catch(Exception exception) {
                         PluginManager.HandlePluginException(exception, IntPtr.Zero, plugin.PluginInformation.Name, "Adding multi items to pool.");
                     }
                 }
                 continue;
             }
             if(plugin.BackgroundButtonSupported && !plugin.BackgroundButtonEnabled) {
                 this.listBoxPool.Items.Add(plugin.PluginInformation);
             }
         }
     }
 }
        private void InitializeOpenedWindow() {
            IsShown = true;
            QTUtility.RegisterPrimaryInstance(ExplorerHandle, this);
            InstallHooks();
            pluginManager = new PluginManager(this);
            if(!SyncButtonBarCurrent(0x100)) {
                new WaitTimeoutCallback(WaitTimeout).BeginInvoke(0x7d0, AsyncComplete_ButtonBarPlugin, null);
            }
            if(QTUtility.CheckConfig(Settings.SaveTransparency) && (QTUtility.WindowAlpha < 0xff)) {
                PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_OR(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000));
                PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, QTUtility.WindowAlpha, 2);
            }

            listViewManager = new ListViewMonitor(ShellBrowser, ExplorerHandle, Handle);
            listViewManager.ListViewChanged += ListViewMonitor_ListViewChanged;
            listViewManager.Initialize();

            IntPtr hwndBreadcrumbBar = WindowUtils.FindChildWindow(ExplorerHandle, hwnd => PInvoke.GetClassName(hwnd) == "Breadcrumb Parent");
            if(hwndBreadcrumbBar != IntPtr.Zero) {
                hwndBreadcrumbBar = PInvoke.FindWindowEx(hwndBreadcrumbBar, IntPtr.Zero, "ToolbarWindow32", null);
                if(hwndBreadcrumbBar != IntPtr.Zero) {
                    breadcrumbBar = new BreadcrumbBar(hwndBreadcrumbBar);
                    breadcrumbBar.MiddleClicked += FolderMiddleClicked;
                }
            }
        }
 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");
     }
 }
        private void InitializeOpenedWindow() {
            IsShown = true;
            QTUtility.RegisterPrimaryInstance(ExplorerHandle, this);
            InstallHooks();
            pluginManager = new PluginManager(this);
            if(!SyncButtonBarCurrent(0x100)) {
                new WaitTimeoutCallback(WaitTimeout).BeginInvoke(0x7d0, AsyncComplete_ButtonBarPlugin, null);
            }
            if(QTUtility.CheckConfig(Settings.HideMenuBar)) {
                WindowUtils.ShowMenuBar(false, ReBarHandle);
            }
            if(QTUtility.CheckConfig(Settings.SaveTransparency) && (QTUtility.WindowAlpha < 0xff)) {
                PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_OR(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000));
                PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, QTUtility.WindowAlpha, 2);
            }

            listViewManager = new ListViewMonitor(ShellBrowser, ExplorerHandle, Handle);
            listViewManager.ListViewChanged += ListViewMonitor_ListViewChanged;
            listViewManager.Initialize();
        }
 public PluginServer(QTTabBarClass tabBar, PluginManager manager) {
     this.tabBar = tabBar;
     shellBrowser = (QTPlugin.Interop.IShellBrowser)this.tabBar.ShellBrowser.GetIShellBrowser();
     pluginManager = manager;
     if((QTUtility.Path_PluginLangFile.Length > 0) && File.Exists(QTUtility.Path_PluginLangFile)) {
         dicLocalizingStrings = QTUtility.ReadLanguageFile(QTUtility.Path_PluginLangFile);
     }
     if(dicLocalizingStrings == null) {
         dicLocalizingStrings = new Dictionary<string, string[]>();
     }
 }
 public void Dispose() {
     this.tabBar = null;
     this.pluginManager = null;
     this.shellBrowser = null;
 }
 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");
     }
 }
        private void InitializeOpenedWindow() {
            this.IsShown = true;
            QTUtility.RegisterPrimaryInstance(this.ExplorerHandle, this);
            this.InstallHooks();
            this.pluginManager = new PluginManager(this);
            if(!this.SyncButtonBarCurrent(0x100)) {
                new WaitTimeoutCallback(QTTabBarClass.WaitTimeout).BeginInvoke(0x7d0, new AsyncCallback(this.AsyncComplete_ButtonBarPlugin), null);
            }
            if(QTUtility.CheckConfig(Settings.HideMenuBar)) {
                WindowUtils.ShowMenuBar(false, base.ReBarHandle);
            }
            if(QTUtility.CheckConfig(Settings.SaveTransparency) && (QTUtility.WindowAlpha < 0xff)) {
                PInvoke.SetWindowLongPtr(this.ExplorerHandle, -20, PInvoke.Ptr_OP_OR(PInvoke.GetWindowLongPtr(this.ExplorerHandle, -20), 0x80000));
                PInvoke.SetLayeredWindowAttributes(this.ExplorerHandle, 0, QTUtility.WindowAlpha, 2);
            }

            listViewWrapper = new ListViewWrapper(ShellBrowser, ExplorerHandle);
            listViewWrapper.SVDestroy       += ListView_SVDestroy;
            listViewWrapper.SVMouseActivate += ListView_SVMouseActivate;
            listViewWrapper.ItemInserted    += ListView_ItemInserted;
            listViewWrapper.ItemDeleted     += ListView_ItemDeleted;
            listViewWrapper.ItemActivated   += ListView_ItemActivated;
            listViewWrapper.AllItemsDeleted += ListView_AllItemsDeleted;
            listViewWrapper.SelectionChanged+= ListView_SelectionChanged;
            listViewWrapper.BeginDrag       += ListView_BeginDrag;
            listViewWrapper.DropHilighted   += ListView_DropHilighted;
            listViewWrapper.HotTrack        += ListView_HotTrack;
            listViewWrapper.MiddleClick     += ListView_MiddleClick;
            listViewWrapper.DoubleClick     += ListView_DoubleClick;
            listViewWrapper.KeyDown         += ListView_KeyDown;
            listViewWrapper.GetInfoTip      += ListView_GetInfoTip;
            listViewWrapper.BeginLabelEdit  += ListView_BeginLabelEdit;
            listViewWrapper.EndLabelEdit    += ListView_EndLabelEdit;
            listViewWrapper.BeginScroll     += ListView_BeginScroll;
            listViewWrapper.MouseLeave      += ListView_MouseLeave;
            
        }
Beispiel #13
0
 protected override void OnExplorerAttached() {
     this.ExplorerHandle = (IntPtr)base.Explorer.HWND;
     QTUtility.instanceManager.AddButtonBarHandle(this.ExplorerHandle, base.Handle);
     this.dropTargetWrapper = new DropTargetWrapper(this);
     if(fNoSettings) {
         if(this.pluginManager == null) {
             QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(this.ExplorerHandle);
             if(tabBar != null) {
                 this.pluginManager = tabBar.PluginServerInstance;
                 if(this.pluginManager != null) {
                     this.pluginManager.AddRef();
                 }
             }
             this.CreateItems(false);
         }
         fNoSettings = false;
     }
 }
Beispiel #14
0
        /// <summary>
        /// 加载一个默认的 插件, 如果存在的话! TODO
        /// </summary>
        private static void InitDefaultQTConfigPlugin()
        {
            ///////////// add default plugin by qwop 2012-07-10////////////////
            // the program data 's default plugin.
            string defaultQtConfigPath = Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTQuick.dll";
            string turnOffRepeatPath   = Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\TurnOffRepeat.dll";

            string[] plugins = new string[] {
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTQuick.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\TurnOffRepeat.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\CreateNewItem.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\FolderTreeButton.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\Memo.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\MigemoLoader.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTClock.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTFileTools.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTViewModeButton.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\QTWindowManager.dll",
                // Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\SampleSplitButton.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\ShowStatusBar.dll",
                Environment.GetEnvironmentVariable("ProgramData") + @"\QTTabBar\ActivateByMouseHover.dll"
            };

            List <string> lists = new List <string>();

            foreach (string plugin in plugins)
            {
                if (File.Exists(plugin))
                {
                    lists.Add(plugin);
                }
            }

            /* Config.BBar.ActivePluginIDs = new string[] { "QTConfig1.0.0.0(9CD80883)+Qwop.QTConfigPluginButton" };
             * Config.BBar.ButtonIndexes = QTUtility.IsXP
             *      ? new int[] { 1, 2, 0, 3, 4, 5, 0, 6, 7, 0, 11, 13, 12, 14, 15, 0, 65536, 9, 20 }
             *      : new System.Int32[] { 3, 4, 5, 0, 6, 7, 0, 17, 11, 12, 14, 15, 13, 0, 65536, 9, 19, 10 };
             */

            /*
             * if (File.Exists(defaultQtConfigPath))
             * {
             *  // plugin.
             *
             *
             * //  List<string> lists = new string[] { defaultQtConfigPath }.ToList();
             *  lists.Add(defaultQtConfigPath);
             * }
             *
             *
             * if (File.Exists(turnOffRepeatPath))
             * {
             *  lists.Add(turnOffRepeatPath);
             * }
             */

            if (lists.Count > 0)
            {
                PluginManager.SavePluginAssemblyPaths(lists);
            }
        }
Beispiel #15
0
 public override void CloseDW(uint dwReserved) {
     try {
         if(pluginManager != null) {
             pluginManager.Close(true);
             pluginManager = null;
         }
         if(iContextMenu2 != null) {
             Marshal.FinalReleaseComObject(iContextMenu2);
             iContextMenu2 = null;
         }
         foreach(IntPtr ptr in lstPUITEMIDCHILD) {
             if(ptr != IntPtr.Zero) {
                 PInvoke.CoTaskMemFree(ptr);
             }
         }
         if(dropTargetWrapper != null) {
             dropTargetWrapper.Dispose();
             dropTargetWrapper = null;
         }
         QTUtility.instanceManager.RemoveButtonBarHandle(ExplorerHandle);
         fFinalRelease = false;
         base.CloseDW(dwReserved);
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, "buttonbar closing");
     }
 }
 public void Dispose() {
     tabBar = null;
     pluginManager = null;
     shellBrowser = null;
 }
Beispiel #17
0
        protected override void OnExplorerAttached() {
            ExplorerHandle = (IntPtr)Explorer.HWND;
            QTUtility.instanceManager.AddButtonBarHandle(ExplorerHandle, Handle);
            dropTargetWrapper = new DropTargetWrapper(this);
            QTTabBarClass tabBar = QTUtility.instanceManager.GetTabBar(ExplorerHandle);

            // If the TabBar and its PluginManager already exist, that means
            // the ButtonBar must have been closed when the Explorer window
            // opened, so we wont' get an initialization message.  Do 
            // initialization now.
            if(fNoSettings || (tabBar != null && tabBar.PluginServerInstance != null)) {
                if(pluginManager == null) {
                    if(tabBar != null) {
                        pluginManager = tabBar.PluginServerInstance;
                        if(pluginManager != null) {
                            pluginManager.AddRef();
                        }
                    }
                    CreateItems(false);
                }
                fNoSettings = false;
            }
        }
        public override void InitializeConfig()
        {
            // Initialize the button bar tab.
            imageStripLarge = new ImageStrip(new Size(24, 24));
            imageStripSmall = new ImageStrip(new Size(16, 16));
            if (null != WorkingConfig.bbar.ImageStripPath && WorkingConfig.bbar.ImageStripPath.Length > 0)
            {
                Bitmap bitmap;
                Bitmap bitmap2;
                if (LoadExternalImage(WorkingConfig.bbar.ImageStripPath, out bitmap, out bitmap2))
                {
                    imageStripLarge.AddStrip(bitmap);
                    imageStripSmall.AddStrip(bitmap2);
                    bitmap.Dispose();
                    bitmap2.Dispose();
                    if (Path.GetExtension(WorkingConfig.bbar.ImageStripPath).PathEquals(".bmp"))
                    {
                        imageStripLarge.TransparentColor = imageStripSmall.TransparentColor = Color.Magenta;
                    }
                    else
                    {
                        imageStripLarge.TransparentColor = imageStripSmall.TransparentColor = Color.Empty;
                    }
                }
            }
            else
            {
                using (Bitmap b = Resources_Image.ButtonStrip24)
                {
                    imageStripLarge.AddStrip(b);
                }
                imageStripSmall = new ImageStrip(new Size(16, 16));
                using (Bitmap b = Resources_Image.ButtonStrip16)
                {
                    imageStripSmall.AddStrip(b);
                }
            }

            ButtonPool     = new ObservableCollection <ButtonEntry>();
            CurrentButtons = new ObservableCollection <ButtonEntry>();

            // Create a list of all the plugin buttons.
            int order            = QTButtonBar.INTERNAL_BUTTON_COUNT;
            var lstPluginIDs     = new List <string>();
            var dicPluginButtons = new Dictionary <string, ButtonEntry[]>();

            foreach (PluginInformation pi in PluginManager.PluginInformations.Where(pi => pi.Enabled).OrderBy(pi => pi.Name))
            {
                if (pi.PluginType == PluginType.Interactive)
                {
                    lstPluginIDs.Add(pi.PluginID);
                    dicPluginButtons[pi.PluginID] = new ButtonEntry[] { new ButtonEntry(this, order++, 0, pi) };
                }
                else if (pi.PluginType == PluginType.BackgroundMultiple)
                {
                    Plugin plugin;
                    if (PluginManager.TryGetStaticPluginInstance(pi.PluginID, out plugin))
                    {
                        IBarMultipleCustomItems bmci = plugin.Instance as IBarMultipleCustomItems;
                        try {
                            if (bmci != null && bmci.Count > 0)
                            {
                                lstPluginIDs.Add(pi.PluginID);
                                dicPluginButtons[pi.PluginID] =
                                    bmci.Count.RangeSelect(i => new ButtonEntry(this, order++, i, pi)).ToArray();
                            }
                        }
                        catch { }
                    }
                }
            }

            // Add the current buttons (right pane)
            foreach (int i in WorkingConfig.bbar.ButtonIndexes)
            {
                int pluginIndex = i.HiWord() - 1;
                if (pluginIndex >= 0)
                {
                    string        id = WorkingConfig.bbar.ActivePluginIDs[pluginIndex];
                    ButtonEntry[] buttons;
                    if (dicPluginButtons.TryGetValue(id, out buttons) && i.LoWord() < buttons.Length)
                    {
                        CurrentButtons.Add(buttons[i.LoWord()]);
                    }
                }
                else
                {
                    CurrentButtons.Add(new ButtonEntry(this, i, i));
                }
            }

            // Add the rest of the buttons to the button pool (left pane)
            ButtonPool.Add(new ButtonEntry(this, 0, QTButtonBar.BII_SEPARATOR));
            for (int i = 1; i < QTButtonBar.INTERNAL_BUTTON_COUNT; i++)
            {
                if (!WorkingConfig.bbar.ButtonIndexes.Contains(i))
                {
                    ButtonPool.Add(new ButtonEntry(this, i, i));
                }
            }

            foreach (ButtonEntry entry in lstPluginIDs.SelectMany(pid => dicPluginButtons[pid]).Except(CurrentButtons))
            {
                ButtonPool.Add(entry);
            }
            lstButtonBarPool.ItemsSource    = ButtonPool;
            lstButtonBarCurrent.ItemsSource = CurrentButtons;
        }