Пример #1
0
 public AdornmentLayer(IWpfTextView textView, LayerKind layerKind, MetadataAndOrder <IAdornmentLayersMetadata> info)
 {
     TextView               = textView ?? throw new ArgumentNullException(nameof(textView));
     this.layerKind         = layerKind;
     Info                   = info;
     adornmentLayerElements = new List <AdornmentLayerElement>();
 }
Пример #2
0
		int GetInsertIndex(MetadataAndOrder<IAdornmentLayersMetadata> info) {
			for (int i = 0; i < adornmentLayers.Count; i++) {
				if (info.Order < adornmentLayers[i].Info.Order)
					return i;
			}
			return adornmentLayers.Count;
		}
Пример #3
0
		AdornmentLayer Create(MetadataAndOrder<IAdornmentLayersMetadata> info) {
			var layer = new AdornmentLayer(wpfTextView, layerKind, info);
			int index = GetInsertIndex(info);
			adornmentLayers.Insert(index, layer);
			Children.Insert(index, layer);
			return layer;
		}
Пример #4
0
        public IAdornmentLayer GetAdornmentLayer(MetadataAndOrder <IAdornmentLayersMetadata> info)
        {
            var layer = adornmentLayers.FirstOrDefault(a => a.Info.Metadata == info.Metadata);

            if (layer is null)
            {
                layer = Create(info);
            }
            return(layer);
        }