⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mticalibratedlg.cpp

📁 这是一个手机校准程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    {
    ((CButton *)GetDlgItem(IDC_CONEXANT_PAC_CAL))->SetCheck(0);
    ((CButton *)GetDlgItem(IDC_INFINEON_PAC_CAL))->SetCheck(0);
    }

// initialize filename edit controls
  string=get_parameter_template_filename();
  m_ParamTemplateFilename=string;
  index=string.ReverseFind('\\');
  right_length=string.GetLength()-index-1;
  title=string.Right(right_length);
  ((CEdit *)GetDlgItem(IDC_PARAM_TEMPLATE_EDIT))->SetWindowText(title);
  
  string=get_output_filename();
  m_OutputFilename=string;
  index=string.ReverseFind('\\');
  right_length=string.GetLength()-index-1;
  title=string.Right(right_length);
  ((CEdit *)GetDlgItem(IDC_OUTPUT_EDIT))->SetWindowText(title);
  
// set focus on Start button
  ((CButton *)GetDlgItem(IDC_RUN_START))->SetFocus();
	  CAL_Init() ;								// MODIFIED MFC FUNCTION

  return FALSE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMTIcalibrateDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMTIcalibrateDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

	/////////////////////////////////////////////////////////////////////
	//                       END OF MFC GENERATED CODE
	/////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------
//
//	OnRunAbort
//
//		This function called to handle the Run/Abort command.  It sets the
//		'abort' flag true.  The calibration thread must frequenly check
//		the status of the abort flag (using the UI_IsAbort() API function) and
//		terminate when true.  
//
//		An alternate approach would be for OnRunAbort() to terminate the 
//		calibration thread.
//
//-----------------------------------------------------------------------------

void CMTIcalibrateDlg::OnRunAbort() 
  {
  m_IsAbort=1;
  return;
  }

void CMTIcalibrateDlg::OnOK() 
  {
  return;
  }


//-----------------------------------------------------------------------------
//
//	CalThreadEntryFct
//
//		This is the entry function of the calibration thread.  
//		The thread is created using AfxBeginThread ().  The entry function
//		must have the format UINT entryFunction (LPVOID params) and must
//		be C++ callable.  This function in turn calls the highest-level
//		C function in the calibration thread. 
//
//		This function ins NOT a member of the CMTIcalibrateDlg class.
//
//-----------------------------------------------------------------------------

UINT CalThreadEntryFct( LPVOID pParam )
{
	CAL_Exec ( ) ;

	return 0 ;
}

//-----------------------------------------------------------------------------
//
//	OnRunStart
//
//		This function called to handle the Run/Start command.  The 'abort' flag
//		is reset and the calibration thread is created.
//
//-----------------------------------------------------------------------------

void CMTIcalibrateDlg::OnRunStart() 
  {
  CString CSFilename;

  m_IsAbort = 0 ;

// check that filenames have been entered
  ((CEdit *)GetDlgItem(IDC_PARAM_TEMPLATE_EDIT))->GetWindowText(CSFilename);
  if(m_ParamTemplateFilename.IsEmpty() && CSFilename.IsEmpty())
    {
    MessageBox("Need a parameter template filename.");
    return;
    }

  ((CEdit *)GetDlgItem(IDC_OUTPUT_EDIT))->GetWindowText(CSFilename);
//  m_OutputFilename=CSFilename;
  if(m_OutputFilename.IsEmpty() && CSFilename.IsEmpty())
    {
    MessageBox("Need an output filename.");
    return;
    }

// check that filenames have been copied from edit box if browse not used,
// or that the contents of the edit control has been modified
  if(m_ParamTemplateFilename.IsEmpty() || ((CEdit *)GetDlgItem(IDC_PARAM_TEMPLATE_EDIT))->GetModify())
    {
    ((CEdit *)GetDlgItem(IDC_PARAM_TEMPLATE_EDIT))->GetWindowText(CSFilename);
    m_ParamTemplateFilename=CSFilename;
    }
  save_parameter_template_in_registry(m_ParamTemplateFilename);

  if(m_OutputFilename.IsEmpty() || ((CEdit *)GetDlgItem(IDC_OUTPUT_EDIT))->GetModify())
    {
    ((CEdit *)GetDlgItem(IDC_OUTPUT_EDIT))->GetWindowText(CSFilename);
    m_OutputFilename=CSFilename;
    }
  save_output_filename_in_registry(m_OutputFilename);

// check the instrument type
  if(((CButton *)GetDlgItem(IDC_HP8922))->GetCheck())
    {
    m_TesterType=HP8922;
    }
  else if(((CButton *)GetDlgItem(IDC_HP8960))->GetCheck())
    {
    m_TesterType=AGT8960;
    }
  else 
    {
    m_TesterType=CM200;
    }

// check the chipset type
  if(((CButton *)GetDlgItem(IDC_CONEXANT_PAC_CAL))->GetCheck())
    {
    m_PACCalType=CONEXANT;
    }
  else if(((CButton *)GetDlgItem(IDC_INFINEON_PAC_CAL))->GetCheck())
    {
    m_PACCalType=INFINEON;
    }
  else
    {
    }

  theThread = AfxBeginThread ( CalThreadEntryFct, 0, 
			                  THREAD_PRIORITY_NORMAL, 16384, 0, NULL );
  }

//-----------------------------------------------------------------------------
//
//	OnSetupParams
//
//		This function called to handle the Setup/Params command.  The Setup
//		Parameters modal dialog is presented.  If the dialog returns OK status
//		then ...
//
//-----------------------------------------------------------------------------

void CMTIcalibrateDlg::OnSetupParams() 
{

/*
	CParamsDlg paramsDlg ;

	m_ParamList.CopyToShadow ( ) ;

	if ( IDOK==paramsDlg.DoModal ( ) ) {
		m_ParamList.CopyFromShadow ( ) ;
		m_ParamList.SaveToRegistry ( ) ;
*/
  

  CParameterPropertySheet dlg;
  
  dlg.DoModal();
  
/*
  }
*/
}


//-----------------------------------------------------------------------------
//
//	OnHelpAbout
//
//		This function called to handle the Help/About command.  
//
//-----------------------------------------------------------------------------

void CMTIcalibrateDlg::OnHelp() 
{
//	CAboutDlg dlg ;
//	dlg.DoModal ( ) ;
theApp.WinHelp((DWORD) "Main Window",HELP_KEY);
}

void CMTIcalibrateDlg::OnAbout() 
{
	CAboutDlg dlg ;
	dlg.DoModal ( ) ;
}

//-----------------------------------------------------------------------------
//	                            FRIEND FUNCTIONS
//
//	These are 'friends' of class CMTIcalibrateDlg.  They are not members of the
//	class but have access to all class members. They are used by the UI
//	(User Interface) API to access elements of the one-and-only instance of the
//	CMTIcalibrateDlg dialog box.  They are NOT callable from "C".
//
//-----------------------------------------------------------------------------


CString UIF_GetFileName ( void )			// return filename string
{
	return theDialog->m_FileName ;
}

long UIF_IsAbort ( void )					// return status of abort flag
{
	return theDialog->m_IsAbort ;
}

/*
CParamList* UIF_GetParamList ( void )		// return pointer to parameters list
{
	return &theDialog->m_ParamList ;
}
*/
CMTIcalibrateDlg* UIF_GetMainDlg ( void ) 
{
	return theDialog ;
}

CString UIF_GetParamTemplateFilename(void)
  {
  return theDialog->m_ParamTemplateFilename;
  }

CString UIF_GetOutputFilename(void)
  {
  return theDialog->m_OutputFilename;
  }

void UIF_SetStatusBarText(char *text)
  {
  theDialog->status_bar.SetWindowText(text);
  return;
  }

TesterType_t UIF_GetTesterType(void)
  {
  return theDialog->m_TesterType;
  }

PACCalType_t UIF_GetPACCalType(void)
  {
  return theDialog->m_PACCalType;
  }

void UIF_ClearAbort(void)
  {
  theDialog->m_IsAbort=0;
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -