| 0: | // Search.cs | |
| 1: | // Copyright (C) 2000 Mike Krueger | |
| 2: | // | |
| 3: | // This program is free software; you can redistribute it and/or modify | |
| 4: | // it under the terms of the GNU General Public License as published by | |
| 5: | // the Free Software Foundation; either version 2 of the License, or | |
| 6: | // (at your option) any later version. | |
| 7: | // | |
| 8: | // This program is distributed in the hope that it will be useful, | |
| 9: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11: | // GNU General Public License for more details. | |
| 12: | // | |
| 13: | // You should have received a copy of the GNU General Public License | |
| 14: | // along with this program; if not, write to the Free Software | |
| 15: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 16: | ||
| 17: | using Microsoft.Win32; | |
| 18: | using System; | |
| 19: | using System.Collections; | |
| 20: | using System.IO; | |
| 21: | using System.ComponentModel; | |
| 22: | using System.Windows.Forms; | |
| 23: | using System.Drawing; | |
| 24: | using System.Diagnostics; | |
| 25: | using System.CodeDom.Compiler; | |
| 26: | using System.Xml; | |
| 27: | using System.Reflection; | |
| 28: | ||
| 29: | using SharpDevelop.Actions; | |
| 30: | using SharpDevelop.Gui; | |
| 31: | using SharpDevelop.Gui.Dialogs; | |
| 32: | using SharpDevelop.Gui.Window; | |
| 33: | using SharpDevelop.Tool.Data; | |
| 34: | using SharpDevelop.Internal.Project; | |
| 35: | using SharpDevelop.Internal.Messages; | |
| 36: | ||
| 37: | namespace SharpDevelop.Actions.Menu { | |
| 38: | public class Find : ISdPlugin | |
| 39: | { | |
| 40: | public ISdMessageHandler MessageHandler { | |
| 41: | get { | |
| 42: | return null; | |
| 43: | } | |
| 44: | } | |
| 45: | public void Execute(ISdPluginExecutor executor) | |
| 46: | { | |
| 47: | FindDialog fd = new FindDialog(executor.Main); | |
| 48: | fd.Owner = executor.Main; | |
| 49: | } | |
| 50: | } | |
| 51: | ||
| 52: | public class FindNext : ISdPlugin | |
| 53: | { | |
| 54: | public ISdMessageHandler MessageHandler { | |
| 55: | get { | |
| 56: | return null; | |
| 57: | } | |
| 58: | } | |
| 59: | public void Execute(ISdPluginExecutor executor) | |
| 60: | { | |
| 61: | if (FindDialog.find != null) | |
| 62: | FindDialog.find.FindNext(); | |
| 63: | } | |
| 64: | } | |
| 65: | ||
| 66: | public class Replace : ISdPlugin | |
| 67: | { | |
| 68: | public ISdMessageHandler MessageHandler { | |
| 69: | get { | |
| 70: | return null; | |
| 71: | } | |
| 72: | } | |
| 73: | public void Execute(ISdPluginExecutor executor) | |
| 74: | { | |
| 75: | ReplaceDialog rd = new ReplaceDialog(executor.Main); | |
| 76: | rd.Owner = executor.Main; | |
| 77: | } | |
| 78: | } | |
| 79: | ||
| 80: | public class ToggleBookmark : ISdPlugin | |
| 81: | { | |
| 82: | public ISdMessageHandler MessageHandler { | |
| 83: | get { | |
| 84: | return null; | |
| 85: | } | |
| 86: | } | |
| 87: | public void Execute(ISdPluginExecutor executor) | |
| 88: | { | |
| 89: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 90: | if (window != null && window.HasTextArea) { | |
| 91: | window.TextArea.Buffer.Bookmark.ToggleMark(window.TextArea.Caret.CaretPos.Y); | |
| 92: | } | |
| 93: | } | |
| 94: | } | |
| 95: | ||
| 96: | public class PrevBookmark : ISdPlugin | |
| 97: | { | |
| 98: | public ISdMessageHandler MessageHandler { | |
| 99: | get { | |
| 100: | return null; | |
| 101: | } | |
| 102: | } | |
| 103: | public void Execute(ISdPluginExecutor executor) | |
| 104: | { | |
| 105: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 106: | if (window != null && window.HasTextArea) { | |
| 107: | Point pos = window.TextArea.Caret.CaretPos; | |
| 108: | Point old = window.TextArea.Caret.CaretPos; | |
| 109: | pos.Y = window.TextArea.Buffer.Bookmark.PrevMark(pos.Y); | |
| 110: | if (pos.Y != -1) { | |
| 111: | pos.X = 0; | |
| 112: | window.TextArea.Caret.CaretPos = pos; | |
| 113: | window.TextArea.ScrollToCaret(); | |
| 114: | } | |
| 115: | } | |
| 116: | } | |
| 117: | } | |
| 118: | ||
| 119: | public class NextBookmark : ISdPlugin | |
| 120: | { | |
| 121: | public ISdMessageHandler MessageHandler { | |
| 122: | get { | |
| 123: | return null; | |
| 124: | } | |
| 125: | } | |
| 126: | public void Execute(ISdPluginExecutor executor) | |
| 127: | { | |
| 128: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 129: | if (window != null && window.HasTextArea) { | |
| 130: | Point pos = window.TextArea.Caret.CaretPos; | |
| 131: | Point old = pos; | |
| 132: | pos.Y = window.TextArea.Buffer.Bookmark.NextMark(pos.Y); | |
| 133: | if (pos.Y != -1) { | |
| 134: | pos.X = 0; | |
| 135: | window.TextArea.Caret.CaretPos = pos; | |
| 136: | window.TextArea.ScrollToCaret(); | |
| 137: | } | |
| 138: | } | |
| 139: | } | |
| 140: | } | |
| 141: | ||
| 142: | public class ClearBookmarks : ISdPlugin | |
| 143: | { | |
| 144: | public ISdMessageHandler MessageHandler { | |
| 145: | get { | |
| 146: | return null; | |
| 147: | } | |
| 148: | } | |
| 149: | public void Execute(ISdPluginExecutor executor) | |
| 150: | { | |
| 151: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 152: | if (window != null && window.HasTextArea) { | |
| 153: | window.TextArea.TextAreaPainter.Buffer.Bookmark.ClearAll(); | |
| 154: | } | |
| 155: | } | |
| 156: | } | |
| 157: | ||
| 158: | public class GotoMatchingBrace : ISdPlugin | |
| 159: | { | |
| 160: | public ISdMessageHandler MessageHandler { | |
| 161: | get { | |
| 162: | return null; | |
| 163: | } | |
| 164: | } | |
| 165: | public void Execute(ISdPluginExecutor executor) | |
| 166: | { | |
| 167: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 168: | if (window != null && window.HasTextArea && window.TextArea.TextAreaPainter.Highlight != null) { | |
| 169: | window.TextArea.Caret.CaretPos = new Point(window.TextArea.TextAreaPainter.Highlight.Begin.X + 1, | |
| 170: | window.TextArea.TextAreaPainter.Highlight.Begin.Y); | |
| 171: | window.TextArea.Caret.SetUpDownPos(); | |
| 172: | } | |
| 173: | } | |
| 174: | } | |
| 175: | ||
| 176: | public class GotoLineNumber : ISdPlugin | |
| 177: | { | |
| 178: | public ISdMessageHandler MessageHandler { | |
| 179: | get { | |
| 180: | return null; | |
| 181: | } | |
| 182: | } | |
| 183: | public void Execute(ISdPluginExecutor executor) | |
| 184: | { | |
| 185: | ContentWindow window = executor.Main.ActiveContentWindow; | |
| 186: | if (window != null & window.HasTextArea) { | |
| 187: | GotoLineNumberDialog gnd = new GotoLineNumberDialog(window); | |
| 188: | gnd.Owner = executor.Main; | |
| 189: | gnd.Show(); | |
| 190: | } | |
| 191: | } | |
| 192: | } | |
| 193: | } |
This page was automatically generated by SharpDevelop.