// ShapingPage.cpp : implementation file // #include "stdafx.h" #include "afxpriv.h" // afxpriv.h has WM_COMMANDHELP id //#include "CDP5Cfg.h" #include "ShapingPageRes.h" #include "ShapingPage.h" #include ".\ShapingPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CShapingPage property page //#define IDD_SHAPING_PAGE 107 IMPLEMENT_DYNCREATE(CShapingPage, CCfgPropPage) //CShapingPage::CShapingPage() : CCfgPropPage(CShapingPage::IDD) CShapingPage::CShapingPage() : CCfgPropPage("IDD_SHAPING_PAGE") { //{{AFX_DATA_INIT(CShapingPage) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } CShapingPage::~CShapingPage() { } void CShapingPage::DoDataExchange(CDataExchange* pDX) { CCfgPropPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CShapingPage) //}}AFX_DATA_MAP DDX_Control(pDX, IDC_STATIC_SHAPING_PAGE, m_ShapingPageLabel); DDX_Control(pDX, IDC_RISECOMBO, m_RiseCombo); DDX_Control(pDX, IDC_TOPCOMBO, m_TopCombo); DDX_Control(pDX, IDC_OPT_COMBO_TPFA, m_FastPeakCombo); DDX_Control(pDX, IDC_STATIC_FPGACLK1, lblFPGAClk[0]); // current clock value DDX_Control(pDX, IDC_STATIC_FPGACLK2, lblFPGAClk[1]); // hw reload message DDX_Control(pDX, IDC_STATIC_FPGACLK3, lblFPGAClk[2]); // file reload message DDX_Control(pDX, IDC_STATIC_SHAPING_ADVANCED, m_ShapingAdvancedLabel); DDX_Control(pDX, IDC_STATIC_SHAPING_STANDARD, m_ShapingStandardLabel); } BEGIN_MESSAGE_MAP(CShapingPage, CCfgPropPage) ON_CBN_SELCHANGE(IDC_RISECOMBO, OnCbnSelchangeRisecombo) ON_CBN_SELCHANGE(IDC_TOPCOMBO, OnCbnSelchangeTopcombo) //{{AFX_MSG_MAP(CShapingPage) //}}AFX_MSG_MAP ON_EN_CHANGE(IDC_OPT_TEXT_TFLA, OnEnChangeOptTextTfla) ON_EN_CHANGE(IDC_OPT_TEXT_THFA, OnEnChangeOptTextThfa) ON_CBN_SELCHANGE(IDC_OPT_COMBO_PURE, OnCbnSelchangeOptComboPure) ON_EN_CHANGE(IDC_OPT_TEXT_PURE, OnEnChangeOptTextPure) ON_CBN_SELCHANGE(IDC_OPT_COMBO_SCTC, OnCbnSelchangeOptComboSctc) ON_EN_CHANGE(IDC_OPT_TEXT_SCTC, OnEnChangeOptTextSctc) ON_EN_CHANGE(IDC_OPT_TEXT_TPEA, OnEnChangeOptTextTpea) ON_CBN_SELCHANGE(IDC_OPT_COMBO_RTDE, OnCbnSelchangeOptComboRtde) ON_CBN_SELCHANGE(IDC_OPT_COMBO_CUSP, OnCbnSelchangeOptComboCusp) ON_EN_CHANGE(IDC_OPT_TEXT_RTDS, OnEnChangeOptTextRtds) ON_EN_CHANGE(IDC_OPT_TEXT_RTDT, OnEnChangeOptTextRtdt) ON_EN_CHANGE(IDC_OPT_TEXT_BLRD, OnEnChangeOptTextBlrd) ON_EN_CHANGE(IDC_OPT_TEXT_BLRU, OnEnChangeOptTextBlru) ON_CBN_SELCHANGE(IDC_OPT_COMBO_BLRM, OnCbnSelchangeOptComboBlrm) ON_EN_CHANGE(IDC_OPT_TEXT_CUSP, OnEnChangeOptTextCusp) ON_CBN_SELCHANGE(IDC_OPT_COMBO_CLCK, OnCbnSelchangeOptComboClck) ON_CBN_SELCHANGE(IDC_OPT_COMBO_TPFA, OnCbnSelchangeOptComboTpfa) // this function replaces blr quickset 20110504 ON_BN_CLICKED(IDC_BLRQUICKSLOWBUTTON, OnBnClickedBlrquickslowbutton2) ON_COMMAND(ID_HELP, OnHelp) ON_WM_HELPINFO() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CShapingPage message handlers BOOL CShapingPage::OnSetActive() { // TODO: Add your specialized code here and/or call the base class if (s.ReloadCfg) { InitControls(); } return CCfgPropPage::OnSetActive(); } BOOL CShapingPage::OnInitDialog() { CCfgPropPage::OnInitDialog(); BuildToolTips(); m_ShapingPageLabel .SetFontName("Arial") .SetFontSize(24) .SetTextColor(RGB(0,0,255)) .SetBkColor(RGB(244, 243, 238)) .SetFontItalic(TRUE) .SetFontBold(TRUE); m_ShapingAdvancedLabel .SetFontName("Arial") .SetFontSize(18) .SetTextColor(RGB(0, 70, 213)) .SetBkColor(RGB(247, 247, 246)) .SetFontItalic(TRUE) .SetFontBold(FALSE); m_ShapingStandardLabel .SetFontName("Arial") .SetFontSize(18) .SetTextColor(RGB(0, 70, 213)) .SetBkColor(RGB(252, 252, 253)) .SetFontItalic(TRUE) .SetFontBold(FALSE); lblFPGAClk[0] .SetFontName("Arial") .SetFontSize(14) .SetTextColor(colorLightSlateGray) .SetBkColor(colorLightSteelBlue) .SetFontBold(TRUE); // display clock value lblFPGAClk[1] .SetTextColor(colorRed); // hw restart lblFPGAClk[2] .SetTextColor(colorBlue); // file restart InitControls(); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } //dciTFLA TFLA 0 IDC_OPT_TEXT_TFLA dctTxt dcgShaping Flat Top uS //dciTHFA THFA 0 IDC_OPT_TEXT_THFA dctTxt dcgShaping Fast Threshold //dciTPFA TPFA IDC_OPT_COMBO_TPFA 0, dctCbo, dcgShaping, Fast Peaking Time //dciPURE PURE IDC_OPT_COMBO_PURE 0 dctCbo dcgShaping PUR Interval On/Off //dciTPEA TPEA 0 IDC_OPT_TEXT_TPEA dctTxt dcgShaping Peaking Time uS //dciRTDS RTDS 0 IDC_OPT_TEXT_RTDS dctTxt dcgShaping RTD Sensitivity % //dciRTDE RTDE IDC_OPT_COMBO_RTDE 0 dctCbo dcgShaping RTD On/Off //dciRTDT RTDT 0 IDC_OPT_TEXT_RTDT dctTxt dcgShaping RTD Threshold % //dciBLRD BLRD 0 IDC_OPT_TEXT_BLRD dctTxt dcgShaping BLR Down Correction //dciBLRU BLRU 0 IDC_OPT_TEXT_BLRU dctTxt dcgShaping BLR Up Correction //dciBLRM BLRM IDC_OPT_COMBO_BLRM 0 dctCbo dcgShaping BLR Mode //dciCUSP CUSP IDC_OPT_COMBO_CUSP IDC_OPT_TEXT_CUSP dctCboTxt dcgShaping Non-Trapezoidal Shaping % //dciCLCK CLCK IDC_OPT_COMBO_CLCK 0 dctCbo dcgBootOpt 20MHz/80MHz void CShapingPage::InitControls() { HWND hPage = this->GetSafeHwnd(); BOOL bClockEnable; // enable FPGA clock for current device BOOL bIsDPG; bIsDPG =((s.profile->device_type == dppDP5G) || (s.profile->device_type == dppTB5)); bClockEnable = (s.profile->device_type != dppDP5G) && (s.profile->device_type != dppTB5); if (bIsDPG){ if (s.DP5Stat.m_DP5_Status.bScintHas80MHzOption) { // FW6.06.07 or above with ECO enabled bClockEnable = TRUE; // dp5g/tb5 ECO supports 80mhz clock // Allow the software to set the clock cfg value // s.DppConfig.b80MHzModeCfg = TRUE; // sets 80MHz values for controls } else { s.DppConfig.b80MHzModeCfg = FALSE; // old dp5g (or no ECO) does not support 80mhz clock } } GetDlgItem(IDC_OPT_COMBO_CLCK)->EnableWindow(bClockEnable); if (bIsDPG) { GetDlgItem(IDC_OPT_FRAME_SCTC)->ShowWindow(SW_SHOW); GetDlgItem(IDC_OPT_COMBO_SCTC)->ShowWindow(SW_SHOW); GetDlgItem(IDC_OPT_LIMITS_SCTC)->ShowWindow(SW_SHOW); GetDlgItem(IDC_OPT_TEXT_SCTC)->ShowWindow(SW_SHOW); GetDlgItem(IDC_OPT_UNITS_SCTC)->ShowWindow(SW_SHOW); } else { GetDlgItem(IDC_OPT_FRAME_SCTC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_COMBO_SCTC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_LIMITS_SCTC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_TEXT_SCTC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_OPT_UNITS_SCTC)->ShowWindow(SW_HIDE); } InitFastPeakCombo(); //TPFA values are b80MHzModeCfg dependent 20100930 InitBlrMode(); //BLR Mode 3 added for DP5-X 20170120 InitDlgItem(hPage,s.m_DP5Cfg[dciTFLA]); InitDlgItem(hPage,s.m_DP5Cfg[dciTHFA]); // 20100930 InitDlgItem(hPage,s.m_DP5Cfg[dciTPFA]); if (s.profile->device_type != dppMCA8000D) { InitDlgItem(hPage,s.m_DP5Cfg[dciPURE]); } if (bIsDPG){ InitDlgItem(hPage,s.m_DP5Cfg[dciSCTC]); } InitDlgItem(hPage,s.m_DP5Cfg[dciTPEA]); InitDlgItem(hPage,s.m_DP5Cfg[dciRTDS]); InitDlgItem(hPage,s.m_DP5Cfg[dciRTDE]); InitDlgItem(hPage,s.m_DP5Cfg[dciRTDT]); InitDlgItem(hPage,s.m_DP5Cfg[dciBLRD]); InitDlgItem(hPage,s.m_DP5Cfg[dciBLRU]); InitDlgItem(hPage,s.m_DP5Cfg[dciBLRM]); InitDlgItem(hPage,s.m_DP5Cfg[dciCUSP]); //InitDlgItem(hPage,s.m_DP5Cfg[dciPURE]); InitDlgItem(hPage,s.m_DP5Cfg[dciCLCK]); if (s.profile->device_type != dppMCA8000D) { CboUpdate(dciPURE); } if (bIsDPG) { CboUpdate(dciSCTC); } CboUpdate(dciRTDE); CboUpdate(dciTPFA); CboUpdate(dciBLRM); DisplayBlrMode(); CboUpdate(dciCUSP); //CboUpdate(dciPURE); CboUpdate(dciCLCK); RiseTop.Set80MHzMode(s.DppConfig.b80MHzModeCfg); RiseTop.Shaping_Setup(&m_RiseCombo,&m_TopCombo); //Shaping_Setup(); InitComboFromText(hPage,s.m_DP5Cfg[dciTPEA],IDC_RISECOMBO); RiseTop.SetRiseCombo(); InitComboFromText(hPage,s.m_DP5Cfg[dciTFLA],IDC_TOPCOMBO); RiseTop.SetTopCombo(); if (s.DppConfig.b80MHzModeCfg) { lblFPGAClk[0].SetText("80MHz"); b80MHzModeCfg_old = TRUE; } else { lblFPGAClk[0].SetText("20MHz"); b80MHzModeCfg_old = FALSE; } lblFPGAClk[1].ShowWindow(SW_HIDE); lblFPGAClk[2].ShowWindow(SW_HIDE); // Update THFA (FW6.07.05 and later) // Select Threshold for Fast Channel for higher range if (((s.DppConfig.Firmware == 0x67) && (s.DppConfig.Build >= 5)) || (s.DppConfig.Firmware > 0x67)) { // update the range label GetDlgItem(IDC_OPT_LIMITS_THFA)->SetWindowText("0 to 511.93"); } //if (s.profile->device_type == dppMCA8000D) { // ShowMCA8000D_Controls(SW_HIDE); //} else { // ShowMCA8000D_Controls(SW_SHOW); //} //InitComboFromText(hPage,s.m_DP5Cfg[dciTFLA],IDC_RISECOMBO); } void CShapingPage::ShowMCA8000D_Controls(int iShowWin) { GetDlgItem(IDC_OPT_COMBO_BLRM)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_CLCK)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_CUSP)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_PURE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_SCTC)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_RTDE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_COMBO_TPFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_BLRD)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_BLRM)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_BLRU)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_CLCK)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_CUSP)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_PURE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_SCTC)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_RTDE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_RTDS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_RTDT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_TFLA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_THFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_TPEA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_FRAME_TPFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_BLRD)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_BLRU)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_CUSP)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_PURE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_SCTC)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_RTDS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_RTDT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_TFLA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_THFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_LIMITS_TPEA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_BLRD)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_BLRU)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_CUSP)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_PURE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_SCTC)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_RTDS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_RTDT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_TFLA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_THFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_TEXT_TPEA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_BLRD)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_BLRU)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_CUSP)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_PURE)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_SCTC)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_RESL2)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_RESL3)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_RTDS)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_RTDT)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_TFLA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_THFA)->ShowWindow(iShowWin); GetDlgItem(IDC_OPT_UNITS_TPEA)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_RTD_FRAME)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_BLR_FRAME)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_FAST_SHAPING_FRAME)->ShowWindow(iShowWin); GetDlgItem(IDC_BLRQUICKSLOWBUTTON)->ShowWindow(iShowWin); GetDlgItem(IDC_TIMETOPEAKSTATIC)->ShowWindow(iShowWin); GetDlgItem(IDC_FLATTOPSTATIC)->ShowWindow(iShowWin); GetDlgItem(IDC_RISECOMBO)->ShowWindow(iShowWin); GetDlgItem(IDC_TOPCOMBO)->ShowWindow(iShowWin); GetDlgItem(IDC_LABEL_QUICK_PICK_SHAPING)->ShowWindow(iShowWin); GetDlgItem(IDC_LABEL_QUICK_PICK_SHAPING2)->ShowWindow(iShowWin); GetDlgItem(IDC_STATIC_FPGACLK1)->ShowWindow(iShowWin); GetDlgItem(IDC_SHAPINGGROUP)->ShowWindow(iShowWin); GetDlgItem(IDC_LABEL_BLR_MODE_OFF_ON)->ShowWindow(iShowWin); } void CShapingPage::InitFastPeakCombo() { m_FastPeakCombo.ResetContent(); if (s.DppConfig.b80MHzModeCfg) { m_FastPeakCombo.AddString("50"); m_FastPeakCombo.AddString("100"); m_FastPeakCombo.AddString("200"); m_FastPeakCombo.AddString("400"); m_FastPeakCombo.AddString("800"); m_FastPeakCombo.SetCurSel(1); } else { m_FastPeakCombo.AddString("200"); m_FastPeakCombo.AddString("400"); m_FastPeakCombo.AddString("800"); m_FastPeakCombo.AddString("1600"); m_FastPeakCombo.AddString("3200"); m_FastPeakCombo.SetCurSel(1); } } void CShapingPage::InitBlrMode() { CString strBLRM; CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_BLRM); pCombo->ResetContent(); pCombo->AddString("OFF"); pCombo->AddString("1"); if (s.profile->device_type == dppDP5X) { pCombo->AddString("3"); } pCombo->SetCurSel(0); } void CShapingPage::InitDlgItem(HWND hDlg, DP5_CONFIGURATION cfg) { int cboDP5CtrlID = cfg.ListCtrlID; int txtDP5CtrlID = cfg.TextCtrlID; CString strVal = cfg.Setting; int idxList; CString strUnits; CString strLimits; if ((cfg.CtrlType & dctCbo) > 0) { // try to find list index for any combo CComboBox &cb = *(CComboBox *) GetDlgItem(cboDP5CtrlID); //idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,strVal); idxList = s.CtrlUtil.FindCboIdxExact(hDlg,cboDP5CtrlID,strVal); // try exact first if (idxList == LB_ERR) { idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,strVal); } if (idxList == LB_ERR) { // if (idxList != LB_ERR) we already found the value if ((cfg.CtrlType & dctTxt) > 0) { // if cbotxt must find mask, else set to 0 cfg.TextValue = cfg.Setting; // overwrite if currently editing idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"#"); if (idxList == LB_ERR) { // mask begins with + idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"+"); } if (idxList == LB_ERR) { // mask begins with - idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"-"); } if (idxList == LB_ERR) { // not found default to 0 idxList = 0; } } else { idxList = 0; // set to first item } } cb.SetCurSel(idxList); } if ((cfg.CtrlType & dctTxt) > 0) { if ((cfg.CtrlType & dctCbo) == 0) { // cbo update above if (cfg.Setting.GetLength() > 0) { cfg.TextValue = cfg.Setting; } } GetDlgItem(txtDP5CtrlID)->SetWindowText(cfg.TextValue); strUnits = cfg.Units; strLimits = cfg.Limits; switch (txtDP5CtrlID) { case IDC_OPT_TEXT_TFLA: UNIT_INIT(TFLA, strUnits); LIMIT_INIT(TFLA, strLimits); break; case IDC_OPT_TEXT_THFA: UNIT_INIT(THFA, strUnits); LIMIT_INIT(THFA, strLimits); break; case IDC_OPT_TEXT_TPEA: UNIT_INIT(TPEA, strUnits); LIMIT_INIT(TPEA, strLimits); break; case IDC_OPT_TEXT_RTDS: UNIT_INIT(RTDS, strUnits); LIMIT_INIT(RTDS, strLimits); break; case IDC_OPT_TEXT_RTDT: UNIT_INIT(RTDT, strUnits); LIMIT_INIT(RTDT, strLimits); break; case IDC_OPT_TEXT_BLRD: UNIT_INIT(BLRD, strUnits); LIMIT_INIT(BLRD, strLimits); break; case IDC_OPT_TEXT_BLRU: UNIT_INIT(BLRU, strUnits); LIMIT_INIT(BLRU, strLimits); break; case IDC_OPT_TEXT_CUSP: UNIT_INIT(CUSP, strUnits); LIMIT_INIT(CUSP, strLimits); break; case IDC_OPT_TEXT_PURE: UNIT_INIT(PURE, strUnits); LIMIT_INIT(PURE, strLimits); break; case IDC_OPT_TEXT_SCTC: UNIT_INIT(SCTC, strUnits); LIMIT_INIT(SCTC, strLimits); break; } } } // pass dci id to update combo control and display edit controls if any void CShapingPage::CboUpdate(int nID_dci) { CString strCboText; int nID; int CmdShow; nID = s.m_DP5Cfg[nID_dci].ListCtrlID; if (nID == NULL) { return; } CComboBox &cb = *(CComboBox *) GetDlgItem(nID); int idx = cb.GetCurSel(); if (idx > LB_ERR) { cb.GetLBText(idx,strCboText); s.m_DP5Cfg[nID_dci].ComboIndex = idx; s.m_DP5Cfg[nID_dci].ComboValue = strCboText; } else { return; } if (s.m_DP5Cfg[nID_dci].CtrlType == dctCboTxt) { if (strCboText.Find('#') >= 0) { CmdShow = SW_SHOW; } else { CmdShow = SW_HIDE; } switch (nID) { case IDC_OPT_COMBO_CUSP: ALL_VIS(CUSP, CmdShow); CBO_TEXT_VIS(CUSP, (CmdShow!=0)); break; case IDC_OPT_COMBO_PURE: TEXT_VIS(PURE, CmdShow); UNIT_VIS(PURE, CmdShow); LIMIT_VIS(PURE, CmdShow); //ALL_VIS(PURE, CmdShow); // reserved word causes error in macro CBO_TEXT_VIS(PURE, (CmdShow!=0)); break; case IDC_OPT_COMBO_SCTC: TEXT_VIS(SCTC, CmdShow); UNIT_VIS(SCTC, CmdShow); LIMIT_VIS(SCTC, CmdShow); //ALL_VIS(SCTC, CmdShow); // reserved word causes error in macro CBO_TEXT_VIS(SCTC, (CmdShow!=0)); break; } } SetModified(TRUE); } //CBO_TEXT_VIS(RESL, (CmdShow!=0)); //CboTextVis(IDC_OPT_COMBO_RESL,IDC_OPT_TEXT_RESL,(CmdShow!=0)); //void CboTextVis(int nIdCbox, int nIdEdit, BOOL isText); void CShapingPage::CboTextVis(int nIdCbox, int nIdEdit, BOOL isText) { UINT ddSize; RECT lpRect; CEdit* pEdit; CComboBox* pCombo; int btnSize = 20; pEdit = (CEdit*)GetDlgItem(nIdEdit); // cast to edit for rect pEdit->GetRect(&lpRect); // get rect ddSize = lpRect.right - lpRect.left; // save width if (isText) { GetDlgItem(nIdEdit)->ShowWindow(SW_SHOW); pCombo = (CComboBox*)GetDlgItem(nIdCbox); pCombo->GetWindowRect(&lpRect); ScreenToClient(&lpRect); //int ddSize1 = lpRect.right - lpRect.left; // save width //TRACE("Combo Edit %d\r\n",ddSize1); lpRect.right = lpRect.left + btnSize; pCombo->MoveWindow(&lpRect,TRUE); pCombo->SetDroppedWidth(ddSize + btnSize); } else { GetDlgItem(nIdEdit)->ShowWindow(SW_HIDE); // hide edit //TRACE("Edit %d\r\n",ddSize); pCombo = (CComboBox*)GetDlgItem(nIdCbox); // cast to combo pCombo->GetWindowRect(&lpRect); // get win size ScreenToClient(&lpRect); // adjust to screen //int ddSize2 = lpRect.right - lpRect.left; // save width //TRACE("Combo %d\r\n",ddSize2); lpRect.right = lpRect.left + ddSize + btnSize; // get restored combo size pCombo->MoveWindow(&lpRect,TRUE); // restore combo pCombo->SetDroppedWidth(ddSize); // restore combo } } // pass dci id to update combo control and display edit controls if any void CShapingPage::TextUpdate(int nID_dci) { CString strText; int nID; nID = s.m_DP5Cfg[nID_dci].TextCtrlID; if (nID == NULL) { return; } GetDlgItem(nID)->GetWindowText(strText); s.m_DP5Cfg[nID_dci].TextValue = strText; SetModified(TRUE); } void CShapingPage::OnCbnSelchangeOptComboPure() { if (s.profile->device_type != dppMCA8000D) { CboUpdate(dciPURE); } } void CShapingPage::OnCbnSelchangeOptComboSctc() { BOOL bIsDPG =((s.profile->device_type == dppDP5G) || (s.profile->device_type == dppTB5)); if (bIsDPG) { CboUpdate(dciSCTC); } } void CShapingPage::OnCbnSelchangeOptComboRtde() { CboUpdate(dciRTDE); } void CShapingPage::OnCbnSelchangeOptComboBlrm() { CboUpdate(dciBLRM); DisplayBlrMode(); } void CShapingPage::DisplayBlrMode() { CString strBLRM; CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_BLRM); pCombo->GetWindowText(strBLRM); strBLRM = strBLRM.Left(2); if (strBLRM == "OF") { GetDlgItem(IDC_LABEL_BLR_MODE_OFF_ON)->SetWindowText(_T("BLR OFF")); } else { GetDlgItem(IDC_LABEL_BLR_MODE_OFF_ON)->SetWindowText(_T("BLR ON")); } } void CShapingPage::OnCbnSelchangeOptComboCusp() { CboUpdate(dciCUSP); } void CShapingPage::OnEnChangeOptTextPure() { if (s.profile->device_type != dppMCA8000D) { TextUpdate(dciPURE); } } void CShapingPage::OnEnChangeOptTextSctc() { BOOL bIsDPG =((s.profile->device_type == dppDP5G) || (s.profile->device_type == dppTB5)); if (bIsDPG) { TextUpdate(dciSCTC); } } void CShapingPage::OnCbnSelchangeOptComboTpfa() { CboUpdate(dciTPFA); } void CShapingPage::OnEnChangeOptTextTfla() { TextUpdate(dciTFLA); } void CShapingPage::OnEnChangeOptTextThfa() { TextUpdate(dciTHFA); } void CShapingPage::OnEnChangeOptTextTpea() { TextUpdate(dciTPEA); } void CShapingPage::OnEnChangeOptTextRtds() { TextUpdate(dciRTDS); } void CShapingPage::OnEnChangeOptTextRtdt() { TextUpdate(dciRTDT); } void CShapingPage::OnEnChangeOptTextBlrd() { TextUpdate(dciBLRD); } void CShapingPage::OnEnChangeOptTextBlru() { TextUpdate(dciBLRU); } void CShapingPage::OnEnChangeOptTextCusp() { TextUpdate(dciCUSP); } void CShapingPage::OnCbnSelchangeOptComboClck() { CString strClck; CString strOldClck; CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_OPT_COMBO_CLCK); pCombo->GetWindowText(strClck); if (atoi(strClck) == 20) { s.DppConfig.b80MHzModeCfg = FALSE; } else if (atoi(strClck) == 80) { s.DppConfig.b80MHzModeCfg = TRUE; } //AfxMessageBox(strClck); CboUpdate(dciCLCK); lblFPGAClk[1].ShowWindow(SW_HIDE); lblFPGAClk[2].ShowWindow(SW_HIDE); if (b80MHzModeCfg_old != s.DppConfig.b80MHzModeCfg) { if (s.isDppConnected) { lblFPGAClk[1].ShowWindow(SW_SHOW); } else { lblFPGAClk[2].ShowWindow(SW_SHOW); } } UpdateData(FALSE); } void CShapingPage::BLRQuickSet(CString strMode, CString strDown, CString strUp) { int idxList; HWND hDlg = this->GetSafeHwnd(); CString strVal = strMode; // set BLR to MODE 1 CComboBox &cb = *(CComboBox *) GetDlgItem(IDC_OPT_COMBO_BLRM); //idxList = s.CtrlUtil.FindCboIdx(hDlg,IDC_OPT_COMBO_BLRM,strVal); idxList = s.CtrlUtil.FindCboIdxExact(hDlg,IDC_OPT_COMBO_BLRM,strVal); // try exact first if (idxList == LB_ERR) { idxList = s.CtrlUtil.FindCboIdx(hDlg,IDC_OPT_COMBO_BLRM,strVal); } if (idxList == LB_ERR) { // not found default to 0 idxList = 0; } cb.SetCurSel(idxList); CboUpdate(dciBLRM); GetDlgItem(IDC_OPT_TEXT_BLRD)->SetWindowText(strDown); TextUpdate(dciBLRD); GetDlgItem(IDC_OPT_TEXT_BLRU)->SetWindowText(strUp); TextUpdate(dciBLRU); } BOOL CShapingPage::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class //================================================================== MSG msg = *pMsg; if (msg.message == WM_MOUSEMOVE) { // Relay events to the tooltip control msg.hwnd = (HWND)m_ToolTip.SendMessage(TTM_WINDOWFROMPOINT, 0, (LPARAM)&msg.pt); CPoint pt = pMsg->pt; ::ScreenToClient(msg.hwnd, &pt); msg.lParam = MAKELONG(pt.x, pt.y); m_ToolTip.Activate(TRUE); // make sure tooltip is active m_ToolTip.RelayEvent(&msg); // Let the ToolTip process this message. } else if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) { CWnd* pCurrent= GetFocus(); int ctrl = pCurrent->GetDlgCtrlID(); //if (ctrl == IDC_OPT_TEXT_MCST) { if (isCEditBox(ctrl)) { ::SendMessage(this->m_hWnd, WM_COMMAND, MAKEWPARAM(ctrl, EN_CHANGE), (LPARAM) m_hWnd); CWnd* pNext= pCurrent->GetNextWindow( GW_HWNDNEXT ); pMsg->wParam = VK_TAB; //if ( pNext != NULL ) { // if (pNext->GetDlgCtrlID() != IDOK ) { // pNext->SetFocus(); // return TRUE; // } //} } else if (isCComboBox(ctrl)) { CWnd* pNext= pCurrent->GetNextWindow( GW_HWNDNEXT ); pMsg->wParam = VK_TAB; } } //================================================================== return CCfgPropPage::PreTranslateMessage(pMsg); } BOOL CShapingPage::isCEditBox(int nID) { BOOL isEdit = FALSE; switch (nID) { case IDC_OPT_TEXT_TFLA: isEdit = TRUE; break; case IDC_OPT_TEXT_THFA: isEdit = TRUE; break; case IDC_OPT_TEXT_TPEA: isEdit = TRUE; break; case IDC_OPT_TEXT_RTDS: isEdit = TRUE; break; case IDC_OPT_TEXT_RTDT: isEdit = TRUE; break; case IDC_OPT_TEXT_BLRD: isEdit = TRUE; break; case IDC_OPT_TEXT_BLRU: isEdit = TRUE; break; case IDC_OPT_TEXT_CUSP: isEdit = TRUE; break; case IDC_OPT_TEXT_PURE: isEdit = TRUE; break; case IDC_OPT_TEXT_SCTC: isEdit = TRUE; break; case IDC_OPT_TEXT_TLLD: isEdit = TRUE; break; } return isEdit; } BOOL CShapingPage::isCComboBox(int nID) { BOOL isCombo = FALSE; switch (nID) { case IDC_OPT_COMBO_CLCK: isCombo = TRUE; break; case IDC_OPT_COMBO_PURE: isCombo = TRUE; break; case IDC_OPT_COMBO_SCTC: isCombo = TRUE; break; case IDC_OPT_COMBO_RTDE: isCombo = TRUE; break; case IDC_OPT_COMBO_BLRM: isCombo = TRUE; break; case IDC_OPT_COMBO_CUSP: isCombo = TRUE; break; case IDC_OPT_COMBO_TLLD: isCombo = TRUE; break; case IDC_OPT_COMBO_TPFA: isCombo = TRUE; break; } return isCombo; } void CShapingPage::SetCboItem(int nID, CString strVal) { HWND hPage = this->GetSafeHwnd(); int cboDP5CtrlID = nID; int idxList; CComboBox &cb = *(CComboBox *) GetDlgItem(cboDP5CtrlID); idxList = s.CtrlUtil.FindCboIdxExact(hPage,cboDP5CtrlID,strVal); // try exact first if (idxList == LB_ERR) { idxList = s.CtrlUtil.FindCboIdx(hPage,cboDP5CtrlID,strVal); } if (idxList == LB_ERR) { // if (idxList != LB_ERR) we already found the value idxList = 0; // set to first item } cb.SetCurSel(idxList); } void CShapingPage::OnCbnSelchangeRisecombo() { CString strRise; RiseTop.SetRiseCombo(); m_RiseCombo.GetWindowText(strRise); GetDlgItem(IDC_OPT_TEXT_TPEA)->SetWindowText(strRise); TextUpdate(dciTPEA); SetCboItem(IDC_TOPCOMBO,"0.200"); OnCbnSelchangeTopcombo(); } void CShapingPage::OnCbnSelchangeTopcombo() { CString strTop; RiseTop.SetTopCombo(); m_TopCombo.GetWindowText(strTop); GetDlgItem(IDC_OPT_TEXT_TFLA)->SetWindowText(strTop); TextUpdate(dciTFLA); } void CShapingPage::InitComboFromText(HWND hDlg, DP5_CONFIGURATION cfg, int nID) { CString strVal = cfg.Setting; int idxList; CComboBox &cb = *(CComboBox *) GetDlgItem(nID); idxList = s.CtrlUtil.FindCboIdx(hDlg,nID,strVal); idxList = s.CtrlUtil.FindCboIdxExact(hDlg,nID,strVal); // try exact first if (idxList == LB_ERR) { idxList = s.CtrlUtil.FindCboIdx(hDlg,nID,strVal); } if (idxList == LB_ERR) { // if (idxList != LB_ERR) we already found the value strVal = cfg.TextValue; idxList = s.CtrlUtil.FindCboIdx(hDlg,nID,strVal); if (idxList == LB_ERR) { // not found default to 0 idxList = 0; } } cb.SetCurSel(idxList); } // this function replaces blr quickset 20110504 void CShapingPage::OnBnClickedBlrquickslowbutton2() { BLRQuickSet("1","3","0"); } //////////////////////////////////////////////////////////////////////////////////// // HtmlHelp for shared dialog // NOTE: shared dialogs use string type IDD, not global IDD BOOL CShapingPage::OnHelpInfo(HELPINFO* pHelpInfo) { CString strHelp; if (pHelpInfo->iContextType == HELPINFO_WINDOW) { if (pHelpInfo->dwContextId == 0) { ::HtmlHelp(this->GetSafeHwnd(), theApp.m_pszHelpFilePath, HH_HELP_CONTEXT, HIDD_SHAPING_PAGE); } else { // } } return true; } void CShapingPage::OnHelp() // enable property sheet help button help { ::HtmlHelp(this->GetSafeHwnd(), theApp.m_pszHelpFilePath, HH_HELP_CONTEXT, HIDD_SHAPING_PAGE); //SendMessage(WM_COMMANDHELP); // } //////////////////////////////////////////////////////////////////////////////////// void CShapingPage::BuildToolTips() { if (!m_ToolTip.Create(this)) { TRACE0("Unable to create ToolTip control\n"); } else { m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_BLRD), IDS_TT_BLR_DOWN_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_BLRD), IDS_TT_BLR_DOWN_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_BLRD), IDS_TT_BLR_DOWN_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_BLRD), IDS_TT_BLR_DOWN_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_BLRM), IDS_TT_BLR_MODE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_BLRM), IDS_TT_BLR_MODE); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_BLRU), IDS_TT_BLR_UP_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_BLRU), IDS_TT_BLR_UP_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_BLRU), IDS_TT_BLR_UP_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_BLRU), IDS_TT_BLR_UP_CORRECTION); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_CLCK), IDS_TT_FPGA_CLOCK_SPEED); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_CLCK), IDS_TT_FPGA_CLOCK_SPEED); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_CUSP), IDS_TT_NON_TRAPEZOIDAL_SHAPING); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_CUSP), IDS_TT_NON_TRAPEZOIDAL_SHAPING); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_CUSP), IDS_TT_NON_TRAPEZOIDAL_SHAPING); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_CUSP), IDS_TT_NON_TRAPEZOIDAL_SHAPING); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_CUSP), IDS_TT_NON_TRAPEZOIDAL_SHAPING); ////m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_SHAPING_PAGE), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_PURE), IDS_TT_PUR_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_PURE), IDS_TT_PUR_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_PURE), IDS_TT_PUR_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_PURE), IDS_TT_PUR_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_PURE), IDS_TT_PUR_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_SCTC), IDS_TT_SCTC); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_SCTC), IDS_TT_SCTC); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_SCTC), IDS_TT_SCTC); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_SCTC), IDS_TT_SCTC); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_SCTC), IDS_TT_SCTC); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_RTDE), IDS_TT_RTD_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_RTDE), IDS_TT_RTD_ON_OFF); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_RTDS), IDS_TT_RTD_SENSITIVITY); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_RTDS), IDS_TT_RTD_SENSITIVITY); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_RTDS), IDS_TT_RTD_SENSITIVITY); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_RTDS), IDS_TT_RTD_SENSITIVITY); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_RTDT), IDS_TT_RTD_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_RTDT), IDS_TT_RTD_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_RTDT), IDS_TT_RTD_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_RTDT), IDS_TT_RTD_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_TFLA), IDS_TT_FLAT_TOP_WIDTH); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_TFLA), IDS_TT_FLAT_TOP_WIDTH); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_TFLA), IDS_TT_FLAT_TOP_WIDTH); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_TFLA), IDS_TT_FLAT_TOP_WIDTH); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_THFA), IDS_TT_FAST_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_THFA), IDS_TT_FAST_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_THFA), IDS_TT_FAST_THRESHOLD); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_THFA), IDS_TT_FAST_THRESHOLD); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_TLLD), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_TLLD), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_TLLD), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_TLLD), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_TLLD), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_TEXT_TPEA), IDS_TT_PEAKING_TIME); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_LIMITS_TPEA), IDS_TT_PEAKING_TIME); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_TPEA), IDS_TT_PEAKING_TIME); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_TPEA), IDS_TT_PEAKING_TIME); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_COMBO_TPFA), IDS_TT_FAST_PEAKING_TIME); m_ToolTip.AddTool(GetDlgItem(IDC_OPT_FRAME_TPFA), IDS_TT_FAST_PEAKING_TIME); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_FPGACLK1), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_FPGACLK2), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_FPGACLK3), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_SHAPING_ADVANCED), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_PULSE_SHAPING), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_LABEL_QUICK_PICK_SHAPING), IDS_TT_PEAKING_QPICK); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_SHAPING_BASIC), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_TOPCOMBO), IDS_TT_PEAKING_QPICK); m_ToolTip.AddTool(GetDlgItem(IDC_RISECOMBO), IDS_TT_PEAKING_QPICK); //m_ToolTip.AddTool(GetDlgItem(IDC_SHAPINGGROUP), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_STATIC_SHAPING_STANDARD), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_LABEL_QUICK_PICK_SHAPING2), IDS_TT_PEAKING_QPICK); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_RESL2), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_OPT_UNITS_RESL3), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_TIMETOPEAKSTATIC), IDS_TT); //m_ToolTip.AddTool(GetDlgItem(IDC_FLATTOPSTATIC), IDS_TT); m_ToolTip.AddTool(GetDlgItem(IDC_BLRQUICKSLOWBUTTON), IDS_TT_BLR_QUICKSET); m_ToolTip.Activate(TRUE); m_ToolTip.SetMaxTipWidth(200); } }