mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 06:38:44 -05:00
Rationalize Wide Graph freq labels.
Labels should always be multiples of the major tick interval. When Start freq is nonzero, labels need to be moved. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4464 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
81a9df2ed7
commit
4980d0cdc9
35
plotter.cpp
35
plotter.cpp
@ -238,11 +238,12 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
m_hdivs = w*df/m_freqPerDiv + 0.9999;
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
painter0.drawRect(0, 0, w, 30);
|
||||
MakeFrequencyStrs();
|
||||
|
||||
//draw tick marks on upper scale
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=1; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)( (float)i*pixperdiv );
|
||||
for( int i=0; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)((m_xOffset+i)*pixperdiv );
|
||||
painter0.drawLine(x,18,x,30);
|
||||
}
|
||||
int minor=5;
|
||||
@ -253,28 +254,10 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
}
|
||||
|
||||
//draw frequency values
|
||||
MakeFrequencyStrs();
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
if(0==i) {
|
||||
//left justify the leftmost text
|
||||
x = (int)( (float)i*pixperdiv);
|
||||
x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter,
|
||||
m_HDivText[i]);
|
||||
}
|
||||
else if(m_hdivs == i) {
|
||||
//right justify the rightmost text
|
||||
x = (int)( (float)i*pixperdiv - pixperdiv);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter,
|
||||
m_HDivText[i]);
|
||||
} else {
|
||||
//center justify the rest of the text
|
||||
x = (int)( (float)i*pixperdiv - pixperdiv/2);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,
|
||||
m_HDivText[i]);
|
||||
}
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
|
||||
float bw=9.0*12000.0/m_nsps;
|
||||
@ -320,10 +303,12 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
|
||||
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
|
||||
{
|
||||
float freq;
|
||||
int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv;
|
||||
f*=m_freqPerDiv;
|
||||
m_xOffset=float(f-m_startFreq)/m_freqPerDiv;
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
freq = m_startFreq + i*m_freqPerDiv;
|
||||
m_HDivText[i].setNum((int)freq);
|
||||
m_HDivText[i].setNum(f);
|
||||
f+=m_freqPerDiv;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user