Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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;
 }