Ejemplo n.º 1
0
        private void InitContextMenu(bool spellCheck)
        {
            this._miUndo = new ToolStripMenuItem("Undo", null, (s, ea) => _scintilla.Undo());
            Items.Add(this._miUndo);
            this._miRedo = new ToolStripMenuItem("Redo", null, (s, ea) => _scintilla.Redo());

            Items.Add(this._miRedo);

            if (spellCheck)
            {
                _miCheckSpelling = new ToolStripMenuItem("Check Spelling", null,
                                                         (s, ea) => ScintillaTextEditorFactory.CheckSpelling(_scintilla, Hunspell))
                {
                    ShortcutKeys = Keys.F7
                };

                Items.Add(_miCheckSpelling);
            }

            Items.Add(new ToolStripSeparator());

            _miWordwrap = new ToolStripMenuItem("Word Wrap");
            foreach (WrapMode mode in Enum.GetValues(typeof(WrapMode)))
            {
                var mi = new ToolStripMenuItem(mode.ToString(), null, SetWordWrapMode)
                {
                    Tag = mode
                };
                mi.Checked = _scintilla.WrapMode == mode;
                _miWordwrap.DropDownItems.Add(mi);
            }

            _miSpelling = new ToolStripMenuItem("Spelling");
            Items.Add(_miSpelling);

            Items.Add(_miWordwrap);

            Items.Add(new ToolStripSeparator());

            this._miCut = new ToolStripMenuItem("Cut", null, (s, ea) => _scintilla.Cut());
            Items.Add(_miCut);
            this._miCopy = new ToolStripMenuItem("Copy", null, (s, ea) => _scintilla.Copy());
            Items.Add(_miCopy);
            Items.Add(new ToolStripMenuItem("Paste", null, (s, ea) => _scintilla.Paste()));
            this._miDelete = new ToolStripMenuItem("Delete", null, (s, ea) => _scintilla.ReplaceSelection(""));
            Items.Add(_miDelete);
            Items.Add(new ToolStripSeparator());

            this._miSelectAll = new ToolStripMenuItem("Select All", null, (s, ea) => _scintilla.SelectAll());
            Items.Add(_miSelectAll);
        }
Ejemplo n.º 2
0
        //When the "Copy" button is pressed in the "Edit" toolstrip.
        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Get the selected tab's TextArea.
            int tab = editorTabs.SelectedIndex;

            if (tab == -1)
            {
                return;
            }
            Scintilla textArea = GetTextAreaFromTab(tab);

            //Copy.
            textArea.Copy();
        }
Ejemplo n.º 3
0
 public void Copy()
 {
     if (editor.Focused)
     {
         editor.Copy();
     }
     if (log.Focused)
     {
         log.Copy();
     }
     if (results.Focused)
     {
         results.CopySelectedRows();
     }
 }
        private static void AddContextMenuStrip(this Scintilla scintilla)
        {
            var contextMenuStrip = new ContextMenuStrip();

            contextMenuStrip.Items.Add("Select all", null, (sender, args) => scintilla.SelectAll());
            contextMenuStrip.Items.Add("-");
            contextMenuStrip.Items.Add("Cut", null, (sender, args) => scintilla.Cut());
            contextMenuStrip.Items.Add("Copy", null, (sender, args) => scintilla.Copy());
            contextMenuStrip.Items.Add("Paste", null, (sender, args) => scintilla.Paste());
            contextMenuStrip.Items.Add("-");

            // Syntax-Highlight-Sprachen hinzufügen
            var lexerSelectorMenu = new ToolStripComboBox("Syntax")
            {
                DropDownStyle = ComboBoxStyle.DropDownList
            };

            lexerSelectorMenu.Items.Add("None");
            lexerSelectorMenu.Items.Add("C# / C++");
            lexerSelectorMenu.Items.Add("Delphi");
            lexerSelectorMenu.Items.Add("JavaScript");

            lexerSelectorMenu.SelectedIndex   = 0;
            lexerSelectorMenu.DropDownClosed += (sender, args) =>
            {
                switch (lexerSelectorMenu.SelectedIndex)
                {
                case 0:
                    scintilla.SetNone();
                    break;

                case 1:
                    scintilla.SetCpp();
                    break;

                case 2:
                    scintilla.SetDelphi();
                    break;

                case 3:
                    scintilla.SetJs();
                    break;
                }
            };

            contextMenuStrip.Items.Add(lexerSelectorMenu);
            scintilla.ContextMenuStrip = contextMenuStrip;
        }
        public void Copy()
        {
            switch (_CurrentTab)
            {
            case DesignTabs.Design:
                dcDesign.Copy();
                break;

            case DesignTabs.Edit:
                scintilla1.Copy();
                break;

            case DesignTabs.Preview:
                rdlPreview.Copy();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
        public void SetMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            menu.Closed += new ToolStripDropDownClosedEventHandler(OnClosed);
            textArea.ContextMenuStrip = menu;

            menu.Items.Add(new ToolStripMenuItem("Undo Ctrl+Z", null, (s, ea) => textArea.Undo())
            {
                Enabled = textArea.CanUndo
            });
            menu.Items.Add(new ToolStripMenuItem("Redo Ctrl+Y", null, (s, ea) => textArea.Redo())
            {
                Enabled = textArea.CanRedo
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Cut Ctrl+X", null, (s, ea) => textArea.Cut())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem("Copy Ctrl+C", null, (s, ea) => textArea.Copy())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem("Paste Ctrl+V", null, (s, ea) => textArea.Paste())
            {
                Enabled = textArea.CanPaste
            });
            menu.Items.Add(new ToolStripMenuItem("Delete", null, (s, ea) => textArea.DeleteRange(textArea.SelectionStart, textArea.SelectionEnd - textArea.SelectionStart))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Select All Ctrl+A", null, (s, ea) => textArea.SelectAll()));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Find Ctrl+F", null, OpenFindDialog)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripMenuItem("Find and Replace Ctrl+H", null, OpenReplaceDialog)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Comment Selected Lines", null, (s, ea) => sbDocument.Comment(true)));
            menu.Items.Add(new ToolStripMenuItem("Un-Comment Selected Lines", null, (s, ea) => sbDocument.Comment(false)));
            menu.Items.Add(new ToolStripMenuItem("Un-Comment File Commands", null, (s, ea) => sbDocument.UnCommentFile()));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Collapse Folding", null, (s, ea) => sbDocument.FoldAll(FoldAction.Contract)));
            menu.Items.Add(new ToolStripMenuItem("Expand Folding", null, (s, ea) => sbDocument.FoldAll(FoldAction.Expand)));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Navigate Back Ctrl+B", null, (s, ea) => sbDocument.GoBackwards())
            {
                Enabled = sbDocument.lineStack.backwards.Count > 1
            });
            menu.Items.Add(new ToolStripMenuItem("Navigate Forwards Ctrl+Shift+B", null, (s, ea) => sbDocument.GoForwards())
            {
                Enabled = sbDocument.lineStack.forwards.Count > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(menuColors);
            menu.Items.Add(menuFonts);
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Copy Selection to Clipboard as HTML text", null, CopyToHtml)
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem("Copy Selection to Clipboard as HTML", null, (s, ea) => textArea.CopyAllowLine(CopyFormat.Html))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem("Copy Selection to Clipboard as RTF", null, (s, ea) => textArea.CopyAllowLine(CopyFormat.Rtf))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem("Open Containing Folder", null, OpenContainingFolder)
            {
                Enabled = null != sbDocument.Tab && File.Exists(((TabHeader)sbDocument.Tab.Header).FilePath)
            });
            menu.Items.Add(new ToolStripMenuItem("Add to Debug Watch Ctrl+Shift+W", null, (s, ea) => sbDocument.AddWatch())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem("Display Flow Chart", null, OpenFlowChart)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripMenuItem("Format Program", null, (s, ea) => sbDocument.Lexer.Format()));
        }
Ejemplo n.º 7
0
 public void Copy()
 {
     textArea.Copy();
 }
Ejemplo n.º 8
0
 void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TextArea.Copy();
 }
Ejemplo n.º 9
0
 public void Copy()
 {
     _editor.Copy();
 }
Ejemplo n.º 10
0
        public void SetMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            menu.Closed += new ToolStripDropDownClosedEventHandler(OnClosed);
            textArea.ContextMenuStrip = menu;

            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String89, null, (s, ea) => textArea.Undo())
            {
                Enabled = textArea.CanUndo
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String90, null, (s, ea) => textArea.Redo())
            {
                Enabled = textArea.CanRedo
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String91, null, (s, ea) => textArea.Cut())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String92, null, (s, ea) => textArea.Copy())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String93, null, (s, ea) => textArea.Paste())
            {
                Enabled = textArea.CanPaste
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String94, null, (s, ea) => textArea.DeleteRange(textArea.SelectionStart, textArea.SelectionEnd - textArea.SelectionStart))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String95, null, (s, ea) => textArea.SelectAll()));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String96, null, OpenFindDialog)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String97, null, OpenReplaceDialog)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String98, null, (s, ea) => sbDocument.Comment(true)));
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String99, null, (s, ea) => sbDocument.Comment(false)));
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String100, null, (s, ea) => sbDocument.UnCommentFile()));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String101, null, (s, ea) => sbDocument.FoldAll(FoldAction.Contract)));
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String102, null, (s, ea) => sbDocument.FoldAll(FoldAction.Expand)));
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String103, null, (s, ea) => sbDocument.GoBackwards())
            {
                Enabled = sbDocument.lineStack.backwards.Count > 1
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String104, null, (s, ea) => sbDocument.GoForwards())
            {
                Enabled = sbDocument.lineStack.forwards.Count > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(menuColors);
            menu.Items.Add(menuFonts);
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String105, null, CopyToHtml)
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String106, null, (s, ea) => textArea.CopyAllowLine(CopyFormat.Html))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String107, null, (s, ea) => textArea.CopyAllowLine(CopyFormat.Rtf))
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String108, null, OpenContainingFolder)
            {
                Enabled = null != sbDocument.Tab && File.Exists(((TabHeader)sbDocument.Tab.Header).FilePath)
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String109, null, (s, ea) => sbDocument.AddWatch())
            {
                Enabled = textArea.SelectedText.Length > 0
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String110, null, OpenFlowChart)
            {
                Enabled = null != sbDocument.Tab
            });
            menu.Items.Add(new ToolStripMenuItem(Properties.Strings.String111, null, (s, ea) => sbDocument.Lexer.Format()));
        }
Ejemplo n.º 11
0
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     scintillaTextArea.Copy();
 }
Ejemplo n.º 12
0
 private void CopyMnu_Click(object sender, EventArgs e)
 {
     _scintilla.Copy();
 }
Ejemplo n.º 13
0
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     codeEditorControl.Copy();
 }
Ejemplo n.º 14
0
 public override void Copy()
 {
     _codeBox.Copy();
 }