Exemple #1
0
        private DocumentForm NewDocument()
        {
            DocumentForm doc = new DocumentForm();

            SetScintillaToCurrentOptions(doc);
            doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);
            if (lineNumbersToolStripMenuItem.Checked)
            {
                doc.Scintilla.Margins.Margin0.Width = LINE_NUMBERS_MARGIN_WIDTH;
            }
            doc.Show(dockPanel);
            toolIncremental.Searcher.Scintilla = doc.Scintilla;
            return(doc);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public DocumentForm OpenFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                return(null);
            }

            foreach (DocumentForm documentForm in dockPanel.Documents)
            {
                if (filePath.EqualIgnoreCase(documentForm.FilePath))
                {
                    documentForm.Select();
                    return(documentForm);
                }
            }

            DocumentForm doc      = new DocumentForm();
            Encoding     encoding = Encoding.Default;
            //以下代码执行顺序必须调整,SCide判断编码有点不准
            //doc.Scintilla.Text = FileHelper.Read(filePath, out encoding);
            //doc.Scintilla.Encoding = encoding;

            //调整为:
            string content = FileHelper.Read(filePath, out encoding);

            doc.Scintilla.Encoding = encoding;
            doc.Scintilla.Text     = content;

            doc.Scintilla.UndoRedo.EmptyUndoBuffer();
            doc.Scintilla.Modified = false;
            doc.Text     = Path.GetFileName(filePath);
            doc.FilePath = filePath;
            if (lineNumbersToolStripMenuItem.Checked)
            {
                doc.Scintilla.Margins.Margin0.Width = LINE_NUMBERS_MARGIN_WIDTH;
            }
            doc.Show(dockPanel);
            toolIncremental.Searcher.Scintilla = doc.Scintilla;
            encodingToolStripStatusLabel.Text  = encoding.BodyName;
            SetLanguage(doc);
            return(doc);
        }
Exemple #4
0
        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;
        }
Exemple #5
0
 private DocumentForm NewDocument()
 {
     DocumentForm doc = new DocumentForm();
     SetScintillaToCurrentOptions(doc);
     doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);
     doc.Show(dockPanel);
     toolIncremental.Searcher.Scintilla = doc.Scintilla;
     return doc;
 }