Rev 9 | Rev 11 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | freddie | 1 | /* |
2 | * Created by SharpDevelop. |
||
3 | * User: 06pfjn |
||
4 | * Date: 30/06/2010 |
||
5 | * Time: 12:15 |
||
6 | * |
||
7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. |
||
8 | */ |
||
9 | using System; |
||
10 | using System.Collections.Generic; |
||
11 | using System.Drawing; |
||
12 | using System.Windows.Forms; |
||
13 | |||
14 | namespace LassyPad |
||
15 | { |
||
16 | /// <summary> |
||
17 | /// Description of MainForm. |
||
18 | /// </summary> |
||
19 | public partial class MainForm : Form |
||
20 | { |
||
9 | freddie | 21 | |
22 | public class word |
||
23 | { |
||
24 | public Color colour; |
||
25 | public List<string> words; |
||
1 | freddie | 26 | |
9 | freddie | 27 | public word(Color colourN, string wordsN) |
28 | { |
||
29 | colour = colourN; |
||
30 | words = new List<string>(); |
||
31 | string[] tempWords = wordsN.Split(','); |
||
32 | for (int i = 0; i < tempWords.Length; i++) |
||
33 | words.Add(tempWords[i]); |
||
34 | } |
||
35 | |||
36 | } |
||
37 | |||
38 | public class comment |
||
39 | { |
||
40 | public Color colour; |
||
41 | public string start; |
||
42 | public string end; |
||
43 | |||
44 | public comment(Color colourN, string startN, string endN) |
||
45 | { |
||
46 | colour = colourN; |
||
47 | start = startN; |
||
48 | end = endN; |
||
49 | } |
||
50 | |||
51 | public comment(Color colourN, string startN) |
||
52 | { |
||
53 | colour = colourN; |
||
54 | start = startN; |
||
55 | end = "\n"; |
||
56 | } |
||
57 | } |
||
58 | |||
1 | freddie | 59 | public class rtfFile |
60 | { |
||
61 | public string loc; |
||
62 | public RichTextBox rtfBox; |
||
63 | public bool saved; |
||
9 | freddie | 64 | public bool isRtf; |
65 | public int syntax; |
||
66 | |||
1 | freddie | 67 | public rtfFile(string locN) |
68 | { |
||
69 | loc = locN; |
||
70 | saved = true; |
||
71 | rtfBox = new RichTextBox(); |
||
72 | } |
||
73 | |||
74 | public void save() |
||
75 | { |
||
9 | freddie | 76 | if (loc.EndsWith(".rtf")) |
77 | rtfBox.SaveFile(loc); |
||
78 | else |
||
79 | { |
||
80 | string str = rtfBox.Rtf; |
||
81 | rtfBox.Rtf = rtfBox.Text; |
||
82 | rtfBox.SaveFile(loc); |
||
83 | rtfBox.Rtf = str; |
||
84 | } |
||
1 | freddie | 85 | saved = true; |
86 | } |
||
87 | |||
4 | freddie | 88 | public bool open() |
1 | freddie | 89 | { |
90 | try |
||
91 | { |
||
92 | saved = true; |
||
9 | freddie | 93 | if (loc.EndsWith(".rtf")) |
10 | freddie | 94 | { |
95 | rtfBox.LoadFile(loc, RichTextBoxStreamType.TextTextOleObjs); |
||
9 | freddie | 96 | isRtf = true; |
10 | freddie | 97 | } |
9 | freddie | 98 | else |
10 | freddie | 99 | { |
100 | rtfBox.LoadFile(loc, RichTextBoxStreamType.PlainText); |
||
9 | freddie | 101 | isRtf = false; |
10 | freddie | 102 | } |
1 | freddie | 103 | } |
104 | catch (Exception ex) |
||
105 | { |
||
10 | freddie | 106 | MessageBox.Show(ex.Message, "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
107 | return false; |
||
1 | freddie | 108 | } |
4 | freddie | 109 | return true; |
1 | freddie | 110 | } |
111 | } |
||
112 | |||
9 | freddie | 113 | public class syntax |
114 | { |
||
115 | |||
116 | public string id; |
||
117 | public List<word> words; |
||
118 | public List<comment> comments; |
||
119 | |||
120 | public syntax(string idN) |
||
121 | { |
||
122 | id = idN; |
||
123 | words = new List<MainForm.word>(); |
||
124 | comments = new List<MainForm.comment>(); |
||
125 | } |
||
126 | |||
127 | } |
||
128 | |||
1 | freddie | 129 | public List<rtfFile> files = new List<rtfFile>(); |
130 | public int curFileID; |
||
131 | |||
9 | freddie | 132 | public List<syntax> syntaxes = new List<syntax>(); |
133 | |||
1 | freddie | 134 | public int selectionStart; |
135 | public int selectionLength; |
||
136 | |||
137 | public MainForm() |
||
138 | { |
||
139 | |||
140 | InitializeComponent(); |
||
141 | |||
142 | } |
||
143 | |||
144 | void MainFormLoad(object sender, EventArgs e) |
||
145 | { |
||
146 | welcomeView.Url = new Uri("http://tim32.org/~freddie/LassyPad/Welcome.htm"); |
||
147 | initAll(); |
||
7 | freddie | 148 | |
149 | bool openRes; |
||
150 | string[] envArgs = System.Environment.GetCommandLineArgs(); |
||
151 | for (int i = 0; i < envArgs.Length; i++) |
||
152 | { |
||
153 | if (envArgs[i].EndsWith(".rtf") || envArgs[i].EndsWith(".txt")) |
||
154 | { |
||
155 | files.Add(new rtfFile(envArgs[i])); |
||
156 | openRes = files[files.Count - 1].open(); |
||
157 | if (openRes) |
||
158 | { |
||
159 | treeView.Nodes["Files"].Nodes.Add(envArgs[i], envArgs[i]); |
||
160 | showFile(files.Count - 1); |
||
161 | } |
||
162 | else |
||
163 | files.RemoveAt(files.Count - 1); |
||
164 | } |
||
165 | } |
||
1 | freddie | 166 | } |
167 | |||
168 | public void initAll() |
||
169 | { |
||
170 | initTreeView(); |
||
9 | freddie | 171 | loadSyntaxes(); |
1 | freddie | 172 | } |
173 | |||
174 | public void initTreeView() |
||
175 | { |
||
176 | // welcome |
||
177 | treeView.Nodes.Add("Welcome", "Welcome"); |
||
178 | treeView.Nodes["Welcome"].Nodes.Add("Introduction", "Introduction"); |
||
179 | treeView.Nodes["Welcome"].Nodes.Add("Help", "Help"); |
||
180 | |||
181 | // |
||
182 | treeView.Nodes.Add("Files", "Files"); |
||
183 | } |
||
184 | |||
9 | freddie | 185 | public void loadSyntaxes() |
186 | { |
||
187 | System.IO.StreamReader reader = new System.IO.StreamReader("data/syntaxes.dat"); |
||
188 | string r = reader.ReadToEnd(); |
||
189 | string[] data = r.Split('\n'); |
||
190 | string[] d, d2; |
||
191 | |||
192 | for (int i = 0; i < data.Length; i++) |
||
193 | { |
||
194 | data[i] = data[i].Replace("\r", ""); |
||
195 | if (data[i].EndsWith(":")) |
||
196 | { |
||
197 | syntaxes.Add(new syntax(data[i].Substring(0, data[i].Length - 1))); |
||
198 | syntaxHighlightingToolStripMenuItem.Items.Add(data[i].Substring(0, data[i].Length - 1)); |
||
199 | } |
||
200 | else |
||
201 | { |
||
202 | d = data[i].Split(' '); |
||
203 | switch (d[0]) |
||
204 | { |
||
205 | case ("word"): |
||
206 | { |
||
207 | if (d.Length == 3) |
||
208 | syntaxes[syntaxes.Count - 1].words.Add(new word(Color.FromName(d[1]), d[2])); |
||
209 | else if (d.Length == 5) |
||
210 | { |
||
211 | d2 = d[1].Split(','); |
||
212 | syntaxes[syntaxes.Count - 1].words.Add(new word(Color.FromArgb(int.Parse(d2[0]), int.Parse(d2[1]), int.Parse(d2[2])), d[2])); |
||
213 | } |
||
214 | break; |
||
215 | } |
||
216 | } |
||
217 | } |
||
218 | } |
||
219 | } |
||
220 | |||
1 | freddie | 221 | void TreeViewNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) |
222 | { |
||
223 | if (e.Node.Level == 0) |
||
224 | { |
||
225 | switch (e.Node.Name) |
||
226 | { |
||
227 | case ("Welcome"): |
||
228 | { |
||
229 | welcomeView.Url = new Uri("http://tim32.org/~freddie/LassyPad/Welcome.htm"); |
||
230 | break; |
||
231 | } |
||
232 | } |
||
233 | } |
||
234 | else |
||
235 | { |
||
236 | switch (e.Node.Parent.Name) |
||
237 | { |
||
238 | case ("Welcome"): |
||
239 | { |
||
240 | if (e.Node.Name == "Introduction") |
||
241 | welcomeView.Url = new Uri("http://tim32.org/~freddie/LassyPad/Introduction.htm"); |
||
242 | else if (e.Node.Name == "Help") |
||
243 | welcomeView.Url = new Uri("http://tim32.org/~freddie/LassyPad/Help.htm"); |
||
244 | |||
245 | break; |
||
246 | } |
||
247 | case ("Files"): |
||
248 | { |
||
249 | showFile(e.Node.Name); |
||
250 | break; |
||
251 | } |
||
252 | } |
||
253 | } |
||
254 | } |
||
255 | |||
256 | // other functions |
||
257 | |||
7 | freddie | 258 | public void insertImageFromFile() |
259 | { |
||
260 | DialogResult res = openFileDialog1.ShowDialog(); |
||
261 | if (openFileDialog1.FileName != "" && res != DialogResult.Cancel) |
||
262 | { |
||
263 | // HELL - Get help from somewhere.... |
||
264 | } |
||
265 | } |
||
266 | |||
267 | public void zoomIn() |
||
268 | { |
||
269 | editorView.ZoomFactor *= 1.2f; |
||
270 | } |
||
271 | |||
272 | public void zoomOut() |
||
273 | { |
||
274 | editorView.ZoomFactor /= 1.2f; |
||
275 | } |
||
276 | |||
1 | freddie | 277 | public void setSelection() |
278 | { |
||
279 | editorView.Select(selectionStart, selectionLength); |
||
280 | } |
||
281 | |||
282 | public void showFile(int fileID) |
||
283 | { |
||
284 | tabControl.SelectedIndex = 1; |
||
285 | editorView.Rtf = files[fileID].rtfBox.Rtf; |
||
286 | curFileID = fileID; |
||
9 | freddie | 287 | if (files[curFileID].isRtf) |
288 | syntaxHighlightingToolStripMenuItem.Enabled = false; |
||
289 | else |
||
290 | syntaxHighlightingToolStripMenuItem.Enabled = true; |
||
1 | freddie | 291 | } |
292 | |||
293 | public void showFile(string filename) |
||
294 | { |
||
295 | tabControl.SelectedIndex = 1; |
||
296 | for (int i = 0; i < files.Count; i++) |
||
297 | { |
||
3 | freddie | 298 | if (files[i].loc == filename) |
299 | { |
||
300 | editorView.Rtf = files[i].rtfBox.Rtf; |
||
301 | curFileID = i; |
||
9 | freddie | 302 | if (files[curFileID].isRtf) |
303 | syntaxHighlightingToolStripMenuItem.Enabled = false; |
||
304 | else |
||
305 | syntaxHighlightingToolStripMenuItem.Enabled = true; |
||
3 | freddie | 306 | return; |
307 | } |
||
1 | freddie | 308 | } |
309 | } |
||
310 | |||
311 | // file functions |
||
312 | |||
313 | public void newFile() |
||
314 | { |
||
315 | int i = 0; |
||
3 | freddie | 316 | bool exists; |
1 | freddie | 317 | while (true) |
318 | { |
||
3 | freddie | 319 | exists = false; |
1 | freddie | 320 | for (int j = 0; j < files.Count; j++) |
321 | { |
||
3 | freddie | 322 | if ((files[j].loc == "NewFile" + i.ToString() + ".rtf")) |
323 | exists = true; |
||
1 | freddie | 324 | } |
3 | freddie | 325 | if (!exists) |
326 | { |
||
327 | files.Add(new rtfFile("NewFile" + i.ToString() + ".rtf")); |
||
328 | treeView.Nodes["Files"].Nodes.Add("NewFile" + i.ToString() + ".rtf", "NewFile" + i.ToString() + ".rtf"); |
||
9 | freddie | 329 | files[files.Count - 1].isRtf = true; |
3 | freddie | 330 | showFile(files.Count - 1); |
331 | return; |
||
332 | } |
||
1 | freddie | 333 | i++; |
334 | } |
||
335 | |||
336 | } |
||
337 | |||
338 | public void renameFile(string filename, string newFilename) |
||
339 | { |
||
3 | freddie | 340 | treeView.Nodes["Files"].Nodes[filename].Text = newFilename; |
341 | treeView.Nodes["Files"].Nodes[filename].Name = newFilename; |
||
1 | freddie | 342 | for (int i = 0; i < files.Count; i++) |
343 | { |
||
344 | if (files[i].loc == filename) |
||
345 | files[i].loc = newFilename; |
||
346 | } |
||
347 | } |
||
348 | |||
3 | freddie | 349 | public void renameFile(int fileID, string newFilename) |
350 | { |
||
351 | treeView.Nodes["Files"].Nodes[files[fileID].loc].Text = newFilename; |
||
352 | treeView.Nodes["Files"].Nodes[files[fileID].loc].Name = newFilename; |
||
353 | files[fileID].loc = newFilename; |
||
354 | } |
||
355 | |||
1 | freddie | 356 | public void openFile() |
357 | { |
||
4 | freddie | 358 | bool openRes; |
1 | freddie | 359 | DialogResult res = openFileDialog1.ShowDialog(); |
360 | if (openFileDialog1.FileName != "" && res != DialogResult.Cancel) |
||
361 | { |
||
362 | files.Add(new rtfFile(openFileDialog1.FileName)); |
||
4 | freddie | 363 | openRes = files[files.Count - 1].open(); |
364 | if (openRes) |
||
365 | { |
||
366 | treeView.Nodes["Files"].Nodes.Add(openFileDialog1.FileName, openFileDialog1.FileName); |
||
367 | showFile(files.Count - 1); |
||
368 | } |
||
369 | else |
||
370 | files.RemoveAt(files.Count - 1); |
||
1 | freddie | 371 | } |
372 | } |
||
373 | |||
374 | public void closeFile() |
||
375 | { |
||
376 | if (curFileID < files.Count && curFileID > -1) |
||
377 | { |
||
378 | treeView.Nodes["Files"].Nodes.RemoveByKey(files[curFileID].loc); |
||
379 | files.RemoveAt(curFileID); |
||
380 | if (curFileID >= files.Count) |
||
381 | curFileID--; |
||
382 | if (files.Count > 0) |
||
383 | showFile(curFileID); |
||
384 | else |
||
385 | tabControl.SelectedIndex = 0; |
||
386 | } |
||
387 | } |
||
388 | |||
8 | freddie | 389 | public void saveAll() |
390 | { |
||
391 | for (int i = 0; i < files.Count; i++) |
||
392 | files[i].save(); |
||
393 | } |
||
394 | |||
1 | freddie | 395 | // format functions |
396 | |||
397 | public void addStyle(FontStyle newStyles) |
||
398 | { |
||
399 | FontStyle fStyle = editorView.SelectionFont.Style; |
||
400 | editorView.SelectionFont = new Font(editorView.SelectionFont, fStyle | newStyles); |
||
401 | } |
||
402 | |||
403 | public void remStyle(FontStyle remStyles) |
||
404 | { |
||
405 | FontStyle fStyle = editorView.SelectionFont.Style; |
||
406 | fStyle -= remStyles; |
||
407 | editorView.SelectionFont = new Font(editorView.SelectionFont, fStyle); |
||
408 | } |
||
409 | |||
410 | // form events |
||
411 | |||
412 | void EditorViewTextChanged(object sender, EventArgs e) |
||
413 | { |
||
414 | if (curFileID < files.Count && curFileID > -1) |
||
415 | { |
||
416 | files[curFileID].rtfBox.Rtf = editorView.Rtf; |
||
417 | files[curFileID].saved = false; |
||
418 | } |
||
419 | } |
||
420 | |||
421 | void EditorViewSelectionChanged(object sender, EventArgs e) |
||
422 | { |
||
423 | selectionStart = editorView.SelectionStart; |
||
424 | selectionLength = editorView.SelectionLength; |
||
7 | freddie | 425 | textColourF.ForeColor = editorView.SelectionColor; |
2 | tom | 426 | // sizeF.Text = editorView.SelectionFont.Size.ToString(); |
1 | freddie | 427 | } |
428 | |||
429 | #region File stuff |
||
430 | |||
431 | void ToolStripButton1Click(object sender, EventArgs e) |
||
432 | { |
||
433 | newFile(); |
||
434 | } |
||
435 | |||
436 | void NewToolStripMenuItemClick(object sender, EventArgs e) |
||
437 | { |
||
438 | newFile(); |
||
439 | } |
||
440 | |||
441 | void ToolStripButton2Click(object sender, EventArgs e) |
||
442 | { |
||
443 | openFile(); |
||
444 | } |
||
445 | |||
446 | void OpenToolStripMenuItemClick(object sender, EventArgs e) |
||
447 | { |
||
448 | openFile(); |
||
449 | } |
||
450 | |||
451 | void ToolStripButton3Click(object sender, EventArgs e) |
||
452 | { |
||
453 | files[curFileID].save(); |
||
454 | } |
||
455 | |||
456 | void SaveToolStripMenuItemClick(object sender, EventArgs e) |
||
457 | { |
||
458 | files[curFileID].save(); |
||
459 | } |
||
460 | |||
461 | void ToolStripButton4Click(object sender, EventArgs e) |
||
462 | { |
||
463 | closeFile(); |
||
464 | } |
||
465 | |||
3 | freddie | 466 | void SaveAsToolStripMenuItemClick(object sender, EventArgs e) |
467 | { |
||
468 | DialogResult res = saveFileDialog1.ShowDialog(); |
||
469 | if (saveFileDialog1.FileName != "" && res != DialogResult.Cancel) |
||
470 | { |
||
471 | renameFile(curFileID, saveFileDialog1.FileName); |
||
472 | files[curFileID].loc = saveFileDialog1.FileName; |
||
473 | files[curFileID].save(); |
||
474 | } |
||
475 | } |
||
476 | |||
1 | freddie | 477 | #endregion |
478 | |||
479 | #region Format stuff |
||
480 | |||
481 | void BoldFClick(object sender, EventArgs e) |
||
482 | { |
||
483 | if (editorView.SelectionFont.Bold) |
||
484 | remStyle(FontStyle.Bold); |
||
485 | else |
||
486 | addStyle(FontStyle.Bold); |
||
487 | } |
||
488 | |||
489 | void ItalicFClick(object sender, EventArgs e) |
||
490 | { |
||
491 | if (editorView.SelectionFont.Italic) |
||
492 | remStyle(FontStyle.Italic); |
||
493 | else |
||
494 | addStyle(FontStyle.Italic); |
||
495 | } |
||
496 | |||
497 | void UnderlineFClick(object sender, EventArgs e) |
||
498 | { |
||
499 | if (editorView.SelectionFont.Underline) |
||
500 | remStyle(FontStyle.Underline); |
||
501 | else |
||
502 | addStyle(FontStyle.Underline); |
||
503 | } |
||
504 | |||
505 | void ToolStripButton5Click(object sender, EventArgs e) |
||
506 | { |
||
507 | editorView.SelectionAlignment = HorizontalAlignment.Left; |
||
508 | } |
||
509 | |||
510 | void ToolStripButton6Click(object sender, EventArgs e) |
||
511 | { |
||
512 | editorView.SelectionAlignment = HorizontalAlignment.Center; |
||
513 | } |
||
514 | |||
515 | void ToolStripButton7Click(object sender, EventArgs e) |
||
516 | { |
||
517 | editorView.SelectionAlignment = HorizontalAlignment.Right; |
||
518 | } |
||
519 | |||
520 | void SizeFTextChanged(object sender, EventArgs e) |
||
521 | { |
||
522 | setSelection(); |
||
523 | FontStyle fStyle = editorView.SelectionFont.Style; |
||
524 | float size = 0.0f; |
||
525 | if (float.TryParse(sizeF.Text, out size)) |
||
526 | { |
||
527 | if (size > 0) |
||
528 | editorView.SelectionFont = new Font(editorView.SelectionFont.FontFamily, size, fStyle); |
||
529 | } |
||
530 | } |
||
531 | |||
532 | #endregion |
||
533 | |||
534 | void WordWrapToolStripMenuItemClick(object sender, EventArgs e) |
||
535 | { |
||
536 | editorView.WordWrap = ! editorView.WordWrap; |
||
537 | wordWrapToolStripMenuItem.Checked = editorView.WordWrap; |
||
538 | } |
||
6 | freddie | 539 | |
540 | void ToolStripButton8Click(object sender, EventArgs e) |
||
541 | { |
||
7 | freddie | 542 | insertImageFromFile(); |
6 | freddie | 543 | } |
7 | freddie | 544 | |
545 | #region editorMenuStrip |
||
546 | |||
547 | void CloseFileToolStripMenuItemClick(object sender, EventArgs e) |
||
548 | { |
||
549 | closeFile(); |
||
550 | } |
||
551 | |||
552 | void SaveFileToolStripMenuItemClick(object sender, EventArgs e) |
||
553 | { |
||
554 | files[curFileID].save(); |
||
555 | } |
||
556 | |||
557 | void InToolStripMenuItemClick(object sender, EventArgs e) |
||
558 | { |
||
559 | zoomIn(); |
||
560 | } |
||
561 | |||
562 | void OutToolStripMenuItemClick(object sender, EventArgs e) |
||
563 | { |
||
564 | zoomOut(); |
||
565 | } |
||
566 | |||
567 | #endregion |
||
568 | |||
8 | freddie | 569 | void TextColourFClick(object sender, EventArgs e) |
7 | freddie | 570 | { |
571 | DialogResult res = colorDialog1.ShowDialog(); |
||
572 | if (res != DialogResult.Cancel) |
||
573 | { |
||
574 | textColourF.ForeColor = colorDialog1.Color; |
||
575 | editorView.SelectionColor = colorDialog1.Color; |
||
576 | } |
||
577 | } |
||
8 | freddie | 578 | |
579 | void ToolStripButton9Click(object sender, EventArgs e) |
||
580 | { |
||
581 | saveAll(); |
||
582 | } |
||
9 | freddie | 583 | |
584 | void TabControlSelectedIndexChanged(object sender, EventArgs e) |
||
585 | { |
||
586 | if (tabControl.SelectedIndex == 1 && files.Count == 0) |
||
587 | { |
||
588 | newFile(); |
||
589 | } |
||
590 | } |
||
591 | |||
592 | void SyntaxHighlightingToolStripMenuItemSelectedIndexChanged(object sender, EventArgs e) |
||
593 | { |
||
594 | |||
595 | // clear own highlighting |
||
596 | files[curFileID].rtfBox.Rtf = editorView.Text; |
||
597 | files[curFileID].syntax = -1; |
||
598 | |||
599 | // sort out new stuff |
||
600 | if (syntaxHighlightingToolStripMenuItem.SelectedIndex == 1) |
||
601 | { |
||
602 | for (int i = 0; i < syntaxes.Count; i++) |
||
603 | { |
||
604 | if (files[curFileID].loc.EndsWith(syntaxes[i].id)) |
||
605 | { |
||
606 | files[curFileID].syntax = i; |
||
607 | break; |
||
608 | } |
||
609 | } |
||
610 | } |
||
611 | else |
||
612 | files[curFileID].syntax = syntaxHighlightingToolStripMenuItem.SelectedIndex - 2; |
||
613 | |||
614 | applySyntax(curFileID); |
||
615 | showFile(curFileID); |
||
616 | |||
617 | } |
||
618 | |||
619 | public void applySyntax(int fileID) |
||
620 | { |
||
621 | if (files[fileID].isRtf) |
||
622 | return; |
||
623 | |||
624 | if (files[fileID].syntax == -1) |
||
625 | files[fileID].rtfBox.Rtf = files[fileID].rtfBox.Text; |
||
626 | else |
||
627 | { |
||
628 | int pos; |
||
629 | string[] data = files[fileID].rtfBox.Text.Split(new char[] { ' ', '\n' }); |
||
630 | for (int i = 0; i < syntaxes[files[fileID].syntax].words.Count; i++) |
||
631 | { |
||
632 | pos = 0; |
||
633 | for (int j = 0; j < data.Length; j++) |
||
634 | { |
||
635 | if (syntaxes[files[fileID].syntax].words[i].words.Contains(data[j])) |
||
636 | { |
||
637 | files[fileID].rtfBox.Select(pos, data[j].Length); |
||
638 | files[fileID].rtfBox.SelectionColor = syntaxes[files[fileID].syntax].words[i].colour; |
||
639 | } |
||
640 | pos += data[j].Length + 1; |
||
641 | } |
||
642 | } |
||
643 | } |
||
644 | |||
645 | } |
||
1 | freddie | 646 | } |
647 | } |