Exemple #1
0
        public DocumentForm OpenFile(string filePath)
        {
            bool isOpen = false;
            foreach (DocumentForm documentForm in dockPanel.Documents)
            {
                if (filePath.Equals(documentForm.FilePath, StringComparison.OrdinalIgnoreCase))
                {
                    documentForm.Select();
                    isOpen = true;
                    break;
                }
            }

            // Open the files
            if (isOpen) return null;

            DocumentForm doc = new DocumentForm();
            doc.m_mainForm = this;
            SetScintillaToCurrentOptions(doc);
            doc.Scintilla.Text = File.ReadAllText(filePath);
            doc.Scintilla.UndoRedo.EmptyUndoBuffer();
            doc.Scintilla.Modified = false;
            doc.Text = Path.GetFileName(filePath);
            doc.ParseFile();
            doc.FilePath = filePath;
            doc.Show(dockPanel);
            toolIncremental.Searcher.Scintilla = doc.Scintilla;

            return doc;
        }
Exemple #2
0
 private DocumentForm NewDocument()
 {
     DocumentForm doc = new DocumentForm();
     doc.m_mainForm = this;
     SetScintillaToCurrentOptions(doc);
     doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);
     doc.Show(dockPanel);
     toolIncremental.Searcher.Scintilla = doc.Scintilla;
     return doc;
 }