Inheritance: System.Windows.Forms.Panel
        public TextEditorControl()
        {
            SetStyle(ControlStyles.ContainerControl, true);

            textAreaPanel.Dock = DockStyle.Fill;

            Document = (new DocumentFactory()).CreateDocument();
            Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            primaryTextArea  = new TextAreaControl(this);
            activeTextAreaControl = primaryTextArea;

            primaryTextArea.TextArea.GotFocus += delegate
            {
                SetActiveTextAreaControl(primaryTextArea);
            };

            primaryTextArea.Dock = DockStyle.Fill;
            textAreaPanel.Controls.Add(primaryTextArea);
            InitializeTextAreaControl(primaryTextArea);
            Controls.Add(textAreaPanel);
            ResizeRedraw = true;
            Document.UpdateCommited += new EventHandler(CommitUpdateRequested);
            OptionsChanged();
        }
Esempio n. 2
0
 protected override void InitializeTextAreaControl(SD.TextAreaControl newControl)
 {
     base.InitializeTextAreaControl(newControl);
     if (OnInitializeTextAreaControl != null)
     {
         OnInitializeTextAreaControl(this, newControl);
     }
 }
Esempio n. 3
0
		protected void SetActiveTextAreaControl(TextAreaControl value)
		{
			if (activeTextAreaControl != value) {
				activeTextAreaControl = value;
				
				if (ActiveTextAreaControlChanged != null) {
					ActiveTextAreaControlChanged(this, EventArgs.Empty);
				}
			}
		}
		protected override void InitializeTextAreaControl(TextAreaControl newControl) {
			base.InitializeTextAreaControl(newControl);
			newControl.TextArea.KeyEventHandler += new KeyEventHandler(HandleKeyPress);

			newControl.SelectionManager.SelectionChanged += new EventHandler(SelectionChanged);
			newControl.Document.DocumentChanged += new DocumentEventHandler(DocumentChanged);
			newControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged);
			newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText);

			newControl.MouseWheel += new MouseEventHandler(TextAreaMouseWheel);
			newControl.DoHandleMousewheel = false;
		}
		protected override void InitializeTextAreaControl(TextAreaControl newControl)
		{
			base.InitializeTextAreaControl(newControl);
			
			newControl.ShowContextMenu += delegate(object sender, MouseEventArgs e) {
				MenuService.ShowContextMenu(this, contextMenuPath, (Control)sender, e.X, e.Y);
			};
			newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress);
			newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText);
			
//			newControl.TextArea.IconBarMargin.Painted   += new MarginPaintEventHandler(PaintIconBarBreakPoints);
//			newControl.TextArea.IconBarMargin.MouseDown += new MarginMouseEventHandler(IconBarMouseDown);
			
			newControl.MouseWheel                       += new MouseEventHandler(TextAreaMouseWheel);
			newControl.DoHandleMousewheel = false;
		}
        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();
            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);
        }
Esempio n. 7
0
        public TextEditorControl()
        {
            SetStyle(ControlStyles.ContainerControl, true);

            textAreaPanel.Dock = DockStyle.Fill;

            Document = (new DocumentFactory()).CreateDocument();
            Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            primaryTextArea                    = new TextAreaControl(this);
            activeTextAreaControl              = primaryTextArea;
            primaryTextArea.TextArea.GotFocus += delegate {
                SetActiveTextAreaControl(primaryTextArea);
            };
            primaryTextArea.Dock = DockStyle.Fill;
            textAreaPanel.Controls.Add(primaryTextArea);
            InitializeTextAreaControl(primaryTextArea);
            Controls.Add(textAreaPanel);
            ResizeRedraw             = true;
            Document.UpdateCommited += new EventHandler(CommitUpdateRequested);
            OptionsChanged();
        }
Esempio n. 8
0
        public void Split()
        {
            if (secondaryTextArea == null)
            {
                secondaryTextArea = new TextAreaControl(this)
                {
                    Dock   = DockStyle.Bottom,
                    Height = Height / 2
                };

                secondaryTextArea.TextArea.GotFocus += delegate {
                    SetActiveTextAreaControl(secondaryTextArea);
                };

                textAreaSplitter = new Splitter
                {
                    BorderStyle = BorderStyle.FixedSingle,
                    Height      = 8,
                    Dock        = DockStyle.Bottom
                };
                textAreaPanel.Controls.Add(textAreaSplitter);
                textAreaPanel.Controls.Add(secondaryTextArea);
                InitializeTextAreaControl(secondaryTextArea);
                secondaryTextArea.OptionsChanged();
            }
            else
            {
                SetActiveTextAreaControl(primaryTextArea);

                textAreaPanel.Controls.Remove(secondaryTextArea);
                textAreaPanel.Controls.Remove(textAreaSplitter);

                secondaryTextArea.Dispose();
                textAreaSplitter.Dispose();
                secondaryTextArea = null;
                textAreaSplitter  = null;
            }
        }
        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();
                }
            }
        }
        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;
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        public void Split()
        {
            if (secondaryTextArea == null)
            {
                secondaryTextArea        = new TextAreaControl(this);
                secondaryTextArea.Dock   = DockStyle.Bottom;
                secondaryTextArea.Height = Height / 2;

                secondaryTextArea.TextArea.GotFocus += delegate
                {
                    SetActiveTextAreaControl(secondaryTextArea);
                    //ADDED by Ali Özgür
                    OnGotFocus(EventArgs.Empty);
                };

                textAreaSplitter             = new Splitter();
                textAreaSplitter.BorderStyle = BorderStyle.FixedSingle;
                textAreaSplitter.Height      = 8;
                textAreaSplitter.Dock        = DockStyle.Bottom;
                textAreaPanel.Controls.Add(textAreaSplitter);
                textAreaPanel.Controls.Add(secondaryTextArea);
                InitializeTextAreaControl(secondaryTextArea);
                secondaryTextArea.OptionsChanged();
            }
            else
            {
                SetActiveTextAreaControl(primaryTextArea);

                textAreaPanel.Controls.Remove(secondaryTextArea);
                textAreaPanel.Controls.Remove(textAreaSplitter);

                secondaryTextArea.Dispose();
                textAreaSplitter.Dispose();
                secondaryTextArea = null;
                textAreaSplitter  = null;
            }
        }
Esempio n. 13
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (printDocument != null)
                {
                    printDocument.BeginPrint -= BeginPrint;
                    printDocument.PrintPage  -= PrintPage;
                    printDocument             = null;
                }

                Document.UndoStack.ClearAll();
                Document.UpdateCommited -= CommitUpdateRequested;

                if (textAreaPanel != null)
                {
                    if (secondaryTextArea != null)
                    {
                        secondaryTextArea.Dispose();
                        textAreaSplitter.Dispose();
                        secondaryTextArea = null;
                        textAreaSplitter  = null;
                    }

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

                    textAreaPanel.Dispose();
                    textAreaPanel = null;
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 14
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();
                }
            }
        }
		bool UpdateOpenFileWithRootDirectoryRefChanges(WixDocument wixDocument, TextAreaControl textAreaControl)
		{
			// Get the xml for the root directory ref.
			WixDirectoryRefElement rootDirectoryRef = wixDocument.RootDirectoryRef;
			string xml = GetWixXml(rootDirectoryRef);

			// Find the root directory ref location.
			return ReplaceElement(rootDirectoryRef.Id, WixDirectoryRefElement.DirectoryRefElementName, textAreaControl, xml);
		}
Esempio n. 16
0
 private void HookEvents(TextAreaControl control)
 {
     control.Caret.CaretModeChanged += (s, e) => UpdateCaretMode();
     control.Caret.PositionChanged += (s, e) => UpdateCaretPosition();
     control.TextArea.KeyDown += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyDown(e.KeyData));
     control.TextArea.KeyUp += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyUp(e.KeyData));
     control.TextArea.KeyPress += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyPress(e.KeyChar));
     control.TextArea.MouseDown += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseDown(e.Button, e.X, e.Y));
     control.TextArea.MouseUp += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseUp(e.Button, e.X, e.Y));
     control.TextArea.MouseClick += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseClick(e.Button, e.X, e.Y));
     control.TextArea.MouseDoubleClick += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseDoubleClick(e.Button, e.X, e.Y));
     control.TextArea.MouseWheel += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseWheel(e.Delta));
 }
		protected override void InitializeTextAreaControl(TextAreaControl newControl)
		{
			newControl.TextArea.DoProcessDialogKey += HandleDialogKey;
		}
		bool UpdateOpenFileWithRootDirectoryChanges(WixDocument wixDocument, TextAreaControl textAreaControl)
		{
			// Get the xml for the root directory.
			WixDirectoryElement rootDirectory = wixDocument.RootDirectory;
			string xml = GetWixXml(rootDirectory);

			// Find the root directory location.
			bool updated = ReplaceElement(rootDirectory.Id, WixDirectoryElement.DirectoryElementName, textAreaControl, xml);
			if (updated) {
				return true;
			}
			
			// Find the product end element location.
			IDocument document = textAreaControl.Document;
			Location location = WixDocument.GetEndElementLocation(new StringReader(document.TextContent), "Product", wixDocument.Product.GetAttribute("Id"));
			if (!location.IsEmpty) {
				// Insert the xml with an extra new line at the end.
				ITextEditorProperties properties = SharpDevelopTextEditorProperties.Instance;
				WixDocumentEditor documentEditor = new WixDocumentEditor(textAreaControl);
				documentEditor.Insert(location.Y, location.X, String.Concat(xml, properties.LineTerminator));
				return true;
			}
			return false;
		}
Esempio n. 19
0
		public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
		{
			this.motherTextAreaControl      = motherTextAreaControl;
			this.motherTextEditorControl    = motherTextEditorControl;
			
			caret            = new Caret(this);
			selectionManager = new SelectionManager(Document);
			
			this.textAreaClipboardHandler = new TextAreaClipboardHandler(this);
			
			ResizeRedraw = true;
			
			SetStyle(ControlStyles.DoubleBuffer, false);
//			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();
			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);
		}
Esempio n. 20
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();
         }
     }
 }
Esempio n. 21
0
		public void Split()
		{
			if (secondaryTextArea == null) {
				secondaryTextArea = new TextAreaControl(this);
				secondaryTextArea.Dock = DockStyle.Bottom;
				secondaryTextArea.Height = Height / 2;
				
				secondaryTextArea.TextArea.GotFocus += delegate {
					SetActiveTextAreaControl(secondaryTextArea);
				};
				
				textAreaSplitter =  new Splitter();
				textAreaSplitter.BorderStyle = BorderStyle.FixedSingle ;
				textAreaSplitter.Height = 8;
				textAreaSplitter.Dock = DockStyle.Bottom;
				textAreaPanel.Controls.Add(textAreaSplitter);
				textAreaPanel.Controls.Add(secondaryTextArea);
				InitializeTextAreaControl(secondaryTextArea);
				secondaryTextArea.OptionsChanged();
			} else {
				SetActiveTextAreaControl(primaryTextArea);
				
				textAreaPanel.Controls.Remove(secondaryTextArea);
				textAreaPanel.Controls.Remove(textAreaSplitter);
				
				secondaryTextArea.Dispose();
				textAreaSplitter.Dispose();
				secondaryTextArea = null;
				textAreaSplitter  = null;
			}
		}
Esempio n. 22
0
 protected override void InitializeTextAreaControl(TextAreaControl newControl)
 {
     newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress);
     base.InitializeTextAreaControl(newControl);
 }
		/// <summary>
		/// Tries to replace the element defined by element name and its Id attribute in the
		/// text editor with the specified xml.
		/// </summary>
		/// <param name="id">The Id attribute of the element.</param>
		/// <param name="elementName">The name of the element.</param>
		/// <param name="textAreaControl">The text area control to update.</param>
		/// <param name="xml">The replacement xml.</param>
		bool ReplaceElement(string id, string elementName, TextAreaControl textAreaControl, string xml)
		{
			WixDocumentEditor documentEditor = new WixDocumentEditor(textAreaControl);
			IDocument document = textAreaControl.Document;
			DomRegion region = WixDocument.GetElementRegion(new StringReader(document.TextContent), elementName, id);
			if (!region.IsEmpty) {
				documentEditor.Replace(region, xml);
				return true;
			}
			return false;
		}
		public ProvidedDocumentInformation(IDocument document, string fileName, TextAreaControl textAreaControl)
		{
			this.document   = document;
			this.textBuffer = document.TextBufferStrategy;
			this.fileName   = fileName;
			this.textAreaControl = textAreaControl;
			this.endOffset = this.CurrentOffset;
		}
 public FindTargetImpl(TextAreaControl textAreaControl)
 {
     _textAreaControl = textAreaControl;
 }
Esempio n. 26
0
		protected virtual void InitializeTextAreaControl(TextAreaControl newControl)
		{
		}
Esempio n. 27
0
		private void IndentLines()
		{
			ICSharpCode.TextEditor.TextAreaControl ta = new TextAreaControl (textEditorControl);
			switch (m_Lenguaje)
			{
				case TipoLenguaje.Text:
				{break;}

				case TipoLenguaje.CSHARP: case TipoLenguaje.C64CHARP:
				{
					
					CSharpBinding.FormattingStrategy.CSharpFormattingStrategy Formating  = new CSharpBinding.FormattingStrategy.CSharpFormattingStrategy ();
					Formating.IndentLines(ta.TextArea,0,textEditorControl.Document.TotalNumberOfLines-1);
					break;
				}
				case TipoLenguaje.VBNET: case TipoLenguaje.VBSCRIPT:
				{
					VBBinding.FormattingStrategy.VBFormattingStrategy Formating = new VBBinding.FormattingStrategy.VBFormattingStrategy ();
					Formating.IndentLines(ta.TextArea,0,textEditorControl.Document.TotalNumberOfLines-1);
					break;
				}
				case TipoLenguaje.CPP: 
				{
					CPPBinding.FormattingStrategy.CSharpFormattingStrategy Formating  = new CPPBinding.FormattingStrategy.CSharpFormattingStrategy ();
					Formating.IndentLines(ta.TextArea,0,textEditorControl.Document.TotalNumberOfLines-1);
					break;
				}
				case TipoLenguaje.JAVA: case TipoLenguaje.JAVASCRIPT:
				{
					JavaBinding.FormattingStrategy.JavaFormattingStrategy  Formating  = new JavaBinding.FormattingStrategy.JavaFormattingStrategy ();
					Formating.IndentLines(ta.TextArea,0,textEditorControl.Document.TotalNumberOfLines-1);
					break;
				}
			}
			
		}
Esempio n. 28
0
		protected override void Dispose(bool disposing)
		{
			if (disposing) {
				if (printDocument != null) {
					printDocument.BeginPrint -= new PrintEventHandler(this.BeginPrint);
					printDocument.PrintPage  -= new PrintPageEventHandler(this.PrintPage);
					printDocument = null;
				}
				Document.UndoStack.ClearAll();
				//Document.UpdateCommited -= new EventHandler(CommitUpdateRequested);
				if (textAreaPanel != null) {
					if (secondaryTextArea != null) {
						secondaryTextArea.Dispose();
						textAreaSplitter.Dispose();
						secondaryTextArea = null;
						textAreaSplitter  = null;
					}
					if (primaryTextArea != null) {
						primaryTextArea.Dispose();
					}
					textAreaPanel.Dispose();
					textAreaPanel = null;
				}
			}
			base.Dispose(disposing);
		}
		public WixDocumentEditor(TextAreaControl textAreaControl)
		{
			this.textAreaControl = textAreaControl;
		}
Esempio n. 30
0
 protected virtual void InitializeTextAreaControl(TextAreaControl newControl)
 {
 }
Esempio n. 31
0
        public void Split()
        {
            if (secondaryTextArea == null)
            {
                secondaryTextArea        = new TextAreaControl(this);
                secondaryTextArea.Dock   = DockStyle.Bottom;
                secondaryTextArea.Height = Height / 2;

                secondaryTextArea.TextArea.GotFocus += delegate {
                    SetActiveTextAreaControl(secondaryTextArea);
                };

                textAreaSplitter             = new Splitter();
                textAreaSplitter.BorderStyle = BorderStyle.FixedSingle;
                textAreaSplitter.BackColor   = Color.Orange;
                textAreaSplitter.Height      = 8;
                textAreaSplitter.Dock        = DockStyle.Bottom;
                textAreaPanel.Controls.Add(textAreaSplitter);
                textAreaPanel.Controls.Add(secondaryTextArea);
                InitializeTextAreaControl(secondaryTextArea);
                secondaryTextArea.OptionsChanged();

                secondaryTextArea.TextArea.Leave += delegate {
                    textAreaLastLeave = TextAreaSide.Secondary;
                };

                secondaryTextArea.Caret.Position = primaryTextArea.Caret.Position;
                secondaryTextArea.CenterViewOn(secondaryTextArea.Caret.Line, 0);
                secondaryTextArea.TextArea.Select();
            }
            else
            {
                if (!primaryTextArea.TextArea.Focused && (secondaryTextArea.TextArea.Focused || textAreaLastLeave == TextAreaSide.Secondary))
                {
                    primaryTextArea.Caret.Position = secondaryTextArea.Caret.Position;
                }
                else
                {
                    secondaryTextArea.Caret.Position = primaryTextArea.Caret.Position;
                    secondaryTextArea.CenterViewOn(secondaryTextArea.Caret.Line, 0);
                }
                secondaryTextArea.Visible = !secondaryTextArea.Visible;
                textAreaSplitter.Visible  = !textAreaSplitter.Visible;
                if (secondaryTextArea.Visible == false)
                {
                    SetActiveTextAreaControl(primaryTextArea);
                }
                else
                {
                    secondaryTextArea.TextArea.Select();
                }

                //textAreaPanel.Controls.Remove(secondaryTextArea);
                //textAreaPanel.Controls.Remove(textAreaSplitter);

                //secondaryTextArea.Dispose();
                //textAreaSplitter.Dispose();
                //secondaryTextArea = null;
                //textAreaSplitter  = null;
            }
        }
Esempio n. 32
0
        protected override void InitializeTextAreaControl(TextAreaControl newControl)
        {
            base.InitializeTextAreaControl(newControl);

            primaryTextAreaControl = newControl;

            newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress);

            newControl.ContextMenuStrip = contextMenuStrip;
            newControl.SelectionManager.SelectionChanged += new EventHandler(SelectionChanged);
            newControl.Document.DocumentChanged += new DocumentEventHandler(DocumentChanged);
            newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText);

            newControl.MouseWheel += new MouseEventHandler(TextAreaMouseWheel);
            newControl.DoHandleMousewheel = false;
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Document.UndoStack.ClearAll();
                Document.UpdateCommited -= new EventHandler(CommitUpdateRequested);

                if (textAreaPanel != null)
                {
                    if (secondaryTextArea != null)
                    {
                        secondaryTextArea.Dispose();
                        textAreaSplitter.Dispose();
                        secondaryTextArea = null;
                        textAreaSplitter  = null;
                    }

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

                    textAreaPanel.Dispose();
                    textAreaPanel = null;
                }
            }
            base.Dispose(disposing);
        }