KeySignatureWidth(KeySignature key) { ClefSymbol clefsym = new ClefSymbol(Clef.Treble, 0, false); int result = clefsym.MinWidth; AccidSymbol[] keys = key.GetSymbols(Clef.Treble); foreach (AccidSymbol symbol in keys) { result += symbol.MinWidth; } return(result + SheetMusic.LeftMargin + 5); }
private int measureLength; /** The time (in pulses) of a measure */ /** Create a new staff with the given list of music symbols, * and the given key signature. The clef is determined by * the clef of the first chord symbol. The track number is used * to determine whether to join this left/right vertical sides * with the staffs above and below. The SheetMusicOptions are used * to check whether to display measure numbers or not. */ public Staff(List <MusicSymbol> symbols, KeySignature key, MidiOptions options, int tracknum, int totaltracks) { keysigWidth = SheetMusic.KeySignatureWidth(key); this.tracknum = tracknum; this.totaltracks = totaltracks; showMeasures = (options.showMeasures && tracknum == 0); measureLength = options.time.Measure; Clef clef = FindClef(symbols); clefsym = new ClefSymbol(clef, 0, false); keys = key.GetSymbols(clef); this.symbols = symbols; CalculateWidth(options.scrollVert); CalculateHeight(); CalculateStartEndTime(); FullJustify(); }
private int ytop; /** The y pixel of the top of the staff */ #endregion Fields #region Constructors /** Create a new staff with the given list of music symbols, * and the given key signature. The clef is determined by * the clef of the first chord symbol. The track number is used * to determine whether to join this left/right vertical sides * with the staffs above and below. The SheetMusicOptions are used * to check whether to display measure numbers or not. */ public Staff(List<MusicSymbol> symbols, KeySignature key, MidiOptions options, int tracknum, int totaltracks) { keysigWidth = SheetMusic.KeySignatureWidth(key); this.tracknum = tracknum; this.totaltracks = totaltracks; showMeasures = (options.showMeasures && tracknum == 0); measureLength = options.time.Measure; Clef clef = FindClef(symbols); clefsym = new ClefSymbol(clef, 0, false); keys = key.GetSymbols(clef); this.symbols = symbols; CalculateWidth(options.scrollVert); CalculateHeight(); CalculateStartEndTime(); FullJustify(); }
/** Get the width (in pixels) needed to display the key signature */ public static int KeySignatureWidth(KeySignature key) { ClefSymbol clefsym = new ClefSymbol(Clef.Treble, 0, false); int result = clefsym.MinWidth; AccidSymbol[] keys = key.GetSymbols(Clef.Treble); foreach (AccidSymbol symbol in keys) { result += symbol.MinWidth; } return result + SheetMusic.LeftMargin + 5; }