static void copy_col (int dest, int src)
{
    int y;
    
    for (y = 0; y < STONE_LINES; y++)
        field [mapx(dest)][mapy(y)] = field [mapx(src)][mapy(y)];
}
Example #2
0
void SigScale::setPos(int idx, unsigned val, bool)
{
    if (val == pos[idx])
    {
        redraw();
        return;
    }
    unsigned opos = mapx(pos[idx]);
    pos[idx] = val;
    if (!isVisible())
        return;
    val = mapx(val);
    int x = -9;
    int w = 18;
    if (opos > val)
    {
        w += opos - val;
        x += val;
    }
    else
    {
        w += val - opos;
        x += opos;
    }
    redraw();
    //redraw(QRect(x, 0, w, height()));
}
static void clean_last_col (void)
{
    int y;

    for (y = 0; y < STONE_LINES; y++){
        field [mapx(STONE_COLS-1)][mapy(y)].color = 0;
        field [mapx(STONE_COLS-1)][mapy(y)].tag   = 0;
    }
}
static void compress_column (int x)
{
    int y, ym;
    
    for (y = STONE_LINES - 1; y >= 0; y--){
        if (!field [mapx(x)][mapy(y)].tag)
            continue;
        for (ym = y; ym < STONE_LINES - 1; ym++)
            field [mapx(x)][mapy(ym)] = field [mapx(x)][mapy(ym+1)];
        field [mapx(x)][mapy(ym)].color = 0;
        field [mapx(x)][mapy(ym)].tag   = 0;
    }
}
Example #5
0
void BasicDrawPanel::Paint(wxDC &dc)
{
	dc.SetPen( wxPen( wxColor(255,0,0), 3 ) );
	switch(mMeassure)
	{
		case M_DIFF:
			dc.SetPen( wxPen( wxColor(255,0,0), 3 ) );
			dc.DrawLine( mapx(mMStartX), mapy(mMStartY), mapx(mMEndX), mapy(mMEndY));
			break;
		case M_POINT:
			dc.DrawCircle(mapx(mMStartX), mapy(mMStartY),3);
			break;
		default:
			break;
	}
}
Example #6
0
void MTScale::setPos(int idx, unsigned val, bool)
{
	if (val == MAXINT)
	{
		if (idx == 3)
		{
			pos[3] = MAXINT;
			redraw(QRect(0, 0, width(), height()));
		}
		return;
	}
	if (waveMode)
		val = tempomap.tick2frame(val);
	if (val == pos[idx])
		return;
	//unsigned opos = mapx(pos[idx] == MAXINT ? val : pos[idx]);
	int opos = mapx(pos[idx] == MAXINT ? val : pos[idx]);
	pos[idx] = val;
	if (!isVisible())
		return;

	int tval = mapx(val);
	int x = -9;
	int w = 18;

	if (tval < 0)
	{ // tval<0 occurs whenever the window is scrolled left, so I switched to signed int (ml)
		//printf("MTScale::setPos - idx:%d val:%d tval:%d opos:%d w:%d h:%d\n", idx, val, tval, opos, width(), height());

		redraw(QRect(0, 0, width(), height()));
		return;
	}
	//if (opos > (unsigned int) tval) {	//prevent compiler warning: comparison signed/unsigned
	if (opos > tval)
	{
		w += opos - tval;
		x += tval;
	}
	else
	{
		w += tval - opos;
		x += opos;
	}
	//printf("MTScale::setPos idx:%d val:%d tval:%d opos:%d x:%d w:%d h:%d\n", idx, val, tval, opos, x, w, height());

	redraw(QRect(x, 0, w, height()));
}
Example #7
0
void setViewPort(int minx, int miny, int maxx, int maxy)
{
      rx = (double)getmaxx()/(double)(maxx-minx);
      ry = (double)getmaxy()/(double)(maxy-miny);
      mix = minx;
      miy = miny;


		// Y-axis
		for(int j=miny;j<maxy;j++)
			putpixel((int)mapx(0),(int)mapy(j),10);

		// X-axis
		for(int k=minx;k<maxx;k++)
			putpixel((int)mapx(k),(int)mapy(0),10);

}
Example #8
0
KCanvasWindow::KCanvasWindow(HINSTANCE hInst, HWND hWnd, int x, int y, int w, int h)
{
	scale            = 1;
	hMetaFile        = NULL;
	hNTMetaFile      = NULL;

	page_margin      = 10;
	canvas_backcolor = RGB(0xFF, 0xFF, 0x80);
	hInstance        = hInst;

	Createwindow("CanvasClass",
                 IDI_COLIVE,
                 0,
                 "Canvas", 
		         WS_VISIBLE | WS_CHILD | WS_BORDER,
		         mapx(x), mapy(y), mapx(w), mapy(h), 
                 hWnd,
                 hInst,
                 NULL, 0, (HBRUSH) GetStockObject(WHITE_BRUSH) );
}
static void compress_x (void)
{
    int x, xm, l;

    for (x = 0; x < STONE_COLS; x++){
        for (l = STONE_COLS; field [mapx(x)][mapy(0)].color == 0 && l; l--){
            for (xm = x; xm < STONE_COLS-1; xm++)
                copy_col (xm, xm+1);
            clean_last_col ();
        } 
    }
}
Example #10
0
QPoint View::map(const QPoint& p) const
      {
      /*
      int x, y;
      if (xmag < 0) {
            x = lrint(double(p.x())/double(-xmag) - rmapx_f(xorg)) - xpos;  
            }
      else {
            x = p.x()*xmag - xpos - lrint(rmapx_f(xorg));
            }
      if (ymag < 0) {
            y = lrint(double(p.y())/double(-ymag) - rmapy_f(yorg)) - ypos;
            }
      else {
            y = p.y()*ymag - ypos - lrint(rmapy_f(yorg));
            }
      return QPoint(x, y);
      */
      return QPoint(mapx(p.x()), mapy(p.y()));
      }
Example #11
0
void T3DObjectStarMap::calculate()
{
	double x0,y0,z0,gr,fc;
	double hx,hy,hz,vx,vy,vz;
	T4color col2,col2L,col2R;

	double sx=sizex->G_val();
	double sy=sizey->G_val();
	double ssize=starsize->G_val();

	if (calculated) return;

	Tdoublearray &stars_MAG=G_3DCosmos().stars_MAG;
	Tdoublearray &stars_E1=G_3DCosmos().stars_E1;
	Tdoublearray &stars_E2=G_3DCosmos().stars_E2;

	Tarray<QString> &const_code=G_3DCosmos().const_code;
	Tdoublearray &const_E1_1=G_3DCosmos().const_E1_1;
	Tdoublearray &const_E1_2=G_3DCosmos().const_E1_2;
	Tdoublearray &const_E2_1=G_3DCosmos().const_E2_1;
	Tdoublearray &const_E2_2=G_3DCosmos().const_E2_2;

	//for stars

	starvertexbuffer.reset();starcolorbufferL.reset();starcolorbufferR.reset();startexturebuffer.reset();
	if (ssize>0)
	{
		for (int i=0; i<stars_E1.G_count(); i++)
		{
			x0=mapx(stars_E1[i]);
			y0=mapy(stars_E2[i]);
			z0=0;
			gr=(7-stars_MAG[i])/7;
			gr=sqrt(gr);
			if (gr<0.15) gr=0.15;
			if (gr>1.0) gr=1.0;
			fc=ssize*gr;
			hx=fc;hy=0;hz=0;
			vx=0;vy=fc;vz=0;

			col2.r=gr*color->G_R();
			col2.g=gr*color->G_G();
			col2.b=gr*color->G_B();
			col2.a=1*color->G_A();
			col2L=col2;col2L.ColMapL();
			col2R=col2;col2R.ColMapR();

			startexturebuffer.add(T2textureidx(0,0));
			starvertexbuffer.add(Tvec3d(x0-hx-vx,y0-hy-vy,z0-hz-vz));

			startexturebuffer.add(T2textureidx(0,1));
			starvertexbuffer.add(Tvec3d(x0-hx+vx,y0-hy+vy,z0-hz+vz));

			startexturebuffer.add(T2textureidx(1,1));
			starvertexbuffer.add(Tvec3d(x0+hx+vx,y0+hy+vy,z0+hz+vz));

			startexturebuffer.add(T2textureidx(1,0));
			starvertexbuffer.add(Tvec3d(x0+hx-vx,y0+hy-vy,z0+hz-vz));


			starcolorbufferL.add(col2L);starcolorbufferL.add(col2L);starcolorbufferL.add(col2L);starcolorbufferL.add(col2L);
			starcolorbufferR.add(col2R);starcolorbufferR.add(col2R);starcolorbufferR.add(col2R);starcolorbufferR.add(col2R);
		}
	}

	//for constellation lines
	conlinesvertexbuffer.reset();
	conlinestexturebuffer.reset();

	QString constname=singleconstellationname->G_string();

	double linesize=conlinesize->G_val();
	if (linesize>1.0e-9)
	{
		for (int i=0; i<const_E1_1.G_count(); i++)
			if ((qstrlen(constname)==0)||(issame(*const_code[i],constname)))
		{
			double xx1=mapx(const_E1_1[i]);
			double xx2=mapx(const_E1_2[i]);
			double yy1=mapy(const_E2_1[i]);
			double yy2=mapy(const_E2_2[i]);
			if (xx1>xx2)
			{
				double tmp=xx1; xx1=xx2; xx2=tmp;
				tmp=yy1; yy1=yy2; yy2=tmp;
			}
			if (fabs(xx1-xx2)<sx/2)
			{
				addline(xx1,yy1,xx2,yy2);
			}
			else
			{
				addline(xx2-sx,yy1,xx1,yy2);
				addline(xx2,yy1,xx1+sx,yy2);
			}
		}
	}
	calculated=true;
}
Example #12
0
void WaveView::setPos(int idx, unsigned val, bool adjustScrollbar)
      {
      val = MusEGlobal::tempomap.tick2frame(val);
      if (pos[idx] == val)
            return;
      int opos = mapx(pos[idx]);
      int npos = mapx(val);

      if (adjustScrollbar && idx == 0) {
            switch (MusEGlobal::song->follow()) {
                  case  MusECore::Song::NO:
                        break;
                  case MusECore::Song::JUMP:
                        if (npos >= width()) {
                              int ppos =  val - xorg - rmapxDev(width()/4);
                              if (ppos < 0)
                                    ppos = 0;
                              emit followEvent(ppos);
                              opos = mapx(pos[idx]);
                              npos = mapx(val);
                              }
                        else if (npos < 0) {
                              int ppos =  val - xorg - rmapxDev(width()*3/4);
                              if (ppos < 0)
                                    ppos = 0;
                              emit followEvent(ppos);
                              opos = mapx(pos[idx]);
                              npos = mapx(val);
                              }
                        break;
	    case MusECore::Song::CONTINUOUS:
                        if (npos > (width()*5)/8) {
                              int ppos =  pos[idx] - xorg - rmapxDev(width()*5/8);
                              if (ppos < 0)
                                    ppos = 0;
                              emit followEvent(ppos);
                              opos = mapx(pos[idx]);
                              npos = mapx(val);
                              }
                        else if (npos < (width()*3)/8) {
                              int ppos =  pos[idx] - xorg - rmapxDev(width()*3/8);
                              if (ppos < 0)
                                    ppos = 0;
                              emit followEvent(ppos);
                              opos = mapx(pos[idx]);
                              npos = mapx(val);
                              }
                        break;
                  }
            }

      int x;
      int w = 1;
      if (opos > npos) {
            w += opos - npos;
            x = npos;
            }
      else {
            w += npos - opos;
            x = opos;
            }
      pos[idx] = val;
      //redraw(QRect(x, 0, w, height()));
      redraw(QRect(x-1, 0, w+2, height()));    // p4.0.28 From Canvas::draw (is otherwise identical). Fix for corruption.
      }
Example #13
0
void SigScale::pdraw(QPainter& p, const QRect& r)
{
    int x = r.x();
    int w = r.width();
    int h = height();

    if (x < 0)
        x = 0;
    QColor colTimeLine = QColor(172,181,176);
    p.setPen(colTimeLine);
    p.setFont(QFont("fixed-width", 9, QFont::Bold));
    for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si)
    {
        SigEvent* e = si->second;
        int xp = mapx(e->tick);
        if (xp > x + w)
            break;
        if (xp + 40 < x)
            continue;
        p.drawLine(xp, 0, xp, h / 2);
        p.drawLine(xp, h / 2, xp + 5, h / 2);
        QString s;
        s.sprintf("%d/%d", e->sig.z, e->sig.n);
        p.drawText(xp + 8, h - 6, s);
    }

    //---------------------------------------------------
    //    draw location marker
    //---------------------------------------------------

    //Christopher here is your color
    QList<QColor> colors;
    colors << QColor(0, 186, 255) << QColor(139, 225, 69) << QColor(139, 225, 69) << QColor(156,75,219);
    if (pos[3] != MAXINT)
    {
        p.setPen(colors.at(3));
        int xp = mapx(pos[3]);
        if (xp >= x && xp < x + w)
        {
            p.drawLine(xp, 0, xp, height()-10);
            QPixmap* pm = markIcon[3];
            p.drawPixmap(xp - pm->width() / 2, 1, *pm);
        }
    }

    //colors << QColor(139, 225, 69) << QColor(139, 225, 69) << QColor(0, 186, 255);
    for (int i = 0; i < 3; ++i)
    {
        int xp = mapx(pos[i]);
        if (xp >= x && xp < x + w)
        {
            p.setPen(colors.at(i));
            p.drawLine(xp, 0, xp, 8);
            QPixmap* pm = markIcon[i];
            p.drawPixmap(xp - pm->width() / 2, 1, *pm);
        }
    }
    /*//p.setPen(Qt::red);
    p.setPen(QColor(0, 186, 255));
    int xp = mapx(pos[0]);
    if (xp >= x && xp < x + w)
        p.drawLine(xp, 0, xp, h);
    //p.setPen(Qt::blue);
    p.setPen(QColor(139, 225, 69));
    xp = mapx(pos[1]);
    if (xp >= x && xp < x + w)
        p.drawLine(xp, 0, xp, h);
    xp = mapx(pos[2]);
    if (xp >= x && xp < x + w)
        p.drawLine(xp, 0, xp, h);*/
}
Example #14
0
void View::drawTickRaster(QPainter& p, int x, int y, int w, int h, int raster)
      {
      // Changed to draw in device coordinate space instead of virtual, transformed space.     Tim. p4.0.30  
      
      //int mx = mapx(x);
      int my = mapy(y);
      //int mw = mapx(x + w) - mx;
      //int mw = mapx(x + w) - mx - 1;
      //int mh = mapy(y + h) - my;
      //int mh = mapy(y + h) - my - 1;
      
      //p.save();
      bool wmtxen = p.worldMatrixEnabled();
      p.setWorldMatrixEnabled(false);
      
      int xx,bar1, bar2, beat;
      unsigned tick;
      AL::sigmap.tickValues(x, &bar1, &beat, &tick);
      AL::sigmap.tickValues(x+w, &bar2, &beat, &tick);
      ++bar2;
      ///int y2 = y + h;
      //int y2 = my + mh;
      int y2 = mapy(y + h) - 1;
      //printf("View::drawTickRaster x:%d y:%d w:%d h:%d mx:%d my:%d mw:%d mh:%d y2:%d bar1:%d bar2:%d\n", x, y, w, h, mx, my, mw, mh, y2, bar1, bar2);  
      //printf("View::drawTickRaster x:%d y:%d w:%d h:%d my:%d mh:%d y2:%d bar1:%d bar2:%d\n", x, y, w, h, my, mh, y2, bar1, bar2);  
      for (int bar = bar1; bar < bar2; ++bar) {
            ///unsigned x = AL::sigmap.bar2tick(bar, 0, 0);
            unsigned xb = AL::sigmap.bar2tick(bar, 0, 0);
            int xt = mapx(xb);
            p.setPen(Qt::black);
            ///p.drawLine(x, y, x, y2);
            p.drawLine(xt, my, xt, y2);
            int z, n;
            ///AL::sigmap.timesig(x, z, n);
            AL::sigmap.timesig(xb, z, n);
            ///int q = p.xForm(QPoint(raster, 0)).x() - p.xForm(QPoint(0, 0)).x();
            ///int q = p.combinedTransform().map(QPoint(raster, 0)).x() - p.combinedTransform().map(QPoint(0, 0)).x();
            //int q = rmapx(raster);
            int qq = raster;
            //if (q < 8)        // grid too dense
            if (rmapx(raster) < 8)        // grid too dense
                  qq *= 2;
            p.setPen(Qt::lightGray);
            if (raster>=4) {
                        ///int xx = x + qq;
                        //int xx = mapx(xb + qq);
                        xx = xb + qq;
                        int xxx = AL::sigmap.bar2tick(bar, z, 0);
                        //int xxx = mapx(AL::sigmap.bar2tick(bar, z, 0));
                        while (xx <= xxx) {
                               ///p.drawLine(xx, y, xx, y2);
                               int x = mapx(xx);
                               p.drawLine(x, my, x, y2);
                               xx += qq;
                               //xx += rmapx(qq);
                               }
                        //xx = xxx;
                        }

            p.setPen(Qt::darkGray);
            for (int beat = 1; beat < z; beat++) {
                        ///int xx = AL::sigmap.bar2tick(bar, beat, 0);
                        xx = mapx(AL::sigmap.bar2tick(bar, beat, 0));
                        //printf(" bar:%d z:%d beat:%d xx:%d\n", bar, z, beat, xx);  
                        ///p.drawLine(xx, y, xx, y2);
                        p.drawLine(xx, my, xx, y2);
                        }

            }
      //p.setWorldMatrixEnabled(true);
      p.setWorldMatrixEnabled(wmtxen);
      //p.restore();      
      }
Example #15
0
void MTScale::pdraw(QPainter& p, const QRect& r)
{
	QColor colTimeLine = QColor(172,181,176);
	int x = r.x();
	int w = r.width();

	//printf("MTScale::pdraw x:%d w:%d\n", x, w);

	x -= 20;
	w += 40; // wg. Text

	//---------------------------------------------------
	//    draw Marker
	//---------------------------------------------------

	int y = 12;
	p.setPen(colTimeLine);
	p.setFont(QFont("fixed-width", 9, QFont::Bold));
	p.drawLine(r.x(), y + 1, r.x() + r.width(), y + 1);
	QRect tr(r);
	tr.setHeight(12);
	MarkerList* marker = song->marker();
	for (iMarker m = marker->begin(); m != marker->end(); ++m)
	{

		int xp;
		if (waveMode)
			xp = mapx(m->second.frame());
		else
			xp = mapx(m->second.tick());
		if (xp > x + w)
			break;
		int xe = r.x() + r.width();
		iMarker mm = m;
		++mm;
		if (mm != marker->end())
		{

			if (waveMode)
				xe = mapx(tempomap.tick2frame(mm->first));
			else
				xe = mapx(mm->first);
		}

		QRect tr(xp, 0, xe - xp, 13);

		QRect wr = r.intersect(tr);
		if (!wr.isEmpty())
		{
			if (m->second.current())
			{
				p.fillRect(wr, QColor(89, 89, 102));
			}

			int x2;
			if (mm != marker->end())
			{
				if (waveMode)
					x2 = mapx(tempomap.tick2frame(mm->first));
				else
					x2 = mapx(mm->first);
			}
			else
				x2 = xp + 200;

			//printf("MTScale::pdraw marker %s xp:%d y:%d h:%d r.x:%d r.w:%d\n", m->second.name().toLatin1(), xp, height(), y, r.x(), r.width());

			// Must be reasonable about very low negative x values! With long songs > 15min
			//  and with high horizontal magnification, 'ghost' drawings appeared,
			//  apparently the result of truncation later (xp = -65006 caused ghosting
			//  at bar 245 with magnification at max.), even with correct clipping region
			//  applied to painter in View::paint(). Tim.  Apr 5 2009
			// Quote: "Warning: Note that QPainter does not attempt to work around
			//  coordinate limitations in the underlying window system. Some platforms may
			//  behave incorrectly with coordinates as small as +/-4000."
			if (xp >= -32)
				p.drawPixmap(xp, 0, *flagIconS);

			if (xp >= -1023)
			{
				QRect r = QRect(xp + 10, 0, x2 - xp, 12);
				p.setPen(colTimeLine);
				p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter, m->second.name());
			}

			if (xp >= 0)
			{
				p.setPen(colTimeLine);
				p.drawLine(xp, y, xp, height());
			}
		}
	}
	unsigned ctick;
	int bar1, bar2, beat;
	unsigned tick;

	if (waveMode)
	{
		ctick = tempomap.frame2tick(mapxDev(x));
		AL::sigmap.tickValues(ctick, &bar1, &beat, &tick);
		AL::sigmap.tickValues(tempomap.frame2tick(mapxDev(x + w)),
				&bar2, &beat, &tick);
	}
	else
	{
		ctick = mapxDev(x);
		AL::sigmap.tickValues(ctick, &bar1, &beat, &tick);
		AL::sigmap.tickValues(mapxDev(x + w), &bar2, &beat, &tick);
	}

	//printf("bar %d  %d-%d=%d\n", bar, ntick, stick, ntick-stick);
	int h = height() - 12;

	int stick = AL::sigmap.bar2tick(bar1, 0, 0);
	int ntick;
	for (int bar = bar1; bar <= bar2; bar++, stick = ntick)
	{
		ntick = AL::sigmap.bar2tick(bar + 1, 0, 0);
		int tpix, a, b = 0;
		if (waveMode)
		{
			a = tempomap.tick2frame(ntick);
			b = tempomap.tick2frame(stick);
			tpix = rmapx(a - b);
		}
		else
		{
			tpix = rmapx(ntick - stick);
		}
		if (tpix < 64)
		{
			// don�t show beats if measure is this small
			int n = 1;
			if (tpix < 32)
				n = 2;
			if (tpix <= 16)
				n = 4;
			if (tpix < 8)
				n = 8;
			if (tpix <= 4)
				n = 16;
			if (tpix <= 2)
				n = 32;
			if (bar % n)
				continue;
			int x = mapx(waveMode ? b : stick);
			QString s;
			s.setNum(bar + 1);
			p.drawLine(x, y + 1, x, y + 1 + h);
			QRect r = QRect(x + 2, y, 1000, h);
			p.setFont(QFont("fixed-width", 9, QFont::Bold));
			p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip, s);
		}
		else
		{
			int z, n;
			AL::sigmap.timesig(stick, z, n);
			for (int beat = 0; beat < z; beat++)
			{
				int xx = AL::sigmap.bar2tick(bar, beat, 0);
				if (waveMode)
					xx = tempomap.tick2frame(xx);
				int xp = mapx(xx);
				QString s;
				QRect r(xp + 2, y, 1000, h);
				int y1;
				int num;
				if (beat == 0)
				{
					num = bar + 1;
					y1 = y + 1;
					p.setFont(QFont("fixed-width", 9, QFont::Bold));
				}
				else
				{
					num = beat + 1;
					y1 = y + 7;
					p.setFont(QFont("fixed-width", 7, QFont::Normal));
					r.setY(y + 3);
				}
				s.setNum(num);
				p.drawLine(xp, y1, xp, y + 1 + h);
				p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip, s);
			}
		}
	}

	//---------------------------------------------------
	//    draw location marker
	//---------------------------------------------------

	//Christopher here is your color
	p.setPen(QColor(156,75,219));

	if (pos[3] != MAXINT)
	{
		int xp = mapx(pos[3]);
		if (xp >= x && xp < x + w)
			p.drawLine(xp, 0, xp, height());
	}

	p.setPen(colTimeLine);
	if (barLocator)
	{
		p.setPen(QColor(0, 186, 255));
		int xp = mapx(pos[0]);
		if (xp >= x && xp < x + w)
			p.drawLine(xp, 0, xp, height());
		p.setPen(QColor(139, 225, 69));
		xp = mapx(pos[1]);
		if (xp >= x && xp < x + w)
			p.drawLine(xp, 0, xp, height());
		xp = mapx(pos[2]);
		if (xp >= x && xp < x + w)
			p.drawLine(xp, 0, xp, height());
	}
	else
	{
		for (int i = 0; i < 3; ++i)
		{
			int xp = mapx(pos[i]);
			if (xp >= x && xp < x + w)
			{
				QPixmap* pm = markIcon[i];
				p.drawPixmap(xp - pm->width() / 2, y - 1, *pm);
			}
		}
	}
}
Example #16
0
void Canvas::setPos(int idx, unsigned val, bool adjustScrollbar)
{
	//if (pos[idx] == val) // Seems to be some refresh problems here, pos[idx] might be val but the gui not updated.
	//    return;          // skipping this return forces update even if values match. Matching values only seem
	// to occur when initializing
	int opos = mapx(_pos[idx]);
	int npos = mapx(val);

	if (adjustScrollbar && idx == 0)
	{
		switch (song->follow())
		{
		case Song::NO:
			break;
		case Song::JUMP:
			if (npos >= width())
			{
				int ppos = val - xorg - rmapxDev(width() / 8);
				if (ppos < 0)
					ppos = 0;
				emit followEvent(ppos);
				opos = mapx(_pos[idx]);
				npos = mapx(val);
			}
			else if (npos < 0)
			{
				int ppos = val - xorg - rmapxDev(width()*3 / 4);
				if (ppos < 0)
					ppos = 0;
				emit followEvent(ppos);
				opos = mapx(_pos[idx]);
				npos = mapx(val);
			}
			break;
			case Song::CONTINUOUS:
			if (npos > (width() / 2))
			{
				int ppos = _pos[idx] - xorg - rmapxDev(width() / 2);
				if (ppos < 0)
					ppos = 0;
				emit followEvent(ppos);
				opos = mapx(_pos[idx]);
				npos = mapx(val);
			}
			else if (npos < (width() / 2))
			{
				int ppos = _pos[idx] - xorg - rmapxDev(width() / 2);
				if (ppos < 0)
					ppos = 0;
				emit followEvent(ppos);
				opos = mapx(_pos[idx]);
				npos = mapx(val);
			}
			break;
		}
	}

	int x;
	int w = 1;
	if (opos > npos)
	{
		w += opos - npos;
		x = npos;
	}
	else
	{
		w += npos - opos;
		x = opos;
	}
	_pos[idx] = val;
	//redraw(QRect(x - 1, 0, w + 2, height()));
	update();
}