Наследование: TextEditorControlBase
Пример #1
0
        /// <summary>
        /// Sets a new text to be edited.
        /// </summary>
        /// <param name="text">The text to set.</param>
        /// <param name="format">The format named used to determine the highlighting scheme (e.g. XML).</param>
        public void SetContent(string text, string format)
        {
            var textEditor = new TextEditorControl
            {
                Location = new Point(0, 0),
                Size = Size - new Size(0, statusStrip.Height),
                Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                TabIndex = 0,
                ShowVRuler = false,
                Document =
                {
                    TextContent = text,
                    HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(format)
                }
            };
            textEditor.TextChanged += TextEditor_TextChanged;
            textEditor.Validating += TextEditor_Validating;

            Controls.Add(textEditor);
            if (TextEditor != null)
            {
                Controls.Remove(TextEditor);
                TextEditor.Dispose();
            }
            TextEditor = textEditor;

            SetStatus(ImageResources.Info, "OK");
        }
Пример #2
0
 /// <summary>
 /// Creates the appropriate ITextEditor instance for the given text editor
 /// </summary>
 /// <param name="textEditor">The text editor instance</param>
 /// <returns></returns>
 public static ITextEditor CreateEditor(TextEditorControl textEditor)
 {
     if (Platform.IsRunningOnMono)
         return new MonoCompatibleTextEditor(textEditor);
     else
         return new DefaultTextEditor(textEditor);
 }
Пример #3
0
        protected override void Run(ICSharpCode.TextEditor.TextEditorControl textEditor, ICSharpCode.SharpDevelop.Dom.Refactoring.RefactoringProvider provider)
        {
            if (textEditor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected)
            {
                MethodExtractorBase extractor = GetCurrentExtractor(textEditor);
                if (extractor != null)
                {
                    if (extractor.Extract())
                    {
                        ExtractMethodForm form = new ExtractMethodForm(extractor.ExtractedMethod, new Func <IOutputAstVisitor>(extractor.GetOutputVisitor));

                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            extractor.ExtractedMethod.Name = form.Text;
                            try {
                                textEditor.Document.UndoStack.StartUndoGroup();
                                extractor.InsertAfterCurrentMethod();
                                extractor.InsertCall();
                                textEditor.Document.FormattingStrategy.IndentLines(textEditor.ActiveTextAreaControl.TextArea, 0, textEditor.Document.TotalNumberOfLines - 1);
                            } finally {
                                textEditor.Document.UndoStack.EndUndoGroup();
                            }
                            textEditor.ActiveTextAreaControl.SelectionManager.ClearSelection();
                        }
                    }
                }
            }
        }
Пример #4
0
		public void ShowFor(TextEditorControl editor, bool replaceMode)
		{
            //this.Text = replaceMode ? "查找和替换" : "查找";
			Editor = editor;

			_search.ClearScanRegion();
            SelectionManager sm = editor.ActiveTextAreaControl.SelectionManager;
			if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1) {
                ISelection sel = sm.SelectionCollection[0];
				if (sel.StartPosition.Line == sel.EndPosition.Line)
					txtLookFor.Text = sm.SelectedText;
				else
					_search.SetScanRegion(sel);
			} else {
				// Get the current word that the caret is on
				Caret caret = editor.ActiveTextAreaControl.Caret;
				int start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
				int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
				txtLookFor.Text = editor.Document.GetText(start, endAt - start);
			}
			
			ReplaceMode = replaceMode;

			this.Owner = (Form)editor.TopLevelControl;
			this.Show();
			
			txtLookFor.SelectAll();
			txtLookFor.Focus();
		}
Пример #5
0
		public DiffPanel(IViewContent viewContent)
		{
			this.viewContent = viewContent;
			
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			textEditor = new TextEditorControl();
			textEditor.Dock = DockStyle.Fill;
			diffViewPanel.Controls.Add(textEditor);
			
			textEditor.TextEditorProperties = SharpDevelopTextEditorProperties.Instance;
			textEditor.Document.ReadOnly = true;
			textEditor.Enabled = false;
			
			textEditor.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("Patch");
			
			ListViewItem newItem;
			newItem = new ListViewItem(new string[] { "Base", "", "", "" });
			newItem.Tag = Revision.Base;
			leftListView.Items.Add(newItem);
			newItem.Selected = true;
			newItem = new ListViewItem(new string[] { "Work", "", "", "" });
			newItem.Tag = Revision.Working;
			rightListView.Items.Add(newItem);
		}
Пример #6
0
        protected Dom.IMember GetParentMember(ICSharpCode.TextEditor.TextEditorControl textEditor, int line, int column)
        {
            Dom.ParseInformation parseInfo = ParserService.GetParseInformation(textEditor.FileName);
            if (parseInfo != null)
            {
                Dom.IClass c = parseInfo.MostRecentCompilationUnit.GetInnermostClass(line, column);
                if (c != null)
                {
                    foreach (Dom.IMember member in c.Properties)
                    {
                        if (member.BodyRegion.IsInside(line, column))
                        {
                            return(member);
                        }
                    }
                    foreach (Dom.IMember member in c.Methods)
                    {
                        if (member.BodyRegion.IsInside(line, column))
                        {
                            return(member);
                        }
                    }
                }
            }

            return(null);
        }
Пример #7
0
        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            #region Sanity checks
            if (context == null) throw new ArgumentNullException(nameof(context));
            if (provider == null) throw new ArgumentNullException(nameof(provider));
            #endregion

            var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService == null) return value;

            var editorControl = new TextEditorControl {Text = value as string, Dock = DockStyle.Fill};
            var form = new Form
            {
                FormBorderStyle = FormBorderStyle.SizableToolWindow,
                ShowInTaskbar = false,
                Controls = {editorControl}
            };

            var fileType = context.PropertyDescriptor.Attributes.OfType<FileTypeAttribute>().FirstOrDefault();
            if (fileType != null)
            {
                editorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(fileType.FileType);
                form.Text = fileType.FileType + " Editor";
            }
            else form.Text = "Editor";

            editorService.ShowDialog(form);
            return editorControl.Text;
        }
		/// <summary>
		/// Creates an incremental search for the specified text editor.
		/// </summary>
		/// <param name="textEditor">The text editor to search in.</param>
		/// <param name="forwards">Indicates whether the search goes
		/// forward from the cursor or backwards.</param>
		public IncrementalSearch(TextEditorControl textEditor, bool forwards)
		{
			
			this.forwards = forwards;
			if (forwards) {
				incrementalSearchStartMessage = StringParser.Parse("${res:ICSharpCode.SharpDevelop.DefaultEditor.IncrementalSearch.ForwardsSearchStatusBarMessage} ");
			} else {
				incrementalSearchStartMessage = StringParser.Parse("${res:ICSharpCode.SharpDevelop.DefaultEditor.IncrementalSearch.ReverseSearchStatusBarMessage} ");
			}
			this.textEditor = textEditor;
			
			// Disable code completion.
			codeCompletionEnabled = CodeCompletionOptions.EnableCodeCompletion;
			CodeCompletionOptions.EnableCodeCompletion = false;
			
			AddFormattingStrategy();
			
			TextArea.KeyEventHandler += TextAreaKeyPress;
			TextArea.DoProcessDialogKey += TextAreaProcessDialogKey;
			TextArea.LostFocus += TextAreaLostFocus;
			TextArea.MouseClick += TextAreaMouseClick;
			
			EnableIncrementalSearchCursor();
			
			// Get text to search and initial search position.
			text = textEditor.Document.TextContent;
			startIndex = TextArea.Caret.Offset;
			originalStartIndex = startIndex;
		
			GetInitialSearchText();
			ShowTextFound(searchText.ToString());
		}
Пример #9
0
		public MainViewContent(string fileName, SharpSnippetCompilerControl snippetControl, IWorkbenchWindow workbenchWindow)
		{
			file = new SnippetFile(fileName);
			this.snippetControl = snippetControl;
			this.textEditor = snippetControl.TextEditor;
			this.workbenchWindow = workbenchWindow;
		}
Пример #10
0
        private TextEditorControl CreateTextBox()
        {
            var tb = new TextEditorControl();
            tb.IsReadOnly = true;            
            
            // TODO: set proper highlighting.
            tb.SetHighlighting("C#");

            var high = (ICSharpCode.TextEditor.Document.DefaultHighlightingStrategy)tb.Document.HighlightingStrategy;
            var def = high.Rules.First();
            var delim = " ,().:\t\n\r";
            for(int i = 0; i < def.Delimiters.Length; ++i)
                def.Delimiters[i] = delim.Contains((char)i);

            tb.ShowLineNumbers = false;
            tb.ShowInvalidLines = false;
            tb.ShowVRuler = false;
            tb.ActiveTextAreaControl.TextArea.ToolTipRequest += OnToolTipRequest;
            tb.ActiveTextAreaControl.TextArea.MouseMove += OnTextAreaMouseMove;

            string[] tryFonts = new[] { "Consolas", "Lucida Console" };

            foreach (var fontName in tryFonts)
            {
                tb.Font = new Font(fontName, 9, FontStyle.Regular);
                if (tb.Font.Name == fontName) break;
            }

            if (!tryFonts.Contains(tb.Font.Name))
                tb.Font = new Font(FontFamily.GenericMonospace, 9);
            
            return tb;
        }
Пример #11
0
 public static void SetLine(TextEditorControl tec, int line)
 {
     TextArea textArea = tec.ActiveTextAreaControl.TextArea;
     textArea.Caret.Column = 0;
     textArea.Caret.Line = line;
     textArea.Caret.UpdateCaretPosition();
 }
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea                = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited  += DocumentUpdateCommitted;

            vScrollBar.VisibleChanged += (sender, e) =>
            {
                if (!vScrollBar.Visible)
                    vScrollBar.Value = 0;
            };

            hScrollBar.VisibleChanged += (sender, e) =>
            {
                if (!hScrollBar.Visible)
                    hScrollBar.Value = 0;
            };
        }
Пример #13
0
 public Goto(TextEditorControl editor)
 {
     InitializeComponent();
     Editor = editor;
     Editor.TextChanged += Editor_TextChanged;
     UpdateMaximumLine();
     numericUpDown.Select(0, numericUpDown.Value.ToString().Length);
 }
Пример #14
0
        public override System.Windows.Forms.Control GetEditor()
        {
            //return base.GetEditor();
            if (textEditor == null)
                textEditor = new TextEditorControl();

            return textEditor;
        }
Пример #15
0
 public FdoSqlQueryCtl()
 {
     InitializeComponent();
     _editor = new TextEditorControl();
     _editor.Dock = DockStyle.Fill;
     _editor.SetHighlighting("SQL");
     this.Controls.Add(_editor);
 }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the TextEditorTextContent class.
        /// This TextEditorTextContent instance will be linked with a
        /// TextEditorControl.
        /// </summary>
        /// <param name="textBox">The TextEditorControl to link with.</param>
        public TextEditorTextContext(TextEditorControl textBox)
        {
            TextBox = textBox;
            SubscribeToTextBox();

            remoteMarker = new TextMarker(0, 0, TextMarkerType.SolidBlock, System.Drawing.Color.Yellow);

            // TODO: implement insert / delete
        }
		/// <summary>
		/// Creates a new DefinitionViewPad object
		/// </summary>
		public DefinitionViewPad()
		{
			ctl = new TextEditorControl();
			ctl.Document.ReadOnly = true;
			ctl.TextEditorProperties = SharpDevelopTextEditorProperties.Instance;
			ctl.ActiveTextAreaControl.TextArea.DoubleClick += OnDoubleClick;
			ParserService.ParserUpdateStepFinished += OnParserUpdateStep;
			ctl.VisibleChanged += delegate { UpdateTick(null); };
		}
 public Ast_CSharp_ShowDetailsInViewer(TextEditorControl _textEditorControl, TabControl _tabControl)
 {
     /*sourceCodeEditor = _sourceCodeEditor;
     tabControl = (TabControl)sourceCodeEditor.field("tcSourceInfo");
      * */
     tabControl = _tabControl;
     textEditorControl = _textEditorControl;
     createGUI();
 }
		public MethodExtractorBase(ICSharpCode.TextEditor.TextEditorControl textEditor, ISelection selection)
		{
			this.currentDocument = textEditor.Document;
			this.textEditor = textEditor;
			this.currentSelection = selection;
			
			this.start = new Location(this.currentSelection.StartPosition.Column + 1, this.currentSelection.StartPosition.Line + 1);
			this.end = new Location(this.currentSelection.EndPosition.Column + 1, this.currentSelection.EndPosition.Line + 1);
		}
Пример #20
0
 public void Test_DeleteNotEmptyAt0()
 {
     ICSharpCode.TextEditor.TextEditorControl textEditorControl = new ICSharpCode.TextEditor.TextEditorControl();
     textEditorControl.Text = "test content";
     textEditorTextContext = new TextEditorTextContext(textEditorControl);
     DeleteOperation delete = new DeleteOperation(0);
     textEditorTextContext.Delete(null, delete);
     Assert.AreEqual("est content", textEditorTextContext.Data, "Inconsistent state after deletion!");
 }
Пример #21
0
        public MethodExtractorBase(ICSharpCode.TextEditor.TextEditorControl textEditor, ISelection selection)
        {
            this.currentDocument  = textEditor.Document;
            this.textEditor       = textEditor;
            this.currentSelection = selection;

            this.start = new Location(this.currentSelection.StartPosition.Column + 1, this.currentSelection.StartPosition.Line + 1);
            this.end   = new Location(this.currentSelection.EndPosition.Column + 1, this.currentSelection.EndPosition.Line + 1);
        }
 protected IdeBridgeCodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth)
     : base(completionDataProvider, completionData, parentForm, control, showDeclarationWindow, fixedListViewWidth)
 {
     TopMost = true;
     declarationViewWindow.Dispose();
     declarationViewWindow = new DeclarationViewWindow(null);
     declarationViewWindow.TopMost = true;
     SetDeclarationViewLocation();
 }
Пример #23
0
        protected override async void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PopulateDetails();

            var msilEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock = DockStyle.Fill,
                Text = Decompiler.DecompileToIL(MethodDef.Body)
            };
            msiltab.Controls.Add(msilEditor);

            var codeEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock = DockStyle.Fill,
                Text = await Decompiler.GetSourceCode(MethodDef),
                Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") }
            };
            codetab.Controls.Add(codeEditor);

            if (!MethodDef.HasBody)
            {
                hookbutton.Enabled = false;
                gotohookbutton.Enabled = false;
                return;
            }

            MethodSignature methodsig = Utility.GetMethodSignature(MethodDef);

            bool hookfound = false;
            foreach (var manifest in MainForm.CurrentProject.Manifests)
            {
                foreach (var hook in manifest.Hooks)
                {
                    if (hook.Signature.Equals(methodsig) && hook.TypeName == MethodDef.DeclaringType.FullName)
                    {
                        hookfound = true;
                        methodhook = hook;
                        break;
                    }
                }
            }
            if (hookfound)
            {
                hookbutton.Enabled = false;
                gotohookbutton.Enabled = true;
            }
            else
            {
                hookbutton.Enabled = true;
                gotohookbutton.Enabled = false;
            }
        }
Пример #24
0
 private void ResetTextEditor(string highlighting = "C#")
 {
     this.EditorContainer.Controls.Clear();
     this.TextEditor      = new TextEditorControl();
     this.TextEditor.Dock = DockStyle.Fill;
     this.EditorContainer.Controls.Add(this.TextEditor);
     this.TextEditor.SetHighlighting(highlighting);
     this.TextEditor.ActiveTextAreaControl.TextArea.KeyDown += OnKeyDown;
     this.TextEditor.TextChanged += TextEditorOnTextChanged;
 }
 MethodExtractorBase GetCurrentExtractor(TextEditorControl editor)
 {
     switch (LanguageBindingService.GetCodonPerCodeFileName(editor.FileName).Language) {
         case "C#":
             return new CSharpMethodExtractor(editor, editor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0]);
         default:
             MessageService.ShowError(string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.ExtractMethodNotSupported}"), LanguageBindingService.GetCodonPerCodeFileName(editor.FileName).Language));
             return null;
     }
 }
Пример #26
0
		public static CodeCompletionWindow ShowCompletionWindow(Form parent, TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider, char firstChar)
		{
			ICompletionData[] completionData = completionDataProvider.GenerateCompletionData(fileName, control.ActiveTextAreaControl.TextArea, firstChar);
			if (completionData == null || completionData.Length == 0) {
				return null;
			}
			CodeCompletionWindow codeCompletionWindow = new CodeCompletionWindow(completionDataProvider, completionData, parent, control, fileName);
			codeCompletionWindow.ShowCompletionWindow();
			return codeCompletionWindow;
		}
		// ********************************************************************************************************************************
		
		/// <summary>
		/// Attempts to resolve a reference to a resource using all registered resolvers.
		/// </summary>
		/// <param name="editor">The text editor for which a resource resolution attempt should be performed.</param>
		/// <param name="charTyped">The character that has been typed at the caret position but is not yet in the buffer (this is used when invoked from code completion), or <c>null</c>.</param>
		/// <returns>A <see cref="ResourceResolveResult"/> that describes which resource is referenced by the expression at the caret in the specified editor, or <c>null</c> if all registered resolvers return <c>null</c>.</returns>
		public static ResourceResolveResult Resolve(TextEditorControl editor, char? charTyped)
		{
			ResourceResolveResult result;
			foreach (IResourceResolver resolver in Resolvers) {
				if ((result = resolver.Resolve(editor, charTyped)) != null) {
					return result;
				}
			}
			return null;
		}
Пример #28
0
		/// <summary>
		/// Returns the class in which the carret currently is, returns null
		/// if the carret is outside the class boundaries.
		/// </summary>
		IClass GetCurrentClass(TextEditorControl textEditorControl, ICompilationUnit cu, string fileName)
		{
			IDocument document = textEditorControl.Document;
			if (cu != null) {
				int caretLineNumber = document.GetLineNumberForOffset(textEditorControl.ActiveTextAreaControl.Caret.Offset) + 1;
				int caretColumn     = textEditorControl.ActiveTextAreaControl.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1;
				return FindClass(cu.Classes, caretLineNumber, caretColumn);
			}
			return null;
		}
Пример #29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextEditor"/> class.
        /// </summary>
        public TextEditor()
        {
            InitializeComponent();

            toolstrip = ToolbarService.CreateToolStrip(this, "/FdoToolbox/TextEditor/Toolbar");
            editor = new TextEditorControl();
            editor.Dock = DockStyle.Fill;

            this.Controls.Add(editor);
            this.Controls.Add(toolstrip);
        }
Пример #30
0
		public Form1()
		{
			InitializeComponent();
			TextEditorControl ctrl = new TextEditorControl();
			ctrl.Dock = DockStyle.Fill;
			ctrl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("XML");
			ctrl.TextEditorProperties = InitializeProperties();
			// ctrl.Document.FormattingStrategy = new Xml

			Controls.Add(ctrl);
		}
Пример #31
0
        AutoCompleteWindow(ICompletionDataProvider completionDataProvider, Form parentForm, TextEditorControl control, string fileName, bool showDeclarationWindow)
            : base(parentForm, control)
        {
            this.showDeclarationWindow = showDeclarationWindow;

            workingScreen = Screen.GetWorkingArea(Location);
            startOffset = control.ActiveTextAreaControl.Caret.Offset + 1;
            endOffset = startOffset;
            if (completionDataProvider.PreSelection != null)
            {
                startOffset -= completionDataProvider.PreSelection.Length + 1;
                endOffset--;
            }

            codeCompletionListView = new CodeCompletionListView(completionData);
            codeCompletionListView.ImageList = completionDataProvider.ImageList;
            codeCompletionListView.Dock = DockStyle.Fill;
            codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged);
            codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick);
            codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick);
            Controls.Add(codeCompletionListView);

            if (completionData.Length > 10)
            {
                vScrollBar.Dock = DockStyle.Right;
                vScrollBar.Minimum = 0;
                vScrollBar.Maximum = completionData.Length - 8;
                vScrollBar.SmallChange = 1;
                vScrollBar.LargeChange = 3;
                codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged);
                Controls.Add(vScrollBar);
            }

            this.drawingSize = GetListViewSize();
            SetLocation();

            declarationViewWindow = new DeclarationViewWindow(parentForm);
            SetDeclarationViewLocation();
            declarationViewWindow.ShowDeclarationViewWindow();
            control.Focus();
            CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty);

            if (completionDataProvider.DefaultIndex >= 0)
            {
                codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex);
            }

            if (completionDataProvider.PreSelection != null)
            {
                CaretOffsetChanged(this, EventArgs.Empty);
            }

            vScrollBar.Scroll += new ScrollEventHandler(DoScroll);
        }
        public static CodeCompletionKeyHandler Attach(ScriptFile mainForm, TextEditorControl editor)
        {
            CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor);

            //editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler;
            editor.ActiveTextAreaControl.TextArea.KeyDown += h.TextAreaKeyEventHandler;
            // When the editor is disposed, close the code completion window
            editor.Disposed += h.CloseCodeCompletionWindow;

            return h;
        }
		public static CodeCompletionKeyHandler Attach(IntellisenseForm iForm, TextEditorControl editor)
		{
			CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(iForm, editor);
			
			editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler;
			
			// When the editor is disposed, close the code completion window
			editor.Disposed += h.CloseCodeCompletionWindow;
			
			return h;
		}
Пример #34
0
        /// <summary>
        /// Crée une nouvelle page.
        /// </summary>
        void CreateNewPage(string fullpath, bool load)
        {
            // Création de l'éditeur de code.
            ICSharpCode.TextEditor.TextEditorControl editor = new ICSharpCode.TextEditor.TextEditorControl();
            string dir = "res\\";
            FileSyntaxModeProvider fsmProvider;

            if (Directory.Exists(dir))
            {
                fsmProvider = new FileSyntaxModeProvider(dir);

                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
                editor.SetHighlighting("clank");
            }
            editor.ConvertTabsToSpaces = true;
            editor.Dock              = System.Windows.Forms.DockStyle.Fill;
            editor.IsReadOnly        = false;
            editor.Location          = new System.Drawing.Point(0, 0);
            editor.Size              = new System.Drawing.Size(591, 249);
            editor.Font              = new System.Drawing.Font("Consolas", 10);
            editor.TabIndex          = 0;
            editor.Text              = "main\r\n{\r\n}\r\n";
            editor.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            // Ajout d'un nouveau tab page.
            int    index   = m_codeTabs.TabCount;
            string display = fullpath;

            if (File.Exists(fullpath))
            {
                display = Path.GetFileName(fullpath);
            }
            TabPage page = new TabPage(display);

            page.Controls.Add(editor);
            PageInfo info = new PageInfo()
            {
                SourceFile = fullpath, Page = page, Editor = editor
            };

            m_pageInfos.Add(info);

            editor.TextChanged += (object sender, EventArgs e) => { OnEditorTextChanged(info); };

            // Chargement ?
            if (load && File.Exists(fullpath))
            {
                string text = File.ReadAllText(fullpath);
                editor.Text = text;
            }

            m_codeTabs.TabPages.Add(page);
            m_codeTabs.SelectedTab = page;
        }
Пример #35
0
 public TextAreaControl(TextEditorControl motherTextEditorControl)
 {
     this.motherTextEditorControl = motherTextEditorControl;
     this.textArea = new ICSharpCode.TextEditor.TextArea(motherTextEditorControl, this);
     base.Controls.Add(this.textArea);
     this.vScrollBar.ValueChanged += new EventHandler(this.VScrollBarValueChanged);
     base.Controls.Add(this.vScrollBar);
     this.hScrollBar.ValueChanged += new EventHandler(this.HScrollBarValueChanged);
     base.Controls.Add(this.hScrollBar);
     base.ResizeRedraw = true;
     this.Document.TextContentChanged += new EventHandler(this.DocumentTextContentChanged);
     this.Document.DocumentChanged    += new DocumentEventHandler(this.AdjustScrollBarsOnDocumentChange);
     this.Document.UpdateCommited     += new EventHandler(this.DocumentUpdateCommitted);
 }
Пример #36
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            Document.DocumentChanged += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited  += AdjustScrollBarsOnCommittedUpdate;
        }
Пример #37
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars);
            SetStyle(ControlStyles.Selectable, true);
        }
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            textArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += VScrollBarValueChanged;
            Controls.Add(vScrollBar);

            hScrollBar.ValueChanged += HScrollBarValueChanged;
            Controls.Add(hScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged    += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited     += DocumentUpdateCommitted;
        }
Пример #39
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            _motherTextEditorControl = motherTextEditorControl;

            TextArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(TextArea);

            VScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(VScrollBar);

            HScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(HScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged    += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited     += DocumentUpdateCommitted;
        }
Пример #40
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea = new TextArea(motherTextEditorControl, this);

            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            IsCreated = true;

            AttachToDocumentEvents();
        }
Пример #41
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            _motherTextEditorControl = motherTextEditorControl;

            TextArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(TextArea);

            VScrollBar.ValueChanged += VScrollBarValueChanged;
            Controls.Add(VScrollBar);

            HScrollBar.ValueChanged += HScrollBarValueChanged;
            Controls.Add(HScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged             += DocumentTextContentChanged;
            Document.DocumentChanged                += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited                 += DocumentUpdateCommitted;
            Document.FoldingManager.FoldingsChanged += FoldingManagerOnFoldingsChanged;
        }
Пример #42
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            this.motherTextAreaControl   = motherTextAreaControl;
            this.motherTextEditorControl = motherTextEditorControl;

            caret            = new Caret(this);
            selectionManager = new SelectionManager(Document, this);

            this.textAreaClipboardHandler = new TextAreaClipboardHandler(this);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
//			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//			SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);

            textView = new TextView(this);

            gutterMargin  = new GutterMargin(this);
            foldMargin    = new FoldMargin(this);
            iconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin });
            OptionsChanged();


            new TextAreaMouseHandler(this).Attach();

            // 下列语句需要在STAThread 下才能运行
            //new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme('{', '}'));
            bracketshemes.Add(new BracketHighlightingSheme('(', ')'));
            bracketshemes.Add(new BracketHighlightingSheme('[', ']'));

            caret.PositionChanged                   += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged             += new EventHandler(TextContentChanged);
            Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
        }
Пример #43
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw       = true;
            AutoHideScrollbars = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged    += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited     += DocumentUpdateCommitted;

            ContextMenuStrip = new ContextMenu(this);
        }
        // Start the print.
        public void Print(TextEditorControl editor)
        {
            _editor = editor;
            PrintDocument pdoc = new PrintDocument();

            pdoc.PrinterSettings     = _printerSettings;
            pdoc.DefaultPageSettings = _pageSettings;

            PrintDialog pdlg = new PrintDialog();

            pdlg.AllowSelection   = true;
            pdlg.ShowHelp         = true;
            pdlg.Document         = pdoc;
            pdlg.AllowPrintToFile = true;

            // We don't support page selection.
            pdlg.AllowSomePages = false;

            // If the result is OK then print the document.
            if (pdlg.ShowDialog() == DialogResult.OK)
            {
                // Init from user selections.
                _curPageNumber = 0;

                if (pdlg.PrinterSettings.PrintRange == PrintRange.Selection && _editor.ActiveTextAreaControl.TextArea.SelectionManager.HasSomethingSelected)
                {
                    _curLineNumber = _editor.ActiveTextAreaControl.TextArea.SelectionManager.StartPosition.Line;
                    _endLineNumber = _editor.ActiveTextAreaControl.TextArea.SelectionManager.EndPosition.Line;
                }
                else // No selection, print all.
                {
                    _curLineNumber = 0;
                    _endLineNumber = _editor.Document.TotalNumberOfLines;
                }

                pdoc.BeginPrint += new PrintEventHandler(BeginPrint);
                pdoc.PrintPage  += new PrintPageEventHandler(PrintPage);
                pdoc.Print();
            }
        }
Пример #45
0
        public CodeTextBox()
        {
            m_oEditor      = new ICSharpCode.TextEditor.TextEditorControl();
            m_oEditor.Dock = DockStyle.Fill;

            m_oEditor.AllowCaretBeyondEOL = false;
            m_oEditor.ShowEOLMarkers      = false;
            m_oEditor.ShowHRuler          = false;
            m_oEditor.ShowLineNumbers     = false;
            m_oEditor.ShowSpaces          = false;
            m_oEditor.ShowTabs            = false;
            m_oEditor.ShowVRuler          = false;
            m_oEditor.ShowInvalidLines    = false;
            m_oEditor.TextEditorProperties.IsIconBarVisible = false;
            m_oEditor.TextEditorProperties.LineViewerStyle  = LineViewerStyle.None;
            m_oEditor.EnableFolding       = false;
            m_oEditor.ShowMatchingBracket = false;

            TextArea oTextArea = m_oEditor.ActiveTextAreaControl.TextArea;

            oTextArea.MouseDown += new MouseEventHandler(TextArea_MouseDown);
            oTextArea.MouseUp   += new MouseEventHandler(TextArea_MouseUp);
            oTextArea.MouseMove += new MouseEventHandler(TextArea_MouseMove);
            oTextArea.KeyDown   += new System.Windows.Forms.KeyEventHandler(TextArea_KeyDown);
            oTextArea.KeyPress  += new KeyPressEventHandler(TextArea_KeyPress);
            oTextArea.KeyUp     += new System.Windows.Forms.KeyEventHandler(TextArea_KeyUp);
            oTextArea.DragEnter += new DragEventHandler(TextArea_DragEnter);
            oTextArea.DragLeave += new EventHandler(TextArea_DragLeave);
            oTextArea.DragDrop  += new DragEventHandler(TextArea_DragDrop);
            oTextArea.DragOver  += new DragEventHandler(TextArea_DragOver);

            m_oEditor.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(Caret_PositionChanged);
            m_oEditor.Document.DocumentChanged += new DocumentEventHandler(Document_DocumentChanged);

            // This is required for data binding to work correctly.
            m_oEditor.Validating += new CancelEventHandler(m_oEditor_Validating);

            this.Controls.Add(m_oEditor);
        }
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            MotherTextAreaControl   = motherTextAreaControl;
            MotherTextEditorControl = motherTextEditorControl;

            Caret            = new Caret(this);
            SelectionManager = new SelectionManager(Document, this);

            ClipboardHandler = new TextAreaClipboardHandler(this);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, value: true);
//            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, value: false);
            SetStyle(ControlStyles.ResizeRedraw, value: true);
            SetStyle(ControlStyles.Selectable, value: true);

            TextView = new TextView(this);

            GutterMargin  = new GutterMargin(this);
            FoldMargin    = new FoldMargin(this);
            IconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { IconBarMargin, GutterMargin, FoldMargin });
            OptionsChanged();

            new TextAreaMouseHandler(this).Attach();
            new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme(opentag: '{', closingtag: '}'));
            bracketshemes.Add(new BracketHighlightingSheme(opentag: '(', closingtag: ')'));
            bracketshemes.Add(new BracketHighlightingSheme(opentag: '[', closingtag: ']'));

            Caret.PositionChanged                   += SearchMatchingBracket;
            Document.TextContentChanged             += TextContentChanged;
            Document.FoldingManager.FoldingsChanged += DocumentFoldingsChanged;
        }
Пример #47
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            MotherTextAreaControl   = motherTextAreaControl;
            MotherTextEditorControl = motherTextEditorControl;

            Caret            = new Caret(this);
            SelectionManager = new SelectionManager(Document, this);
            MousePos         = new Point(0, 0);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            //			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            //			SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);

            TextView = new TextView(this);

            GutterMargin  = new GutterMargin(this);
            FoldMargin    = new FoldMargin(this);
            IconBarMargin = new IconBarMargin(this);
            _leftMargins.AddRange(new IMargin[] { IconBarMargin, GutterMargin, FoldMargin });
            OptionsChanged();


            new TextAreaMouseHandler(this).Attach(); //TODO1 refactor all these
            new TextAreaDragDropHandler().Attach(this);

            _bracketSchemes.Add(new BracketHighlightingSheme('{', '}')); //TODO1 hardcoded
            _bracketSchemes.Add(new BracketHighlightingSheme('(', ')'));
            _bracketSchemes.Add(new BracketHighlightingSheme('[', ']'));

            Caret.PositionChanged                   += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged             += TextContentChanged;
            Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
        }
Пример #48
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (!disposed)
                {
                    disposed = true;

                    if (caret != null)
                    {
                        caret.PositionChanged -= SearchMatchingBracket;
                        caret.Dispose();
                    }

                    if (selectionManager != null)
                    {
                        selectionManager.Dispose();
                    }

                    Document.TextContentChanged             -= TextContentChanged;
                    Document.FoldingManager.FoldingsChanged -= DocumentFoldingsChanged;
                    motherTextAreaControl   = null;
                    motherTextEditorControl = null;

                    foreach (AbstractMargin margin in leftMargins)
                    {
                        if (margin is IDisposable)
                        {
                            (margin as IDisposable).Dispose();
                        }
                    }

                    textView.Dispose();
                }
            }
        }
Пример #49
0
        public void ShowFor(TextEditorControl editor, bool replaceMode)
        {
            Editor = editor;

            _search.ClearScanRegion();
            var sm = editor.ActiveTextAreaControl.SelectionManager;

            if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1)
            {
                var sel = sm.SelectionCollection[0];
                if (sel.StartPosition.Line == sel.EndPosition.Line)
                {
                    txtLookFor.Text = sm.SelectedText;
                }
                else
                {
                    _search.SetScanRegion(sel);
                }
            }
            else
            {
                // Get the current word that the caret is on
                Caret caret = editor.ActiveTextAreaControl.Caret;
                int   start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
                int   endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
                txtLookFor.Text = editor.Document.GetText(start, endAt - start);
            }

            ReplaceMode = replaceMode;

            this.Owner = (Form)editor.TopLevelControl;
            this.Show();

            txtLookFor.SelectAll();
            txtLookFor.Focus();
        }
Пример #50
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                if (!_disposed)
                {
                    _disposed = true;
                    if (_caret != null)
                    {
                        _caret.PositionChanged -= new EventHandler(SearchMatchingBracket);
                        _caret.Dispose();
                    }

                    if (_selectionManager != null)
                    {
                        _selectionManager.Dispose();
                    }

                    Document.TextContentChanged             -= new EventHandler(TextContentChanged);
                    Document.FoldingManager.FoldingsChanged -= new EventHandler(DocumentFoldingsChanged);
                    _motherTextAreaControl   = null;
                    _motherTextEditorControl = null;

                    foreach (AbstractMargin margin in _leftMargins)
                    {
                        if (margin is IDisposable)
                        {
                            (margin as IDisposable).Dispose();
                        }
                    }

                    _textView.Dispose();
                }
            }
        }
Пример #51
0
 public HighlightGroup(TextEditorControl editor)
 {
     _editor   = editor;
     _document = editor.Document;
 }
Пример #52
0
 private void 重做ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.XmlContextMenuStrip.SourceControl.Select();
     ICSharpCode.TextEditor.TextEditorControl rtb = (TextEditorControl)this.XmlContextMenuStrip.SourceControl;
     rtb.Redo();
 }
Пример #53
0
 protected Dom.IMember GetParentMember(ICSharpCode.TextEditor.TextEditorControl textEditor, TextLocation location)
 {
     return(GetParentMember(textEditor, location.Line, location.Column));
 }
Пример #54
0
        private void InitializeComponent()
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TextCodeEditor));
            this.textEditorControl = new ICSharpCode.TextEditor.TextEditorControl();
            this.Menu       = new System.Windows.Forms.ContextMenu();
            this.menuItem1  = new System.Windows.Forms.MenuItem();
            this.menuItem3  = new System.Windows.Forms.MenuItem();
            this.menuItem4  = new System.Windows.Forms.MenuItem();
            this.menuItem5  = new System.Windows.Forms.MenuItem();
            this.menuItem6  = new System.Windows.Forms.MenuItem();
            this.menuItem8  = new System.Windows.Forms.MenuItem();
            this.menuItem9  = new System.Windows.Forms.MenuItem();
            this.menuItem10 = new System.Windows.Forms.MenuItem();
            this.menuItem12 = new System.Windows.Forms.MenuItem();
            this.menuItem13 = new System.Windows.Forms.MenuItem();
            this.lblTitle   = new System.Windows.Forms.Label();
            this.menuItem2  = new System.Windows.Forms.MenuItem();
            this.SuspendLayout();
            //
            // textEditorControl
            //
            this.textEditorControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                   | System.Windows.Forms.AnchorStyles.Left)
                                                                                  | System.Windows.Forms.AnchorStyles.Right)));
            this.textEditorControl.Encoding       = ((System.Text.Encoding)(resources.GetObject("textEditorControl.Encoding")));
            this.textEditorControl.Location       = new System.Drawing.Point(0, 16);
            this.textEditorControl.Name           = "textEditorControl";
            this.textEditorControl.ShowEOLMarkers = true;
            this.textEditorControl.ShowSpaces     = true;
            this.textEditorControl.ShowTabs       = true;
            this.textEditorControl.ShowVRuler     = true;
            this.textEditorControl.Size           = new System.Drawing.Size(544, 320);
            this.textEditorControl.TabIndex       = 0;

            this.textEditorControl.Changed   += new System.EventHandler(this.textEditorControl_Changed);
            this.textEditorControl.Load      += new System.EventHandler(this.textEditorControl_Load);
            this.textEditorControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textEditorControl_MouseDown);
            //
            // Menu
            //
            this.Menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                this.menuItem1
            });
            this.Menu.Popup += new System.EventHandler(this.Menu_Popup);
            //
            // menuItem1
            //
            this.menuItem1.Index = 0;
            this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                this.menuItem3,
                this.menuItem4,
                this.menuItem5,
                this.menuItem6,
                this.menuItem8,
                this.menuItem9,
                this.menuItem10,
                this.menuItem12,
                this.menuItem13,
                this.menuItem2
            });
            this.menuItem1.Text = "Lenguaje";
            //
            // menuItem3
            //
            this.menuItem3.Index  = 0;
            this.menuItem3.Text   = "XML";
            this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
            //
            // menuItem4
            //
            this.menuItem4.Index  = 1;
            this.menuItem4.Text   = "C#";
            this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
            //
            // menuItem5
            //
            this.menuItem5.Index  = 2;
            this.menuItem5.Text   = "C64#";
            this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
            //
            // menuItem6
            //
            this.menuItem6.Index  = 3;
            this.menuItem6.Text   = "C++";
            this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
            //
            // menuItem8
            //
            this.menuItem8.Index  = 4;
            this.menuItem8.Text   = "HTML";
            this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
            //
            // menuItem9
            //
            this.menuItem9.Index  = 5;
            this.menuItem9.Text   = "JAVA";
            this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
            //
            // menuItem10
            //
            this.menuItem10.Index  = 6;
            this.menuItem10.Text   = "JScript";
            this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
            //
            // menuItem12
            //
            this.menuItem12.Index  = 7;
            this.menuItem12.Text   = "VBNET";
            this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
            //
            // menuItem13
            //
            this.menuItem13.Index  = 8;
            this.menuItem13.Text   = "VBSCRIPT";
            this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
            //
            // lblTitle
            //
            this.lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                         | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTitle.BackColor   = System.Drawing.Color.Silver;
            this.lblTitle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lblTitle.ContextMenu = this.Menu;
            this.lblTitle.Location    = new System.Drawing.Point(0, 0);
            this.lblTitle.Name        = "lblTitle";
            this.lblTitle.Size        = new System.Drawing.Size(544, 16);
            this.lblTitle.TabIndex    = 1;
            //
            // menuItem2
            //
            this.menuItem2.Index  = 9;
            this.menuItem2.Text   = "TXT";
            this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
            //
            // TextCodeEditor
            //
            this.BackColor   = System.Drawing.Color.Silver;
            this.ContextMenu = this.Menu;
            this.Controls.Add(this.lblTitle);
            this.Controls.Add(this.textEditorControl);
            this.Name       = "TextCodeEditor";
            this.Size       = new System.Drawing.Size(544, 336);
            this.Load      += new System.EventHandler(this.TextCodeEditor_Load);
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TextCodeEditor_MouseDown);
            this.ResumeLayout(false);
        }
Пример #55
0
 private void 全选ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.XmlContextMenuStrip.SourceControl.Select();
     ICSharpCode.TextEditor.TextEditorControl rtb = (TextEditorControl)this.XmlContextMenuStrip.SourceControl;
     rtb.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(TxtXml, e);
 }
Пример #56
0
        public static void Attach(MainForm mainForm, TextEditor.TextEditorControl editor)
        {
            ToolTipProvider tp = new ToolTipProvider(mainForm, editor);

            editor.ActiveTextAreaControl.TextArea.ToolTipRequest += tp.OnToolTipRequest;
        }
Пример #57
0
 private ToolTipProvider(MainForm mainForm, TextEditor.TextEditorControl editor)
 {
     this.mainForm = mainForm;
     this.editor   = editor;
 }
Пример #58
0
        public static void Attach(IntellisenseForm iForm, TextEditor.TextEditorControl editor)
        {
            var tp = new ToolTipProvider(iForm, editor);

            editor.ActiveTextAreaControl.TextArea.ToolTipRequest += tp.OnToolTipRequest;
        }
Пример #59
0
 private ToolTipProvider(IntellisenseForm iForm, TextEditor.TextEditorControl editor)
 {
     _iForm  = iForm;
     _editor = editor;
 }
 public TextEditorContainer(string fileSystemPath)
 {
     _textEditor = new TextEditorControl();
     Controls.Add(_textEditor);
     _textEditor.Dock = DockStyle.Fill;
     TabTitle = Path.GetFileName(fileSystemPath) ?? "";
     TabToolTip = fileSystemPath;
     Open(fileSystemPath);
     _textEditor.TextChanged += new EventHandler(TextEditorTextChanged);
 }