Example #1
0
 /// <summary>
 /// Creates a new editor window within this form and displays it.
 /// </summary>
 /// <param name="fileName">The filename of the file contained in this form.</param>
 /// <param name="codeData">The data in the file to show in the editor control.</param>
 /// <returns></returns>
 public CodeEditor AddEditorWindow(string fileName = null, string codeData = null)
 {
     CodeEditor editor = new CodeEditor(this);
     editor.MdiParent = this;
     if (fileName != null && codeData != null)
         editor.LoadContents(fileName, codeData);
     editor.Show();
     ActivateMdiChild(editor);
     return editor;
 }
Example #2
0
 /// <summary>
 /// Opens the specified file in an Editor window.
 /// </summary>
 /// <param name="fileName">The filename of the file to open.</param>
 /// <param name="editor">The editor to open the file in, or null to create a new one.</param>
 public void Open(string fileName, CodeEditor editor = null)
 {
     string codeData = File.ReadAllText(fileName);
     if (editor == null)
     {
         AddEditorWindow(fileName, codeData);
     }
     else
     {
         editor.LoadContents(fileName, codeData);
         editor.editorControl.ActiveTextAreaControl.Caret.Line = 0;
         editor.editorControl.ActiveTextAreaControl.Caret.Column = 0;
         editor.UpdateWindowTitle();
         editor.Activate();
     }
 }
Example #3
0
 public FindReplace(CodeEditor editor)
 {
     InitializeComponent();
     Editor = editor;
 }
Example #4
0
 /// <summary>
 /// Shows an OpenFileDialog, prompting the user to open a file.
 /// </summary>
 /// <param name="editor">The editor to open the file in, or null to create a new one.</param>
 public void Open(CodeEditor editor = null)
 {
     Events.Enqueue("Showing open dialog...");
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = Properties.Resources.DialogFilter;
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             Open(ofd.FileName, editor);
         }
     }
 }
Example #5
0
 public FindReplace(CodeEditor editor)
 {
     InitializeComponent();
     Editor = editor;
 }