Пример #1
0
		public DecompilerTextView()
		{
			HighlightingManager.Instance.RegisterHighlighting(
				"ILAsm", new string[] { ".il" },
				delegate {
					using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd")) {
						using (XmlTextReader reader = new XmlTextReader(s)) {
							return HighlightingLoader.Load(reader, HighlightingManager.Instance);
						}
					}
				});

			HighlightingManager.Instance.RegisterHighlighting(
				"C#", new string[] { ".cs" },
				delegate {
					using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "CSharp-Mode.xshd")) {
						using (XmlTextReader reader = new XmlTextReader(s)) {
							return HighlightingLoader.Load(reader, HighlightingManager.Instance);
						}
					}
				});

			InitializeComponent();
			
			this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
			textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
			this.uiElementGenerator = new UIElementGenerator();
			textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
			textEditor.Options.RequireControlModifierForHyperlinkClick = false;
			textEditor.TextArea.TextView.MouseHover += TextViewMouseHover;
			textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped;
			textEditor.TextArea.PreviewMouseDown += TextAreaMouseDown;
			textEditor.TextArea.PreviewMouseUp += TextAreaMouseUp;
			textEditor.SetBinding(Control.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") });
			textEditor.SetBinding(Control.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") });
			textEditor.SetBinding(TextEditor.WordWrapProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("EnableWordWrap") });

			// disable Tab editing command (useless for read-only editor); allow using tab for focus navigation instead
			RemoveEditCommand(EditingCommands.TabForward);
			RemoveEditCommand(EditingCommands.TabBackward);
			
			textMarkerService = new TextMarkerService(textEditor.TextArea.TextView);
			textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
			textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
			textEditor.ShowLineNumbers = true;
			DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;

			// SearchPanel
			SearchPanel.Install(textEditor.TextArea)
				.RegisterCommands(Application.Current.MainWindow.CommandBindings);
			
			ShowLineMargin();
			
			// add marker service & margin
			textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
			textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
		}
Пример #2
0
        public DecompilerTextView()
        {
            HighlightingManager.Instance.RegisterHighlighting(
                "ILAsm", new string[] { ".il" },
                delegate
            {
                using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd"))
                {
                    using (XmlTextReader reader = new XmlTextReader(s))
                    {
                        return(HighlightingLoader.Load(reader, HighlightingManager.Instance));
                    }
                }
            });

            this.Loaded += DecompilerTextView_Loaded;
            InitializeComponent();

            this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
            textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
            this.uiElementGenerator = new UIElementGenerator();
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
            textEditor.Options.RequireControlModifierForHyperlinkClick = false;
            textEditor.TextArea.TextView.MouseHover        += TextViewMouseHover;
            textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped;
            textEditor.SetBinding(Control.FontFamilyProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont")
            });
            textEditor.SetBinding(Control.FontSizeProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize")
            });

            // add marker service & margin
            iconMargin        = new IconBarMargin((manager = new IconBarManager()));
            textMarkerService = new TextMarkerService(textEditor);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.ShowLineNumbers = true;
            DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;

            textEditor.TextArea.LeftMargins.Insert(0, iconMargin);
            textEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };

            // Bookmarks context menu
            IconMarginActionsProvider.Add(iconMargin);
            // Bookmarks context menu
            textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(textEditor.TextArea));

            ShowLineMargin();

            // add marker service & margin
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);

            this.Loaded += DecompilerTextView_Loaded;
        }
        public DecompilerTextView()
        {
            InitializeComponent();

            this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
            textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
            this.uiElementGenerator       = new UIElementGenerator();
            this.bracketHighlightRenderer = new BracketHighlightRenderer(textEditor.TextArea.TextView);
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
            textEditor.Options.RequireControlModifierForHyperlinkClick = false;
            textEditor.TextArea.TextView.PointerHover        += TextViewMouseHover;
            textEditor.TextArea.TextView.PointerHoverStopped += TextViewMouseHoverStopped;
            textEditor.TextArea.AddHandler(PointerPressedEvent, TextAreaMouseDown, RoutingStrategies.Tunnel);
            textEditor.TextArea.AddHandler(PointerReleasedEvent, TextAreaMouseUp, RoutingStrategies.Tunnel);
            textEditor.TextArea.Caret.PositionChanged += HighlightBrackets;
            textEditor.Bind(TextEditor.FontFamilyProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "SelectedFont"
            });
            textEditor.Bind(TextEditor.FontSizeProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "SelectedFontSize"
            });
            textEditor.Bind(TextEditor.WordWrapProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "EnableWordWrap"
            });

            // disable Tab editing command (useless for read-only editor); allow using tab for focus navigation instead
            RemoveEditCommand(EditingCommands.TabForward);
            RemoveEditCommand(EditingCommands.TabBackward);

            textMarkerService = new TextMarkerService(textEditor.TextArea.TextView);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.ShowLineNumbers = true;
            DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;

            // TODO: SearchPanel is automatically installed, but have to disable replace mode
            // TemplateApplied += (s,e) =>

            ShowLineMargin();

            // add marker service & margin
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
        }
Пример #4
0
        public DecompilerTextView()
        {
            HighlightingManager.Instance.RegisterHighlighting(
                "ILAsm", new string[] { ".il" },
                delegate {
                using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd")) {
                    using (XmlTextReader reader = new XmlTextReader(s)) {
                        return(HighlightingLoader.Load(reader, HighlightingManager.Instance));
                    }
                }
            });

            InitializeComponent();
            this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
            textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
            this.uiElementGenerator = new UIElementGenerator();
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
            textEditor.Options.RequireControlModifierForHyperlinkClick = false;
            textEditor.TextArea.TextView.MouseHover        += TextViewMouseHover;
            textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped;
        }
Пример #5
0
 /// <summary>
 /// Creates a visual line text element with the specified length.
 /// It uses the <see cref="ITextRunConstructionContext.VisualLine"/> and its
 /// <see cref="VisualLineElement.RelativeTextOffset"/> to find the actual text string.
 /// </summary>
 public VisualLineReferenceText(VisualLine parentVisualLine, int length, ReferenceElementGenerator parent, ReferenceSegment referenceSegment)
     : base(parentVisualLine, length)
 {
     this.parent = parent;
     this.referenceSegment = referenceSegment;
 }
Пример #6
0
 /// <summary>
 /// Creates a visual line text element with the specified length.
 /// It uses the <see cref="ITextRunConstructionContext.VisualLine"/> and its
 /// <see cref="VisualLineElement.RelativeTextOffset"/> to find the actual text string.
 /// </summary>
 public VisualLineReferenceText(VisualLine parentVisualLine, int length, ReferenceElementGenerator parent, ReferenceSegment referenceSegment) : base(parentVisualLine, length)
 {
     this.parent           = parent;
     this.referenceSegment = referenceSegment;
 }
        public DecompilerTextView()
        {
            HighlightingManager.Instance.RegisterHighlighting(
                "ILAsm", new string[] { ".il" },
                delegate {
                using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd")) {
                    using (XmlTextReader reader = new XmlTextReader(s)) {
                        return(HighlightingLoader.Load(reader, HighlightingManager.Instance));
                    }
                }
            });

            HighlightingManager.Instance.RegisterHighlighting(
                "C#", new string[] { ".cs" },
                delegate {
                using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "CSharp-Mode.xshd")) {
                    using (XmlTextReader reader = new XmlTextReader(s)) {
                        return(HighlightingLoader.Load(reader, HighlightingManager.Instance));
                    }
                }
            });

            InitializeComponent();

            this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
            textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
            this.uiElementGenerator = new UIElementGenerator();
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
            textEditor.Options.RequireControlModifierForHyperlinkClick = false;
            textEditor.TextArea.TextView.PointerHover        += TextViewMouseHover;
            textEditor.TextArea.TextView.PointerHoverStopped += TextViewMouseHoverStopped;
            textEditor.TextArea.AddHandler(PointerPressedEvent, TextAreaMouseDown, RoutingStrategies.Tunnel);
            textEditor.TextArea.AddHandler(PointerReleasedEvent, TextAreaMouseUp, RoutingStrategies.Tunnel);
            textEditor.Bind(TextEditor.FontFamilyProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "SelectedFont"
            });
            textEditor.Bind(TextEditor.FontSizeProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "SelectedFontSize"
            });
            textEditor.Bind(TextEditor.WordWrapProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = "EnableWordWrap"
            });

            // disable Tab editing command (useless for read-only editor); allow using tab for focus navigation instead
            RemoveEditCommand(EditingCommands.TabForward);
            RemoveEditCommand(EditingCommands.TabBackward);

            textMarkerService = new TextMarkerService(textEditor.TextArea.TextView);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.ShowLineNumbers = true;
            DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;

            // TODO: SearchPanel is automatically installed, but have to disable replace mode
            // TemplateApplied += (s,e) =>

            ShowLineMargin();

            // add marker service & margin
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
        }