1:   //  ToolCommands.cs
2:   //  Copyright (C) 2002 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.IO;
20:   using System.Threading;
21:   using System.Drawing;
22:   using System.Drawing.Printing;
23:   using System.Collections;
24:   using System.ComponentModel;
25:   using System.Windows.Forms;
26:   using System.Diagnostics;
27:   using System.Text;
28:  
29:   using Core.AddIns;
30:   using Core.Util;
31:   using Core.Properties;
32:   using Core.Gui;
33:   using Core.Gui.Creators;
34:  
35:   using SharpDevelop.Gui.Dialogs;
36:   using SharpDevelop.DefaultEditor.Text;
37:   using SharpDevelop.DefaultEditor.Gui.Editor;
38:   using SharpDevelop.Gui;
39:  
40:   namespace SharpDevelop.DefaultEditor.Commands {
41:       
42:       public class ShowColorDialog : AbstractMenuCommand
43:       {
44:           public override void Run()
45:           {
46:               IWorkbenchWindow window WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
47:               
48:               if (window == null || !(window.WindowContent.Control is TextAreaControl)) {
49:                   return;
50:               }
51:               TextAreaControl textarea = (TextAreaControl)window.WindowContent.Control;
52:               
53:               ColorDialog cd new ColorDialog();
54:               if (cd.ShowDialog() == DialogResult.OK) {
55:                   string colorstr "#" cd.Color.ToArgb().ToString("X");
56:                   if (cd.Color.IsKnownColor) {
57:                       colorstr cd.Color.ToKnownColor().ToString();
58:                   }
59:                   
60:                   textarea.Document.Insert(textarea.Document.Caret.Offsetcolorstr);
61:                   int lineNumber textarea.Document.GetLineNumberOfOffset(textarea.Document.Caret.Offset);
62:                   textarea.Document.Caret.Offset += colorstr.Length;
63:                   textarea.UpdateLines(lineNumberlineNumber);
64:               }
65:               cd.Dispose();
66:               
67:           }
68:       }
69:       
70:   }

This page was automatically generated by SharpDevelop.