private DocumentForm NewDocument() { DocumentForm doc = new DocumentForm(); SetScintillaToCurrentOptions(doc); doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount); doc.Show(dockPanel); return(doc); }
private DocumentForm OpenFile(string filePath) { DocumentForm doc = new DocumentForm(); SetScintillaToCurrentOptions(doc); doc.Scintilla.Text = File.ReadAllText(filePath); doc.Scintilla.UndoRedo.EmptyUndoBuffer(); doc.Scintilla.Modified = false; doc.Text = Path.GetFileName(filePath); doc.FilePath = filePath; doc.Show(dockPanel); //toolIncremental.Searcher.Scintilla = doc.Scintilla; return(doc); }
private void SetScintillaToCurrentOptions(DocumentForm doc) { // Turn on line numbers? if (lineNumbersToolStripMenuItem.Checked) { doc.Scintilla.Margins.Margin0.Width = LINE_NUMBERS_MARGIN_WIDTH; } else { doc.Scintilla.Margins.Margin0.Width = 0; } // Turn on white space? if (whitespaceToolStripMenuItem.Checked) { doc.Scintilla.Whitespace.Mode = WhitespaceMode.VisibleAlways; } else { doc.Scintilla.Whitespace.Mode = WhitespaceMode.Invisible; } // Turn on word wrap? if (wordWrapToolStripMenuItem.Checked) { doc.Scintilla.LineWrapping.Mode = LineWrappingMode.Word; } else { doc.Scintilla.LineWrapping.Mode = LineWrappingMode.None; } // Show EOL? doc.Scintilla.EndOfLine.IsVisible = endOfLineToolStripMenuItem.Checked; // Set the zoom doc.Scintilla.ZoomFactor = _zoomLevel; }