Exemple #1
0
        internal static void CheckSearchReplacePanel(Form1 form, bool makeVisible, bool refreshConfig)
        {
            ToolStripButton showSearchPanelToolStripButton = form.showSearchPanelToolStripButton;
            //ToolStripMenuItem showSearchPanelToolStripMenuItem = form.showSearchPanelToolStripMenuItem;
            Panel             searchReplacePanel = form.searchReplacePanel;
            TextBox           searchTextBox      = form.searchPanel.searchTextBox;
            ToolStripButton   highlightsResultsToolStripButton = form.searchPanel.highlightsResultsToolStripButton;
            CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(form.pagesTabControl.SelectedTabPage);

            highlightsResultsToolStripButton.Checked = ConfigUtil.GetBoolParameter("SearchHighlightsResults");
            searchReplacePanel.Visible             = makeVisible;
            showSearchPanelToolStripButton.Checked = makeVisible;
            //showSearchPanelToolStripMenuItem.Checked = makeVisible;
            UpdateConfigParameter("SearchReplacePanelDisabled", (!makeVisible).ToString(), refreshConfig);

            switch (ConfigUtil.GetIntParameter("SearchReturn"))
            {
            case 0:
                form.searchPanel.searchTextBox.ReturnActionType  = CustomTextBox.ReturnAction.StartSearch;
                form.searchPanel.replaceTextBox.ReturnActionType = CustomTextBox.ReturnAction.StartReplace;
                break;

            case 1:
                form.searchPanel.searchTextBox.ReturnActionType  = CustomTextBox.ReturnAction.InsertCR;
                form.searchPanel.replaceTextBox.ReturnActionType = CustomTextBox.ReturnAction.InsertCR;
                break;
            }

            pageTextBox.Refresh();

            if (!makeVisible) // && !form.IsOpening)
            {
                //if (refreshConfig)
                //{
                //    StringUtil.ClearHighlightsResults(form);
                //}

                pageTextBox.Focus();
                return;
            }

            FileListManager.LoadSearchHistory(form);
            searchTextBox.Focus();
            searchTextBox.SelectAll();
        }