Correct the placement of vertical grid lines when start freq is nonzero.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4717 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2014-12-01 21:38:48 +00:00
parent ed6b6143cf
commit 11d8b17733

View File

@ -195,24 +195,25 @@ void CPlotter::DrawOverlay() //DrawOverlay()
pixperdiv = m_freqPerDiv/df; pixperdiv = m_freqPerDiv/df;
y = m_h2 - m_h2/VERT_DIVS; y = m_h2 - m_h2/VERT_DIVS;
m_hdivs = w*df/m_freqPerDiv + 0.9999; m_hdivs = w*df/m_freqPerDiv + 1.9999;
for( int i=1; i<m_hdivs; i++) //draw vertical grids float xx0=float(m_startFreq)/float(m_freqPerDiv);
{ xx0=xx0-int(xx0);
x = (int)( (float)i*pixperdiv ); int x0=xx0*pixperdiv+0.5;
if(x >= 0 and x<=m_w) { for( int i=1; i<m_hdivs; i++) { //draw vertical grids
painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); x = (int)((float)i*pixperdiv ) - x0;
painter.drawLine(x, 0, x , y); if(x >= 0 and x<=m_w) {
painter.drawLine(x, m_h2-5, x , m_h2); painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
} painter.drawLine(x, 0, x , y);
painter.drawLine(x, m_h2-5, x , m_h2);
} }
}
pixperdiv = (float)m_h2 / (float)VERT_DIVS; pixperdiv = (float)m_h2 / (float)VERT_DIVS;
painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
for( int i=1; i<VERT_DIVS; i++) //draw horizontal grids for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
{ y = (int)( (float)i*pixperdiv );
y = (int)( (float)i*pixperdiv ); painter.drawLine(0, y, w, y);
painter.drawLine(0, y, w, y); }
}
} }
QRect rect0; QRect rect0;