Exemplo n.º 1
0
        /// <summary>
        /// Menu Options Event
        /// </summary>
        /// <param name="sender">System parm</param>
        /// <param name="e">System parm</param>
        /// <history>
        /// [Theodore_Ward]		??/??/????  Initial
        /// [Curtis_Beard]		01/11/2005	.Net Conversion
        /// [Curtis_Beard]		11/10/2006	ADD: Update combo boxes and language changes
        /// [Curtis_Beard]		11/22/2006	CHG: Remove use of browse in combobox
        /// [Curtis_Beard]		05/22/2007	FIX: 1723814, rehighlight the selected result
        /// [Curtis_Beard]	   02/24/2012	CHG: 3488321, ability to change results font
        /// [Curtis_Beard]	   09/26/2012	CHG: Update status bar text
        /// [Curtis_Beard]	   10/10/2012	ADD: 3479503, ability to change file list font
        /// [Curtis_Beard]		06/15/2015	CHG: 57, support external language files
        /// </history>
        private void OptionsMenuItem_Click(object sender, System.EventArgs e)
        {
            var optionsForm = new frmOptions();
             var previousUseEncodingCache = GeneralSettings.UseEncodingCache;
             var previousEncodingPerformance = GeneralSettings.EncodingPerformance;

             if (optionsForm.ShowDialog(this) == DialogResult.OK)
             {
            //update combobox lengths
            while (cboFilePath.Items.Count > Core.GeneralSettings.MaximumMRUPaths)
               cboFilePath.Items.RemoveAt(cboFilePath.Items.Count - 1);
            while (cboFileName.Items.Count > Core.GeneralSettings.MaximumMRUPaths)
               cboFileName.Items.RemoveAt(cboFileName.Items.Count - 1);
            while (cboSearchForText.Items.Count > Core.GeneralSettings.MaximumMRUPaths)
               cboSearchForText.Items.RemoveAt(cboSearchForText.Items.Count - 1);

            // load new language if necessary
            if (optionsForm.IsLanguageChange)
            {
               Language.ProcessForm(this, this.toolTip1);

               SetColumnsText();
               SetWindowText();

               // clear statusbar text
               SetStatusBarMessage(string.Empty);
               CalculateTotalCount();
            }

            // change results display and rehighlight
            var foreground = Convertors.ConvertStringToSolidColorBrush(Core.GeneralSettings.ResultsForeColor);
            var background = Convertors.ConvertStringToSolidColorBrush(Core.GeneralSettings.ResultsBackColor);
            var contextForeground = Convertors.ConvertStringToSolidColorBrush(Core.GeneralSettings.ResultsContextForeColor);
            var font = Convertors.ConvertStringToFont(Core.GeneralSettings.ResultsFont);
            txtHits.Foreground = foreground;
            txtHits.Background = background;
            txtHits.LineNumbersForeground = contextForeground;
            txtHits.LineNumbersMatchForeground = foreground;
            txtHits.FontFamily = new System.Windows.Media.FontFamily(font.FontFamily.Name);
            txtHits.FontSize = font.SizeInPoints * 96 / 72;

            lstFileNames.Font = Convertors.ConvertStringToFont(Core.GeneralSettings.FilePanelFont);

            // update current display
            if (lstFileNames.SelectedItems.Count > 0)
            {
               lstFileNames_SelectedIndexChanged(null, null);
            }
            else if (txtHits.Text.Length > 0)
            {
               ProcessAllMatchesForDisplay();
            }
             }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Menu Options Event
        /// </summary>
        /// <param name="sender">System parm</param>
        /// <param name="e">System parm</param>
        /// <history>
        /// [Theodore_Ward]     ??/??/????  Initial
        /// [Curtis_Beard]	   01/11/2005	.Net Conversion
        /// [Curtis_Beard]	   11/10/2006	ADD: Update combo boxes and language changes
        /// [Curtis_Beard]	   11/22/2006	CHG: Remove use of browse in combobox
        /// </history>
        private void mnuOptions_Click(object sender, System.EventArgs e)
        {
            frmOptions _form = new frmOptions();

             if (_form.ShowDialog(this) == DialogResult.OK)
             {
            // change result colors
            txtHits.ForeColor = Common.ConvertStringToColor(AstroGrep.Core.GeneralSettings.ResultsForeColor);
            txtHits.BackColor = Common.ConvertStringToColor(AstroGrep.Core.GeneralSettings.ResultsBackColor);

            //update combobox lengths
            while (cboFilePath.Items.Count > AstroGrep.Core.GeneralSettings.MaximumMRUPaths)
               cboFilePath.Items.RemoveAt(cboFilePath.Items.Count - 1);

            while (cboFileName.Items.Count > AstroGrep.Core.GeneralSettings.MaximumMRUPaths)
               cboFileName.Items.RemoveAt(cboFileName.Items.Count - 1);
            while (cboSearchForText.Items.Count > AstroGrep.Core.GeneralSettings.MaximumMRUPaths)
               cboSearchForText.Items.RemoveAt(cboSearchForText.Items.Count - 1);

            // load new language if necessary
            if (_form.IsLanguageChange)
            {
               Language.Load(Core.GeneralSettings.Language);
               Language.ProcessForm(this, this.toolTip1);

               SetColumnsText();

               // reload label
               __SearchOptionsText = lnkSearchOptions.Text;
               if (!__OptionsShow)
                  lnkSearchOptions.Text = String.Format(__SearchOptionsText, ">>");
               else
                  lnkSearchOptions.Text = String.Format(__SearchOptionsText, "<<");
            }
             }
             _form = null;
        }