Exemplo n.º 1
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawWaterCursor(void)
{
	if( !m_pRxSet ) return;

    int fo = m_pRxSet->m_pDem->m_CarrierFreq;
	int xx = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ) * m_fftXW / m_WaterWidth;
	if( xx < m_rcBar[sbWATER].Left + 4 ) return;
    if( xx > m_rcBar[sbWATER].Right - 4 ) return;
    TCanvas *pCanvas = StatusBar->Canvas;
	int fb = m_rcBar[sbWATER].Bottom - 1;
#if 0
	if( (m_pRxSet->m_Mode == MODE_RTTY) || (m_pRxSet->m_Mode == MODE_U_RTTY) ){
		pCanvas->Pen->Width = 3;
		pCanvas->Pen->Color = MainVARI->m_tWaterColset[4].c;
		int x = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ - 85.5) * m_fftXW / m_WaterWidth;
        pCanvas->MoveTo(x, fb-4);
        pCanvas->LineTo(x, fb-1);
		x = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ + 85.5) * m_fftXW / m_WaterWidth;
        pCanvas->LineTo(x, fb-1);
        pCanvas->LineTo(x, fb-5);
		pCanvas->Pen->Width = 1;
    }
#endif
	POINT pt[3];
    pt[0].x = xx - 4; pt[0].y = fb;
    pt[1].x = xx + 4; pt[1].y = fb;
    pt[2].x = xx; pt[2].y = fb - 6;

	pCanvas->Pen->Color = MainVARI->m_tWaterColset[3].c;
	pCanvas->Brush->Color = MainVARI->m_tWaterColset[4].c;
	pCanvas->Polygon(pt, 2);
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::DrawFFT(BOOL fClear)
{
	if( !m_pBitmapFFT ) return;

    TCanvas *pCanvas = m_pBitmapFFT->Canvas;
    TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_fftXW; rc.Bottom = m_fftYW;
    pCanvas->Brush->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->Pen->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->FillRect(rc);

	pCanvas->Pen->Style = psDot;
    int xx, y;
    int fh = pCanvas->TextHeight("A");

	switch(MainVARI->m_FFTVType){
		case 0:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 86; y += 20 ){
				xx = y * m_fftYW / 100;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
        case 1:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 66; y += 20 ){
				xx = y * m_fftYW / 60;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
    }

#if 1
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
	MainVARI->DrawFreqScale(pCanvas, m_fftXW, m_fftYW, 0, 3000, fh, FALSE);
#else
	int A, L;
	A = 500; L = 500;
	f = 0;
    int f, fw;
	char bf[128];
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
    y = 0;
	for( ; f < 3000; f += A ){
	    xx = f * m_fftXW / 3000;
        if( xx >= m_fftXW ) break;
		if( !(f % 1000) || !(f % L) ){
			sprintf(bf, "%u", f);
            fw = pCanvas->TextWidth(bf)/2;
            if( (xx - fw) > 0 ) pCanvas->TextOut(xx - fw, y, bf);
//    		pCanvas->MoveTo(xx, y ? 0 : fh); pCanvas->LineTo(xx, y ? m_fftYW-fh : m_fftYW);
    		pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
        }
        else {
    		pCanvas->MoveTo(xx, 0); pCanvas->LineTo(xx, m_fftYW);
        }
    }
#endif
	pCanvas->Pen->Color = clGreen;
	xx = (DEMSAMPFREQ*0.5) * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	int rfo = m_ToneFreq;
	pCanvas->Pen->Style = psSolid;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[4].c;
	xx = 0.5 + rfo * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	POINT pt[4];
	pt[0].x = xx; pt[0].y = fh;
    pt[1].x = xx - 3; pt[1].y = fh+3;
    pt[2].x = xx; pt[2].y = fh + 6;
    pt[3].x = xx + 3; pt[3].y = fh+3;
	pCanvas->Brush->Color = MainVARI->m_tFFTColset[4].c;
	pCanvas->Polygon(pt, 3);

    if( !fClear ){
		pCanvas->Pen->Style = psSolid;
		pCanvas->Pen->Color = MainVARI->m_tFFTColset[1].c;

		double k = double(PBoxFFT->Height)/double(MainVARI->PBoxFFT->Height);
		int *pFFT = MainVARI->m_fftout;
		int xo = 0;
    	int x, y;
		if( MainVARI->m_FFTVType == 1 ){
			int yo = m_fftYW * 40;
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - ((y-yo)/60);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
        }
        else {
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - (y/100);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
		}
    }
}