Exemplo 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(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);
            // 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));
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        void initializeBookmarkManager()
        {
            bookmarkMargin = new IconBarManager(this.Document);
            this.TextArea.LeftMargins.Add(new IconBarMargin(bookmarkMargin));

            IServiceContainer services = (IServiceContainer)this.Document.ServiceProvider.GetService(typeof(IServiceContainer));

            if (services != null)
            {
                services.AddService(typeof(IBookmarkMargin), bookmarkMargin);
            }
        }