private void cmdEditorCommand(string arg) { Control c = ActiveControl; while (c is ContainerControl) c = (c as ContainerControl).ActiveControl; if (c == null) return; switch (arg) { case "Undo": if (c is TextBoxBase) (c as TextBoxBase).Undo(); else if (c is TextArea) new ICSharpCode.TextEditor.Actions.Undo().Execute(c as TextArea); break; case "Redo": if (c is TextBoxBase) (c as TextBoxBase).Undo(); else if (CurrSQLEditor != null) new ICSharpCode.TextEditor.Actions.Redo().Execute(c as TextArea); break; case "Cut": if (c is TextBoxBase) (c as TextBoxBase).Cut(); else if (c is TextArea) new ICSharpCode.TextEditor.Actions.Cut().Execute(c as TextArea); break; case "Copy": if (c is TextBoxBase) (c as TextBoxBase).Copy(); else if (c is TextArea) new ICSharpCode.TextEditor.Actions.Copy().Execute(c as TextArea); break; case "Paste": if (c is TextBoxBase) (c as TextBoxBase).Paste(); else if (c is TextArea) new ICSharpCode.TextEditor.Actions.Paste().Execute(c as TextArea); break; case "SelectAll": if (c is TextBoxBase) (c as TextBoxBase).SelectAll(); else if (c is TextArea) new ICSharpCode.TextEditor.Actions.SelectWholeDocument().Execute(c as TextArea); break; case "Find": case "Replace": if (c is TextArea && CurrSQLEditor != null) { FindDialog fd = new FindDialog(CurrSQLEditor.SQLEditor); fd.Show(); } break; case "Beautify": string selectedText = null; if (c is TextBoxBase) selectedText = (c as TextBoxBase).SelectedText; else if (c is TextArea) selectedText = (c as TextArea).SelectionManager.SelectedText; if (string.IsNullOrEmpty(selectedText)) { MessageBox.Show("Select SQL statement to beautify", "Cinar Database Tools"); return; } SQLParser.Parser parser = new SQLParser.Parser(new StringReader(selectedText)); string beautifiedSQL = ""; try { SQLParser.Statement statement = parser.ReadNextStatement(); while (statement != null) { beautifiedSQL += statement.ToString(); statement = parser.ReadNextStatement(); } } catch (Exception ex) { MessageBox.Show("SQL parse error:\n" + ex.Message, "Cinar Database Tools"); break; } if (c is TextBoxBase) { (c as TextBoxBase).SelectedText = beautifiedSQL; } else if (c is TextArea) { ISelection sel = (c as TextArea).SelectionManager.SelectionCollection[0]; (c as TextArea).Document.Replace(sel.Offset, sel.Length, beautifiedSQL); (c as TextArea).SelectionManager.ClearSelection(); } break; } c.Refresh(); }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (Program.Connected) if (FindDialog == null) { FindDialog = new FindDialog(); FindDialog.Torrentlistview = torrentListView; FindDialog.FormClosed += delegate (object s, FormClosedEventArgs ee) { FindDialog = null; }; FindDialog.Show(); } else { FindDialog.Focus(); } }
public void ShowFindDialog(ChartControl chartControl, FindDialog.FindDialogMode mode) { if (MyFindDialog == null || MyFindDialog.IsDisposed) { FindDialog fd = MyFindDialog; MyFindDialog = new FindDialog(this); if (fd != null) { MyFindDialog.StartPosition = FormStartPosition.Manual; MyFindDialog.Location = fd.Location; MyFindDialog.OpenOptions = fd.OpenOptions; } } MyFindDialog.Mode = mode; if (MyFindDialog.Visible) { MyFindDialog.Activate(); } else { MyFindDialog.Show(this); } MyFindDialog.ResetFocus(); }
public MainWindow() { FindDialog findDialog = new FindDialog(); findDialog.Owner = this; ExtensibilityManager.RegisterFindDialog(findDialog); InitializeComponent(); }
public FindDialog CreateDialog() { dlg = new FindDialog(); dlg.FindText.TextChanged += new EventHandler(FindText_TextChanged); UpdateUI(); return dlg; }
private void InitializeComponent() { this.contextMenuStrip = new ContextMenuStrip(); this.findToolStripMenuItem = new ToolStripMenuItem(); this.findDialog1 = new FindDialog(); this.contextMenuStrip.SuspendLayout(); base.SuspendLayout(); this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { this.findToolStripMenuItem }); this.contextMenuStrip.Name = "contextMenuStrip"; this.contextMenuStrip.RenderMode = ToolStripRenderMode.System; this.contextMenuStrip.ShowImageMargin = false; this.contextMenuStrip.Size = new Size(81, 26); this.findToolStripMenuItem.Name = "findToolStripMenuItem"; this.findToolStripMenuItem.Size = new Size(80, 22); this.findToolStripMenuItem.Text = "&Find"; this.findDialog1.ParentControl = this; this.findDialog1.ReplaceAvailable = false; this.findDialog1.SearchRegularExpression = null; this.findDialog1.SearchRequested += new SearchEventHandler(this.findDialog1_SearchRequested); this.RightToLeft = RightToLeft.Yes; this.RightToLeftLayout = true; this.ContextMenuStrip = this.contextMenuStrip; base.KeyDown += new KeyEventHandler(this.SearchableTreeView_KeyDown); this.contextMenuStrip.ResumeLayout(false); base.ResumeLayout(false); }
/// <summary> /// Make a simple find dialog /// </summary> /// <param name="_findDialog">The FindDialog parent object</param> /// <param name="defaultText">Default text for the input box</param> /// <param name="restoreData">Restore data (if any) to restore the user-changeable form properties from</param> /// <param name="formatter">Formatter to read the above</param> /// <param name="replaceMode">Start in replace mode?</param> /// <param name="offerReplace">Offer the user the chance to switch to Replace mode?</param> public FindForm(FindDialog _findDialog, Stream restoreData, IFormatter formatter, string defaultText, bool replaceMode, bool offerReplace) { findDialog = _findDialog; Owner = findDialog.ParentControl.FindForm(); InitializeComponent(); findDialog.SearchMode = FindDialog.SearchModes.Ready; replaceModeCheckBox.Visible = offerReplace; // Populate searchTypeComboBox foreach (FindForm.SearchType searchType in Enum.GetValues(typeof(FindForm.SearchType))) { // convert StringsThatLookLikeThis to Strings that look like this searchTypeComboBox.Items.Add(searchType.ToString()[0] + Regex.Replace(searchType.ToString().Substring(1), @"(\B[A-Z])", " $1").ToLower()); } searchTypeComboBox.SelectedIndex = 0; if (restoreData == null) { replaceModeCheckBox.Checked = replaceMode; // apply this attribute here because it can change the size of the form // Generate an appropriate position for the dialog - just off the parent control, but on the screen Control parentControl = findDialog.ParentControl; // Get the current bounds of the screen Rectangle screenBounds = Screen.GetWorkingArea(this); // Try a position top right of the parent Rectangle bounds = new Rectangle(parentControl.PointToScreen(new Point(parentControl.Width - Width, -Height)), Size); Rectangle intersection = Rectangle.Intersect(screenBounds, bounds); if (!intersection.Equals(bounds)) { // If intersection betwen screen bounds and dialog bounds is not exactly the same as the dialog bounds, // some or all of the dialog is off screen. // So, set the position to just below the bottom right of the parent control bounds = new Rectangle(parentControl.PointToScreen(new Point(parentControl.Width - Width, parentControl.Height)), Size); } Bounds = bounds; // Appy the chosen bounds } else { // Restore the important settings from the previously recorded RestoreData ApplyRestoreData(restoreData, formatter); replaceModeCheckBox.Checked = replaceMode; // apply this attribute here because it can change the size of the form } ApplySearchMode(); // Set the initial visual setting if (defaultText != null) { searchHistoryComboBox.Text = defaultText; } Reshow(); }
public static Regex Execute() { using (FindDialog dialog = new FindDialog()) { if (dialog.ShowDialog() == DialogResult.OK) return dialog.Regex; return null; } }
public void ShowFindDlg() { FindDialog FindDlg = new FindDialog(this); FindDlg.richTextBox1 = this.richTextBox1; FindDlg.textBox1.Text = this.richTextBox1.SelectedText; FindDlg.StartPosition = FormStartPosition.CenterParent; //FindDlg.ShowDialog(); FindDlg.ShowDialog(); }
void FindOnExecute(object sender, ExecutedRoutedEventArgs args) { FindDialog dlg = new FindDialog(this); dlg.FindWhat = strFindWhat; dlg.MatchCase = strcomp == StringComparison.Ordinal; dlg.Direction = dirFind; dlg.FindNext += FindDialogOnFindNext; dlg.Show(); }
public void EnableFindButton() { FindDialogInteractor i = new FindDialogInteractor(); using (FindDialog dlg = i.CreateDialog()) { dlg.Show(); Assert.IsFalse(dlg.FindButton.Enabled); dlg.FindText.Text = "0ABE"; Assert.IsTrue(dlg.FindButton.Enabled); } }
public MainWindow() { FindDialog findDialog = new FindDialog(); findDialog.Owner = this; ExtensibilityManager.RegisterFindDialog(findDialog); ExtensibilityManager.RegisterSignaturePropertiesDialog(new SignaturePropertiesDialog()); ExtensibilityManager.RegisterSignSignatureDialog(new SignSignatureDialog()); InitializeComponent(); }
public void Rtb_KeyDown(Object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.F) { FindDialog fd = new FindDialog(this); fd.Show(); } if (e.Control && e.KeyCode == Keys.G) { GoTo(); } if (e.Control && e.KeyCode == Keys.S) { if (String.IsNullOrEmpty(FilePath)) { SaveAs(); } else { Save(); }; } if (e.Control && e.KeyCode == Keys.O) { OpenFile(); } if (e.KeyCode == Keys.Tab) { e.SuppressKeyPress = true; if (rtb.SelectionLength > 0) { string result = ""; string[] lines = rtb.SelectedLines(); for (int i = 0; i < lines.Length; i++) { result += "\t" + lines[i] + "\n"; } rtb.SelectedText = result; } else { rtb.SelectedText += "\t"; } } }
private void FindBtn_Click(object sender, EventArgs e) { if (IsFindDialogOpened) { _currentFindUI.BringToFront(); } else { _currentFindUI = new FindDialog(LoggerTxt); _currentFindUI.Show(this); } _currentFindUI.FindWhat = LoggerTxt.SelectedText; _currentFindUI.FindWhatTxt.SelectAll(); }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (Helpers.GetOpenForms().Where((f) => f.Text == "Find").Count() > 0 && findDialog != null) { findDialog.BringToFront(); } else { findDialog = new FindDialog(); findDialog.PrecacheResults += OnPreacacheResults; findDialog.FindNext += OnFindNext; findDialog.Show(); } }
public override void Execute() { FindDialog.CloseIfOpen(); FindInFilesDialog.CloseIfOpen(); ReplaceDialog replaceDialog = ReplaceDialog.GetReplaceDialog(this.FindReplaceModel, this.TextEditor, this.MessageDisplayService); if (!this.TextEditor.IsSelectionEmpty) { string text = this.TextEditor.GetText(this.TextEditor.SelectionStart, this.TextEditor.SelectionLength); if (!string.IsNullOrEmpty(text) && text.IndexOf('\n') == -1) { replaceDialog.FindText = text; } } replaceDialog.Show(); }
void FindReplace() { //IFind AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { if (finddlg == null) { finddlg = new FindDialog(atb); ServiceHost.Window.MainForm.AddOwnedForm(finddlg); } finddlg.Show(); finddlg.Location = atb.PointToScreen(new Point(atb.Width - finddlg.Width - atb.vscroll.Width, 0)); } }
private void OnFindClick(object sender, EventArgs e) { if (textBoxInfo == null) { return; } if (findDlg == null) { findDlg = new FindDialog(textBoxInfo); // Keep it on top findDlg.Owner = this; findDlg.Show(); } else { findDlg.Visible = true; } }
void MenuEditFindOnClick(object obj, EventArgs ea) { if (OwnedForms.Length > 0) { return; } txtbox.HideSelection = false; FindDialog dlg = new FindDialog(); dlg.Owner = this; dlg.FindText = strFind; dlg.MatchCase = bMatchCase; dlg.FindDown = bFindDown; dlg.FindNext += new EventHandler(FindDialogOnFindNext); dlg.CloseDlg += new EventHandler(FindReplaceDialogOnCloseDlg); dlg.Show(); }
public override void Execute() { ReplaceDialog.CloseIfOpen(); FindInFilesDialog.CloseIfOpen(); FindDialog findDialog = FindDialog.GetFindDialog(this.FindReplaceModel, this.TextEditor, this.MessageDisplayService); if (string.IsNullOrEmpty(findDialog.FindText)) { findDialog.SearchReverse = false; findDialog.Show(); } else { if (!findDialog.FindNext()) { return; } this.TextEditor.Focus(); } }
private void ReplaceAndFindAgain(FindDialog.SettingsInfo settings) { if (textEditControl.SelectionNonEmpty) { ITextStorage find = textEditControl.TextStorageFactory.FromUtf16Buffer( settings.FindText, 0, settings.FindText.Length, Environment.NewLine); if (textEditControl.SelectionEndLine == (textEditControl.SelectionStartLine + find.Count - 1) && (textEditControl.SelectionEndCharPlusOne == (find.Count == 1 ? textEditControl.SelectionStartChar + find[0].Length : find[find.Count - 1].Length)) && textEditControl.IsMatch( find, settings.CaseSensitive, settings.MatchWholeWord, textEditControl.SelectionStartLine, textEditControl.SelectionStartChar)) { ITextStorage replace = textEditControl.TextStorageFactory.FromUtf16Buffer( settings.ReplaceText, 0, settings.ReplaceText.Length, Environment.NewLine); textEditControl.SelectedTextStorage = replace; textEditControl.SetInsertionPoint(textEditControl.SelectionEndLine, textEditControl.SelectionEndCharPlusOne); } else { textEditControl.ErrorBeep(); return; } } FindHelper(settings); }
public void 查找ToolStripMenuItem_Click(object sender, EventArgs e) { r = GetCurrentRichTextBox(); FindDialog f = new FindDialog(); f.rtb = r; //传值(从主窗口传到FindForm) f.Owner = this; //悬浮于当前窗体 f.Show(); }
private void item_13_Click(object sender, System.EventArgs e) { FindDialog dlg = new FindDialog(_find); if (dlg.ShowDialog() == DialogResult.OK) { _find = dlg.Find; _find.Node = ((AsmView)ActiveMdiChild).SelectedNode; ((AsmView)ActiveMdiChild).Find(_find); } }
private void menuItemFind_Click(object sender, System.EventArgs e) { // Only one at a time! if ( mFindDialog != null ) return; if ( mLogic.MemorySimulation == null ) return; mFindDialog = new FindDialog(); mFindDialog.Initialize( this, mLogic.MemorySimulation ); mFindDialog.Closed += new EventHandler(FindDialog_Closed); mFindDialog.Show(); }
private void findToolStripMenuItem1_Click(object sender, EventArgs e) { var frm = new FindDialog(); frm.ShowDialog(this); }
public static void DoShowDialog() { if (_instance != null) { _instance.BringToFront(); return; } else { _instance = new FindDialog(); _instance.ShowDialogInternal(); } }
protected override void OnClosed(EventArgs e) { _instance = null; base.OnClosed(e); Dispose(); }
private void mnuFind_Click(object sender, System.EventArgs e) { FindDialog findDialog = new FindDialog(txtPad, false); findDialog.Show(); }
private void lvTranslations_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) { OnEditEntry(sender, e); return; } if (e.KeyCode == Keys.F3) { if (doneSearching) { if (MessageBox.Show("Do you want to re-start search from the beginning ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { doneSearching = false; _lastIndex = 0; } } else { _lastIndex++; } FindNextItem(); return; } if (e.Modifiers == Keys.Control) { if (e.KeyCode == Keys.F) { FindDialog dlg = new FindDialog(); if (dlg.ShowDialog() == DialogResult.OK) { _find = dlg.TextToFind.ToLowerInvariant(); _lastIndex = 0; FindNextItem(); } } else if (e.KeyCode == Keys.M) { string[] files = Directory.EnumerateFiles(_lookupPath, TranslationFile.TranslationFileEnglishName, SearchOption.AllDirectories).ToArray(); CopyAndMoveDialog dlg = new CopyAndMoveDialog(files); dlg.ShowDialog(); } } if (e.Modifiers == (Keys.Control | Keys.Shift)) { if (e.KeyCode == Keys.V) { string[] files = Directory.EnumerateFiles(_lookupPath, TranslationFile.TranslationFileEnglishName, SearchOption.AllDirectories).ToArray(); ResourceValidationDialog dlg = new ResourceValidationDialog(files); dlg.Show(); } } }
private void mnuFind_Click(object sender, System.EventArgs e) { FindDialog dlg = new FindDialog(_find); //if (dlg.ShowDialog() == DialogResult.OK) //{ // _find = dlg.Find; // _find.Node = ((AsmView)ActiveMdiChild).SelectedNode; // ((AsmView)ActiveMdiChild).Find(_find); //} }
private void Find() { FindDialog dialog = new FindDialog(); if ( findSearchText != string.Empty ) { dialog.SearchText = this.findSearchText; dialog.IsCaseChecked = this.findSearchCase; dialog.IsWholeChecked = this.findSearchWhole; dialog.IsUp = this.findSearchDirection; } if ( dialog.Run() ) { this.findSearchText = dialog.SearchText; this.findSearchCase = dialog.IsCaseChecked; this.findSearchWhole = dialog.IsWholeChecked; this.findSearchDirection = dialog.IsUp; if ( !this.htmlControl.Find(this.findSearchText, this.findSearchCase, this.findSearchWhole, this.findSearchDirection) ) { MessageBox.Show("Finished searching the document.", Resource.GetString("ApplicationName"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
// events private void RicherTextbox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.Modifiers == Keys.Control & e.KeyCode == Keys.F) { if (findDialog == null) findDialog = new FindDialog(); this.HideSelection = false; // set the text selected when open findDialog.inputTextbox.Select(0, findDialog.inputTextbox.Text.Length); // show findDialog.ShowDialog(); } }
private void searchToolStripMenuItem1_Click(object sender, EventArgs e) { FindDialog findDialog = new FindDialog(this); findDialog.Show(); }
private void InitializeComponent() { this.components = new Container(); this.contextMenuStrip = new ContextMenuStrip(this.components); this.undoToolStripMenuItem = new ToolStripMenuItem(); this.toolStripSeparator1 = new ToolStripSeparator(); this.formatTextToolStripMenuItem = new ToolStripMenuItem(); this.fontToolStripMenuItem = new ToolStripMenuItem(); this.toolStripSeparator4 = new ToolStripSeparator(); this.boldToolStripMenuItem = new ToolStripMenuItem(); this.italicsToolStripMenuItem = new ToolStripMenuItem(); this.underlineToolStripMenuItem = new ToolStripMenuItem(); this.toolStripSeparator2 = new ToolStripSeparator(); this.cutToolStripMenuItem = new ToolStripMenuItem(); this.copyToolStripMenuItem = new ToolStripMenuItem(); this.pasteToolStripMenuItem = new ToolStripMenuItem(); this.deleteToolStripMenuItem = new ToolStripMenuItem(); this.toolStripSeparator3 = new ToolStripSeparator(); this.findToolStripMenuItem = new ToolStripMenuItem(); this.replaceToolStripMenuItem = new ToolStripMenuItem(); this.toolStripSeparator5 = new ToolStripSeparator(); this.selectAllToolStripMenuItem = new ToolStripMenuItem(); this.findDialog1 = new FindDialog(); this.contextMenuStrip.SuspendLayout(); base.SuspendLayout(); this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { this.undoToolStripMenuItem, this.toolStripSeparator1, this.formatTextToolStripMenuItem, this.toolStripSeparator2, this.cutToolStripMenuItem, this.copyToolStripMenuItem, this.pasteToolStripMenuItem, this.deleteToolStripMenuItem, this.toolStripSeparator3, this.findToolStripMenuItem, this.replaceToolStripMenuItem, this.toolStripSeparator5, this.selectAllToolStripMenuItem }); this.contextMenuStrip.Name = "contextMenuStrip1"; this.contextMenuStrip.RenderMode = ToolStripRenderMode.System; this.contextMenuStrip.ShowImageMargin = false; this.contextMenuStrip.Size = new Size(104, 226); this.contextMenuStrip.Opening += new CancelEventHandler(this.contextMenuStrip1_Opening); this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; this.undoToolStripMenuItem.Size = new Size(103, 22); this.undoToolStripMenuItem.Text = "&Undo"; this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new Size(100, 6); this.formatTextToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.fontToolStripMenuItem, this.toolStripSeparator4, this.boldToolStripMenuItem, this.italicsToolStripMenuItem, this.underlineToolStripMenuItem }); this.formatTextToolStripMenuItem.Name = "formatTextToolStripMenuItem"; this.formatTextToolStripMenuItem.Size = new Size(103, 22); this.formatTextToolStripMenuItem.Text = "F&ormat"; this.fontToolStripMenuItem.Name = "fontToolStripMenuItem"; this.fontToolStripMenuItem.Size = new Size(165, 22); this.fontToolStripMenuItem.Text = "&Font"; this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Size = new Size(162, 6); this.boldToolStripMenuItem.Name = "boldToolStripMenuItem"; this.boldToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl-B"; this.boldToolStripMenuItem.Size = new Size(165, 22); this.boldToolStripMenuItem.Text = "&Bold"; this.italicsToolStripMenuItem.Name = "italicsToolStripMenuItem"; this.italicsToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl-I"; this.italicsToolStripMenuItem.Size = new Size(165, 22); this.italicsToolStripMenuItem.Text = "&Italics"; this.underlineToolStripMenuItem.Name = "underlineToolStripMenuItem"; this.underlineToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl-U"; this.underlineToolStripMenuItem.Size = new Size(165, 22); this.underlineToolStripMenuItem.Text = "&Underline"; this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new Size(100, 6); this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; this.cutToolStripMenuItem.Size = new Size(103, 22); this.cutToolStripMenuItem.Text = "C&ut"; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.Size = new Size(103, 22); this.copyToolStripMenuItem.Text = "&Copy"; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.Size = new Size(103, 22); this.pasteToolStripMenuItem.Text = "&Paste"; this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; this.deleteToolStripMenuItem.Size = new Size(103, 22); this.deleteToolStripMenuItem.Text = "&Delete"; this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new Size(100, 6); this.findToolStripMenuItem.Name = "findToolStripMenuItem"; this.findToolStripMenuItem.Size = new Size(103, 22); this.findToolStripMenuItem.Text = "&Find"; this.replaceToolStripMenuItem.Name = "replaceToolStripMenuItem"; this.replaceToolStripMenuItem.Size = new Size(103, 22); this.replaceToolStripMenuItem.Text = "&Replace"; this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new Size(100, 6); this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; this.selectAllToolStripMenuItem.Size = new Size(103, 22); this.selectAllToolStripMenuItem.Text = "Select &All"; this.findDialog1.ParentControl = this; this.findDialog1.ReplaceAvailable = false; this.findDialog1.SearchRegularExpression = null; this.findDialog1.ReplaceRequested += new ReplaceEventHandler(this.findDialog1_ReplaceRequested); this.findDialog1.CancelReplaceRequested += new EventHandler(this.findDialog1_CancelReplaceRequested); this.findDialog1.SearchRequested += new SearchEventHandler(this.findDialog1_SearchRequested); this.ContextMenuStrip = this.contextMenuStrip; base.ReadOnlyChanged += new EventHandler(this.SearchableRichTextBox_ReadOnlyChanged); base.KeyDown += new KeyEventHandler(this.SearchableRichTextBox_KeyDown); this.contextMenuStrip.ResumeLayout(false); base.ResumeLayout(false); }
private void ReplaceAll(FindDialog.SettingsInfo settings) { if (String.IsNullOrEmpty(settings.FindText)) { return; } ITextStorage find = textEditControl.TextStorageFactory.FromUtf16Buffer( settings.FindText, 0, settings.FindText.Length, Environment.NewLine); ITextStorage replace = textEditControl.TextStorageFactory.FromUtf16Buffer( settings.ReplaceText, 0, settings.ReplaceText.Length, Environment.NewLine); using (IDisposable undoGroup = textEditControl.UndoOpenGroup()) { SelPoint start, end; if (settings.RestrictToSelection) { textEditControl.UndoSaveSelection(); start = textEditControl.SelectionStart; end = textEditControl.SelectionEnd; } else { start = new SelPoint(0, 0); end = new SelPoint(textEditControl.Count - 1, textEditControl.GetLine(textEditControl.Count - 1).Length); } textEditControl.SetInsertionPoint(start); while (textEditControl.Find(find, settings.CaseSensitive, settings.MatchWholeWord, false/*wrap*/, false/*up*/) && (textEditControl.SelectionStart <= end) && (textEditControl.SelectionEnd <= end)) { end = textEditControl.AdjustForRemove(end, textEditControl.Selection); end = textEditControl.AdjustForInsert(end, textEditControl.SelectionStart, replace); textEditControl.SelectedTextStorage = replace; textEditControl.SetInsertionPoint(textEditControl.SelectionEndLine, textEditControl.SelectionEndCharPlusOne); } if (settings.RestrictToSelection) { textEditControl.SetSelection(start, end, false/*startIsActive*/); } } textEditControl.ScrollToSelection(); }
void FindClick(object sender, EventArgs e) { FindDialog.DoShowDialog(); }
private void SearchCallGraphView( string SearchText ) { CallGraphTreeView.Select(); if( SearchText == null ) { FindDialog FindWindow = new FindDialog( LastSearchText, bSearchTextIsRegex, bSearchTextMatchCase ); DialogResult Result = FindWindow.ShowDialog(); if( Result == DialogResult.Cancel ) { return; } SearchText = FindWindow.SearchTextBox.Text; bSearchTextIsRegex = FindWindow.RegexCheckButton.Checked; bSearchTextMatchCase = FindWindow.MatchCaseCheckButton.Checked; if( Result == DialogResult.Yes ) { FCallGraphTreeViewParser.UnhighlightAll( CallGraphTreeView ); TreeNode FirstResult; long AllocationSize; int AllocationCount; try { int NumResults = FCallGraphTreeViewParser.HighlightAllNodes( CallGraphTreeView, SearchText, bSearchTextIsRegex, bSearchTextMatchCase, out FirstResult, out AllocationSize, out AllocationCount ); MessageBox.Show( NumResults + " results found\nTotal size: " + FormatSizeString( AllocationSize ) + "\nTotal count: " + AllocationCount, "Find all results" ); } catch( ArgumentException ) { // a message box is displayed when this exception is thrown, // so no need to inform the user of the error again FirstResult = null; } if( FirstResult != null ) { SelectCallGraphViewNode( FirstResult ); } LastSearchText = SearchText; return; } } LastSearchText = SearchText; try { TreeNode Node = FCallGraphTreeViewParser.FindNode( CallGraphTreeView, LastSearchText, bSearchTextIsRegex, bSearchTextMatchCase ); if( Node != null ) { SelectCallGraphViewNode( Node ); } else { MessageBox.Show( "The search string was not found" ); } } catch( ArgumentException ) { // a message box is displayed when this exception is thrown, // so no need to inform the user of the error again } }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (Enable) { using (FindDialog dialog = new FindDialog( Find, !textEditControl.ReadOnly ? ReplaceAndFindAgain : (FindDialog.DoMethod)null, !textEditControl.ReadOnly ? ReplaceAll : (FindDialog.DoMethod)null)) { dialog.ShowDialog(); } } }
void ShowDialogInternal() { TreeNode node = GetFirstSelectedNode(); if (node == null) { Hide(); _instance = null; ErrorDialog.Show(StringParser.Parse("${res:ComponentInspector.FindDialog.NoTreeNodeSelectedMessage}"), StringParser.Parse("${res:ComponentInspector.FindDialog.NoTreeNodeSelectedDialogTitle}"), MessageBoxIcon.Error); return; } _startingNode.Text = node.FullPath; _startingNode.Tag = node; SetButtons(false); Show(); }
private void SetupNavigation() { _findDialog = new FindDialog(); _jumpToAddressDialog = new JumpToAddressDialog(); _jumpToMethodDialog = new JumpToMethodDialog(this); }
private void OnReplace(object sender, EventArgs eventArgs) { FindDialog findDialog = new FindDialog(this, FindDialog.FindDialogType.Replace); findDialog.Show(this); }
public void FindDialog_Closed(object sender, System.EventArgs e) { mFindDialog = null; }
private void bnFind_Click(object sender, EventArgs e) { FindDialog dlg = new FindDialog(); FindDialog.OnFindHandler handler = new FindDialog.OnFindHandler(this.OnFind); dlg.Find += handler; dlg.ShowDialog(this); dlg.Find -= handler; }
private void DoSearchFind() { FindDialog fd = new FindDialog(); fd.m_mainForm = this; fd.m_si = m_si; fd.Show(this); }
private bool FindHelper(FindDialog.SettingsInfo settings) { bool wrap = lastFindFailed && (lastFindLine == textEditControl.SelectionActiveLine) && (lastFindCharPlusOne == textEditControl.SelectionActiveChar); bool result = textEditControl.Find( textEditControl.TextStorageFactory.FromUtf16Buffer( settings.FindText, 0, settings.FindText.Length, Environment.NewLine), settings.CaseSensitive, settings.MatchWholeWord, wrap, (modifierKeys & Keys.Shift) == 0 ? settings.Up : !settings.Up); lastFindFailed = !result; if (lastFindFailed) { lastFindLine = textEditControl.SelectionActiveLine; lastFindCharPlusOne = textEditControl.SelectionActiveChar; } else { textEditControl.ScrollToSelection(); } return result; }
public override void Execute() { FindDialog.CloseIfOpen(); ReplaceDialog.CloseIfOpen(); FindInFilesDialog.GetFindInFilesDialog(this.services).Show(); }
public override void Run() { FindDialog.DoShowDialog(); }
private void mnuReplace_Click(object sender, System.EventArgs e) { FindDialog findDialog = new FindDialog(txtPad, true); findDialog.Show(); }
private void Find() { string selectedText; if (tabControlSubtitle.SelectedIndex == TabControlSourceView) selectedText = textBoxSource.SelectedText; else selectedText = textBoxListViewText.SelectedText; if (selectedText.Length == 0 && _findHelper != null) { if (_clearLastFind) { _clearLastFind = false; _findHelper.FindType = _clearLastFindType; selectedText = _clearLastFindText; } else { selectedText = _findHelper.FindText; } } using (var findDialog = new FindDialog(_subtitle)) { findDialog.SetIcon(toolStripButtonFind.Image as Bitmap); findDialog.Initialize(selectedText, _findHelper); if (findDialog.ShowDialog(this) != DialogResult.OK) { return; } _findHelper = findDialog.GetFindDialogHelper(_subtitleListViewIndex); if (!string.IsNullOrWhiteSpace(_findHelper.FindText)) { if (Configuration.Settings.Tools.FindHistory.Count == 0 || Configuration.Settings.Tools.FindHistory[0] != _findHelper.FindText) Configuration.Settings.Tools.FindHistory.Insert(0, _findHelper.FindText); } ShowStatus(string.Format(_language.SearchingForXFromLineY, _findHelper.FindText, _subtitleListViewIndex + 1)); if (tabControlSubtitle.SelectedIndex == TabControlListView) { int selectedIndex = -1; //set the starting selectedIndex if a row is highlighted if (SubtitleListview1.SelectedItems.Count > 0) selectedIndex = SubtitleListview1.SelectedItems[0].Index; //if we fail to find the text, we might want to start searching from the top of the file. bool foundIt = false; if (_findHelper.Find(_subtitle, _subtitleAlternate, selectedIndex)) { foundIt = true; } else if (_findHelper.StartLineIndex >= 1) { if (MessageBox.Show(_language.FindContinue, _language.FindContinueTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { selectedIndex = -1; if (_findHelper.Find(_subtitle, _subtitleAlternate, selectedIndex)) foundIt = true; } } if (foundIt) { SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex); TextBox tb; if (_findHelper.MatchInOriginal) tb = textBoxListViewTextAlternate; else tb = textBoxListViewText; tb.Focus(); tb.SelectionStart = _findHelper.SelectedPosition; tb.SelectionLength = _findHelper.FindTextLength; ShowStatus(string.Format(_language.XFoundAtLineNumberY, _findHelper.FindText, _findHelper.SelectedIndex + 1)); _findHelper.SelectedPosition++; } else { ShowStatus(string.Format(_language.XNotFound, _findHelper.FindText)); } } else if (tabControlSubtitle.SelectedIndex == TabControlSourceView) { if (_findHelper.Find(textBoxSource, textBoxSource.SelectionStart)) { textBoxSource.SelectionStart = _findHelper.SelectedIndex; textBoxSource.SelectionLength = _findHelper.FindTextLength; textBoxSource.ScrollToCaret(); ShowStatus(string.Format(_language.XFoundAtLineNumberY, _findHelper.FindText, textBoxSource.GetLineFromCharIndex(textBoxSource.SelectionStart))); } else { ShowStatus(string.Format(_language.XNotFound, _findHelper.FindText)); } } } }
public void Find() { if (_functions != null) { FindDialog fd = new FindDialog(_functions, FindCallBack); fd.ShowDialog(); } }