コード例 #1
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin)
        {
            IWpfTextView text_view = view_host.TextView;

            try
            {
                Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString();
            }
            catch { }

            if (!PresenceSent)
            {
                PresenceSent = true;
                MonitoringService.SendPresense();
            }

            if (!SettingsLoaded)
            {
                ReadSettings(OptionsService.GlobalOptions);
            }

            RemoveVerticalScrollBar(container_margin);

            var navigator         = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer);
            var format            = FormatMapService.GetEditorFormatMap(text_view);
            var tagger            = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator);
            var marks_enumerator  = new MarksEnumerator(AggregatorFactoryService, text_view);
            var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view);
            var words_enumerator  = new HighlightedWordsEnumerator(text_view, tagger);

            return(new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger));
        }
コード例 #2
0
        public RockMargin(
            IWpfTextView view,
            MarksEnumerator marks,
            ChangeEnumerator changes,
            HighlightedWordsEnumerator highlights,
            HighlightWordTagger tagger)
        {
            _view       = view;
            _marks      = marks;
            _changes    = changes;
            _highlights = highlights;
            _tagger     = tagger;

            _track  = new Track(view, this);
            _render = new TrackRender(_view, _track, _marks, _changes, _highlights);

            this.Width        = _view.Options.GetOptionValue(OptionsKeys.Width);
            this.ClipToBounds = true;
            this.Background   = Utils.CreateBrush(_view.Options.GetOptionValue(OptionsKeys.BackgroundColor));

            view.Options.OptionChanged += OnOptionChanged;
            view.LayoutChanged         += OnTextViewLayoutChanged;
            view.ZoomLevelChanged      += OnViewStateChanged;
            highlights.WordsChanged    += OnWordHighlightsChanged;
            marks.MarksChanged         += OnMarksChanged;
            changes.ChangesChanged     += OnChangesChanged;

            this.SizeChanged          += OnViewStateChanged;
            this.MouseRightButtonDown += this.OnMouseRightButtonDown;
            this.MouseLeftButtonDown  += this.OnMouseLeftButtonDown;
            this.MouseLeftButtonUp    += this.OnMouseLeftButtonUp;
            this.MouseMove            += this.OnMouseMove;

            _render.Visuals.ForEach(delegate(Visual v) { AddVisualChild(v); });
        }
コード例 #3
0
ファイル: RockMargin.cs プロジェクト: shashClp/RockMargin
        public RockMargin(
            IWpfTextView view,
            MarksEnumerator marks,
            ChangeEnumerator changes,
            HighlightedWordsEnumerator highlights,
            HighlightWordTagger tagger)
        {
            _view = view;
            _marks = marks;
            _changes = changes;
            _highlights = highlights;
            _tagger = tagger;

            _track = new Track(view, this);
            _render = new TrackRender(_view, _track, _marks, _changes, _highlights);

            this.Width = _view.Options.GetOptionValue(OptionsKeys.Width);
            this.ClipToBounds = true;
            this.Background = Utils.CreateBrush(_view.Options.GetOptionValue(OptionsKeys.BackgroundColor));

            view.Options.OptionChanged += OnOptionChanged;
            view.LayoutChanged += OnTextViewLayoutChanged;
            view.ZoomLevelChanged += OnViewStateChanged;
            highlights.WordsChanged += OnWordHighlightsChanged;
            marks.MarksChanged += OnMarksChanged;
            changes.ChangesChanged += OnChangesChanged;

            this.SizeChanged += OnViewStateChanged;
            this.MouseRightButtonDown += this.OnMouseRightButtonDown;
            this.MouseLeftButtonDown += this.OnMouseLeftButtonDown;
            this.MouseLeftButtonUp += this.OnMouseLeftButtonUp;
            this.MouseMove += this.OnMouseMove;

            _render.Visuals.ForEach(delegate(Visual v) { AddVisualChild(v); });
        }
コード例 #4
0
        public TrackRender(IWpfTextView view, Track track, MarksEnumerator marks, ChangeEnumerator changes, HighlightedWordsEnumerator highlights)
        {
            _view       = view;
            _track      = track;
            _marks      = marks;
            _changes    = changes;
            _highlights = highlights;

            _timer          = new DispatcherTimer();
            _timer.Tick    += OnInvalidateTextTimer;
            _timer.Interval = TimeSpan.FromMilliseconds(500);

            ReloadOptions();
            InitDrawingObjects();
        }
コード例 #5
0
ファイル: TrackRender.cs プロジェクト: shashClp/RockMargin
        public TrackRender(IWpfTextView view, Track track, MarksEnumerator marks, ChangeEnumerator changes, HighlightedWordsEnumerator highlights)
        {
            _view = view;
            _track = track;
            _marks = marks;
            _changes = changes;
            _highlights = highlights;

            _timer = new DispatcherTimer();
            _timer.Tick += OnInvalidateTextTimer;
            _timer.Interval = TimeSpan.FromMilliseconds(500);

            ReloadOptions();
            InitDrawingObjects();
        }
コード例 #6
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin)
        {
            IWpfTextView text_view = view_host.TextView;

            try
            {
                Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString();
            }
            catch { }

            if (!PresenceSent)
            {
                PresenceSent = true;
                MonitoringService.SendPresense();
            }

            if (!SettingsLoaded)
                ReadSettings(OptionsService.GlobalOptions);

            RemoveVerticalScrollBar(container_margin);

            var navigator = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer);
            var format = FormatMapService.GetEditorFormatMap(text_view);
            var tagger = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator);
            var marks_enumerator = new MarksEnumerator(AggregatorFactoryService, text_view);
            var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view);
            var words_enumerator = new HighlightedWordsEnumerator(text_view, tagger);

            return new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger);
        }