Ejemplo n.º 1
0
BOOL NetCfg::OnInitDialog()
{
	CComboBox *hCombo;
	CEdit *hEdit;

	hCombo = (CComboBox*)GetDlgItem(IDC_COMBO_THREAD);
	hCombo->InsertString(-1,"1");
	// 	hCombo->InsertString(-1,"2");
	// 	hCombo->InsertString(-1,"3");
	// 	hCombo->InsertString(-1,"4");
	hCombo->SetCurSel(0);

	hCombo = (CComboBox*)GetDlgItem(IDC_COMBO_TICK);
	hCombo->InsertString(-1,"10");
	hCombo->InsertString(-1,"100");
	hCombo->InsertString(-1,"500");
	hCombo->InsertString(-1,"1000");
	hCombo->SetCurSel(3);


	hEdit = (CEdit*)GetDlgItem(IDC_EDIT_TICK);
	hEdit->SetWindowText("10");


	CIPAddressCtrl *hip;
	hip = (CIPAddressCtrl *)GetDlgItem(IDC_IP_TARGET);
	hip->SetWindowText(m_ini.ip);

	
	hEdit = (CEdit*)GetDlgItem(IDC_EDIT_BROWSE);
	hEdit->SetWindowText(m_ini.def_file);

	GetDlgItem(IDC_BTN_TRANSFER)->EnableWindow(FALSE);
	return TRUE;
}
Ejemplo n.º 2
0
BOOL CHMIRunDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	int number = gCfgFile.GetTowerNumber();
	CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_COMBO_RUN);

	int row;
	CString str;
	for(row=0; row<number; row++)
	{
		str.Format("风机%d", row + 1);
		pCombo->InsertString(row, str);
	}
	pCombo->InsertString(row, "机舱");
	pCombo->SetCurSel(0);
	
	CIPAddressCtrl *pIPAddr = (CIPAddressCtrl *)GetDlgItem(IDC_IPADDRESS_RUN);
	pIPAddr->SetAddress(gCfgFile.GetTowerIP(0));

	CHMIDlg *pDlg = (CHMIDlg *)(GetParent()->GetParent());
	pDlg->SetTipString(__T("加载配置文件成功!"));

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CVideoOSCRuleSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	_CWndCS(this);
	CString strText;
	CComboBox *pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_SENSITIVITY_LEVEL);
	strText.Format("%s", _CS("ConfigVideo.High") );
	pComboBox->InsertString(0,strText);
//	int nInsert = pComboBox->AddString(strText);
//	pComboBox->SetItemData(nInsert, 0);
	
	strText.Format("%s", _CS("ConfigVideo.Middle") );
	pComboBox->InsertString(1,strText);
//	nInsert = pComboBox->AddString(strText);
//	pComboBox->SetItemData(nInsert, 1);
	
	strText.Format("%s", _CS("ConfigVideo.Lower") );
	pComboBox->InsertString(2,strText);
//	nInsert = pComboBox->AddString(strText);
//	pComboBox->SetItemData(nInsert, 2);
	
	pComboBox->SetCurSel(m_Rule.iLevel);

	CButton* pCheck = (CButton*)GetDlgItem(IDC_CHECK_SHOWTRACE);
	if (m_Rule.iShowTrack!=0)
	{
		pCheck->SetCheck(BST_CHECKED);
	}
	else
	{
		pCheck->SetCheck(BST_UNCHECKED);
	}

	if (m_Rule.iAbandumEnable)
	{
		((CButton*)GetDlgItem(IDC_RADIO_ABANDUM))->SetCheck(BST_CHECKED);
	}
	else if (m_Rule.iStolenEnable)
	{
		((CButton*)GetDlgItem(IDC_RADIO_STOLEN))->SetCheck(BST_CHECKED);
	}
	else if (m_Rule.iNoParkingEnable)
	{
		((CButton*)GetDlgItem(IDC_RADIO_NOPARKING))->SetCheck(BST_CHECKED);
		
	}
	m_sliderRangeMin.SetPos(m_Rule.stNoParkingRulePara.stOscPara.nSizeMin);//显示其中一个最小像素,保存时,保存所有
	OnReleasedcaptureSliderRangeMin(0,0);
	return TRUE;  
}
Ejemplo n.º 4
0
// 查找串口
void CPMSRSet::FindComPort()
{
	HKEY   hKey;

	st_CommPara.usCommNum = 0;	// 串口数量

	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\DeviceMap\\SerialComm"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
	{
		TCHAR       szPortName[256], szComName[256];
		DWORD       dwLong, dwSize;
		int         nCount = 0;
		CComboBox*  pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);

		pCombo->ResetContent();
		while (true)
		{
			dwLong = dwSize = 256;
			if (RegEnumValue(hKey, nCount, szPortName, &dwLong, NULL, NULL, (PUCHAR)szComName, &dwSize) == ERROR_NO_MORE_ITEMS)
				break;

			pCombo->InsertString(nCount, szComName);
			nCount++;
			st_CommPara.usCommNum++;
		}
		RegCloseKey(hKey);
		pCombo->SetCurSel(0);
	}

}
Ejemplo n.º 5
0
BOOL CFileDialogEx::OnInitDialog() 
{
	CFileDialog::OnInitDialog();
	
	// The edit box
	HWND editBox = ::GetDlgItem (*(this->GetParent ()), edt1);

	// The combo box
	CComboBox combo;
	combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));

	// Insert the strings
	char text[512];
	text[0] = 0;
	HKEY hKey;
	DWORD type = REG_SZ;
	DWORD size;
	if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS)
	{
		uint i;
		for (i=0; i<PATH_REMEBERED_SIZE; i++)
		{
			size = 512;
			if (RegQueryValueEx (hKey, toString (i).c_str (), 0, &type, (LPBYTE)text, &size) == ERROR_SUCCESS)
				combo.InsertString (-1, text);
		}
		if (m_ofn.lpstrInitialDir)
			combo.SelectString (-1, m_ofn.lpstrInitialDir);
	}

	combo.Detach ();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 6
0
// 查找串口
void CSerialPort::FindComPort(CComboBox& m_PortNO)
{
    HKEY   hKey;
    UINT i;

    for (i = 0; i<MaxSerialPortNum; i++)///存放串口号的数组初始化
    {
        m_ComArray[i] = -1;
    }

    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\DeviceMap\\SerialComm"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        TCHAR       szPortName[256], szComName[256];
        DWORD       dwLong, dwSize;

        m_ComCount = 0;
        m_PortNO.ResetContent();///刷新时,清空下拉列表内容
        while (true)
        {
            dwLong = dwSize = 256;
            if (RegEnumValue(hKey, m_ComCount, szPortName, &dwLong, NULL, NULL, (PUCHAR)szComName, &dwSize) == ERROR_NO_MORE_ITEMS)
                break;

            m_PortNO.InsertString(m_ComCount, szComName);
            m_ComArray[m_ComCount] = atoi((char*)(szComName + 3));
            m_ComCount++;
        }
        RegCloseKey(hKey);
        m_PortNO.SetCurSel(0);
    }

}
Ejemplo n.º 7
0
//===========================================================================
void CFAVConnectDlg::OnBnClickedConnectCheck()
//===========================================================================
{
	// TODO: Add your control notification handler code here
	CArray<CString,CString> strArrayCOM;
	UINT	uPortCount;
	CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_CONNECT_COMSEL);
	CString strCOMPORT;
	if(m_bCOMSel){
		GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(FALSE);
		m_bGetSerialPort = FALSE;
		for(UINT i = pCbox->GetCount(); i > 0; i--){
			pCbox->DeleteString(i-1);
		}
		m_bCOMSel = FALSE;
	}
	else{
		if(!m_bGetSerialPort){
			m_bGetSerialPort = TRUE;
			uPortCount = m_UARTComm.GetSerialPort(TRUE, strArrayCOM);
			for(UINT i = 0; i < uPortCount; i++){
				strCOMPORT = strArrayCOM.GetAt(m_UARTComm.GetCOMIndex(i));
				pCbox->InsertString(i,strCOMPORT);
			}
			pCbox->SetCurSel(0);
		}
		GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(TRUE);
		m_bCOMSel = TRUE;
	}
}
Ejemplo n.º 8
0
int FindReplDlg::GetFindText(CComboBox& wnd, bsString& text)
{
	int len;
	char *tp;
	int sel = wnd.GetCurSel();
	if (sel == -1)
	{
		len = wnd.GetWindowTextLength()+1;
		tp = new char[len];
		wnd.GetWindowText(tp, len);
		sel = wnd.FindStringExact(-1, tp);
		if (sel == -1)
		{
			sel = wnd.InsertString(0, tp);
			wnd.SetCurSel(sel);
		}
		int cnt;
		while ((cnt = wnd.GetCount()) >= 20)
			wnd.DeleteString(cnt-1);
	}
	else
	{
		len = wnd.GetLBTextLen(sel)+1;
		tp = new char[len];
		wnd.GetLBText(sel, tp);
	}
	text.Attach(tp);
	return sel;
}
Ejemplo n.º 9
0
BOOL CAddDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	CComboBox* pComb = (CComboBox*)GetDlgItem(IDC_SEX_COMBO);
	pComb->InsertString(0,"男");
	pComb->InsertString(1,"女");

	if (modifyFlag)
	{
		SetWindowText("修改员工信息");
		GetDlgItem(ID_ADD)->SetWindowText("修改");
		SetDlgItemText(IDC_NO_EDIT,no);
		GetDlgItem(IDC_NO_EDIT)->EnableWindow(FALSE);
		SetDlgItemText(IDC_NAME_EDIT,name);
		if (sex.Compare("男") == 0)
		{
			pComb->SetCurSel(0);
		}else{
			pComb->SetCurSel(1);
		}
		SetDlgItemText(IDC_SEX_COMBO,sex);
		SetDlgItemText(IDC_DUTY_EDIT,duty);
		SetDlgItemText(IDC_TEL_EDIT,tel);
	}else{
		
		pComb->SetCurSel(0);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Ejemplo n.º 10
0
VOID CBindTypePage::UpdateControls (UINT32 nType)
{
	CComboBox ctlComboBox;
	ctlComboBox.Attach(GetDlgItem(IDC_COMBO_DISKCOUNT));
	ctlComboBox.ResetContent();

	WTL::CString strDesc;

	switch(nType)
	{
	case NMT_AGGREGATE :
		ctlComboBox.InsertString(-1, _T("2"));
		ctlComboBox.InsertString(-1, _T("3"));
		ctlComboBox.InsertString(-1, _T("4"));
		ctlComboBox.InsertString(-1, _T("5"));
		ctlComboBox.InsertString(-1, _T("6"));
		ctlComboBox.InsertString(-1, _T("7"));
		ctlComboBox.InsertString(-1, _T("8"));
		strDesc.LoadString(IDS_BNZ_DESC_AGGREGATION);
		break;
	case NMT_RAID0 :
		ctlComboBox.InsertString(-1, _T("2"));
		ctlComboBox.InsertString(-1, _T("4"));
		ctlComboBox.InsertString(-1, _T("8"));
		strDesc.LoadString(IDS_BNZ_DESC_RAID0);
		break;
	case NMT_RAID1 :
		ctlComboBox.InsertString(-1, _T("2"));
		strDesc.LoadString(IDS_BNZ_DESC_RAID1);
		break;
	case NMT_RAID4 :
		ctlComboBox.InsertString(-1, _T("3"));
		ctlComboBox.InsertString(-1, _T("5"));
		ctlComboBox.InsertString(-1, _T("9"));
		strDesc.LoadString(IDS_BNZ_DESC_RAID4);
		break;
	default:
		break;
	}

	ctlComboBox.SetCurSel(0);

	CStatic ctlStatic;
	ctlStatic.Attach(GetDlgItem(IDC_BIND_TYPE_DESCRIPTION));
	ctlStatic.SetWindowText(strDesc);

}
Ejemplo n.º 11
0
BOOL CAddDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	CComboBox* pComb = (CComboBox*)GetDlgItem(IDC_SEX_COMBO);
	pComb->InsertString(0,"男");
	pComb->InsertString(1,"女");
	pComb->SetCurSel(0);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Ejemplo n.º 12
0
void KG3DAnimationContainer::FillAnimationComboBox(CComboBox& ComboBox)
{
    ComboBox.ResetContent();
    LPCTSTR pszAniName = NULL;
    for (int i = 0; i < static_cast<int>(m_Clips.size()); i++)
    {
        m_Clips[i]->GetName(&pszAniName);
        ComboBox.InsertString(i, pszAniName);
        ComboBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
    }
}
Ejemplo n.º 13
0
void vPopulateDiagnosticStandardComboBox(STANDARD_COMB sg_asInterface[], int nSize,
                              CComboBox& omComboBox)
{
    omComboBox.ResetContent();
    for (int i = 0, nIncr = 0; i < nSize; i++)
    {
        if (sg_asInterface[i].mo_bShow)
        {
            omComboBox.InsertString(nIncr++, sg_asInterface[i].m_omStandard);
        }
    }
}
Ejemplo n.º 14
0
void vPopulateMsgTypeComboBox(SCONFIGDATA_COMB asConfigData[], int nSize,
                              CComboBox& omComboBox)
{
    omComboBox.ResetContent();
    for (int i = 0, nIncr = 0; i < nSize; i++)
    {
        if (asConfigData[i].m_bShow)
        {
            omComboBox.InsertString(nIncr++, asConfigData[i].m_omTypeName);
        }
    }
}
Ejemplo n.º 15
0
void xTerrainHeightDlg::_Init(Event * sender)
{
	CComboBox * cbBrushType = (CComboBox *)GetDlgItem(IDC_Combo_TH_BrushType);
	CComboBox * cbBrushOp = (CComboBox *)GetDlgItem(IDC_Combo_TH_BrushOp);

	cbBrushOp->InsertString(0, "Up");
	cbBrushOp->InsertString(1, "Down");
	cbBrushOp->InsertString(2, "Smooth");
	cbBrushOp->SetCurSel(0);

	FileSystem fs("../Core/Terrain/Brushes");

	fs.Load();

	Archive::FileInfoVisitor v = fs.GetFileInfos();

	while (!v.Endof())
	{
		const Archive::FileInfo & info = v.Cursor()->second;

		if (info.type == Archive::FILE_ARCHIVE)
		{
			TString128 base = File::RemoveExternName(info.name);
			TString128 ext = File::GetExternName(info.name);

			if (ext == "png")
				cbBrushType->AddString(base.c_str());
		}

		++v;
	}

	cbBrushType->SetCurSel(0);

	OnOpChanged();
	OnTypeChanged();

	SetDlgItemText(IDC_Edit_TH_BrushSize, "50");
	SetDlgItemText(IDC_Edit_TH_BrushDensity, "1");
}
Ejemplo n.º 16
0
void vPopulateInterfaceComboBox(INTERFACE_COMB sg_asInterface[], int nSize,

								CComboBox& omComboBox)
{
    omComboBox.ResetContent();
    for (int i = 0, nIncr = 0; i < nSize; i++)
    {
        if (sg_asInterface[i].m_bShow)
        {
            omComboBox.InsertString(nIncr++, sg_asInterface[i].m_omTypeName);
        }
    }
}
Ejemplo n.º 17
0
// CFAVReaderDlg message handlers
//===========================================================================
BOOL CFAVReaderDlg::OnInitDialog()
//===========================================================================
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_READER_MEMBANK_DATA);
	pCbox->InsertString(0,_T("Reserved"));
	pCbox->InsertString(1,_T("EPC"));
	pCbox->InsertString(2,_T("TID"));
	pCbox->InsertString(3,_T("USER"));
	pCbox->SetCurSel(1);

	CEdit* pEditAddress = (CEdit*)GetDlgItem(IDC_READER_ADDRESS_DATA);
	pEditAddress->LimitText(4);
	pEditAddress->SetWindowText(_T("2"));

	CEdit* pEditLength = (CEdit*)GetDlgItem(IDC_READER_LENGTH_DATA);
	pEditLength->LimitText(2);
	pEditLength->SetWindowText(_T("6"));

	m_ListBox.SetContextMenuId(IDR_LISTBOX_MENU);
	// Create tooltips
	m_ToolTips.Create(this, TTS_ALWAYSTIP);
	::SendMessage(m_ToolTips.m_hWnd, TTM_SETMAXTIPWIDTH, 0, SHRT_MAX);
	CString str = _T("");
	str.Format(_T("Writes communication data to %s"), m_strLogFile);
	m_ToolTips.AddTool(GetDlgItem(IDC_READER_LOGFILE), str);

	//CString str = _T("");
	str.Format(_T("Please enter the Hex type.(0 ~ 3FFF)"));
	m_ToolTips.AddTool(GetDlgItem(IDC_READER_ADDRESS_DATA), str);
	str.Format(_T("Please enter the Hex type.(1 ~ 20)\r\nRead Length: 1 ~ 20\r\nWrite Length: 1 ~ 10"));
	m_ToolTips.AddTool(GetDlgItem(IDC_READER_LENGTH_DATA), str);

	m_bGetOverResultWait = TRUE;
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 18
0
void CDlgReadInfo::InitLayerList()
{
	CStringArray strArray;
	CDistEntityTool tempTool;
	tempTool.GetAllLayerName(strArray);
	CComboBox* pCmb = (CComboBox*) GetDlgItem(IDC_COMBO_CADLY);
	pCmb->ResetContent();
	int nCount = strArray.GetCount();
	for(int i=0; i<nCount; i++)
		pCmb->AddString(strArray.GetAt(i));

	pCmb->InsertString(0,"所有图层");
	pCmb->SetCurSel(0);
}
Ejemplo n.º 19
0
//初始化函数
BOOL CSetChip::OnInitDialog()
{
	__super::OnInitDialog();

	//设置标题
	SetWindowText(TEXT("压注"));

	//计算押注
	LONG lChipsArray[SET_CHIP_COUNT] ;

	//数据验证
	ASSERT( m_wMaxChip > 0 ) ;
	if ( m_wMaxChip <= 0 ) return TRUE ;

	for ( BYTE cbChipIndex = 0; cbChipIndex < SET_CHIP_COUNT; ++cbChipIndex )
	{
		lChipsArray[cbChipIndex] = LONG ( ( cbChipIndex + 1.0 ) / SET_CHIP_COUNT * m_wMaxChip ) ;

		//整百处理
		if ( lChipsArray[cbChipIndex] > 100 )
		{
			LONG lHundredCount = lChipsArray[cbChipIndex] / 100 ;
			lChipsArray[cbChipIndex] = lHundredCount * 100 ;
		}
	}

	//插入押注
	CComboBox *pChipComBox = ( CComboBox* ) GetDlgItem( IDC_SETCHIP ) ;
	CString strChip ;

	for ( BYTE cbChipIndex = 0; cbChipIndex < SET_CHIP_COUNT; ++cbChipIndex )
	{
		strChip.Format( TEXT( "%ld" ), lChipsArray[cbChipIndex] ) ;
		pChipComBox->InsertString( cbChipIndex, strChip ) ;
	}
	pChipComBox->SetCurSel( 0 ) ;	

	pChipComBox->SetFocus() ;

	m_nChip = lChipsArray[0] ;

	return TRUE;
}
Ejemplo n.º 20
0
int CChannelConfigurationDlg::nUpdateLinSettings()
{
    CComboBox* pomCombo = (CComboBox*)GetDlgItem(IDC_COMBO_LIN_PROTOCOL);

    if ( pomCombo != nullptr )
    {
        for ( int i = 0 ; i < ( sizeof(sg_LINPROTOCOL_BAUD)/ sizeof(sg_LINPROTOCOL_BAUD[0])); i++ )
        {
            pomCombo->InsertString(i, sg_LINPROTOCOL_BAUD[i].m_strProtocol.c_str());
        }
        pomCombo->SetCurSel(0);
    }

    m_nLinBaudRate = 1900;
    UpdateData(FALSE);
    OnOverwriteCheckBoxClick();

    return 0;
}
Ejemplo n.º 21
0
void COptsAudioDlg::PopulateDeviceCombo(CComboBox& Combo, const CDSDeviceInfoArray& DevInfo, const GUID& DeviceGuid)
{
	int	iSelDev = -1;
	int	iDefaultDev = -1;
	int	devs = DevInfo.GetSize();
	for (int iDev = 0; iDev < devs; iDev++) {	// for each device
		const CDSPlayer::CDSDeviceInfo&	info = DevInfo[iDev];
		Combo.AddString(info.m_Description);
		if (IsEqualGUID(info.m_Guid, DeviceGuid))	// if selected device
			iSelDev = iDev;
		if (IsEqualGUID(info.m_Guid, GUID_NULL))	// if default device
			iDefaultDev = iDev;
	}
	if (iSelDev < 0) {	// if selected device not found
		if (iDefaultDev >= 0)	// if default device was found
			iSelDev = iDefaultDev;	// select default device
		else {	// no default device; shouldn't happen
			Combo.InsertString(0, _T("<default>"));
			iSelDev = 0;
		}
	}
	Combo.SetCurSel(iSelDev);
}
Ejemplo n.º 22
0
void CSerialPort::Hkey2ComboBox(CComboBox& m_PortNO)
{
    HKEY hTestKey;
    bool Flag = FALSE;

    ///仅是XP系统的注册表位置,其他系统根据实际情况做修改
    if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DEVICEMAP\\SERIALCOMM"), 0, KEY_READ, &hTestKey) ) {
        QueryKey(hTestKey);
    }
    RegCloseKey(hTestKey);

    int i = 0;
    m_PortNO.ResetContent();///刷新时,清空下拉列表内容
    while(i < MaxSerialPortNum && -1 != m_nComArray[i]) {
        CString szCom;
        szCom.Format(_T("COM%d"), m_nComArray[i]);
        m_PortNO.InsertString(i, szCom.GetBuffer(5));
        ++i;
        Flag = TRUE;
        if (Flag)///把第一个发现的串口设为下拉列表的默认值
            m_PortNO.SetCurSel(0);
    }

}
Ejemplo n.º 23
0
//creates the appropriate controls for a property
void CPropertyWnd::CreatePropertyControls(CPackerProperty* pProp, uint32 nProp, uint32 nID, const CRect& rOrigArea)
{
	ASSERT(pProp);

	//flags for all controls
	DWORD nBaseFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;

	//a working area rectangle
	CRect rArea(rOrigArea);

	switch(pProp->GetType())
	{
	case PROPERTY_REAL:
		{
			//create the edit box for editing the number
			CEdit* pNewEdit = new CEdit;
			if(pNewEdit)
			{
				pNewEdit->CreateEx(WS_EX_CLIENTEDGE, "Edit", "", nBaseFlags | ES_AUTOHSCROLL, 
									rArea.left, rArea.top, rArea.Width(), rArea.Height(),
									GetSafeHwnd(), (HMENU)nID);

				CPackerRealProperty* pReal = (CPackerRealProperty*)pProp;

				//set the default
				CString sText;
				sText.Format((pReal->IsInteger()) ? "%.0f" : "%.2f", pReal->GetValue());
				pNewEdit->SetWindowText(sText);

				//save it in the list
				m_pPropControl[nProp][0] = pNewEdit;

				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewEdit, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_STRING:
		{
			CPackerStringProperty* pString = (CPackerStringProperty*)pProp;

			//rectangle for the edit control
			CRect rEditArea(rArea);

			//see if this is going to be a filename
			if(pString->IsFilename())
			{
				rEditArea.DeflateRect(0, 0, BROWSE_BUTTON_WIDTH, 0);
			}

			//create the edit box for editing the string
			CEdit* pNewEdit = new CEdit;
			if(pNewEdit)
			{
				pNewEdit->CreateEx(WS_EX_CLIENTEDGE, "Edit", "", nBaseFlags | ES_AUTOHSCROLL, 
									rEditArea.left, rEditArea.top, 
									rEditArea.Width(), rEditArea.Height(),
									GetSafeHwnd(), (HMENU)nID);

				//set the default
				pNewEdit->SetWindowText(pString->GetValue());

				//save it in the list
				m_pPropControl[nProp][0] = pNewEdit;
			}

			//setup the tooltip
			m_ToolTip.AddWindowTool(pNewEdit, pProp->GetHelp());

			//create the browse button if needed
			if(pString->IsFilename())
			{
				CButton* pNewButton = new CButton;
				if(pNewButton)
				{
					pNewButton->Create("...", nBaseFlags, CRect(rEditArea.right, rArea.top, rArea.right, rArea.bottom), this, nID + 1);
					m_pPropControl[nProp][1] = pNewButton;

					//setup the button's tooltip
					m_ToolTip.AddWindowTool(pNewButton, IDS_TOOLTIP_BROWSE_FOR_FILE);
				}					
			}
		}
		break;
	case PROPERTY_ENUM:
		{
			//create the combo box for the drop down of selections
			CComboBox* pNewCombo = new CComboBox;
			if(pNewCombo)
			{
				CPackerEnumProperty* pEnum = (CPackerEnumProperty*)pProp;

				CRect rFullArea(rArea);
				rFullArea.InflateRect(0, 0, 0, PROPERTY_HEIGHT * min(3, pEnum->GetNumItems()));

				pNewCombo->Create(nBaseFlags | CBS_DROPDOWNLIST, rFullArea, this, nID);

				//add the items
				for(uint32 nCurrItem = 0; nCurrItem < pEnum->GetNumItems(); nCurrItem++)
				{
					pNewCombo->InsertString(nCurrItem, pEnum->GetItem(nCurrItem));
				}

				//select the item
				pNewCombo->SetCurSel(pEnum->GetSelection());

				//save it in the list
				m_pPropControl[nProp][0] = pNewCombo;

				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewCombo, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_BOOL:
		{
			//create a check box for checking/unchecking items
			CButton* pNewButton = new CButton;
			if(pNewButton)
			{
				pNewButton->Create("", nBaseFlags | BS_AUTOCHECKBOX, rArea, this, nID); 
				m_pPropControl[nProp][0] = pNewButton;

				//init the default value
				CPackerBoolProperty* pBoolProp = (CPackerBoolProperty*)pProp;
				pNewButton->SetCheck(pBoolProp->GetValue() ? 1 : 0);
		
				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewButton, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_INTERFACE:
		{
			CPackerInterfaceProperty* pIntf = (CPackerInterfaceProperty*)pProp;

			DWORD nTextStyle	= 0;
			bool  bDisplayName	= true;

			switch(pIntf->GetInterfaceType())
			{
			case CPackerInterfaceProperty::TEXT_LEFT:
				nTextStyle = SS_LEFT;
				break;
			case CPackerInterfaceProperty::TEXT_RIGHT:
				nTextStyle = SS_RIGHT;
				break;
			case CPackerInterfaceProperty::TEXT_CENTER:
				nTextStyle = SS_CENTER;
				break;
			case CPackerInterfaceProperty::SEPARATOR:
				nTextStyle = SS_GRAYFRAME;
				bDisplayName = false;
				rArea.bottom -= rArea.Height() * 3 / 4;
				break;
			default:
				break;
			}

			if(pIntf->GetInterfaceType() != CPackerInterfaceProperty::BLANK)
			{
				CStatic* pStatic = new CStatic;
				if(pStatic)
				{
					if(bDisplayName)
					{
						rArea.top = rArea.bottom - GetAbsoluteFontHeight();
					}

					pStatic->Create(bDisplayName ? pProp->GetName() : "", nBaseFlags | nTextStyle, rArea, this, nID); 
					m_pPropControl[nProp][0] = pStatic;
				}
			}
		}
		break;
	default:
		ASSERT(FALSE);
		break;
	}

	//setup the fonts for all the new properties
	for(uint32 nCurrCtrl = 0; nCurrCtrl < MAX_CONTROLS_PER_PROP; nCurrCtrl++)
	{
		if(m_pPropControl[nProp][nCurrCtrl])
		{
			m_pPropControl[nProp][nCurrCtrl]->SetFont(&m_Font);
		}
	}
}
Ejemplo n.º 24
0
// CFAVRMCDlg message handlers
//===========================================================================
BOOL CFAVRMCDlg::OnInitDialog()
//===========================================================================
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	//! @defgroup Setting groups initialization
	//! @{
	//! @{ Key Define
	CEdit* pEditKeyDef = (CEdit*)GetDlgItem(IDC_RMC_KEYDEFINE_DATA);
	pEditKeyDef->SetWindowText(_T("SN pairing"));
	//! @}

	//! @{ Command
	CComboBox* pCMDCBox = (CComboBox*)GetDlgItem(IDC_RMC_CMD_DATA);
	pCMDCBox->InsertString(0,_T("M0"));
	pCMDCBox->InsertString(1,_T("M1"));
	pCMDCBox->SetCurSel(0);
	//! @}

	//! @{ Key
	CEdit* pEditKey = (CEdit*)GetDlgItem(IDC_RMC_KEY_DATA);
	pEditKey->SetWindowText(_T("50"));
	//! @}

	//! @{ Flag
	CComboBox* pFLAGCBox = (CComboBox*)GetDlgItem(IDC_RMC_FLAG_DATA);
	pFLAGCBox->InsertString(0,_T("0: No Double Key"));
	pFLAGCBox->InsertString(1,_T("1: Flag1"));
	pFLAGCBox->InsertString(2,_T("2: Flag2"));
	pFLAGCBox->InsertString(3,_T("3: Flag1 + Flag2"));
	pFLAGCBox->InsertString(4,_T("4: Flag3"));
	pFLAGCBox->InsertString(5,_T("5: Flag1 + Flag3"));
	pFLAGCBox->InsertString(6,_T("6: Flag2 + Flag3"));
	pFLAGCBox->SetCurSel(0);
	//! @}

	//! @{ SN
	CEdit* pEditSN = (CEdit*)GetDlgItem(IDC_RMC_SN_DATA);
	pEditSN->LimitText(8);
	pEditSN->SetWindowText(_T("FFFFFFFF"));
	pEditSN->EnableWindow(FALSE);
	//! @}

	//! @{ Number of times
	CEdit* pEditTimes = (CEdit*)GetDlgItem(IDC_RMC_TIMES_DATA);
	pEditTimes->LimitText(2);
	pEditTimes->SetWindowText(_T("37"));
	//! @}
	EnableGroupboxControls(::GetDlgItem(m_hWnd, IDC_RMC_SETTINGS), FALSE);		//Close groups
	//! @}


	//! @defgroup Send Sequences groups initialization
	//! @{
	//! @{ ListCtrl
	m_ListCtrl.InsertColumn(0, "Key Define", LVCFMT_CENTER, 100);
	m_ListCtrl.InsertColumn(1, "Command", LVCFMT_CENTER, 75);
	m_ListCtrl.InsertColumn(2, "Key", LVCFMT_CENTER, 40);
	m_ListCtrl.InsertColumn(3, "Flag", LVCFMT_CENTER, 50);
	m_ListCtrl.InsertColumn(4, "SN", LVCFMT_CENTER, 80);
	m_ListCtrl.InsertColumn(5, "Times", LVCFMT_CENTER, 40);
	m_ListCtrl.SetColumnWidth(5,LVSCW_AUTOSIZE_USEHEADER);
	m_ListCtrl.SetExtendedStyle(m_ListCtrl.GetExtendedStyle()|
		LVS_EX_FULLROWSELECT|
		LVS_EX_GRIDLINES);
	// http://msdn.microsoft.com/zh-tw/magazine/cc164140(en-us).aspx
	// Fixed column width
	CHeaderCtrl* pHeaderCtrl = (CHeaderCtrl*)m_ListCtrl.GetHeaderCtrl();
	pHeaderCtrl-> EnableWindow(FALSE);
	//! @}
	//EnableGroupboxControls(::GetDlgItem(m_hWnd, IDC_RMC_SEQUENCES), FALSE);		//Close groups
	//! @}

	// Create tooltips
	m_ToolTipsRMC.Create(this, TTS_ALWAYSTIP);
	::SendMessage(m_ToolTipsRMC.m_hWnd, TTM_SETMAXTIPWIDTH, 0, SHRT_MAX);
	CString str = _T("");
	str.Format(_T("Power"));
	m_ToolTipsRMC.AddTool(GetDlgItem(IDC_RMC_DEMO_POWER), str);
	str.Format(_T("Light OFF"));
	m_ToolTipsRMC.AddTool(GetDlgItem(IDC_RMC_DEMO_BULBOFF), str);

	CRect BtnRectPower; 
	m_ButtonPower.GetWindowRect(BtnRectPower);
	ScreenToClient(BtnRectPower);
	m_ButtonPower.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectPower);
	m_ButtonPower.SetRgnStyle(0);
	m_ButtonPower.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonPower.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonPower.SetBitmapId(0, IDB_RMCDEMO_POWER_NOMAL, IDB_RMCDEMO_POWER_MOVE,
		IDB_RMCDEMO_POWER_DOWN, IDB_RMCDEMO_POWER_MOVE);

	CRect BtnRectBulbOFF; 
	m_ButtonBulbOFF.GetWindowRect(BtnRectBulbOFF);
	ScreenToClient(BtnRectBulbOFF);
	m_ButtonBulbOFF.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectBulbOFF);
	m_ButtonBulbOFF.SetRgnStyle(0);
	m_ButtonBulbOFF.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBulbOFF.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBulbOFF.SetBitmapId(1, IDB_RMCDEMO_BULBOFF_NORMAL, IDB_RMCDEMO_BULBOFF_MOVE,
		IDB_RMCDEMO_BULBOFF_DOWN, IDB_RMCDEMO_BULBOFF_MOVE);

	CRect BtnRectBulbON; 
	m_ButtonBulbON.GetWindowRect(BtnRectBulbON);
	ScreenToClient(BtnRectBulbON);
	m_ButtonBulbON.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectBulbON);
	m_ButtonBulbON.SetRgnStyle(0);
	m_ButtonBulbON.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBulbON.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBulbON.SetBitmapId(2, IDB_RMCDEMO_BULBON_NORMAL, IDB_RMCDEMO_BULBON_MOVE,
		IDB_RMCDEMO_BULBON_DOWN, IDB_RMCDEMO_BULBON_MOVE);

	CRect BtnRectBON; 
	m_ButtonBuleON.GetWindowRect(BtnRectBON);
	ScreenToClient(BtnRectBON);
	m_ButtonBuleON.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectBON);
	m_ButtonBuleON.SetRgnStyle(0);
	m_ButtonBuleON.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBuleON.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBuleON.SetBitmapId(3, IDB_RMCDEMO_BON_NORMAL, IDB_RMCDEMO_BON_MOVE,
		IDB_RMCDEMO_BON_DOWN, IDB_RMCDEMO_BON_MOVE);

	CRect BtnRectBOFF; 
	m_ButtonBuleOFF.GetWindowRect(BtnRectBOFF);
	ScreenToClient(BtnRectBOFF);
	m_ButtonBuleOFF.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectBOFF);
	m_ButtonBuleOFF.SetRgnStyle(0);
	m_ButtonBuleOFF.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBuleOFF.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonBuleOFF.SetBitmapId(4, IDB_RMCDEMO_BOFF_NOMAL, IDB_RMCDEMO_BOFF_MOVE,
		IDB_RMCDEMO_BOFF_DOWN, IDB_RMCDEMO_BOFF_MOVE);

	CRect BtnRectGON; 
	m_ButtonGreenON.GetWindowRect(BtnRectGON);
	ScreenToClient(BtnRectGON);
	m_ButtonGreenON.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectGON);
	m_ButtonGreenON.SetRgnStyle(0);
	m_ButtonGreenON.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonGreenON.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonGreenON.SetBitmapId(5, IDB_RMCDEMO_GON_NORMAL, IDB_RMCDEMO_GON_MOVE,
		IDB_RMCDEMO_GON_DOWN, IDB_RMCDEMO_GON_MOVE);

	CRect BtnRectGOFF; 
	m_ButtonGreenOFF.GetWindowRect(BtnRectGOFF);
	ScreenToClient(BtnRectGOFF);
	m_ButtonGreenOFF.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectGOFF);
	m_ButtonGreenOFF.SetRgnStyle(0);
	m_ButtonGreenOFF.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonGreenOFF.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonGreenOFF.SetBitmapId(6, IDB_RMCDEMO_GOFF_NORMAL, IDB_RMCDEMO_GOFF_MOVE,
		IDB_RMCDEMO_GOFF_DOWN, IDB_RMCDEMO_GOFF_MOVE);

	CRect BtnRectRON; 
	m_ButtonRedON.GetWindowRect(BtnRectRON);
	ScreenToClient(BtnRectRON);
	m_ButtonRedON.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectRON);
	m_ButtonRedON.SetRgnStyle(0);
	m_ButtonRedON.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonRedON.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonRedON.SetBitmapId(7, IDB_RMCDEMO_RON_NORMAL, IDB_RMCDEMO_RON_MOVE,
		IDB_RMCDEMO_RON_DOWN, IDB_RMCDEMO_RON_MOVE);

	CRect BtnRectROFF; 
	m_ButtonRedOFF.GetWindowRect(BtnRectROFF);
	ScreenToClient(BtnRectROFF);
	m_ButtonRedOFF.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectROFF);
	m_ButtonRedOFF.SetRgnStyle(0);
	m_ButtonRedOFF.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonRedOFF.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonRedOFF.SetBitmapId(8, IDB_RMCDEMO_ROFF_NORMAL, IDB_RMCDEMO_ROFF_MOVE,
		IDB_RMCDEMO_ROFF_DOWN, IDB_RMCDEMO_ROFF_MOVE);

	CRect BtnRectPair; 
	m_ButtonPair.GetWindowRect(BtnRectPair);
	ScreenToClient(BtnRectPair);
	m_ButtonPair.SetBackBmp(IDB_RMCDEMO_BK1, BtnRectPair);
	m_ButtonPair.SetRgnStyle(0);
	m_ButtonPair.SetRgnMask(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonPair.SetMaskBitmapId(IDB_RMCDEMO_MASK, TRUE);
	m_ButtonPair.SetBitmapId(9, IDB_RMCDEMO_PAIR_NORMAL, IDB_RMCDEMO_PAIR_MOVE,
		IDB_RMCDEMO_PAIR_DOWN, IDB_RMCDEMO_PAIR_MOVE);



	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void MtnTesterEntry::UpdateComboBoxMachineType()
{
	CComboBox *pSysMachineTypeCombo =((CComboBox *) GetDlgItem(IDC_COMBO_SYS_MACHINE_TYPE));
	CString cstrTemp;

	//pWbAppPerformCheckCombo->Clear(); clear current item
	pSysMachineTypeCombo->ResetContent();

	if(get_sys_language_option() == LANGUAGE_UI_EN)
	{
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_VLED_MAGAZINE, _T(astrMachineTypeNameLabel_en[WB_MACH_TYPE_VLED_MAGAZINE]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_VLED_FORK, _T(astrMachineTypeNameLabel_en[WB_MACH_TYPE_VLED_FORK]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_HORI_LED, _T(astrMachineTypeNameLabel_en[WB_MACH_TYPE_HORI_LED]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_ONE_TRACK_13V_LED, _T(astrMachineTypeNameLabel_en[WB_MACH_TYPE_ONE_TRACK_13V_LED]));
		pSysMachineTypeCombo->InsertString(WB_STATION_XY_VERTICAL, _T(astrMachineTypeNameLabel_en[WB_STATION_XY_VERTICAL]));
		pSysMachineTypeCombo->InsertString(WB_STATION_XY_TOP, _T(astrMachineTypeNameLabel_en[WB_STATION_XY_TOP]));
		pSysMachineTypeCombo->InsertString(WB_STATION_BH, _T(astrMachineTypeNameLabel_en[WB_STATION_BH]));
		pSysMachineTypeCombo->InsertString(WB_STATION_WIRE_CLAMP, _T(astrMachineTypeNameLabel_en[WB_STATION_WIRE_CLAMP]));
		pSysMachineTypeCombo->InsertString(WB_STATION_EFO_BSD, _T(astrMachineTypeNameLabel_en[WB_STATION_EFO_BSD]));
		pSysMachineTypeCombo->InsertString(WB_STATION_USG_LIGHTING_PR, _T(astrMachineTypeNameLabel_en[WB_STATION_USG_LIGHTING_PR]));
		pSysMachineTypeCombo->InsertString(BE_WB_ONE_TRACK_18V_LED, _T(astrMachineTypeNameLabel_en[BE_WB_ONE_TRACK_18V_LED]));  // 20120704
		pSysMachineTypeCombo->InsertString(BE_WB_HORI_20T_LED, _T(astrMachineTypeNameLabel_en[BE_WB_HORI_20T_LED]));  // 20120827
	}
	else
	{
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_VLED_MAGAZINE, _T(astrMachineTypeNameLabel_cn[WB_MACH_TYPE_VLED_MAGAZINE]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_VLED_FORK, _T(astrMachineTypeNameLabel_cn[WB_MACH_TYPE_VLED_FORK]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_HORI_LED, _T(astrMachineTypeNameLabel_cn[WB_MACH_TYPE_HORI_LED]));
		pSysMachineTypeCombo->InsertString(WB_MACH_TYPE_ONE_TRACK_13V_LED, _T(astrMachineTypeNameLabel_cn[WB_MACH_TYPE_ONE_TRACK_13V_LED]));
		pSysMachineTypeCombo->InsertString(WB_STATION_XY_VERTICAL, _T(astrMachineTypeNameLabel_cn[WB_STATION_XY_VERTICAL]));
		pSysMachineTypeCombo->InsertString(WB_STATION_XY_TOP, _T(astrMachineTypeNameLabel_cn[WB_STATION_XY_TOP]));
		pSysMachineTypeCombo->InsertString(WB_STATION_BH, _T(astrMachineTypeNameLabel_cn[WB_STATION_BH]));
		pSysMachineTypeCombo->InsertString(WB_STATION_WIRE_CLAMP, _T(astrMachineTypeNameLabel_cn[WB_STATION_WIRE_CLAMP]));
		pSysMachineTypeCombo->InsertString(WB_STATION_EFO_BSD, _T(astrMachineTypeNameLabel_cn[WB_STATION_EFO_BSD]));
		pSysMachineTypeCombo->InsertString(WB_STATION_USG_LIGHTING_PR, _T(astrMachineTypeNameLabel_cn[WB_STATION_USG_LIGHTING_PR]));
		pSysMachineTypeCombo->InsertString(BE_WB_ONE_TRACK_18V_LED, _T(astrMachineTypeNameLabel_cn[BE_WB_ONE_TRACK_18V_LED]));  // 20120704
		pSysMachineTypeCombo->InsertString(BE_WB_HORI_20T_LED, _T(astrMachineTypeNameLabel_cn[BE_WB_HORI_20T_LED]));  // 20120704
	}
	pSysMachineTypeCombo->SetCurSel(get_sys_machine_type_flag());  // iFlagSysMachineType, 
}
Ejemplo n.º 26
0
void vPopulateFCLength(CComboBox& omComboBox)
{
	omComboBox.ResetContent();
	omComboBox.InsertString(0,"3");
	omComboBox.InsertString(1,"8");   //We just have two options for the length of Flowcontrol
}
Ejemplo n.º 27
0
BOOL CDynToolBar::PreTranslateMessage(MSG* pMsg)
  {// Handle a few messages for our children...
  CWnd* pWnd = FromHandle(pMsg->hwnd); //Get a temp CWnd object for the message we're processing.
  //if (pMsg->message!=WM_PAINT)
  //  {
  //  sprintf(buff, "H=%08x ", (DWORD)(pWnd->m_hWnd));
  //  dbgWM_Msg(buff, pMsg->message, pMsg->wParam, pMsg->lParam, 1);
  //  }
  if (IsChild(pWnd))
    {//It's a child of ours...
    CWnd* pParent = pWnd->GetParent();
    if (pParent && pParent->IsKindOf(RUNTIME_CLASS(CComboBox)))
      {//The parent is a ComboBox!
      switch (pMsg->message)
        {
        case WM_KEYDOWN:
          if (pMsg->wParam==VK_RETURN)
            {
            int Index = FindComboButtonIndex(pParent);
            if (Index>=0)
              {
              int IDIndex = FindComboButtonIDIndex(Index);
              if (IDIndex>=0)
                {
                CComboBox* pCBox = (CComboBox*)pParent;
                int nIndex = pCBox->GetCurSel();
                if (nIndex==CB_ERR)
                  {
                  pCBox->GetWindowText(sCurSel);
                  if (sCurSel.GetLength()>0 && pCBox->FindStringExact(-1, (const char*)sCurSel)==CB_ERR)
                    {
                    bComboListChanged = 1;
                    pCBox->InsertString(0, (const char*)sCurSel);
                    pCBox->SetCurSel(0);
                    }
                  }
                else
                  {
                  pCBox->GetLBText(nIndex, sCurSel);
                  if (nIndex>0)
                    {
                    bComboListChanged = 1;
                    pCBox->DeleteString(nIndex);
                    pCBox->InsertString(0, (const char*)sCurSel);
                    pCBox->SetCurSel(0);
                    }
                  }
                ScdMainWnd()->PostMessage(WM_COMMAND, BtnIDs[IDIndex]);
                }
              }
            }
          else if (bUseEscape && pMsg->wParam==VK_ESCAPE)
            {
            ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Esc);
            }
          break;
        }//end switch
      }
    else if (pParent && pParent->IsKindOf(RUNTIME_CLASS(CEdit)))
      {//The parent is a CEdit!
      switch (pMsg->message)
        {
        case WM_KEYDOWN:
          if (pMsg->wParam==VK_RETURN)
            {
            ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Done);
            }
          else if (bUseEscape && pMsg->wParam==VK_ESCAPE)
            {
            ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Esc);
            }
          break;
        }//end switch
      }
    }
  return CToolBar::PreTranslateMessage(pMsg);
  }
Ejemplo n.º 28
0
BOOL CBrushBaseParamTabDialog::OnInitDialog()
{
	CDialog::OnInitDialog();

	CEdit* pEdit;
	CComboBox* pCombo;
	CSliderCtrl* pSld;

	//base radius
	m_prev_org_rad = m_pEditBrush->GetOrgRadius();
	pSld = (CSliderCtrl*) GetDlgItem(IDC_BASE_RAD_SLD);
	if (pSld) {
		pSld->SetRange(
			IEBrush::MIN_RADIUS,
			IEBrush::MAX_RADIUS);
		pSld->SetPos( m_prev_org_rad );
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_BASE_RAD_SLD\n");
	}
	pEdit = (CEdit*) GetDlgItem(IDC_BASE_RAD_EDIT);
	if (pEdit) {
		TCHAR txt[256];
		wsprintf(txt, "%d", m_prev_org_rad);
		pEdit->SetWindowText(txt);
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_BASE_RAD_EDIT\n");
	}
	m_prev_rad_ctrl_id = m_pEditBrush->GetRadiusCtrlID();
	pCombo = (CComboBox*) GetDlgItem(IDC_RAD_CTRL_COMBO);
	if (pCombo) {
		pCombo->InsertString(IE_BRUSH_CTRL_ID::OFF, "オフ");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::PRESSURE, "筆圧");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::AZIMUTH, "回転");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::ALTITUDE, "傾き");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::RANDOM, "ランダム");
		pCombo->SetCurSel(m_prev_rad_ctrl_id);
	}

	//alpha
	m_prev_alpha_ctrl_id = m_pEditBrush->GetAlphaCtrlID();
	pCombo = (CComboBox*) GetDlgItem(IDC_ALPHA_CTRL_COMBO);
	if (pCombo) {
		pCombo->InsertString(IE_BRUSH_CTRL_ID::OFF, "オフ");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::PRESSURE, "筆圧");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::AZIMUTH, "回転");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::ALTITUDE, "傾き");
		pCombo->InsertString(IE_BRUSH_CTRL_ID::RANDOM, "ランダム");
		pCombo->SetCurSel(m_prev_alpha_ctrl_id);
	}

	//hardness
	m_prev_hardness = m_pEditBrush->GetHardness();
	pSld = (CSliderCtrl*) GetDlgItem(IDC_HARDNESS_SLD);
	if (pSld) {
		pSld->SetRange(0, 100);
		pSld->SetPos( m_prev_hardness );
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_HARDNESS_SLD\n");
	}
	pEdit = (CEdit*) GetDlgItem(IDC_HARDNESS_EDIT);
	if (pEdit) {
		TCHAR txt[256];
		wsprintf(txt, "%d", m_prev_hardness);
		pEdit->SetWindowText(txt);
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_HARDNESS_EDIT\n");
	}

	//min radius
	m_prev_min_rad = m_pEditBrush->GetMinRadius();
	pSld = (CSliderCtrl*) GetDlgItem(IDC_MIN_RAD_SLD);
	if (pSld) {
		pSld->SetRange(0, 100);
		pSld->SetPos( m_prev_min_rad );
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_RAD_SLD\n");
	}
	pEdit = (CEdit*) GetDlgItem(IDC_MIN_RAD_EDIT);
	if (pEdit) {
		TCHAR txt[256];
		wsprintf(txt, "%d", m_prev_min_rad);
		pEdit->SetWindowText(txt);
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_RAD_EDIT\n");
	}

	//min alpha
	m_prev_min_alpha = m_pEditBrush->GetMinAlpha();
	pSld = (CSliderCtrl*) GetDlgItem(IDC_MIN_ALPHA_SLD);
	if (pSld) {
		pSld->SetRange(0, 100);
		pSld->SetPos( m_prev_min_alpha );
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_ALPHA_SLD\n");
	}
	pEdit = (CEdit*) GetDlgItem(IDC_MIN_ALPHA_EDIT);
	if (pEdit) {
		TCHAR txt[256];
		wsprintf(txt, "%d", m_prev_min_alpha);
		pEdit->SetWindowText(txt);
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_ALPHA_EDIT\n");
	}

	//interval
	m_prev_interval = m_pEditBrush->GetInterval();
	pSld = (CSliderCtrl*) GetDlgItem(IDC_INTERVAL_SLD);
	if (pSld) {
		pSld->SetRange(
			IEBrush::MIN_INTERVAL,
			IEBrush::MAX_INTERVAL);
		pSld->SetPos( m_prev_interval );
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_INTERVAL_SLD\n");
	}
	pEdit = (CEdit*) GetDlgItem(IDC_INTERVAL_EDIT);
	if (pEdit) {
		TCHAR txt[256];
		wsprintf(txt, "%d", m_prev_interval);
		pEdit->SetWindowText(txt);
	}
	else {
		::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_INTERVAL_EDIT\n");
	}

	return TRUE;
}
Ejemplo n.º 29
0
//-----  BroadcastEvent()  ----------------------------------------------------
BOOL CFormChunkMergeView::BroadcastEvent(WORD event, void* pParameter)
{
	switch (event)
	{
		case IBCE_CHANGED_SETTINGS:
		{
			//  set settings from configuration
			Configuration*	pConfig (Configuration::getInstance());
			CComboBox*		pCBox   ((CComboBox*) GetDlgItem(IDC_CB_TEMPLATE));
			set<string>		tDirList(pConfig->getDirListTemplates());
			CString			tmpPath (pConfig->_cmDefaultTemplate.c_str());

			//- templates
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "Adding templates");
			pCBox->ResetContent();
			for (auto pIter(tDirList.begin()), pEnd(tDirList.end()); pIter != pEnd; ++pIter)
			{
				if (pIter->rfind(".nif") == string::npos)		continue;
				pCBox->AddString(CString(pIter->c_str()));
				LogMessageObject::LogMessage(NCU_MSG_TYPE_SUB_INFO, "added: %s", pIter->c_str());
			}
			pCBox->SelectString(-1, CString(tmpPath));
			pCBox->GetWindowText(tmpPath);
			if (tmpPath.IsEmpty())		pCBox->SetCurSel(0);
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "templates found: %d", tDirList.size());

			//- materials
			pCBox = (CComboBox*) GetDlgItem(IDC_CB_MAT_SINGLE);
			map<string, NifUtlMaterial>		matMap(NifUtlMaterialList::getInstance()->getMaterialMap());
			short							tIdx  (0);
			short							selIdx(0);

			//  add materials to combo box
			for (auto pIter(matMap.begin()), pEnd(matMap.end()); pIter != pEnd; ++pIter, ++tIdx)
			{
				pCBox->InsertString  (tIdx, CString(pIter->second._name.c_str()));
				pCBox->SetItemDataPtr(tIdx, (void*) (pIter->second._code));

				if (pIter->second._code == pConfig->_cmMatSingleType)
				{
					selIdx = tIdx;
				}
			}
			pCBox->SetCurSel(selIdx);

			//  material flags
			int		selItem(pConfig->_cmMatHandling + IDC_RD_MAT_SINGLE);

			((CButton*) GetDlgItem(IDC_RD_MAT_SINGLE))    ->SetCheck(selItem == IDC_RD_MAT_SINGLE);
			((CButton*) GetDlgItem(IDC_RD_MAT_NITRISHAPE))->SetCheck(selItem == IDC_RD_MAT_NITRISHAPE);
			((CButton*) GetDlgItem(IDC_RD_MAT_DEFINE))    ->SetCheck(selItem == IDC_RD_MAT_DEFINE);
			GetDlgItem(IDC_CB_MAT_SINGLE)->EnableWindow(selItem == IDC_RD_MAT_SINGLE);
			GetDlgItem(IDC_BT_MAT_DEFINE)->EnableWindow(selItem == IDC_RD_MAT_DEFINE);

			//  collision flags
			selItem = pConfig->_cmCollHandling + IDC_RD_COLL_CDATA;
			((CButton*) GetDlgItem(IDC_RD_COLL_CDATA))->SetCheck(selItem == IDC_RD_COLL_CDATA);
			((CButton*) GetDlgItem(IDC_RD_COLL_FBACK))->SetCheck(selItem == IDC_RD_COLL_FBACK);
			((CButton*) GetDlgItem(IDC_RD_COLL_MESH)) ->SetCheck(selItem == IDC_RD_COLL_MESH);

			//  other flags
			((CButton*) GetDlgItem(IDC_RD_COLL_LOCAL))  ->SetCheck(pConfig->_cmMergeColl   ? BST_UNCHECKED : BST_CHECKED);
			((CButton*) GetDlgItem(IDC_RD_COLL_GLOBAL)) ->SetCheck(pConfig->_cmMergeColl   ? BST_CHECKED   : BST_UNCHECKED);
			((CButton*) GetDlgItem(IDC_CK_REORDER_TRIS))->SetCheck(pConfig->_cmReorderTris ? BST_CHECKED   : BST_UNCHECKED);

			break;
		}

		case IBCE_SET_TOOLTIPP:
		{
			_toolTipCtrl.Activate(Configuration::getInstance()->_showToolTipps);
			break;
		}
	}  //  switch (event)

	return TRUE;
}
Ejemplo n.º 30
0
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate dialog
	SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
	SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
	SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
	SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
	SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
	SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
	SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
	SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
	SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_CONN, CTSTRING(FAVORITE_HUB_CONNECTION));
	SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
	SetDlgItemText(IDC_FAV_NO_PM, CTSTRING(FAV_NO_PM));
	SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
	SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
	SetDlgItemText(IDC_FAILOVER, CTSTRING(ACCEPT_FAILOVERS_FAV));
	SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));

	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));
	SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));

	SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
	SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
	SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));

	// Fill in values
	SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
	SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
	SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServerStr()).c_str());
	SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
	SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
	SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
	SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());

	SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());

	CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
	CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
	CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
	CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));
	CheckDlgButton(IDC_FAILOVER, toInt(entry->get(HubSettings::AcceptFailovers)));

	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	auto searchInterval = entry->get(HubSettings::SearchInterval);
	CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HubSettings::getMinInt() ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());

	bool isAdcHub = entry->isAdcHub();

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
	combo.AddString(_T("---"));
	combo.SetCurSel(0);

	const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
	for(const auto& name: favHubGroups | map_keys) {
		int pos = combo.AddString(Text::toT(name).c_str());
		
		if(name == entry->getGroup())
			combo.SetCurSel(pos);
	}

	combo.Detach();

	// TODO: add more encoding into wxWidgets version, this is enough now
	// FIXME: following names are Windows only!
	combo.Attach(GetDlgItem(IDC_ENCODING));
	combo.AddString(_T("System default"));
	combo.AddString(_T("English_United Kingdom.1252"));
	combo.AddString(_T("Czech_Czech Republic.1250"));
	combo.AddString(_T("Russian_Russia.1251"));
	combo.AddString(Text::toT(Text::utf8).c_str());

	ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
	appendProfiles();
	hideShare = entry->getShareProfile() && entry->getShareProfile()->getToken() == SP_HIDDEN;
	CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);


	if(isAdcHub) {
		combo.SetCurSel(4); // select UTF-8 for ADC hubs
		combo.EnableWindow(false);
		if (hideShare)
			ctrlProfile.EnableWindow(false);
	} else {
		ctrlProfile.EnableWindow(false);
		if(entry->getEncoding().empty()) {
			combo.SetCurSel(0);
		} else {
			combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
		}
	}

	combo.Detach();

	// connection modes
	auto appendCombo = [](CComboBox& combo, int curMode) {
		combo.InsertString(0, CTSTRING(DEFAULT));
		combo.InsertString(1, CTSTRING(DISABLED));
		combo.InsertString(2, CTSTRING(ACTIVE_MODE));
		combo.InsertString(3, CTSTRING(PASSIVE_MODE));

		if(curMode == HubSettings::getMinInt())
			combo.SetCurSel(0);
		else if(curMode == SettingsManager::INCOMING_DISABLED)
			combo.SetCurSel(1);
		else if(curMode == SettingsManager::INCOMING_ACTIVE)
			combo.SetCurSel(2);
		else if(curMode == SettingsManager::INCOMING_PASSIVE)
			combo.SetCurSel(3);
	};

	modeCombo4.Attach(GetDlgItem(IDC_MODE4));
	modeCombo6.Attach(GetDlgItem(IDC_MODE6));

	appendCombo(modeCombo4, entry->get(HubSettings::Connection));
	appendCombo(modeCombo6, entry->get(HubSettings::Connection6));

	//external ips
	SetDlgItemText(IDC_SERVER4, Text::toT(entry->get(HubSettings::UserIp)).c_str());
	SetDlgItemText(IDC_SERVER6, Text::toT(entry->get(HubSettings::UserIp6)).c_str());

	fixControls();

	CEdit tmp;
	tmp.Attach(GetDlgItem(IDC_HUBNAME));
	tmp.SetFocus();
	tmp.SetSel(0,-1);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_NICK));
	tmp.LimitText(35);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_USERDESC));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_EMAIL));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBPASS));
	tmp.SetPasswordChar('*');
	tmp.Detach();
	
	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(5, 9999);
	updown.Detach();

	CenterWindow(GetParent());
	loaded = true;
	return FALSE;
}