Exemplo n.º 1
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                double step  = (11 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                int    loops = default(int);
                {
                    double v = global::System.Math.Max(((double)(1)), ((double)((this.width / step))));
                    {
                        double x = global::System.Math.Floor(((double)(v)));
                        loops = ((int)(x));
                    }
                }

                global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                canvas.setColor(res.mainGlyphColor);
                canvas.setFont(res.effectFont);
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Left);
                double textWidth = canvas.measureText(this._label);
                canvas.fillText(this._label, ((double)((cx + this.x))), ((double)((cy + this.y))));
                if (this._isExpanded)
                {
                    int    lineSpacing = ((int)((3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                    double startX      = (((cx + this.x) + textWidth) + lineSpacing);
                    int    endX        = ((((cx + this.x) + this.width) - lineSpacing) - lineSpacing);
                    int    lineY       = ((cy + this.y) + ((int)((8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale))));
                    int    lineSize    = ((int)((8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                    if ((endX > startX))
                    {
                        double lineX = startX;
                        while ((lineX < endX))
                        {
                            canvas.beginPath();
                            canvas.moveTo(lineX, ((double)(lineY)));
                            int __temp_stmt606 = default(int);
                            {
                                double x1 = global::System.Math.Min(((double)((lineX + lineSize))), ((double)(endX)));
                                __temp_stmt606 = ((int)(x1));
                            }

                            canvas.lineTo(((double)(__temp_stmt606)), ((double)(lineY)));
                            lineX += ((double)((lineSize + lineSpacing)));
                            canvas.stroke();
                        }

                        canvas.beginPath();
                        canvas.moveTo(((double)(endX)), ((double)((lineY - ((int)((6 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)))))));
                        canvas.lineTo(((double)(endX)), ((double)((lineY + ((int)((6 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)))))));
                        canvas.stroke();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                global::alphatab.rendering.TabBarRenderer     tabBarRenderer = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                global::alphatab.rendering.RenderingResources res            = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                double startX = ((cx + this.x) + (((double)(this._parent.onNotes.width)) / 2));
                double endX   = default(double);
                if (((this._beat.nextBeat == default(global::alphatab.model.Beat)) || (this._beat.voice != this._beat.nextBeat.voice)))
                {
                    endX = (((cx + this.x) + (((double)(this._parent.onNotes.width)) / 2)) + this._parent.postNotes.width);
                }
                else
                {
                    endX = ((double)((cx + tabBarRenderer.getBeatX(this._beat.nextBeat))));
                }

                int startY     = (cy + this.y);
                int textOffset = ((int)((3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                int sizeY      = ((int)((60 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center);
                if ((this._beat.whammyBarPoints.length >= 2))
                {
                    double dx = (((endX - startX)) / 60);
                    double dy = (((double)(sizeY)) / 24);
                    canvas.beginPath();
                    {
                        int _g1 = 0;
                        int _g  = (this._beat.whammyBarPoints.length - 1);
                        while ((_g1 < _g))
                        {
                            int i = _g1++;
                            global::alphatab.model.BendPoint pt1 = ((global::alphatab.model.BendPoint)(this._beat.whammyBarPoints[i]));
                            global::alphatab.model.BendPoint pt2 = ((global::alphatab.model.BendPoint)(this._beat.whammyBarPoints[(i + 1)]));
                            if (((pt1.@value == pt2.@value) && (i == (this._beat.whammyBarPoints.length - 2))))
                            {
                                continue;
                            }

                            int pt1X = ((int)((startX + (dx * pt1.offset))));
                            int pt1Y = ((int)((startY - (dy * pt1.@value))));
                            int pt2X = ((int)((startX + (dx * pt2.offset))));
                            int pt2Y = ((int)((startY - (dy * pt2.@value))));
                            canvas.moveTo(((double)(pt1X)), ((double)(pt1Y)));
                            canvas.lineTo(((double)(pt2X)), ((double)(pt2Y)));
                            if ((pt2.@value != 0))
                            {
                                double dv = (pt2.@value / 4.0);
                                bool   up = ((pt2.@value - pt1.@value) >= 0);
                                string s  = "";
                                if ((dv < 0))
                                {
                                    s = global::haxe.lang.Runtime.concat(s, "-");
                                }

                                if (((dv >= 1) || (dv <= -1)))
                                {
                                    int __temp_stmt605 = default(int);
                                    {
                                        double v = global::System.Math.Abs(((double)(dv)));
                                        {
                                            double x = global::System.Math.Floor(((double)(v)));
                                            __temp_stmt605 = ((int)(x));
                                        }
                                    }

                                    string __temp_stmt604 = global::Std.@string(__temp_stmt605);
                                    string __temp_stmt603 = global::haxe.lang.Runtime.concat(__temp_stmt604, " ");
                                    s = global::haxe.lang.Runtime.concat(s, __temp_stmt603);
                                }

                                {
                                    double x1 = global::System.Math.Floor(((double)(dv)));
                                    dv -= ((double)(((int)(x1))));
                                }

                                if ((dv == 0.25))
                                {
                                    s = global::haxe.lang.Runtime.concat(s, "1/4");
                                }
                                else
                                {
                                    if ((dv == 0.5))
                                    {
                                        s = global::haxe.lang.Runtime.concat(s, "1/2");
                                    }
                                    else
                                    {
                                        if ((dv == 0.75))
                                        {
                                            s = global::haxe.lang.Runtime.concat(s, "3/4");
                                        }
                                    }
                                }

                                canvas.setFont(res.graceFont);
                                double size = canvas.measureText(s);
                                double sy   = default(double);
                                if (up)
                                {
                                    sy = ((pt2Y - res.graceFont.getSize()) - textOffset);
                                }
                                else
                                {
                                    sy = ((double)((pt2Y + textOffset)));
                                }

                                int sx = pt2X;
                                canvas.fillText(s, ((double)(sx)), sy);
                            }
                        }
                    }

                    canvas.stroke();
                }
            }
        }
Exemplo n.º 3
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                global::alphatab.rendering.TabBarRenderer tabBarRenderer = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                global::alphatab.model.Track track = this.renderer.stave.staveGroup.layout.renderer.track;
                global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                double startY     = ((cy + this.y) + ((10 * this.renderer.stave.staveGroup.layout.renderer.settings.scale) * 0.6));
                int    endY       = ((cy + this.y) + tabBarRenderer.getTabY(track.tuning.length, new global::haxe.lang.Null <int>(-2, true)));
                double fontScale  = ((double)(1));
                double correction = ((double)(0));
                {
                    int _g = track.tuning.length;
                    switch (_g)
                    {
                    case 4:
                    {
                        fontScale = 0.6;
                        break;
                    }


                    case 5:
                    {
                        fontScale = 0.8;
                        break;
                    }


                    case 6:
                    {
                        fontScale  = 1.1;
                        correction = ((double)(1));
                        break;
                    }


                    case 7:
                    {
                        fontScale = 1.15;
                        break;
                    }


                    case 8:
                    {
                        fontScale = 1.35;
                        break;
                    }
                    }
                }

                global::alphatab.platform.model.Font font = res.tabClefFont.clone();
                font.setSize((font.getSize() * fontScale));
                canvas.setColor(res.mainGlyphColor);
                canvas.setFont(font);
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center);
                canvas.fillText("T", ((double)(((cx + this.x) + (this.width / 2)))), startY);
                canvas.fillText("A", ((double)(((cx + this.x) + (this.width / 2)))), ((startY + font.getSize()) - ((int)((correction * this.renderer.stave.staveGroup.layout.renderer.settings.scale)))));
                canvas.fillText("B", ((double)(((cx + this.x) + (this.width / 2)))), (startY + (((font.getSize() - ((int)((correction * this.renderer.stave.staveGroup.layout.renderer.settings.scale))))) * 2)));
            }
        }
Exemplo n.º 4
0
        public virtual int paintScoreInfo(int x, int y)
        {
            unchecked
            {
                int flags = default(int);
                if (this.renderer.settings.layout.@get <bool>("hideInfo", false))
                {
                    flags = 0;
                }
                else
                {
                    flags = 511;
                }

                global::alphatab.model.Score score = this.renderer._get_score();
                double scale = this.renderer.settings.scale;
                global::alphatab.platform.ICanvas             canvas = this.renderer.canvas;
                global::alphatab.rendering.RenderingResources res    = this.renderer.renderingResources;
                canvas.setColor(new global::alphatab.platform.model.Color(((int)(0)), ((int)(0)), ((int)(0)), ((global::haxe.lang.Null <int>)(default(global::haxe.lang.Null <int>)))));
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center);
                double tX   = default(double);
                double size = default(double);
                string str  = "";
                if ((!(this.isNullOrEmpty(score.title)) && (((flags & 1)) != 0)))
                {
                    this.drawCentered(score.title, res.titleFont, y);
                    {
                        double x1 = global::System.Math.Floor(((double)((35 * scale))));
                        y += ((int)(x1));
                    }
                }

                if ((!(this.isNullOrEmpty(score.subTitle)) && (((flags & 2)) != 0)))
                {
                    this.drawCentered(score.subTitle, res.subTitleFont, y);
                    {
                        double x2 = global::System.Math.Floor(((double)((20 * scale))));
                        y += ((int)(x2));
                    }
                }

                if ((!(this.isNullOrEmpty(score.artist)) && (((flags & 4)) != 0)))
                {
                    this.drawCentered(score.artist, res.subTitleFont, y);
                    {
                        double x3 = global::System.Math.Floor(((double)((20 * scale))));
                        y += ((int)(x3));
                    }
                }

                if ((!(this.isNullOrEmpty(score.album)) && (((flags & 8)) != 0)))
                {
                    this.drawCentered(score.album, res.subTitleFont, y);
                    {
                        double x4 = global::System.Math.Floor(((double)((20 * scale))));
                        y += ((int)(x4));
                    }
                }

                if (((!(this.isNullOrEmpty(score.music)) && string.Equals(score.music, score.words)) && (((flags & 64)) != 0)))
                {
                    this.drawCentered(global::haxe.lang.Runtime.concat("Music and Words by ", score.words), res.wordsFont, y);
                    {
                        double x5 = global::System.Math.Floor(((double)((20 * scale))));
                        y += ((int)(x5));
                    }
                }
                else
                {
                    canvas.setFont(res.wordsFont);
                    if ((!(this.isNullOrEmpty(score.music)) && (((flags & 32)) != 0)))
                    {
                        canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Right);
                        canvas.fillText(global::haxe.lang.Runtime.concat("Music by ", score.music), ((double)((this.width - global::alphatab.rendering.layout.PageViewLayout.PagePadding[2]))), ((double)(y)));
                    }

                    if ((!(this.isNullOrEmpty(score.words)) && (((flags & 16)) != 0)))
                    {
                        canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Left);
                        canvas.fillText(global::haxe.lang.Runtime.concat("Words by ", score.music), ((double)(x)), ((double)(y)));
                    }

                    {
                        double x6 = global::System.Math.Floor(((double)((20 * scale))));
                        y += ((int)(x6));
                    }
                }

                {
                    double x7 = global::System.Math.Floor(((double)((20 * scale))));
                    y += ((int)(x7));
                }

                if (!(this.renderer.track.isPercussion))
                {
                    canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Left);
                    global::alphatab.model.Tuning tuning = global::alphatab.model.Tuning.findTuning(this.renderer.track.tuning);
                    if ((tuning != default(global::alphatab.model.Tuning)))
                    {
                        canvas.setFont(res.effectFont);
                        canvas.fillText(tuning.name, ((double)(x)), ((double)(y)));
                        {
                            double x8 = global::System.Math.Floor(((double)((15 * scale))));
                            y += ((int)(x8));
                        }

                        if (!(tuning.isStandard))
                        {
                            int stringsPerColumn = default(int);
                            {
                                double x9 = global::System.Math.Ceiling(((double)((((double)(this.renderer.track.tuning.length)) / 2))));
                                stringsPerColumn = ((int)(x9));
                            }

                            int currentX = x;
                            int currentY = y;
                            {
                                int _g1 = 0;
                                int _g  = this.renderer.track.tuning.length;
                                while ((_g1 < _g))
                                {
                                    int i = _g1++;
                                    str = global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("(", global::Std.@string((i + 1))), ") = "), global::alphatab.model.Tuning.getTextForTuning(this.renderer.track.tuning[i], false));
                                    canvas.fillText(str, ((double)(currentX)), ((double)(currentY)));
                                    {
                                        double x10 = global::System.Math.Floor(((double)((15 * scale))));
                                        currentY += ((int)(x10));
                                    }

                                    if ((i == (stringsPerColumn - 1)))
                                    {
                                        currentY = y;
                                        {
                                            double x11 = global::System.Math.Floor(((double)((43 * scale))));
                                            currentX += ((int)(x11));
                                        }
                                    }
                                }
                            }

                            int __temp_stmt479 = default(int);
                            {
                                double x12 = global::System.Math.Floor(((double)((15 * scale))));
                                __temp_stmt479 = ((int)(x12));
                            }

                            y += (stringsPerColumn * __temp_stmt479);
                        }
                    }
                }

                {
                    double x13 = global::System.Math.Floor(((double)((25 * scale))));
                    y += ((int)(x13));
                }

                return(y);
            }
        }