public SILayout() { _Components = new List <LayoutComponent>(); _Strings = new LayoutItemCollection <SIString>(this); _Strings.CollectionChanged += Strings_CollectionChanged; Margins = new FingerboardMargin(this); _StringSpacingMode = StringSpacingType.Simple; SimpleStringSpacing = new StringSpacingSimple(this); ManualStringSpacing = new StringSpacingManual(this); SingleScaleConfig = new SingleScaleManager(this); DualScaleConfig = new DualScaleManager(this); MultiScaleConfig = new MultipleScaleManager(this); VisualElements = new List <VisualElement>(); _ScaleLengthMode = ScaleLengthType.Single; _FretsTemperament = Temperament.Equal; _FretInterpolation = FretInterpolationMethod.Spline; _CachedBounds = RectangleM.Empty; LayoutName = string.Empty; LayoutChanges = new List <ILayoutChange>(); LayoutVersion = CURRENT_LAYOUT_VERSION; //_InstrumentType = InstrumentType.Guitar; }
private static IEnumerable <T> GetItems <T>(this LayoutItemCollection source) where T : LayoutItemBase { foreach (var item in source) { var groupItem = item as LayoutGroupBase; if (groupItem != null) { foreach (var childItem in groupItem.Items.GetItems <T>()) { yield return(childItem); } } if (item is T) { yield return(item as T); } } }