0:   //  FindDialog.cs 
1:   //  Copyright (C) 2000 Andrea Paatz
2:   //  Copyright (C) 2000 Mike Krueger
3:   //
4:   //  This program is free software; you can redistribute it and/or modify
5:   //  it under the terms of the GNU General Public License as published by
6:   //  the Free Software Foundation; either version 2 of the License, or
7:   //  (at your option) any later version.
8:   //
9:   //  This program is distributed in the hope that it will be useful,
10:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12:   //  GNU General Public License for more details.
13:   //
14:   //  You should have received a copy of the GNU General Public License
15:   //  along with this program; if not, write to the Free Software
16:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17:  
18:   using System;
19:   using System.Drawing;
20:   using System.ComponentModel;
21:   using System.Windows.Forms;
22:  
23:   using SharpDevelop.Gui;
24:   using SharpDevelop.Internal.Text.Search;
25:  
26:   using SharpDevelop.Tool.Data;
27:  
28:   namespace SharpDevelop.Gui.Dialogs {
29:       
30:       /// <summary>
31:       ///    Summary description for FindDialog.
32:       /// </summary>
33:       public class FindDialog : Form {
34:           
35:           /// <summary> 
36:           ///    Required by the Win Forms designer 
37:           /// </summary>
38:           private System.ComponentModel.Container components;
39:           private RadioButton radioButton2;
40:           
41:           
42:           private RadioButton radioButton1;
43:           private GroupBox groupBox1;
44:           private Label label2;
45:           private ComboBox OptionCombo;
46:           private CheckBox checkBox3;
47:           private CheckBox checkBox2;
48:           private CheckBox checkBox1;
49:           private Button button4;
50:           private Button button3;
51:   //        private Button button2;
52:           private Button button1;
53:           private ComboBox FindComboBox;
54:           private Label label1;
55:           
56:           private MainWindow main;
57:           
58:           private static int    lastIndex     0;
59:           private static bool   searchup      false;
60:           
61:           public  static Find   find;
62:           
63:           protected override void OnClosing(CancelEventArgs e)
64:           {
65:               main.Select();
66:               base.OnClosing(e);
67:           }
68:           
69:           public FindDialog(MainWindow main) {
70:               Find.Main main;
71:               
72:               // Required for Win Form Designer support
73:               InitializeComponent();
74:               this.main main;
75:               MaximizeBox  MinimizeBox false;
76:               ShowInTaskbar false;
77:               
78:               // TODO: Add any constructor code after InitializeComponent call
79:               button1.Click += new System.EventHandler(ClickFind);
80:               button3.Click += new System.EventHandler(Close);
81:               AcceptButton button1;
82:               CancelButton button3;
83:               
84:               Icon null;
85:               Owner main;
86:               StartPosition FormStartPosition.CenterParent;
87:               FormBorderStyle FormBorderStyle.FixedDialog;
88:               Show();
89:               FindComboBox.Focus();
90:           }
91:           
92:           /// <summary>
93:           /// Clean up any resources being used.
94:           /// </summary>
95:           protected override void Dispose(bool disposing)
96:           {
97:               if (disposing) {
98:                   if (components != null){
99:                       components.Dispose();
100:                   }
101:               }
102:               base.Dispose(disposing);
103:           }
104:           
105:   //        /// <summary>
106:   //        ///    The main entry point for the application.
107:   //        /// </summary>
108:   //        public static void Main(string[] args) {
109:   //            Application.Run(new FindDialog());
110:   //        }
111:           
112:           
113:           /// <summary>
114:           ///    Required method for Designer support - do not modify
115:           ///    the contents of this method with an editor
116:           /// </summary>
117:           private void InitializeComponent()
118:           {
119:               this.components new System.ComponentModel.Container();
120:               this.radioButton1 new RadioButton();
121:               this.button4 new Button();
122:               this.groupBox1 new GroupBox();
123:               this.button3 new Button();
124:               this.button1 new Button();
125:               this.label2 new Label();
126:               this.checkBox2 new CheckBox();
127:               this.checkBox3 new CheckBox();
128:               this.checkBox1 new CheckBox();
129:               this.FindComboBox new ComboBox();
130:               this.label1 new Label();
131:               this.OptionCombo new ComboBox();
132:               this.radioButton2 new RadioButton();
133:               
134:               radioButton1.Location new System.Drawing.Point(816);
135:               radioButton1.Size new System.Drawing.Size(6416);
136:               radioButton1.TabIndex 0;
137:               radioButton1.Text Resource.GetString("Dialog.NewProject.SearchReplace.Up");
138:               
139:               this.AutoScaleBaseSize new System.Drawing.Size(513);
140:               this.Text Resource.GetString("Dialog.NewProject.SearchReplace.FindDialogName");
141:               
142:               //@design this.TrayLargeIcon = true;
143:               //@design this.SnapToGrid = false;
144:               
145:               //@design this.TrayHeight = 0;
146:   //            this.TopMost = true;
147:               this.ClientSize new System.Drawing.Size(426 35121);
148:               
149:               button4.Location new System.Drawing.Point(35288);
150:               button4.Size new System.Drawing.Size(9624);
151:               button4.TabIndex 5;
152:               button4.Text Resource.GetString("Global.HelpButtonText");
153:               
154:               groupBox1.Location new System.Drawing.Point(16072);
155:               groupBox1.TabIndex 11;
156:               groupBox1.TabStop false;
157:               groupBox1.Text Resource.GetString("Dialog.NewProject.SearchReplace.DirectionText");
158:               groupBox1.Size new System.Drawing.Size(13440);
159:               
160:               button3.Location new System.Drawing.Point(35240);
161:               button3.Size new System.Drawing.Size(9624);
162:               button3.TabIndex 4;
163:               button3.Text Resource.GetString("Global.CloseButtonText");
164:               
165:               button1.Location new System.Drawing.Point(3528);
166:               button1.Size new System.Drawing.Size(9624);
167:               button1.TabIndex 2;
168:               button1.Text Resource.GetString("Dialog.NewProject.SearchReplace.Find");
169:                   
170:               label2.Location new System.Drawing.Point(13348);
171:               label2.Text Resource.GetString("Dialog.NewProject.SearchReplace.SearchIn");
172:               label2.Size new System.Drawing.Size(6014);
173:               label2.TabIndex 10;
174:               
175:               checkBox2.Location new System.Drawing.Point(872);
176:               checkBox2.Text Resource.GetString("Dialog.NewProject.SearchReplace.WholeWord");
177:               checkBox2.Size new System.Drawing.Size(11225);
178:               
179:   //            checkBox2.AccessibleRole = AccessibleRoles.CheckButton;
180:               checkBox2.TabIndex 7;
181:               checkBox2.TextAlign System.Drawing.ContentAlignment.MiddleLeft;
182:               
183:               checkBox3.Location new System.Drawing.Point(896);
184:               checkBox3.Text Resource.GetString("Dialog.NewProject.SearchReplace.WrapEnd");
185:               checkBox3.Size new System.Drawing.Size(11225);
186:               checkBox3.Checked true;
187:   //            checkBox3.AccessibleRole = AccessibleRoles.CheckButton;
188:               checkBox3.TabIndex 8;
189:               checkBox3.TextAlign System.Drawing.ContentAlignment.MiddleLeft;
190:               
191:               checkBox1.Location new System.Drawing.Point(848);
192:               checkBox1.Text Resource.GetString("Dialog.NewProject.SearchReplace.CaseSensitive");
193:               checkBox1.Size new System.Drawing.Size(11225);
194:   //            checkBox1.AccessibleRole = AccessibleRoles.CheckButton;
195:               checkBox1.TabIndex 6;
196:               checkBox1.TextAlign System.Drawing.ContentAlignment.MiddleLeft;
197:               
198:               FindComboBox.Location new System.Drawing.Point(7412);
199:               FindComboBox.Text Find.search.What;
200:               FindComboBox.Size new System.Drawing.Size(26421);
201:               FindComboBox.TabIndex 1;
202:               
203:               label1.Location new System.Drawing.Point(216);
204:               label1.Text Resource.GetString("Dialog.NewProject.SearchReplace.FindWhat");
205:               label1.Size new System.Drawing.Size(8024);
206:               label1.TabIndex 0;
207:               
208:               OptionCombo.Text "";
209:               OptionCombo.Location new System.Drawing.Point(19345);
210:               OptionCombo.Size new System.Drawing.Size(14421);
211:   //            OptionCombo.Style = ComboBoxStyle.DropDownList;
212:               OptionCombo.TabIndex 9;
213:               OptionCombo.Items.Add(Resource.GetString("Global.Location.currentfile"));
214:               OptionCombo.Items.Add(Resource.GetString("Global.Location.allopenfiles"));
215:               OptionCombo.Items.Add(Resource.GetString("Global.Location.wholeproject"));
216:               
217:               OptionCombo.SelectedIndex lastIndex;
218:               
219:               radioButton2.Location new System.Drawing.Point(6416);
220:               radioButton2.Size new System.Drawing.Size(6416);
221:               radioButton2.TabIndex 1;
222:               radioButton2.Text Resource.GetString("Dialog.NewProject.SearchReplace.Down");
223:               
224:   //            this.Controls.Add(groupBox1);
225:               this.Controls.Add(label2);
226:               this.Controls.Add(OptionCombo);
227:               this.Controls.Add(checkBox3);
228:               this.Controls.Add(checkBox2);
229:               this.Controls.Add(checkBox1);
230:               this.Controls.Add(button4);
231:               this.Controls.Add(button3);
232:               this.Controls.Add(button1);
233:               this.Controls.Add(FindComboBox);
234:               this.Controls.Add(label1);
235:               groupBox1.Controls.Add(radioButton2);
236:               groupBox1.Controls.Add(radioButton1);
237:               radioButton1.Checked searchup;
238:               radioButton2.Checked = !searchup;
239:               checkBox1.Checked = !Find.search.BigOnly;
240:               checkBox2.Checked Find.search.WholeWords;
241:               checkBox3.Checked Find.WrapAtTheEnd;
242:               
243:           }
244:           
245:           private void Close(object senderSystem.EventArgs e)
246:           {
247:               Close();
248:           }
249:           
250:           private void ClickFind(object senderSystem.EventArgs e){
251:               
252:               switch (OptionCombo.SelectedIndex){
253:                   case 0:
254:                       find new FindInBuffer();
255:                   break;
256:                   case 1:
257:                       find new FindInAllOpenFiles();
258:                   break;
259:                   case 2
260:                       find new FindInWholeProject();
261:                   break;
262:               }
263:               
264:               Find.search.BigOnly    = !checkBox1.Checked;
265:               Find.search.What       FindComboBox.Text;
266:               Find.search.WholeWords checkBox2.Checked;
267:               Find.WrapAtTheEnd      checkBox3.Checked;
268:               lastIndex              OptionCombo.SelectedIndex;
269:               
270:               
271:               if(!find.FindNext())
272:                   MessageBox.Show(Resource.GetString("Dialog.NewProject.SearchReplace.SearchStringNotFound"));
273:               
274:   /*            if (window != null) {
275:                   Buffer b = window.TextArea.Buffer;
276:                   Point begin = window.TextArea.Caret.CaretPos;
277:                   Point end  = new Point(0, b.Length);
278:                   search.BigOnly = !checkBox1.Checked;
279:                   System.String go = FindComboBox.Text;
280:                   search.What = go;
281:                   Point here = search.Find(b, begin, end);
282:                   if(!Found(here, end, go.Length)){
283:                       if(checkBox3.Checked){
284:                           here = search.Find(b, new Point(0, 0), begin);
285:                           if(!Found(here, begin, go.Length))
286:                               MessageBox.Show("!not found!");
287:                       }else
288:                           MessageBox.Show("!not found!");
289:                   }
290:               }*/
291:           }
292:       }
293:   }

This page was automatically generated by SharpDevelop.