Example #1
0
        public override void doLayout()
        {
            unchecked
            {
                int i = this._number;
                while ((i > 0))
                {
                    int num = (i % 10);
                    global::alphatab.rendering.glyphs.DigitGlyph gl = new global::alphatab.rendering.glyphs.DigitGlyph(new global::haxe.lang.Null <int>(0, true), new global::haxe.lang.Null <int>(0, true), ((int)(num)));
                    this._glyphs.push(gl);
                    i = (i / 10);
                }

                this._glyphs.reverse();
                int cx = 0;
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._glyphs;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph)(_g1[_g]));
                        ++_g;
                        g.x        = cx;
                        g.y        = 0;
                        g.renderer = this.renderer;
                        g.doLayout();
                        cx += g.width;
                    }
                }

                this.width = cx;
            }
        }
        public override void doLayout()
        {
            unchecked
            {
                this._glyphs.sort((((global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun.__hx_current != default(global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun))) ? (global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun.__hx_current) : (global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun.__hx_current = ((global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun)(new global::alphatab.rendering.glyphs.AccidentalGroupGlyph_doLayout_35__Fun())))));
                global::haxe.root.Array <int> columns = new global::haxe.root.Array <int>();
                columns.push(-3000);
                int accidentalSize = ((int)((21 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._glyphs;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph)(_g1[_g]));
                        ++_g;
                        g.renderer = this.renderer;
                        g.doLayout();
                        int gColumn = 0;
                        while ((columns[gColumn] > g.y))
                        {
                            gColumn++;
                            if ((gColumn == columns.length))
                            {
                                columns.push(-3000);
                            }
                        }

                        g.x = gColumn;
                        columns[gColumn] = (g.y + accidentalSize);
                    }
                }

                int columnWidth = ((int)((8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                if ((this._glyphs.length == 0))
                {
                    this.width = 0;
                }
                else
                {
                    this.width = (columnWidth * columns.length);
                }

                {
                    int _g2 = 0;
                    global::haxe.root.Array <object> _g11 = this._glyphs;
                    while ((_g2 < _g11.length))
                    {
                        global::alphatab.rendering.Glyph g1 = ((global::alphatab.rendering.Glyph)(_g11[_g2]));
                        ++_g2;
                        g1.x = (this.width - (((g1.x + 1)) * columnWidth));
                    }
                }
            }
        }
        public override void doLayout()
        {
            unchecked
            {
                int w = 0;
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._notes;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.glyphs.NoteNumberGlyph g = ((global::alphatab.rendering.glyphs.NoteNumberGlyph)(_g1[_g]));
                        ++_g;
                        g.renderer = this.renderer;
                        g.doLayout();
                        if ((g.width > w))
                        {
                            w = g.width;
                        }
                    }
                }

                global::alphatab.rendering.TabBarRenderer tabRenderer = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                double tabHeight = this.renderer.stave.staveGroup.layout.renderer.renderingResources.tablatureFont.getSize();
                int    effectY   = default(int);
                {
                    double x = (this.getNoteY(this._minNote) + (tabHeight / 2));
                    effectY = ((int)(x));
                }

                int effectSpacing = ((int)((7 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                {
                    object __temp_iterator449 = this.beatEffects.iterator();
                    while (((bool)(global::haxe.lang.Runtime.callField(__temp_iterator449, "hasNext", 407283053, default(global::haxe.root.Array)))))
                    {
                        global::alphatab.rendering.Glyph g1 = ((global::alphatab.rendering.Glyph)(global::haxe.lang.Runtime.callField(__temp_iterator449, "next", 1224901875, default(global::haxe.root.Array))));
                        g1.y        = effectY;
                        g1.x        = (this.width / 2);
                        g1.renderer = this.renderer;
                        effectY    += effectSpacing;
                        g1.doLayout();
                    }
                }

                this.width = w;
            }
        }
        public override void addGlyph(global::alphatab.rendering.Glyph g)
        {
            unchecked
            {
                if ((this.beatGlyphs.length == 0))
                {
                    g.x = 0;
                }
                else
                {
                    g.x = (((global::alphatab.rendering.glyphs.BeatContainerGlyph)(this.beatGlyphs[(this.beatGlyphs.length - 1)])).x + ((global::alphatab.rendering.glyphs.BeatContainerGlyph)(this.beatGlyphs[(this.beatGlyphs.length - 1)])).width);
                }

                g.index    = this.beatGlyphs.length;
                g.renderer = this.renderer;
                g.doLayout();
                this.beatGlyphs.push(((global::alphatab.rendering.glyphs.BeatContainerGlyph)(g)));
                this.width = (g.x + g.width);
            }
        }
Example #5
0
        public virtual void addGlyph(global::haxe.root.Array <object> c, global::alphatab.rendering.Glyph g)
        {
            unchecked
            {
                this.isEmpty = false;
                if ((c.length == 0))
                {
                    g.x = 0;
                }
                else
                {
                    g.x = (((global::alphatab.rendering.Glyph)(c[(c.length - 1)])).x + ((global::alphatab.rendering.Glyph)(c[(c.length - 1)])).width);
                }

                g.index    = c.length;
                g.renderer = this;
                g.doLayout();
                c.push(g);
            }
        }
Example #6
0
        public override void doLayout()
        {
            unchecked
            {
                global::haxe.root.Array <object> _g = new global::haxe.root.Array <object>(new object[] { this });
                if (!(this.container.beat.isRest()))
                {
                    this.noteNumbers      = new global::alphatab.rendering.glyphs.TabNoteChordGlyph(new global::haxe.lang.Null <int>(0, true), new global::haxe.lang.Null <int>(0, true), ((bool)((this.container.beat.graceType != global::alphatab.model.GraceType.None))));
                    this.noteNumbers.beat = this.container.beat;
                    this.noteLoop(new global::alphatab.rendering.glyphs.TabBeatGlyph_doLayout_47__Fun(((global::haxe.root.Array <object>)(global::haxe.root.Array <object> .__hx_cast <object>(((global::haxe.root.Array)(_g)))))));
                    this.addGlyph(this.noteNumbers);
                    if (((this.container.beat.whammyBarPoints.length > 0) && !(this.noteNumbers.beatEffects.exists("Whammy"))))
                    {
                        this.noteNumbers.beatEffects.@set("Whammy", new global::alphatab.rendering.glyphs.WhammyBarGlyph(((global::alphatab.model.Beat)(this.container.beat)), ((global::alphatab.rendering.glyphs.BeatContainerGlyph)(this.container))));
                    }

                    if (((!(global::haxe.lang.Runtime.eq((this.container.beat.tremoloSpeed).toDynamic(), (default(global::haxe.lang.Null <global::alphatab.model.Duration>)).toDynamic()))) && !(this.noteNumbers.beatEffects.exists("Tremolo"))))
                    {
                        this.noteNumbers.beatEffects.@set("Tremolo", new global::alphatab.rendering.glyphs.TremoloPickingGlyph(new global::haxe.lang.Null <int>(0, true), new global::haxe.lang.Null <int>(0, true), this.container.beat.tremoloSpeed.@value));
                    }
                }

                int w = 0;
                {
                    int _g1 = 0;
                    global::haxe.root.Array <object> _g11 = this._glyphs;
                    while ((_g1 < _g11.length))
                    {
                        global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph)(_g11[_g1]));
                        ++_g1;
                        g.x        = w;
                        g.renderer = this.renderer;
                        g.doLayout();
                        w += g.width;
                    }
                }

                this.width = w;
            }
        }
Example #7
0
        public override void doLayout()
        {
            unchecked
            {
                int w = 0;
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._glyphs;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph)(_g1[_g]));
                        ++_g;
                        g.x        = w;
                        g.renderer = this.renderer;
                        g.doLayout();
                        w += g.width;
                    }
                }

                this.width = w;
            }
        }
Example #8
0
        public override void doLayout()
        {
            unchecked
            {
                int w = 0;
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._glyphs;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph)(_g1[_g]));
                        ++_g;
                        g.renderer = this.renderer;
                        g.doLayout();
                        {
                            double x = global::System.Math.Max(((double)(w)), ((double)(g.width)));
                            w = ((int)(x));
                        }
                    }
                }

                this.width = w;
            }
        }
		public override   void doLayout()
		{
			unchecked 
			{
				this._infos.sort(( (( global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun.__hx_current != default(global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun) )) ? (global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun.__hx_current) : (global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun.__hx_current = ((global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun) (new global::alphatab.rendering.glyphs.ScoreNoteChordGlyph_doLayout_130__Fun()) )) ));
				int padding = 0;
				int displacedX = 0;
				bool lastDisplaced = false;
				int lastLine = 0;
				bool anyDisplaced = false;
				int w = 0;
				{
					int _g1 = 0;
					int _g = this._infos.length;
					while (( _g1 < _g ))
					{
						int i = _g1++;
						global::alphatab.rendering.Glyph g = ((global::alphatab.rendering.Glyph) (global::haxe.lang.Runtime.getField(this._infos[i], "glyph", 369425836, true)) );
						g.renderer = this.renderer;
						g.doLayout();
						g.x = padding;
						if (( i == 0 )) 
						{
							displacedX = ( g.width + padding );
						}
						 else 
						{
							if (( global::System.Math.Abs(((double) (( ((int) (lastLine) ) - ((int) (global::haxe.lang.Runtime.getField_f(this._infos[i], "line", 1202919412, true)) ) )) )) <= 1 )) 
							{
								if ( ! (lastDisplaced) ) 
								{
									g.x = ((int) (( displacedX - this.renderer.stave.staveGroup.layout.renderer.settings.scale )) );
									anyDisplaced = true;
									lastDisplaced = true;
								}
								 else 
								{
									lastDisplaced = false;
								}
								
							}
							 else 
							{
								lastDisplaced = false;
							}
							
						}
						
						lastLine = ((int) (global::haxe.lang.Runtime.getField_f(this._infos[i], "line", 1202919412, true)) );
						{
							double x = global::System.Math.Max(((double) (w) ), ((double) (( g.x + g.width )) ));
							w = ((int) (x) );
						}
						
					}
					
				}
				
				if (anyDisplaced) 
				{
					this.upLineX = displacedX;
					this.downLineX = displacedX;
				}
				 else 
				{
					this.upLineX = w;
					this.downLineX = padding;
				}
				
				{
					object __temp_iterator447 = this.beatEffects.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator447, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::alphatab.rendering.Glyph e = ((global::alphatab.rendering.Glyph) (global::haxe.lang.Runtime.callField(__temp_iterator447, "next", 1224901875, default(global::haxe.root.Array))) );
						e.renderer = this.renderer;
						e.doLayout();
					}
					
				}
				
				if (( ! (global::haxe.lang.Runtime.eq((this.beat.tremoloSpeed).toDynamic(), (default(global::haxe.lang.Null<global::alphatab.model.Duration>)).toDynamic())) )) 
				{
					int offset = default(int);
					object baseNote = default(object);
					if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
					{
						baseNote = this.minNote;
					}
					 else 
					{
						baseNote = this.maxNote;
					}
					
					int tremoloX = default(int);
					if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
					{
						tremoloX = displacedX;
					}
					 else 
					{
						tremoloX = 0;
					}
					
					{
						global::haxe.lang.Null<global::alphatab.model.Duration> _g2 = this.beat.tremoloSpeed;
						switch (global::haxe.root.Type.enumIndex((_g2).toDynamic()))
						{
							case 5:
							{
								if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
								{
									offset = -15;
								}
								 else 
								{
									offset = 10;
								}
								
								break;
							}
							
							
							case 4:
							{
								if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
								{
									offset = -12;
								}
								 else 
								{
									offset = 10;
								}
								
								break;
							}
							
							
							case 3:
							{
								if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
								{
									offset = -10;
								}
								 else 
								{
									offset = 10;
								}
								
								break;
							}
							
							
							default:
							{
								if (( this.beamingHelper.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up )) 
								{
									offset = -15;
								}
								 else 
								{
									offset = 15;
								}
								
								break;
							}
							
						}
						
					}
					
					this._tremoloPicking = new global::alphatab.rendering.glyphs.TremoloPickingGlyph(new global::haxe.lang.Null<int>(tremoloX, true), new global::haxe.lang.Null<int>(( ((global::alphatab.rendering.Glyph) (global::haxe.lang.Runtime.getField(baseNote, "glyph", 369425836, true)) ).y + ((int) (( offset * this.renderer.stave.staveGroup.layout.renderer.settings.scale )) ) ), true), this.beat.tremoloSpeed.@value);
					this._tremoloPicking.renderer = this.renderer;
					this._tremoloPicking.doLayout();
				}
				
				this.width = ( w + padding );
			}
		}
Example #10
0
        public virtual void createOrResizeGlyph(global::alphatab.rendering.EffectBarGlyphSizing sizing, global::alphatab.model.Beat b)
        {
            unchecked
            {
                switch (global::haxe.root.Type.enumIndex(sizing))
                {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                {
                    global::alphatab.rendering.Glyph g = this._info.createNewGlyph(this, b);
                    g.renderer = this;
                    g.doLayout();
                    ((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(this._effectGlyphs[b.voice.index]))))).@set(b.index, g);
                    ((global::haxe.root.Array <object>)(global::haxe.root.Array <object> .__hx_cast <object>(((global::haxe.root.Array)(this._uniqueEffectGlyphs[b.voice.index]))))).push(g);
                    break;
                }


                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                {
                    if (((b.index > 0) || (this.index > 0)))
                    {
                        global::alphatab.model.Beat prevBeat = b.previousBeat;
                        if (this._info.shouldCreateGlyph(this, prevBeat))
                        {
                            global::alphatab.rendering.Glyph prevEffect = default(global::alphatab.rendering.Glyph);
                            if ((b.index > 0))
                            {
                                prevEffect = ((global::alphatab.rendering.Glyph)(((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(this._effectGlyphs[b.voice.index]))))).@get(prevBeat.index).@value));
                            }
                            else
                            {
                                prevEffect = ((global::alphatab.rendering.Glyph)(((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)((((global::alphatab.rendering.EffectBarRenderer)(((global::alphatab.rendering.BarRendererBase)(this.stave.barRenderers[(this.index - 1)])))))._effectGlyphs[b.voice.index]))))).@get(prevBeat.index).@value));
                            }

                            if (((prevEffect == default(global::alphatab.rendering.Glyph)) || !(this._info.canExpand(this, prevBeat, b))))
                            {
                                this.createOrResizeGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatOnly, b);
                            }
                            else
                            {
                                ((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(this._effectGlyphs[b.voice.index]))))).@set(b.index, prevEffect);
                            }
                        }
                        else
                        {
                            this.createOrResizeGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatOnly, b);
                        }
                    }
                    else
                    {
                        this.createOrResizeGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatOnly, b);
                    }

                    break;
                }
                }
            }
        }