示例#1
0
文件: clockpic.c 项目: tcbabu/kgclock
void *DrawClockPicture(double r){
  double dang=3.0;
  void *img;
  DIG *G;
  int L,i;
  double l,fac,ang,dl;
  float h,s,v,vorg;
  float Red,Green,Blue;
  L = r*0.5+1;
  l= L;
  dl = l*0.15;
  fac = atan(1.0)/45.0;
  

  G = (DIG *)kgInitImage(2*L+1,2*L+1,8);
  kgUserFrame(G,-l,-l,l,l);
  ang =0.0;
  dang *= fac;
  kgLineColor(G,3);
  RGBtoHSV(Dred,Dgreen,Dblue,&h,&s,&vorg);
  v =0.75*vorg;
  HSVtoRGB(&Red,&Green,&Blue,h,s,v);
  kgChangeColor(G,251,30,30,30);
  kgChangeColor(G,253,(int)Red,(int)Green,(int)Blue);
   
  if(vorg < 0.9 ) {
       v = vorg*1.4;
       if(v>1.0) v=1.0;
       HSVtoRGB(&Red,&Green,&Blue,h,s,v);
       kgChangeColor(G,252,(int)Red,(int)Green,(int)Blue);
  }
  else kgChangeColor(G,252,250,250,250);
  ang =0.0;
  for(i=0;i<12;i++) {
    DrawMark(G,ang,dang,l,dl,+2.,-2.,251);
    ang += (30*fac);
  }
  ang =0.0;
  for(i=0;i<12;i++) {
    DrawMark(G,ang,dang,l,dl,-1.,0.0,252);
    ang += (30*fac);
  }
#if 1
  ang =0.0;
  for(i=0;i<12;i++) {
    DrawMark(G,ang,dang,l,dl,+1.0,-1.0,253);
    ang += (30*fac);
  }
#endif
  ang =0.0;
  for(i=0;i<12;i++) {
    DrawMark(G,ang,dang,l,dl,0.,0.,DateColor);
    ang += (30*fac);
  }
  img = kgGetResizedImage(G);
  
  kgCloseImage(G);
  return img;
}
void CShadePickerCtrl::SetMark(CPoint pt)
{
	CRect	cr;
	GetClientRect(cr);
	pt.y = CLAMP(pt.y, cr.top, cr.bottom);
	PtToHLS(cr, pt, m_hls);
	DrawMark(FALSE);
	m_Mark = pt.y;
	DrawMark(TRUE);
	UpdateBuddy();
	NotifyParent();
}
void CShadePickerCtrl::UpdateColor()
{
	CRect	cr;
	GetClientRect(cr);
	CPoint	pt;
	HLSToPt(cr, m_hls, pt);
	if (pt.y != m_Mark) {
		DrawMark(FALSE);
		m_Mark = pt.y;
		DrawMark(TRUE);
	}
	Invalidate();
	UpdateBuddy();
}
void CShadePickerCtrl::ShowMark(bool Enable)
{
	if (Enable == m_ShowMark)
		return;	// nothing to do
	m_ShowMark = Enable;	// order matters
	DrawMark(Enable);
}
示例#5
0
文件: crosshair.c 项目: thequux/pcb
/* ---------------------------------------------------------------------------
 * switches crosshair off
 */
void
CrosshairOff (bool BlockToo)
{
  if (Crosshair.On)
    {
      Crosshair.On = false;
      DrawAttached (BlockToo);
      DrawMark (true);
    }
}
示例#6
0
文件: crosshair.c 项目: thequux/pcb
/* ---------------------------------------------------------------------------
 * switches crosshair on
 */
void
CrosshairOn (bool BlockToo)
{
  if (!Crosshair.On)
    {
      Crosshair.On = true;
      DrawAttached (BlockToo);
      DrawMark (true);
    }
}
示例#7
0
/****************************************************************************
	Desc: グラフを描画する.
	 Arg: グラフの幅
		  グラフの高さ
  Return: ---
****************************************************************************/
void CStockGraph::Draw(CDC* pDC)
{
	DrawBackground(pDC);
	DrawKLine(pDC);
	DrawVolume(pDC);
	for (int iLine = 0; iLine < MA_LINE_MAX; iLine++)
	{
		DrawMovingAverages(pDC, iLine);
	}

	if (m_nMarkCount > 0)
		DrawMark(pDC);
}
示例#8
0
void
ghid_notify_mark_change (bool changes_complete)
{
  render_priv *priv = gport->render_priv;

  /* We sometimes get called before the GUI is up */
  if (gport->drawing_area == NULL)
    return;

  if (changes_complete)
    priv->mark_invalidate_depth --;

  if (priv->mark_invalidate_depth < 0)
    {
      priv->mark_invalidate_depth = 0;
      /* A mismatch of changes_complete == false and == true notifications
       * is not expected to occur, but we will try to handle it gracefully.
       * As we know the mark will have been shown already, we must
       * repaint the entire view to be sure not to leave an artaefact.
       */
      ghid_invalidate_all ();
      return;
    }

  if (priv->mark_invalidate_depth == 0)
    DrawMark ();

  if (!changes_complete)
    {
      priv->mark_invalidate_depth ++;
    }
  else if (gport->drawing_area != NULL)
    {
      /* Queue a GTK expose when changes are complete */
      ghid_draw_area_update (gport, NULL);
    }
}
void CShadePickerCtrl::UpdateMark()
{
	CClientDC	dc(this);
	DrawMark(m_ShowMark, &dc);
}
void CShadePickerCtrl::DrawMark(bool Show)
{
	CClientDC	dc(this);
	DrawMark(Show, &dc);
}
示例#11
0
static void
redraw_region (GdkRectangle *rect)
{
  int eleft, eright, etop, ebottom;
  BoxType region;
  render_priv *priv = gport->render_priv;

  if (!gport->pixmap)
    return;

  if (rect != NULL)
    {
      priv->clip_rect = *rect;
      priv->clip = true;
    }
  else
    {
      priv->clip_rect.x = 0;
      priv->clip_rect.y = 0;
      priv->clip_rect.width = gport->width;
      priv->clip_rect.height = gport->height;
      priv->clip = false;
    }

  set_clip (priv, priv->bg_gc);
  set_clip (priv, priv->offlimits_gc);
  set_clip (priv, priv->mask_gc);
  set_clip (priv, priv->grid_gc);

  region.X1 = MIN(Px(priv->clip_rect.x),
                  Px(priv->clip_rect.x + priv->clip_rect.width + 1));
  region.Y1 = MIN(Py(priv->clip_rect.y),
                  Py(priv->clip_rect.y + priv->clip_rect.height + 1));
  region.X2 = MAX(Px(priv->clip_rect.x),
                  Px(priv->clip_rect.x + priv->clip_rect.width + 1));
  region.Y2 = MAX(Py(priv->clip_rect.y),
                  Py(priv->clip_rect.y + priv->clip_rect.height + 1));

  region.X1 = MAX (0, MIN (PCB->MaxWidth,  region.X1));
  region.X2 = MAX (0, MIN (PCB->MaxWidth,  region.X2));
  region.Y1 = MAX (0, MIN (PCB->MaxHeight, region.Y1));
  region.Y2 = MAX (0, MIN (PCB->MaxHeight, region.Y2));

  eleft = Vx (0);
  eright = Vx (PCB->MaxWidth);
  etop = Vy (0);
  ebottom = Vy (PCB->MaxHeight);
  if (eleft > eright)
    {
      int tmp = eleft;
      eleft = eright;
      eright = tmp;
    }
  if (etop > ebottom)
    {
      int tmp = etop;
      etop = ebottom;
      ebottom = tmp;
    }

  if (eleft > 0)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, 0, 0, eleft, gport->height);
  else
    eleft = 0;
  if (eright < gport->width)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eright, 0, gport->width - eright, gport->height);
  else
    eright = gport->width;
  if (etop > 0)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eleft, 0, eright - eleft + 1, etop);
  else
    etop = 0;
  if (ebottom < gport->height)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eleft, ebottom, eright - eleft + 1,
                        gport->height - ebottom);
  else
    ebottom = gport->height;

  gdk_draw_rectangle (gport->drawable, priv->bg_gc, 1,
                      eleft, etop, eright - eleft + 1, ebottom - etop + 1);

  ghid_draw_bg_image();

  hid_expose_callback (&ghid_hid, &region, 0);
  ghid_draw_grid ();

  /* In some cases we are called with the crosshair still off */
  if (priv->attached_invalidate_depth == 0)
    DrawAttached ();

  /* In some cases we are called with the mark still off */
  if (priv->mark_invalidate_depth == 0)
    DrawMark ();

  draw_lead_user (priv);

  priv->clip = false;

  /* Rest the clip for bg_gc, as it is used outside this function */
  gdk_gc_set_clip_mask (priv->bg_gc, NULL);
}
示例#12
0
void TGraphScale::drawit ( wxDC &dc , wxRect &r , wxRect &inner )
	{
   	wxRect ir = CalcInternalRect ( r ) ;
   	int border = 2 ;
   	
   	if ( horizontal )
   		{
	    if ( ir.x < inner.x ) ir.x = inner.x ;
	    while ( ir.GetRight() > inner.GetRight() ) ir.width-- ;
	    outline = ir ;
	    ir.height -= border*2 ;
	    ir.y += border ;
   		}
    else
    	{
	    if ( ir.y < inner.y ) ir.y = inner.y ;
	    while ( ir.GetBottom() > inner.GetBottom() ) ir.height-- ;
	    outline = ir ;
	    ir.width -= border*2 ;
	    ir.x += border ;
     	}        
   	
   	// Selected? Draw nice background!
   	if ( selected )
   		{
	    dc.SetPen ( *MYPEN ( TGraphDisplay::prettyColor ) ) ;
	    dc.SetBrush ( *MYBRUSH ( TGraphDisplay::prettyColor ) ) ;
	    dc.DrawRectangle ( outline ) ;
	    dc.SetBrush ( *wxTRANSPARENT_BRUSH ) ;
   		}   
   	
   	// Calculate major and minor units
   	float multiplier = 10 ; //( unit == _T("s") ) ? 6 : 10 ;
   	float factor = 1 ;
   	while ( factor <= max ) factor *= multiplier ;
   	float f2 = top - bottom ;
   	while ( factor >= f2 ) factor /= multiplier ;
   	
   	float major = factor ;
   	float minor = major / 5 ;
   	
   	// Draw scale
   	dc.SetFont ( *MYFONT ( 8 , wxMODERN , wxNORMAL , wxNORMAL ) ) ;
   	dc.SetTextForeground ( col ) ;
   	dc.SetPen ( *MYPEN ( col ) ) ;
   	
   	float p = 0 ;
   	while ( p > bottom ) p -= minor ;
   	while ( p < bottom ) p += minor ;
   	if ( p != bottom ) p -= minor ;
   	while ( p <= top )
   		{
			wxString label ;
/*			if ( unit == _T("s") ) label = wxString::Format ( _T("%d:%2d") , p / 60 , ((int)p) % 60 ) ;
			else */label = wxString::Format ( _T("%f") , p ) ;
			DrawMark ( dc , p , ir , label , ( p - ((int)(p/major))*major ) == 0 ) ;
			p += minor ;
   		}    
	
	// Draw "backline" and name/unit
	wxString text = name ;
	if ( !unit.IsEmpty() ) text += _T(" [") + unit + _T("]") ;
   	int tw , th ;
   	dc.GetTextExtent ( text , &tw , &th ) ;
	if ( horizontal )
		{
  		if ( left )
    		{
          	dc.DrawLine ( ir.x , ir.y , ir.GetRight() , ir.y ) ;
          	dc.DrawText ( text , ir.x , ir.y ) ;
          	}   	
  		else
    		{
     		dc.DrawLine ( ir.x , ir.GetBottom() , ir.GetRight() , ir.GetBottom() ) ;
          	dc.DrawText ( text , ir.x , ir.GetBottom() - th ) ;
     		}  		
  		if ( show_mark )
  			{
	    	int c = GetRealCoord ( GetVirtualCoordinate ( mark , inner ) , inner ) ;
	    	dc.SetPen ( *wxRED_PEN ) ;
	    	dc.DrawLine ( c , ir.GetTop() , c , ir.GetBottom() ) ;
  			}    
		}		
	else
		{
		if ( left )
  			{
         dc.DrawLine ( ir.x , ir.y , ir.x , ir.GetBottom() ) ;
         dc.DrawRotatedText ( text , ir.x + 2 , ir.GetBottom() , 90 ) ;
         }   	
		else
  			{
    		dc.DrawLine ( ir.GetRight() , ir.y , ir.GetRight() , ir.GetBottom() ) ;
         dc.DrawRotatedText ( text , ir.GetRight()-th , ir.GetBottom() , 90 ) ;
      	}
  		if ( show_mark )
  			{
	    	int c = GetRealCoord ( GetVirtualCoordinate ( mark , inner ) , inner ) ;
	    	dc.SetPen ( *wxRED_PEN ) ;
	    	dc.DrawLine ( ir.GetLeft() , c , ir.GetRight() , c ) ;
  			}    
  		}
	last_inner = inner ;
	show_mark = false ;
	}    
示例#13
0
文件: FFTDisp.cpp 项目: Quenii/adcevm
// 绘制的顺序,先坐标,再曲线、擦除多余的曲线、坐标值、标记、参数值
void CFFTDisp::DrawCurve()
{
	int i,j;
	CSize szText;
	int x;
	int y;
	CFont* pOldFont;
	CString strMsg;
	CPen *pOldPen;
	double dErr = 0;

	// 与背景对齐
	int nSigPicWidth = m_nClientWidth - FFT_LEFT_MARGIN * 2;
	int nSigPicHeight = m_nClientHeight - FFT_TOP_MARGIN * 2;	
	int nSigPicSmallWidth = nSigPicWidth / FFT_NUM_HORZ;
	int nSigPicSmallHeight = nSigPicHeight / FFT_NUM_VERT;
	// 对齐后的宽度和高度
	int nPicWidth = nSigPicSmallWidth * FFT_NUM_HORZ;
	int nPicHeight = nSigPicSmallHeight * FFT_NUM_VERT;
	
	if ( m_dcPlot.GetSafeHdc() != NULL )
	{		
		// 清除原来的图像
		m_dcPlot.SetBkColor (m_crBackColor) ;
		m_dcPlot.FillRect(m_rectPlot, &m_brushBack) ;
		// 标题
		///////////////////////////////////////////////////////////////////////////
		pOldFont = m_dcPlot.SelectObject( &m_fntTitle );
		m_dcPlot.SetTextColor( m_crImageColor );
		m_dcPlot.TextOut( 2, 2, m_strTitle );
		if ( pOldFont != NULL )
		{			
			m_dcPlot.SelectObject( pOldFont );
		}
		///////////////////////////////////////////////////////////////////////////

		/*
		// 计算Ain
		dErr = 0;		
		CAdcTestPlatView* pView = (CAdcTestPlatView*)GetParent();
		if ( pView != NULL && pView->m_dVpp > 0 )
		{
			// Ain(峰峰值最大为2V)
			dErr = 20*log10( pView->m_dVpp / 2);
		}
		*/

		// 计算Ain
		dErr = 0;
// 		if ( m_dVpp > 0 )
// 		{
// 			dErr = 20*log10( m_dVpp / 2);
// 		}

		// 显示曲线、坐标
		/////////////////////////////////////////////////////////////////////////
		// 画笔
		CPen penCh1Signal( PS_SOLID, 1, m_crImageColor );
		pOldPen = m_dcPlot.SelectObject( &penCh1Signal );
		// 先进行修正(原来更新点数为m_dwDot,所以出现只更新前面数据,后面数据不更新的情况)
		// m_dwDot -> MAX_DEPTH
		for ( i = 0; i < MAX_DEPTH; i++ )
		{
			//m_FFTData[i] += dErr;
			m_daDispData[i] = m_FFTData[i] + dErr;
		}
		// 计算最大值/最小值(这段没有意义,实际的最大最小在下面指定)
		m_dMaxData = -10000;
		m_dMinData = 0;
		for ( i = 0; i < m_dwDot; i++ )
		{
			if ( m_nBeginPos+i >= 0 && m_nBeginPos+i < MAX_DEPTH/2 )
			{
				if ( m_daDispData[m_nBeginPos+i] > m_dMaxData )
				{
					m_dMaxData = m_daDispData[m_nBeginPos+i];
				}
				if ( m_daDispData[m_nBeginPos+i] < m_dMinData )
				{
					m_dMinData = m_daDispData[m_nBeginPos+i];
				}
			}
			
		}
		// 最大值为0dB
		m_dMaxData = 0;
		// 最小值为-120dB -> -160
		m_dMinData = -160;
		// 每像素的点数
		double dPointXpixel = (nPicWidth - 0.0) / m_dwDot;
		double dPointYpixel = (nPicHeight - 0.0 ) / (m_dMaxData-m_dMinData);		

		
		// 画笔
		CPen penAxi( PS_DOT, 1, RGB(128, 128, 128));		
		pOldPen = m_dcPlot.SelectObject( &penAxi );
		
		// 画坐标
		double dData;
		int nCount;
		for ( i = 0; i < m_dwDot; i++ )
		{			
			dData = (m_nBeginPos+i)*m_dOrgSampFreq/MAX_DEPTH;
			// 先找到开始的大小
			if ( i == 0 )
			{
				nCount = dData / m_dGap;//  + 1
			}
			if ( dData >= nCount * m_dGap )
			{
				// 画坐标线
				x = FFT_LEFT_MARGIN + (int)(i*dPointXpixel);			
				y = FFT_TOP_MARGIN;					
				m_dcPlot.MoveTo( x, y );
				x = FFT_LEFT_MARGIN + (int)(i*dPointXpixel);			
				y = FFT_TOP_MARGIN + nPicHeight;					
				m_dcPlot.LineTo( x, y );	
				// 找到第一个后更新计数的大小
				nCount++;
			}
		}
		if ( pOldPen != NULL )
		{
			m_dcPlot.SelectObject( pOldPen );
		}
		CPen penSideAxi( PS_SOLID, 1, RGB(128, 128, 128));	
		pOldPen = m_dcPlot.SelectObject( &penSideAxi );
		// 开始和最后的两根线
		x = FFT_LEFT_MARGIN;			
		y = FFT_TOP_MARGIN;					
		m_dcPlot.MoveTo( x, y );
		x = FFT_LEFT_MARGIN;			
		y = FFT_TOP_MARGIN + nPicHeight;					
		m_dcPlot.LineTo( x, y );
		x = FFT_LEFT_MARGIN + nPicWidth;			
		y = FFT_TOP_MARGIN;					
		m_dcPlot.MoveTo( x, y );
		x = FFT_LEFT_MARGIN + nPicWidth;			
		y = FFT_TOP_MARGIN + nPicHeight;					
		m_dcPlot.LineTo( x, y );
		// 恢复现场		
		if ( pOldPen != NULL )
		{
			m_dcPlot.SelectObject( pOldPen );
		}
		penAxi.DeleteObject();
		penSideAxi.DeleteObject();

		// 显示曲线
		m_bFirstVaule = TRUE;		
		for ( i = 0; i < m_dwDot; i++ )
		{
			// 先移动到第一个有效的点
			if ( m_bFirstVaule && m_nBeginPos+i >= 0 && m_nBeginPos+i < MAX_DEPTH )
			{
				m_bFirstVaule = FALSE;
				m_dcPlot.MoveTo( FFT_LEFT_MARGIN + (int)(i*dPointXpixel), 
					FFT_TOP_MARGIN + nPicHeight - (int)((m_daDispData[m_nBeginPos+i] - m_dMinData)*dPointYpixel) );	
			}
			// 画线
			if ( m_nBeginPos+i >= 0 && m_nBeginPos+i < MAX_DEPTH )
			{
				x = FFT_LEFT_MARGIN + (int)(i*dPointXpixel);			
				y = FFT_TOP_MARGIN + nPicHeight - (int)((m_daDispData[m_nBeginPos+i] - m_dMinData)*dPointYpixel);					
				m_dcPlot.LineTo( x, y );
			}			
		}				
		m_dcPlot.SelectObject( pOldPen );
		penCh1Signal.DeleteObject();
		
		// 擦除多余部分
		CRect rcFill( 0, FFT_TOP_MARGIN + FFT_NUM_VERT * nSigPicSmallHeight,
			m_nClientWidth, m_nClientHeight );
		m_dcPlot.FillRect( rcFill, &m_brushBack );
		/////////////////////////////////////////////////////////////////////////////

		// 显示坐标值
		///////////////////////////////////////////////////////////////////////////
		// 字体
		m_dcPlot.SetTextColor( RGB(128, 128, 128) );		
		pOldFont = m_dcPlot.SelectObject( &m_fntScale );
		// 坐标值
		for ( i = 0; i < m_dwDot; i++ )
		{			
			dData = (m_nBeginPos+i)*m_dOrgSampFreq/MAX_DEPTH;
			// 先找到开始的大小
			if ( i == 0 )
			{
				if ( dData > 0 )
				{
					nCount = dData / m_dGap + 1;
				}
				else
				{
					nCount = dData / m_dGap;
				}
			}
			if ( dData >= nCount * m_dGap )			
			{				
				// 刻度值
				//strMsg.Format( "%d", m_nBeginPos+i );
				//strMsg.Format( "%.2f", (m_nBeginPos+i)*m_dOrgSampFreq/MAX_DEPTH );
				strMsg.Format( "%.2f", nCount * m_dGap - m_dOrgSampFreq / 2 );
				szText = m_dcPlot.GetTextExtent( strMsg );
				x = FFT_LEFT_MARGIN + (int)(i*dPointXpixel) - szText.cx / 2;
				y = FFT_TOP_MARGIN + nPicHeight + 2;
				m_dcPlot.TextOut( x, y, strMsg );
				nCount++;
			}
		}
		// 显示单位
		strMsg = "(MHz)";
		szText = m_dcPlot.GetTextExtent( strMsg );
		x = FFT_LEFT_MARGIN + nPicWidth/2 - szText.cx / 2;
		y = FFT_TOP_MARGIN + nPicHeight + szText.cy;
		m_dcPlot.TextOut( x, y, strMsg );
		if ( pOldFont != NULL )
		{			
			m_dcPlot.SelectObject( pOldFont );
		}
		//////////////////////////////////////////////////////////////////////////

		//////////////////////////////////////////////////////////////////////////
		// 画标记
#define MARK_NUM 6
#define MINGAP 200
		double dMaxData;
		int nPos;
		int naPos[MARK_NUM];		
		
		int t;
		bool bMax = FALSE;

		for ( i = 0; i < MARK_NUM; i++ )
		{
			naPos[i] = -1;
		}
		// 查找5个最大值
		for ( i = 0; i < MARK_NUM; i++ )
		{
			dMaxData = -10000;
			//j>0, ignore DC
			for ( j = 1; j < MAX_DEPTH; j++ )
			{
				
// 				if ( j != naPos[0] && j != naPos[1] && j != naPos[2] 
// 					&& j != naPos[3] && j != naPos[4] && m_daDispData[j] > dMaxData 
// 					&& abs(j-naPos[0])>MINGAP && abs(j-naPos[1])>MINGAP && abs(j-naPos[2])>MINGAP 
// 					&& abs(j-naPos[3])>MINGAP && abs(j-naPos[4])>MINGAP)
// 				{
// 					dMaxData = m_daDispData[j];
// 					nPos = j;
// 				}

				if ( m_daDispData[j] > dMaxData)
				{
					bMax = TRUE;
					for (t=0; t<i; ++t)
					{
						if (j==naPos[t] || abs(j-naPos[t])<MINGAP)
						{
							bMax = FALSE;
						}
					}
					if (bMax)
					{
						dMaxData = m_daDispData[j];
						nPos = j;
					}
				}
			}
			for (t=i; t<MARK_NUM; ++t)
			{
				naPos[t] = nPos;
			}
			//TRACE( "pos = %d, data = %f\n", naPos[i], m_daDispData[ naPos[i] ] );
		}

		pOldFont = m_dcPlot.SelectObject( &m_fntTitle );
		m_dcPlot.SetTextColor( RGB(0,255,255) );		

		// 画标记
		CString strMax;
		for ( i = 0; i < MARK_NUM; i++ )
		{
			// 在当前显示的点数范围内才显示
			if ( naPos[i] - m_nBeginPos < m_dwDot )
			{
				x = FFT_LEFT_MARGIN + (int)( (naPos[i]-m_nBeginPos) * dPointXpixel );			
				y = FFT_TOP_MARGIN + nPicHeight - (int)((m_daDispData[ naPos[i] ] - m_dMinData)*dPointYpixel); 
				DrawMark( x, y, 'x', RGB(0,255,255) );
				strMax.Format( "(%.2f,%.2f)", naPos[i]*m_dOrgSampFreq/MAX_DEPTH, 
					m_daDispData[ naPos[i] ] );
				m_dcPlot.TextOut(x+3, y-3, strMax );
			}			
		}
		////////////////////////////////////////////////////////////////////////

		// 显示参数
		////////////////////////////////////////////////////////////////////////
		
		if ( m_dVpp > 0 && m_bShowParam )
		{
			// 查找最长的,左边对齐
			strMsg.Format( "SFDR = %2.2fdB", m_dSFDR );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			int nLen = szText.cx;

			// Ain(峰峰值最大为2V)
			dErr = 20*log10( m_dVpp / 2);
			strMsg.Format( "AIN  = %.2fdB", dErr );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			x = m_nClientWidth - FFT_LEFT_MARGIN - nLen;
			y = FFT_TOP_MARGIN + 2;		
			m_dcPlot.TextOut( x, y, strMsg );

			// SNR
			strMsg.Format( "SNR  = %.2fdB", m_dSNR );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			x = m_nClientWidth - FFT_LEFT_MARGIN - nLen;
			y = FFT_TOP_MARGIN + 2 + szText.cy;		
			m_dcPlot.TextOut( x, y, strMsg );

			// SFDR
			strMsg.Format( "SFDR = %.2fdB", m_dSFDR );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			x = m_nClientWidth - FFT_LEFT_MARGIN - nLen;
			y = FFT_TOP_MARGIN + 2 + szText.cy*2;		
			m_dcPlot.TextOut( x, y, strMsg );

			// SINAD
			strMsg.Format( "SINAD = %.2fdB", m_dSINAD );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			x = m_nClientWidth - FFT_LEFT_MARGIN - nLen;
			y = FFT_TOP_MARGIN + 2 + szText.cy*3;		
			m_dcPlot.TextOut( x, y, strMsg );

			// ENOB
			strMsg.Format( "ENOB = %.2f", m_dENOB );
			szText = m_dcPlot.GetTextExtent( strMsg );		
			x = m_nClientWidth - FFT_LEFT_MARGIN - nLen;
			y = FFT_TOP_MARGIN + 2 + szText.cy*4;		
			m_dcPlot.TextOut( x, y, strMsg );
		}
		if ( pOldFont != NULL )
		{			
			m_dcPlot.SelectObject( pOldFont );
		}
		//////////////////////////////////////////////////////////////////////////
		
		//////////////////////////////////////////////////////////////////
		// 在顶部显示五个最大值
		CString straValue[MARK_NUM];
		DWORD dwMarkWidth;

		dwMarkWidth = 0;
		for ( i = 0; i < MARK_NUM; i++ )
		{
			// 安全检查
			if ( naPos[i] > 0 )
			{
				straValue[i].Format( "(%.2f,%.2f)", naPos[i]*m_dOrgSampFreq/MAX_DEPTH, 
					m_daDispData[ naPos[i] ] );
			}			
			szText = m_dcPlot.GetTextExtent( straValue[i] );
			dwMarkWidth += szText.cx;
		}

		pOldFont = m_dcPlot.SelectObject( &m_fntTitle );
		m_dcPlot.SetTextColor( RGB(0,255,255) );
		// 视图足够宽时显示5个值
		if ( dwMarkWidth < nPicWidth )
		{
			x = (nPicWidth-dwMarkWidth)/2;
			y = 0;
			szText.cx = 0;
			for ( i = 0; i < MARK_NUM; i++ )
			{
				if ( i > 0 )
				{
					szText = m_dcPlot.GetTextExtent( straValue[i-1] );
				}
				x += szText.cx;
				m_dcPlot.TextOut( x, y, straValue[i] );
			}
		}
		if ( pOldFont != NULL )
		{			
			m_dcPlot.SelectObject( pOldFont );
		}
		///////////////////////////////////////////////////////////////////////////

		///////////////////////////////////////////////////////////////////////////
		// 鼠标移动显示坐标值
		if ( m_ptMove.x >= FFT_LEFT_MARGIN && m_ptMove.x <= FFT_LEFT_MARGIN + nPicWidth
			&& m_ptMove.y >= FFT_TOP_MARGIN && m_ptMove.y <= FFT_TOP_MARGIN + nPicHeight )
		{
			CString strValue;
			int nPos;
			nPos = (m_ptMove.x - FFT_LEFT_MARGIN)*m_dwDot/nPicWidth + m_nBeginPos;
			if ( nPos >= 0 && nPos < MAX_DEPTH / 2 )
			{
				// 显示鼠标点的坐标
				//strValue.Format( "(%.2f , %.2f)", nPos * m_dOrgSampFreq / MAX_DEPTH,	
				//	-(m_ptMove.y - FFT_TOP_MARGIN) / dPointYpixel  );

				// 显示曲线上的点频率和幅度
				strValue.Format( "(%.2f , %.2f)", nPos * m_dOrgSampFreq / MAX_DEPTH,	
					m_daDispData[nPos]  );
				// 字体
				pOldFont = m_dcPlot.SelectObject( &m_fntTitle );
				m_dcPlot.SetTextColor( RGB(0,255,255) );
				// 显示的区域
				szText = m_dcPlot.GetTextExtent( strValue );
				if ( m_ptMove.x + szText.cx <= FFT_LEFT_MARGIN + nPicWidth
					&& m_ptMove.y >= FFT_TOP_MARGIN )
				{
					m_dcPlot.TextOut( m_ptMove.x, m_ptMove.y - szText.cy, strValue );
				}
			}			
		}
		//////////////////////////////////////////////////////////////////////////////
		
		Invalidate();
	}

	
}