internal ColorColumnAdornmentFactory(IEditorFormatMapService formatMapService, SVsServiceProvider serviceProvider) { this.formatMapService = formatMapService; IVsPackage package; var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell)); Marshal.ThrowExceptionForHR(shell.LoadPackage(new Guid(GuidList.colorColumnPkgString), out package)); this.settings = ((ColorColumnPackage)package).Settings; }
/// <summary> /// Creates a square image and attaches an event handler to the layout changed event that /// adds the the square in the upper right-hand corner of the TextView via the adornment layer /// </summary> /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param> public ColorColumn(IWpfTextView textView, IEditorFormatMap formatMap, OptionsPage settings) { _view = textView; _formatMap = formatMap; _settings = settings; _columns = new List <int>(); _cursorColumnList = new List <int>(); _linesOffset = new List <int>(); _cursorColumnList.Add(0); //Dummy initial position; _adornmentLayer = _view.GetAdornmentLayer("ColorColumn"); _columnsImage = new Image(); _cursorColumnImage = new Image(); _settings.PropertyChanged += settings_PropertyChanged; _view.LayoutChanged += view_LayoutChanged; _view.Caret.PositionChanged += caret_PositionChanged; _formatMap.FormatMappingChanged += _formatMap_FormatMappingChanged; resetDrawing(); updateSettings(); }
/// <summary> /// Creates a square image and attaches an event handler to the layout changed event that /// adds the the square in the upper right-hand corner of the TextView via the adornment layer /// </summary> /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param> public ColorColumn(IWpfTextView textView, IEditorFormatMap formatMap, OptionsPage settings) { _view = textView; _formatMap = formatMap; _settings = settings; _columns = new List<int>(); _cursorColumnList = new List<int>(); _linesOffset = new List<int>(); _cursorColumnList.Add(0); //Dummy initial position; _adornmentLayer = _view.GetAdornmentLayer("ColorColumn"); _columnsImage = new Image(); _cursorColumnImage = new Image(); _settings.PropertyChanged += settings_PropertyChanged; _view.LayoutChanged += view_LayoutChanged; _view.Caret.PositionChanged += caret_PositionChanged; _formatMap.FormatMappingChanged += _formatMap_FormatMappingChanged; resetDrawing(); updateSettings(); }
internal ColorColumnTextClassifier(IClassificationTypeRegistryService registry, OptionsPage options, ITextBuffer buffer, ITextView view) { _tag = new ClassificationTag(registry.GetClassificationType("Color Column Text")); _options = options; _columns = new List <int>(); _buffer = buffer; _view = view; _view.LayoutChanged += _view_LayoutChanged; _options.PropertyChanged += _options_PropertyChanged; updateColumns(); }