protected StaveGroup CreateEmptyStaveGroup() { var group = new StaveGroup(); group.Layout = this; var profile = Environment.StaveProfiles.ContainsKey(Renderer.Settings.Staves.Id) ? Environment.StaveProfiles[Renderer.Settings.Staves.Id] : Environment.StaveProfiles["default"]; var isFirstTrack = true; for (var trackIndex = 0; trackIndex < Renderer.Tracks.Length; trackIndex++) { var track = Renderer.Tracks[trackIndex]; for (int staveIndex = 0; staveIndex < track.Staves.Count; staveIndex++) { for (var renderStaveIndex = 0; renderStaveIndex < profile.Length; renderStaveIndex++) { var factory = profile[renderStaveIndex]; var staff = track.Staves[staveIndex]; if (factory.CanCreate(track, staff)) { group.AddStaff(track, new Staff(trackIndex, staff, factory, Renderer.Settings.Staves.AdditionalSettings)); } } } isFirstTrack = false; } return(group); }
protected StaveGroup CreateEmptyStaveGroup() { var group = new StaveGroup(); group.Layout = this; for (var trackIndex = 0; trackIndex < Renderer.Tracks.Length; trackIndex++) { var track = Renderer.Tracks[trackIndex]; string staveProfile; // use optimal profile for track if (track.IsPercussion) { staveProfile = Environment.StaveProfileScore; } else if (track.IsStringed) { staveProfile = Renderer.Settings.Staves.Id; } else { staveProfile = Environment.StaveProfileScore; } var profile = Environment.StaveProfiles.ContainsKey(staveProfile) ? Environment.StaveProfiles[staveProfile] : Environment.StaveProfiles["default"]; for (int staveIndex = 0; staveIndex < track.Staves.Count; staveIndex++) { for (var renderStaveIndex = 0; renderStaveIndex < profile.Length; renderStaveIndex++) { var factory = profile[renderStaveIndex]; var staff = track.Staves[staveIndex]; if (factory.CanCreate(track, staff)) { group.AddStaff(track, new Staff(trackIndex, staff, factory)); } } } } return(group); }
protected StaveGroup CreateEmptyStaveGroup() { var group = new StaveGroup(); group.Layout = this; for (var trackIndex = 0; trackIndex < Renderer.Tracks.Length; trackIndex++) { var track = Renderer.Tracks[trackIndex]; var hasScore = false; //var hasTab = false; foreach (var staff in track.Staves) { switch (staff.StaffKind) { case StaffKind.Tablature: //hasTab = true; break; case StaffKind.Score: hasScore = true; break; case StaffKind.Percussion: break; case StaffKind.Mixed: hasScore = true; //hasTab = true; break; } } for (int staffIndex = 0; staffIndex < track.Staves.Count; staffIndex++) { var staff = track.Staves[staffIndex]; // use optimal profile for track string staveProfile; if (staff.StaffKind == StaffKind.Percussion) { staveProfile = Environment.StaveProfileScore; } else if (staff.StaffKind == StaffKind.Tablature) { if (hasScore) { staveProfile = Environment.StaveProfileTabMixed; } else { staveProfile = Environment.StaveProfileTab; } } else if (staff.IsStringed) { staveProfile = Renderer.Settings.Staves.Id; } else // if(staff.StaffKind == StaffKind.Score) { staveProfile = Environment.StaveProfileScore; } var profile = Environment.StaveProfiles.ContainsKey(staveProfile) ? Environment.StaveProfiles[staveProfile] : Environment.StaveProfiles["default"]; foreach (var factory in profile) { if (factory.CanCreate(track, staff)) { group.AddStaff(track, new Staff(trackIndex, staff, factory)); } } } } return(group); }