コード例 #1
0
ファイル: DiffMargin.cs プロジェクト: zhouweiaccp/gitscc
        /// <summary>
        ///   Creates a <see cref="GitDiffMargin" /> for a given <see cref="IWpfTextView" /> .
        /// </summary>
        /// <param name="textView"> The <see cref="IWpfTextView" /> to attach the margin to. </param>
        internal DiffMargin(IWpfTextView textView, DiffMarginFactory factory)
        {
            _textView = textView;
            _classificationFormatMap = factory.ClassificationFormatMapService.GetClassificationFormatMap(textView);
            _editorFormatMap         = factory.EditorFormatMapService.GetEditorFormatMap(textView);

            _editorFormatMap.FormatMappingChanged += HandleFormatMappingChanged;
            _textView.Closed += (sender, e) => _editorFormatMap.FormatMappingChanged -= HandleFormatMappingChanged;
            UpdateBrushes();

            _textView.Options.OptionChanged += HandleOptionChanged;

            _gitDiffBarControl             = new DiffMarginControl();
            _viewModel                     = new DiffMarginViewModel(this, _textView, factory.TextDocumentFactoryService, new GitCommands());
            _gitDiffBarControl.DataContext = _viewModel;
            _gitDiffBarControl.Width       = MarginWidth;
            UpdateVisibility();
        }
コード例 #2
0
        /// <summary>
        ///   Creates a <see cref="GitDiffMargin" /> for a given <see cref="IWpfTextView" /> .
        /// </summary>
        /// <param name="textView"> The <see cref="IWpfTextView" /> to attach the margin to. </param>
        internal DiffMargin(IWpfTextView textView, DiffMarginFactory factory)
        {
            _textView = textView;
            _classificationFormatMap = factory.ClassificationFormatMapService.GetClassificationFormatMap(textView);
            _editorFormatMap = factory.EditorFormatMapService.GetEditorFormatMap(textView);

            _editorFormatMap.FormatMappingChanged += HandleFormatMappingChanged;
            _textView.Closed += (sender, e) => _editorFormatMap.FormatMappingChanged -= HandleFormatMappingChanged;
            UpdateBrushes();

            _textView.Options.OptionChanged += HandleOptionChanged;

            _gitDiffBarControl = new DiffMarginControl();
            _viewModel = new DiffMarginViewModel(this, _textView, factory.TextDocumentFactoryService, new GitCommands());
            _gitDiffBarControl.DataContext = _viewModel;
            _gitDiffBarControl.Width = MarginWidth;
            UpdateVisibility();
        }