| 1: | // SearchCommands.cs | |
| 2: | // Copyright (C) 2002 Mike Krueger | |
| 3: | // with contributions from : | |
| 4: | // Tyson S. Maxwell | |
| 5: | // | |
| 6: | // This program is free software; you can redistribute it and/or modify | |
| 7: | // it under the terms of the GNU General Public License as published by | |
| 8: | // the Free Software Foundation; either version 2 of the License, or | |
| 9: | // (at your option) any later version. | |
| 10: | // | |
| 11: | // This program is distributed in the hope that it will be useful, | |
| 12: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14: | // GNU General Public License for more details. | |
| 15: | // | |
| 16: | // You should have received a copy of the GNU General Public License | |
| 17: | // along with this program; if not, write to the Free Software | |
| 18: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19: | ||
| 20: | using System; | |
| 21: | using System.IO; | |
| 22: | using System.Threading; | |
| 23: | using System.Drawing; | |
| 24: | using System.Drawing.Printing; | |
| 25: | using System.Collections; | |
| 26: | using System.ComponentModel; | |
| 27: | using System.Windows.Forms; | |
| 28: | using System.Diagnostics; | |
| 29: | using System.Text; | |
| 30: | ||
| 31: | using Core.AddIns; | |
| 32: | using Core.Util; | |
| 33: | using Core.Properties; | |
| 34: | using Core.Gui; | |
| 35: | using Core.Gui.Creators; | |
| 36: | ||
| 37: | using SharpDevelop.Gui.Dialogs; | |
| 38: | using SharpDevelop.DefaultEditor.Text; | |
| 39: | using SharpDevelop.DefaultEditor.Gui.Editor; | |
| 40: | using SharpDevelop.Gui; | |
| 41: | ||
| 42: | namespace SharpDevelop.DefaultEditor.Commands { | |
| 43: | ||
| 44: | public class Find : AbstractMenuCommand | |
| 45: | { | |
| 46: | public override void Run() | |
| 47: | { | |
| 48: | // Get Highlighted value and set it to FindDialog.searchPattern | |
| 49: | IWorkbenchWindow window = | |
| 50: | WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 51: | ||
| 52: | if (window != null && (window.WindowContent.Control is TextAreaControl)) { | |
| 53: | TextAreaControl textarea = | |
| 54: | (TextAreaControl)window.WindowContent.Control; | |
| 55: | FindDialog.searchPattern = textarea.GetSelectedText(); | |
| 56: | } | |
| 57: | ||
| 58: | FindDialog fd = new FindDialog(); | |
| 59: | fd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 60: | } | |
| 61: | } | |
| 62: | ||
| 63: | public class FindNext : AbstractMenuCommand | |
| 64: | { | |
| 65: | public override void Run() | |
| 66: | { | |
| 67: | if (FindDialog.find != null) { | |
| 68: | FindDialog.FindNext(); | |
| 69: | } | |
| 70: | } | |
| 71: | } | |
| 72: | ||
| 73: | public class Replace : AbstractMenuCommand | |
| 74: | { | |
| 75: | public override void Run() | |
| 76: | { | |
| 77: | // Get Highlighted value and set it to FindDialog.searchPattern | |
| 78: | IWorkbenchWindow window = | |
| 79: | WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 80: | ||
| 81: | if (window != null && (window.WindowContent.Control is TextAreaControl)) { | |
| 82: | TextAreaControl textarea = | |
| 83: | (TextAreaControl)window.WindowContent.Control; | |
| 84: | FindDialog.searchPattern = textarea.GetSelectedText(); | |
| 85: | } | |
| 86: | ||
| 87: | ReplaceDialog rd = new ReplaceDialog(); | |
| 88: | rd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 89: | } | |
| 90: | } | |
| 91: | ||
| 92: | public class GotoLineNumber : AbstractMenuCommand | |
| 93: | { | |
| 94: | public override void Run() | |
| 95: | { | |
| 96: | GotoLineNumberDialog gnd = new GotoLineNumberDialog(); | |
| 97: | gnd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 98: | gnd.Show(); | |
| 99: | } | |
| 100: | } | |
| 101: | ||
| 102: | public class GotoMatchingBrace : AbstractMenuCommand | |
| 103: | { | |
| 104: | public override void Run() | |
| 105: | { | |
| 106: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 107: | ||
| 108: | if (window == null || !(window.WindowContent.Control is TextAreaControl)) { | |
| 109: | return; | |
| 110: | } | |
| 111: | TextAreaControl textarea = (TextAreaControl)window.WindowContent.Control; | |
| 112: | ||
| 113: | if (textarea.TextAreaPainter.Highlight != null) { | |
| 114: | textarea.Document.Caret.Offset = textarea.TextAreaPainter.Highlight.Offset + 1; | |
| 115: | textarea.Document.SetDesiredColumn(); | |
| 116: | } | |
| 117: | } | |
| 118: | } | |
| 119: | } |
This page was automatically generated by SharpDevelop.