コード例 #1
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;
                }
                }
            }
        }
コード例 #2
0
        public virtual void alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing sizing, int beatIndex, int voiceIndex, global::alphatab.rendering.Glyph prevGlyph)
        {
            unchecked
            {
                global::alphatab.rendering.Glyph g   = ((global::alphatab.rendering.Glyph)(((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(this._effectGlyphs[voiceIndex]))))).@get(beatIndex).@value));
                global::alphatab.rendering.Glyph pos = default(global::alphatab.rendering.Glyph);
                global::alphatab.rendering.glyphs.BeatContainerGlyph container = ((global::alphatab.rendering.glyphs.BeatContainerGlyph)(this.getOrCreateVoiceContainer(voiceIndex).beatGlyphs[beatIndex]));
                switch (global::haxe.root.Type.enumIndex(sizing))
                {
                case 0:
                {
                    pos     = container.preNotes;
                    g.x     = (pos.x + container.x);
                    g.width = pos.width;
                    break;
                }


                case 1:
                {
                    pos     = container.preNotes;
                    g.x     = (pos.x + container.x);
                    pos     = container.onNotes;
                    g.width = (((pos.x + container.x) + pos.width) - g.x);
                    break;
                }


                case 2:
                {
                    pos     = container.preNotes;
                    g.x     = (pos.x + container.x);
                    pos     = container.postNotes;
                    g.width = (((pos.x + container.x) + pos.width) - g.x);
                    break;
                }


                case 3:
                {
                    pos     = container.onNotes;
                    g.x     = (pos.x + container.x);
                    g.width = pos.width;
                    break;
                }


                case 4:
                {
                    pos     = container.onNotes;
                    g.x     = (pos.x + container.x);
                    pos     = container.postNotes;
                    g.width = (((pos.x + container.x) + pos.width) - g.x);
                    break;
                }


                case 5:
                {
                    pos     = container.postNotes;
                    g.x     = (pos.x + container.x);
                    g.width = pos.width;
                    break;
                }


                case 6:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatOnly, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.preNotes;
                        global::alphatab.rendering.EffectBarRenderer posR = default(global::alphatab.rendering.EffectBarRenderer);
                        posR = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR = default(global::alphatab.rendering.EffectBarRenderer);
                        gR      = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR.x + posR.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR.x + gR.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }


                case 7:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatToOnBeat, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.onNotes;
                        global::alphatab.rendering.EffectBarRenderer posR1 = default(global::alphatab.rendering.EffectBarRenderer);
                        posR1 = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR1 = default(global::alphatab.rendering.EffectBarRenderer);
                        gR1     = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR1.x + posR1.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR1.x + gR1.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }


                case 8:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SinglePreBeatToPostBeat, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.postNotes;
                        global::alphatab.rendering.EffectBarRenderer posR2 = default(global::alphatab.rendering.EffectBarRenderer);
                        posR2 = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR2 = default(global::alphatab.rendering.EffectBarRenderer);
                        gR2     = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR2.x + posR2.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR2.x + gR2.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }


                case 9:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SingleOnBeatOnly, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.onNotes;
                        global::alphatab.rendering.EffectBarRenderer posR3 = default(global::alphatab.rendering.EffectBarRenderer);
                        posR3 = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR3 = default(global::alphatab.rendering.EffectBarRenderer);
                        gR3     = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR3.x + posR3.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR3.x + gR3.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }


                case 10:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.SingleOnBeatToPostBeat, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.postNotes;
                        global::alphatab.rendering.EffectBarRenderer posR4 = default(global::alphatab.rendering.EffectBarRenderer);
                        posR4 = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR4 = default(global::alphatab.rendering.EffectBarRenderer);
                        gR4     = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR4.x + posR4.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR4.x + gR4.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }


                case 11:
                {
                    if ((g != prevGlyph))
                    {
                        this.alignGlyph(global::alphatab.rendering.EffectBarGlyphSizing.GroupedPostBeatOnly, beatIndex, voiceIndex, prevGlyph);
                    }
                    else
                    {
                        pos = container.postNotes;
                        global::alphatab.rendering.EffectBarRenderer posR5 = default(global::alphatab.rendering.EffectBarRenderer);
                        posR5 = ((global::alphatab.rendering.EffectBarRenderer)(pos.renderer));
                        global::alphatab.rendering.EffectBarRenderer gR5 = default(global::alphatab.rendering.EffectBarRenderer);
                        gR5     = ((global::alphatab.rendering.EffectBarRenderer)(g.renderer));
                        g.width = (((((posR5.x + posR5.getBeatGlyphsStart()) + container.x) + pos.x) + pos.width) - (((gR5.x + gR5.getBeatGlyphsStart()) + g.x)));
                        if ((g is global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph))
                        {
                            (((global::alphatab.rendering.glyphs.IMultiBeatEffectGlyph)(((object)(g))))).expandedTo(container.beat);
                        }
                    }

                    break;
                }
                }
            }
        }