Ejemplo n.º 1
0
		public CodeView(string decompiledFileName)
		{
			this.adapter = new DecompiledTextEditorAdapter(new SharpDevelopTextEditor { IsReadOnly = true }) {
				DecompiledFileName = decompiledFileName
			};
			this.Children.Add(adapter.TextEditor);
			adapter.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
			
			// add margin
			this.iconMargin = new IconBarMargin(iconBarManager = new IconBarManager());
			this.adapter.TextEditor.TextArea.LeftMargins.Insert(0, iconMargin);
			this.adapter.TextEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };
			
			// add marker service
			this.textMarkerService = new TextMarkerService(adapter.TextEditor.Document);
			this.adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(IBookmarkMargin), iconBarManager);
			// DON'T add the editor in textview ervices - will mess the setting of breakpoints
			
			// add events
			this.adapter.TextEditor.MouseHover += TextEditorMouseHover;
			this.adapter.TextEditor.MouseHoverStopped += TextEditorMouseHoverStopped;
			this.adapter.TextEditor.MouseLeave += TextEditorMouseLeave;
			
			this.adapter.TextEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(this.adapter.TextEditor.TextArea));
		}
Ejemplo n.º 2
0
		public CodeView(string decompiledFullTypeName)
		{
			DecompiledFullTypeName = decompiledFullTypeName;
			this.adapter = new DecompiledTextEditorAdapter(new SharpDevelopTextEditor { IsReadOnly = true }) {
				DecompiledFullTypeName = decompiledFullTypeName
			};
			this.Children.Add(adapter.TextEditor);
			adapter.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
			
			// add margin
			this.iconMargin = new IconBarMargin(iconBarManager = new IconBarManager());
			this.adapter.TextEditor.TextArea.LeftMargins.Insert(0, iconMargin);
			this.adapter.TextEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };
			
			// add marker service
			this.textMarkerService = new TextMarkerService(this);
			this.adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
			this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(IBookmarkMargin), iconBarManager);
			
			// add events
			this.adapter.TextEditor.MouseHover += TextEditorMouseHover;
			this.adapter.TextEditor.MouseHoverStopped += TextEditorMouseHoverStopped;
			this.adapter.TextEditor.MouseLeave += TextEditorMouseLeave;
		}
Ejemplo n.º 3
0
		public CodeEditor()
		{
			CodeEditorOptions.Instance.PropertyChanged += CodeEditorOptions_Instance_PropertyChanged;
			CustomizedHighlightingColor.ActiveColorsChanged += CustomizedHighlightingColor_ActiveColorsChanged;
			ParserService.ParseInformationUpdated += ParserServiceParseInformationUpdated;
			
			this.FlowDirection = FlowDirection.LeftToRight; // code editing is always left-to-right
			this.CommandBindings.Add(new CommandBinding(SharpDevelopRoutedCommands.SplitView, OnSplitView));
			
			textMarkerService = new TextMarkerService(this);
			iconBarManager = new IconBarManager();
			changeWatcher = new DefaultChangeWatcher();
			
			primaryTextEditor = CreateTextEditor();
			primaryTextEditorAdapter = (CodeEditorAdapter)primaryTextEditor.TextArea.GetService(typeof(ITextEditor));
			Debug.Assert(primaryTextEditorAdapter != null);
			activeTextEditor = primaryTextEditor;
			
			this.Document = primaryTextEditor.Document;
			primaryTextEditor.SetBinding(TextEditor.DocumentProperty, new Binding("Document") { Source = this });
			
			this.ColumnDefinitions.Add(new ColumnDefinition());
			this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
			this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star), MinHeight = minRowHeight });
			SetRow(primaryTextEditor, 1);
			
			this.Children.Add(primaryTextEditor);
		}
Ejemplo n.º 4
0
		public CodeEditor()
		{
			CodeEditorOptions.Instance.PropertyChanged += CodeEditorOptions_Instance_PropertyChanged;
			CustomizedHighlightingColor.ActiveColorsChanged += CustomizedHighlightingColor_ActiveColorsChanged;
			SD.ParserService.ParseInformationUpdated += ParserServiceParseInformationUpdated;
			
			this.FlowDirection = FlowDirection.LeftToRight; // code editing is always left-to-right
			this.document = new TextDocument();
			var documentServiceContainer = document.GetRequiredService<IServiceContainer>();
			
			textMarkerService = new TextMarkerService(document);
			documentServiceContainer.AddService(typeof(ITextMarkerService), textMarkerService);
			
			iconBarManager = new IconBarManager();
			documentServiceContainer.AddService(typeof(IBookmarkMargin), iconBarManager);
			
			if (CodeEditorOptions.Instance.EnableChangeMarkerMargin) {
				changeWatcher = new DefaultChangeWatcher();
			}
			primaryTextEditor = CreateTextEditor();
			primaryTextEditorAdapter = (CodeEditorAdapter)primaryTextEditor.TextArea.GetService(typeof(ITextEditor));
			Debug.Assert(primaryTextEditorAdapter != null);
			
			this.ColumnDefinitions.Add(new ColumnDefinition());
			this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
			this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star), MinHeight = minRowHeight });
			SetRow(primaryTextEditor, 1);
			
			this.Children.Add(primaryTextEditor);
		}
Ejemplo n.º 5
0
		public IconBarMargin(IconBarManager manager)
		{
			if (manager == null)
				throw new ArgumentNullException("manager");
			this.manager = manager;
		}