private DocumentForm NewDocument() { DocumentForm doc = new DocumentForm(); SetScintillaToCurrentOptions(doc); doc.Title = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount); documentsRoot.Children.Add(doc); doc.DockAsDocument(); doc.IsActive = true; return(doc); }
private DocumentForm OpenFile(string filePath) { DocumentForm doc = new DocumentForm(); SetScintillaToCurrentOptions(doc); doc.Scintilla.Text = File.ReadAllText(filePath); doc.Scintilla.EmptyUndoBuffer(); //doc.Scintilla.Modified = false; doc.Title = Path.GetFileName(filePath); doc.FilePath = filePath; documentsRoot.Children.Add(doc); doc.DockAsDocument(); doc.IsActive = true; //incrementalSearcher.Scintilla = doc.Scintilla; return(doc); }
private void SetScintillaToCurrentOptions(DocumentForm doc) { ScintillaWPF ScintillaNet = doc.Scintilla; ScintillaNet.KeyDown += ScintillaNet_KeyDown; // INITIAL VIEW CONFIG ScintillaNet.WrapMode = WrapMode.None; ScintillaNet.IndentationGuides = IndentView.LookBoth; // STYLING InitColors(ScintillaNet); InitSyntaxColoring(ScintillaNet); // NUMBER MARGIN InitNumberMargin(ScintillaNet); // BOOKMARK MARGIN InitBookmarkMargin(ScintillaNet); // CODE FOLDING MARGIN InitCodeFolding(ScintillaNet); // DRAG DROP // TODO - Enable InitDragDropFile //InitDragDropFile(); // INIT HOTKEYS // TODO - Enable InitHotkeys //InitHotkeys(ScintillaNet); // Turn on line numbers? if (lineNumbersMenuItem.IsChecked) { doc.Scintilla.Margins[NUMBER_MARGIN].Width = LINE_NUMBERS_MARGIN_WIDTH; } else { doc.Scintilla.Margins[NUMBER_MARGIN].Width = 0; } // Turn on white space? if (whitespaceMenuItem.IsChecked) { doc.Scintilla.ViewWhitespace = WhitespaceMode.VisibleAlways; } else { doc.Scintilla.ViewWhitespace = WhitespaceMode.Invisible; } // Turn on word wrap? if (wordWrapMenuItem.IsChecked) { doc.Scintilla.WrapMode = WrapMode.Word; } else { doc.Scintilla.WrapMode = WrapMode.None; } // Show EOL? doc.Scintilla.ViewEol = endOfLineMenuItem.IsChecked; // Set the zoom doc.Scintilla.Zoom = _zoomLevel; }