Ejemplo n.º 1
1
void CEasyClientDlg::OnCbnSelchangeComboSource()
{
	CComboBox* pComboxMediaSource = (CComboBox*)GetDlgItem(IDC_COMBO_SOURCE);
	CComboBox* pVideoCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CAMERA) ;
	CComboBox* pComboxAudioSource = (CComboBox*)GetDlgItem(IDC_COMBO_MIC) ;
	CEdit* pEdtRtspSource = (CEdit*)GetDlgItem(IDC_EDIT_SREAM_URL);

	if (NULL == pComboxMediaSource)		return;

	int iCount = pComboxMediaSource->GetCount();
	int iSel = pComboxMediaSource->GetCurSel();
	if (iSel == 0)
	{
		pVideoCombo->EnableWindow(TRUE);
		pComboxAudioSource->EnableWindow(TRUE);
		pEdtRtspSource->SetReadOnly(TRUE);
	} 
	else
	{
		pVideoCombo->EnableWindow(FALSE);
		pComboxAudioSource->EnableWindow(FALSE);
		pEdtRtspSource->SetReadOnly(FALSE);
	}

// 	if (NULL != pComboxAudioSource)	pComboxAudioSource->ShowWindow(iSel == iCount-1?SW_HIDE:SW_SHOW);
// 	if (NULL != pEdtRtspSource)	pEdtRtspSource->ShowWindow(iSel == iCount-1?SW_SHOW:SW_HIDE);
// 
}
LRESULT FavHubProperties::OnTextChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	if (!loaded)
		return 0;
	
	if (wID == IDC_HUBADDR) {
		CComboBox combo;
		combo.Attach(GetDlgItem(IDC_ENCODING));
		tstring address;
		address.resize(1024);
		address.resize(GetDlgItemText(IDC_HUBADDR, &address[0], 1024));

		if(AirUtil::isAdcHub(Text::fromT(address))) {
			if (!hideShare)
				ctrlProfile.EnableWindow(true);
			combo.SetCurSel(4); // select UTF-8 for ADC hubs
			::EnableWindow(GetDlgItem(IDC_STEALTH),	0);
			combo.EnableWindow(false);
		} else {
			ctrlProfile.EnableWindow(false);
			::EnableWindow(GetDlgItem(IDC_STEALTH),	1);
			combo.EnableWindow(true);
		}
		combo.Detach();
	}

	return TRUE;
}
Ejemplo n.º 3
0
BOOL DlgEditCustomEvent::OnInitDialog() 
{
	CDialog::OnInitDialog();
	TString str;
	
// TODO: Add extra initialization here
	CComboBox * p;
	int i;

	p = (CComboBox *)GetDlgItem(IDC_COMBO1);
	for(i =0; i < 30; i++)
	{
		str.Format("%s Tithi (%s Paksa)", GCStrings::GetTithiName(i), GCStrings::GetPaksaName(i/15));
		p->AddString(str);
	}
	p->SetCurSel(this->m_nTithi);
	if (m_nClass != 6)
		p->EnableWindow(FALSE);

	p = (CComboBox *)GetDlgItem(IDC_COMBO2);
	for(i = 0; i < 12; i++)
	{
		p->AddString(GCStrings::GetMasaName(i));
	}
	p->SetCurSel(this->m_nMasa);
	if (m_nClass != 6)
		p->EnableWindow(FALSE);

	p = (CComboBox *)GetDlgItem(IDC_COMBO3);
	for(i = 0; i <= 6; i++)
	{
		p->AddString(GCStrings::GetEventClassText(i));
	}
	p->SetCurSel(this->m_nClass);
	if (m_nClass != 6)
		p->EnableWindow(FALSE);
	else
		p->EnableWindow(GCDisplaySettings::getValue(44)==1);
	
	p = (CComboBox *)GetDlgItem(IDC_COMBO4);
	p->AddString("no fast");
	p->AddString(GCStrings::GetFastingName(0x201));
	p->AddString(GCStrings::GetFastingName(0x202));
	p->AddString(GCStrings::GetFastingName(0x203));
	p->AddString(GCStrings::GetFastingName(0x204));
	p->AddString(GCStrings::GetFastingName(0x205));
	p->SetCurSel(this->m_nFastType);
	if (m_nClass != 6)
		p->EnableWindow(FALSE);

	if (m_nClass != 6)
		GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE);

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CTabCharacteristicsDlg::SetValue(int nValue, CComboBox &cb)
{
	int nCount = cb.GetCount();
	for (int i=0;i<nCount;i++)
		if ((int)cb.GetItemData(i) == nValue)
		{
			cb.SetCurSel(i);
			cb.EnableWindow(TRUE);
			return(TRUE);
		}

	cb.SetCurSel(-1);
	cb.EnableWindow(FALSE);
	return(FALSE);
}
Ejemplo n.º 5
0
void wing_editor::OnSelchangeDepartureLocation() 
{
	CComboBox *box;

	box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET);
	UpdateData();
	if (m_departure_location) {
		GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(TRUE);
		if (m_departure_target < 0) {
			m_departure_target = 0;
		}
		// we need to build up the list box content based on the departure type.  When
		// from a docking bay, only show ships in the list which have them.  Show all ships otherwise
		if ( m_departure_location == DEPART_AT_DOCK_BAY ) {
			management_add_ships_to_combo( box, SHIPS_2_COMBO_DOCKING_BAY_ONLY );
		} else {
			// I think that this section is currently illegal
			Int3();
		}
	} else {
		box->ResetContent();
		box->EnableWindow(TRUE);
		if ( m_departure_target < 0 )
			m_departure_target = -1;
		m_departure_target = 0;
		box->AddString("None");
		for (int i=0; i<Num_jump_nodes; i++)  
			box->AddString(Jumppoint_lists[i].name);
		//GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE);
	}
	UpdateData(FALSE);
}
Ejemplo n.º 6
0
void CoptimizerDlg::OnBnClickedRadioCustom()
{
	CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM);
	CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET);

	CBox->EnableWindow(FALSE);
	Slider->EnableWindow(TRUE);
}
Ejemplo n.º 7
0
void CMainFrame::OnUpdateFontName(CCmdUI* /*pCmdUI*/)
{
	CComboBox *pCombo = (CComboBox*)GetFontNameCombo();
	ASSERT_VALID(pCombo);

	//If Source View, don't display the font name combobox
	if(m_dwCurrentView == ID_VIEW_SOURCE)
	{
		pCombo->EnableWindow(FALSE);
		return;
	}
	else
	{
		if(m_pWebView->QueryStatus(IDM_BLOCKFMT) & OLECMDF_ENABLED)
			pCombo->EnableWindow();
		else
			pCombo->EnableWindow(FALSE);
	}
}
Ejemplo n.º 8
0
void CSummonDlg::SelectAAC(BOOL check)
{
	CComboBox *cBox;
	CButton *cBut;
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_OUTPUT_MPEG_VERSION);
	cBox->EnableWindow(check);
	cBox->ResetContent();
	cBox->AddString((LPCTSTR)"MPEG4");
	cBox->AddString((LPCTSTR)"MPEG2");
	cBox->SetCurSel(1);
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_OUTPUT_AAC_VERSION);
	cBox->EnableWindow(check);
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_AAC_BANDWIDTH);
	cBox->EnableWindow(check);
	cBut=(CButton *)GetDlgItem( IDC_RADIO_SUMMON_AAC_BANDWIDTH);
	cBut->EnableWindow(check);
	
	
}
Ejemplo n.º 9
0
void DiskEditDialog::InitNibbleParmList(void)
{
    ASSERT(fpDiskFS != NULL);
    DiskImg* pDiskImg = fpDiskFS->GetDiskImg();
    CComboBox* pCombo;

    pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
    ASSERT(pCombo != NULL);

    if (pDiskImg->GetHasNibbles()) {
        const DiskImg::NibbleDescr* pTable;
        const DiskImg::NibbleDescr* pCurrent;
        int i, count;

        pTable = pDiskImg->GetNibbleDescrTable(&count);
        if (pTable == NULL || count <= 0) {
            LOGI("WHOOPS: nibble parm got table=0x%08lx, count=%d",
                (long) pTable, count);
            return;
        }
        pCurrent = pDiskImg->GetNibbleDescr();

        /* configure the selection to match the disk analysis */
        int dflt = -1;
        if (pCurrent != NULL) {
            for (i = 0; i < count; i++) {
                if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) {
                    LOGI("  NibbleParm match on entry %d", i);
                    dflt = i;
                    break;
                }
            }

            if (dflt == -1) {
                LOGI("  GLITCH: no match on nibble descr in table?!");
                dflt = 0;
            }
        }

        for (i = 0; i < count; i++) {
            if (pTable[i].numSectors > 0) {
                CString description(pTable[i].description);
                pCombo->AddString(description);
            } else {
                /* only expecting this on the last, "custom" entry */
                ASSERT(i == count-1);
            }
        }
        pCombo->SetCurSel(dflt);
    } else {
        pCombo->AddString(L"Nibble Parms");
        pCombo->SetCurSel(0);
        pCombo->EnableWindow(FALSE);
    }
}
Ejemplo n.º 10
0
void CFcFontBar::SetSelectedFontSize(int Size, BOOL bEnable) 
{
	CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_FONTSIZE);
	ASSERT_VALID(pCb);

	if (Size > 0)
		pCb->SetCurSel(Size -1);
	else
		pCb->SetCurSel(-1);

	pCb->EnableWindow(bEnable);
}
Ejemplo n.º 11
0
void CFcFontBar::SetSelectedFontName(const CString& SelectString, BOOL bEnable) 
{
	CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_FONTNAME);
	ASSERT_VALID(pCb);

	if (SelectString.GetLength() > 0)
		pCb->SelectString(-1, SelectString);
	else
		pCb->SetCurSel(-1);

	pCb->EnableWindow(bEnable);
}
Ejemplo n.º 12
0
void CoptimizerDlg::OnBnClickedRadioPreset()
{	
	CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET);
	CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM);
	int Sel;

	Sel = CBox->GetCurSel();
	CBox->EnableWindow(TRUE);
	
	SetSlider(Slider, Sel);
	Slider->EnableWindow(FALSE);
}
Ejemplo n.º 13
0
void CFolderSet::UpdatePackSet()
{
	CButton* pPack = (CButton*)GetDlgItem(IDC_RADIO_PACK);
	CButton* pUnPack = (CButton*)GetDlgItem(IDC_RADIO_UNPACK);
	CComboBox* pComboPack = (CComboBox*)GetDlgItem(IDC_COMBO_PACKAGE_TYPE);	
	if(pPack == NULL || pUnPack == NULL || pComboPack == NULL)	return;

	CButton* pCompress = (CButton*)GetDlgItem(IDC_RADIO_COMPRESS);
	CButton* pUnCompress = (CButton*)GetDlgItem(IDC_RADIO_UNCOMPRESS);
	CComboBox* pComboCompress= (CComboBox*)GetDlgItem(IDC_COMBO_COMPRESS_TYPE);
	if(pCompress == NULL || pUnCompress == NULL || pComboCompress == NULL)	return;

	if( (m_nPackType & 0x1) == 1)
	{
		pPack->SetCheck(BST_UNCHECKED);
		pUnPack->SetCheck(BST_CHECKED);
		pComboPack->EnableWindow(false);
		pComboPack->SetCurSel(-1);
		//设置为不压缩
		pCompress->SetCheck(BST_UNCHECKED);
		pCompress->EnableWindow(false);
		pUnCompress->SetCheck(BST_CHECKED);
		pComboCompress->EnableWindow(false);
	}
	else
	{
		pPack->SetCheck(BST_CHECKED);
		pUnPack->SetCheck(BST_UNCHECKED);
		pComboPack->EnableWindow(true);
		int nPos = GetComcoPackPosByID(m_nPackType);
		pComboPack->SetCurSel(nPos);

		//设置为不压缩
		pCompress->EnableWindow(true);
		pComboCompress->EnableWindow(true);
	}
}
Ejemplo n.º 14
0
void CAntiVirus::Enum(CComboBox& wndAntiVirus)
{
	if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
		return;

	wndAntiVirus.ResetContent();

	// No anti-virus
	int nAntiVirus = wndAntiVirus.AddString( _T("") );
	wndAntiVirus.SetItemDataPtr( nAntiVirus, (LPVOID)new CString() );

	// Enum available anti-viruses
	CComPtr< ICatInformation > pInfo;
	HRESULT hr = pInfo.CoCreateInstance( CLSID_StdComponentCategoriesMgr );
	if ( SUCCEEDED( hr ) )
	{
		const CATID IDs[ 1 ] = { CATID_MSOfficeAntiVirus };
        CComPtr< IEnumCLSID > pEnum;
        hr = pInfo->EnumClassesOfCategories( 1, IDs, 0, NULL, &pEnum );
		if ( SUCCEEDED( hr ) )
		{
			CLSID clsid;
			while ( pEnum->Next( 1, &clsid, NULL ) == S_OK )
			{
				const CString sCLSID = Hashes::toGuid( clsid, true );
				HKEY hClass = NULL;
				if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_CLASSES_ROOT, _T("CLSID\\") + sCLSID, 0, KEY_READ, &hClass ) )
				{
					// Get it name
					TCHAR szValue[ MAX_PATH ] = {};
					DWORD nValue = MAX_PATH, nType = REG_SZ;
					if ( ERROR_SUCCESS == RegQueryValueEx( hClass, NULL, NULL, &nType, (LPBYTE)szValue, &nValue ) )
					{
						const int nIndex = wndAntiVirus.AddString( szValue );
						wndAntiVirus.SetItemDataPtr( nIndex, (LPVOID)new CString( sCLSID ) );
						if ( Settings.General.AntiVirus.CompareNoCase( sCLSID ) == 0 )
						{
							nAntiVirus = nIndex;
						}
					}
					RegCloseKey( hClass );
				}
			}
		}
	}

	wndAntiVirus.SetCurSel( nAntiVirus );
	wndAntiVirus.EnableWindow( wndAntiVirus.GetCount() > 1 );
}
Ejemplo n.º 15
0
BOOL CValueList::SetComboBoxValue(CComboBox &cb, int nValue, BOOL bDisableOnNoMatch)
{
	CValueItem vi;

	int nCount = cb.GetCount();
	for (int i=0;i<nCount;i++)
		if ((int)cb.GetItemData(i) == nValue)
		{
			cb.SetCurSel(i);
			if (bDisableOnNoMatch)
				cb.EnableWindow(TRUE);
			return(TRUE);
		}

	cb.SetCurSel(-1);
	if (bDisableOnNoMatch)
		cb.EnableWindow(FALSE);
	return(FALSE);

	cb.SetCurSel(-1);
	if (bDisableOnNoMatch)
		cb.EnableWindow(FALSE);
	return(FALSE);
}
Ejemplo n.º 16
0
void CfsclientwDlg::enableButton(const char* name, int enabled)
{
	CButton* pbut = NULL;
	if (strcmp(name, "connect") == 0)
	{
		pbut = (CButton*)GetDlgItem(IDC_BUTCONN);
		pbut->EnableWindow(enabled);
		return;
	}
	if (strcmp(name, "download") == 0)
	{
		pbut = (CButton*)GetDlgItem(IDC_BUTDW);
		pbut->EnableWindow(enabled);
		return;
	}
	if (strcmp(name, "server") == 0)
	{
		CComboBox* pcb = (CComboBox*)GetDlgItem(IDC_COMBOSRV);
		pcb->EnableWindow(enabled);
		return;
	}
}
Ejemplo n.º 17
0
BOOL CEdgeTab::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CButton* pButton = (CButton*)GetDlgItem(IDC_NETWORK_EDGE_CHECK);
	CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO);
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_WEIGHT_EDIT);
	pButton->EnableWindow(m_bEmptyE);
	pCombo->EnableWindow(m_bEmptyE);
	pCombo->SetCurSel(m_lpControlStruct->edgeType);
	if (m_lpControlStruct->edgeType == None) {
		pEdit->EnableWindow(FALSE);
		pButton->EnableWindow(FALSE);	
	}
	else{
		pEdit->EnableWindow(TRUE);
		pEdit->SetWindowText(m_lpControlStruct->defaultWeightOfEdge);
	}
	GetDlgItem(IDC_CAPACITY_EDIT)->EnableWindow(pButton->GetCheck() == 1);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 18
0
int CChannelConfigurationDlg::nDisplayProtocolSettings(int nChannelIndex)
{
    if ( m_eBusType == LIN )
    {
        BOOL bOverrite = m_ouFlexrayChannelConfig[nChannelIndex].m_ouLinParams.m_bOverWriteSettings;

        ((CButton*)GetDlgItem(IDC_CHECK_OVERWRITE_SETTINGS))->SetCheck(bOverrite);

        CComboBox* pomCombo = (CComboBox*)GetDlgItem(IDC_COMBO_LIN_PROTOCOL);
        pomCombo->EnableWindow(bOverrite);

        GetDlgItem(IDC_EDIT_LIN_BAUDRATE)->EnableWindow(bOverrite);

        m_nLinBaudRate = 19200;
        pomCombo->SetCurSel(0);
        for ( int i = 0 ; i < ( sizeof(sg_LINPROTOCOL_BAUD)/ sizeof(sg_LINPROTOCOL_BAUD[0])); i++ )
        {
            if ( m_ouFlexrayChannelConfig[nChannelIndex].m_ouLinParams.m_strProtocolVersion == sg_LINPROTOCOL_BAUD[i].m_strProtocol )
            {
                pomCombo->SetCurSel(i);
                if ( bOverrite == false )
                {
                    m_nLinBaudRate = sg_LINPROTOCOL_BAUD[i].m_nBaudRate;
                }
                else
                {
                    m_nLinBaudRate =  m_ouFlexrayChannelConfig[nChannelIndex].m_ouLinParams.m_nBaudRate;
                }

                break;
            }
        }
        ((CButton*)GetDlgItem(IDC_ENABLE_MASTER_MODE))->SetCheck(m_ouFlexrayChannelConfig[nChannelIndex].m_ouLinParams.m_bIsMasterMode);
        UpdateData(FALSE);
    }
    return 0;
}
Ejemplo n.º 19
0
void CSummonDlg::SelectMP3(BOOL check)
{
	CButton *cBut;
	CComboBox *cBox;
	char i;

	cBut=(CButton *)GetDlgItem( IDC_RADIO_SUMMON_BITRATE);
	cBut->EnableWindow(check);
	cBut=(CButton *)GetDlgItem( IDC_RADIO1);
	cBut->EnableWindow(check);
	cBut=(CButton *)GetDlgItem( IDC_RADIO6);
	cBut->EnableWindow(check);

	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_CBR);
	cBox->EnableWindow(check);
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_VBRMIN);
	cBox->EnableWindow(check);
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_VBRMAX);
	cBox->EnableWindow(check);
	
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_VBRQUALITY);
	cBox->EnableWindow(check);
	cBox->ResetContent();
	for(i='0';i<='9';i++)
	{	
		cBox->AddString((LPCTSTR)i);
	}
	cBox->SetCurSel(4);

	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_SAMPLERATE);
	cBox->EnableWindow(check);
	cBox=(CComboBox *)GetDlgItem( IDC_COMBO_SUMMON_OUTPUT_MPEG_VERSION);
	cBox->EnableWindow(check);
	cBox->ResetContent();
	cBox->AddString((LPCTSTR)"MPEG2");
	cBox->AddString((LPCTSTR)"MPEG1");
	cBox->SetCurSel(1);

}
Ejemplo n.º 20
0
void CStockPropPage::FillPropnameList(REFGUID guid, int nIndirect, CComboBox& combo)
{
	USES_CONVERSION;

	combo.ResetContent();
	UINT cProps = 0;

	ULONG nObjects;
	LPDISPATCH* ppDisp = GetObjectArray(&nObjects);

	if (ppDisp != NULL)
	{
		LPTYPEINFO pTypeInfo;
		LPTYPEATTR pTypeAttr;
		LPVARDESC pVarDesc;
		ULONG iObj;
		WORD iProp;
		BSTR rgbstr[1];
		UINT cName;

		// Get the property sheet locale
		LPPROPERTYPAGESITE pPageSite;
		if ((pPageSite = GetPageSite()) != NULL)
			if (FAILED(pPageSite->GetLocaleID(&m_lcid)))
				m_lcid = 0;

		// Iterate through all objects.

		for (iObj = 0; iObj < nObjects; iObj++)
		{
			pTypeInfo = NULL;
			if ((ppDisp[iObj] != NULL) &&
				SUCCEEDED(ppDisp[iObj]->GetTypeInfo(0, m_lcid, &pTypeInfo)))
			{
				ASSERT(pTypeInfo != NULL);
				pTypeAttr = NULL;
				if (SUCCEEDED(pTypeInfo->GetTypeAttr(&pTypeAttr)))
				{
					ASSERT(pTypeAttr != NULL);

					// Iterate through all properties of object.

					for (iProp = 0; iProp < pTypeAttr->cVars; iProp++)
					{
						pVarDesc = NULL;
						if (SUCCEEDED(pTypeInfo->GetVarDesc(iProp, &pVarDesc)))
						{
							// Check whether property has desired type

							if (!(pVarDesc->wVarFlags & VARFLAG_FHIDDEN) &&
								AfxOleTypeMatchGuid(pTypeInfo,
									&pVarDesc->elemdescVar.tdesc, guid,
									nIndirect))
							{
								// Get property name and insert into list.

								if (SUCCEEDED(pTypeInfo->GetNames(
										pVarDesc->memid, rgbstr, 1, &cName)))
								{
									// Don't insert duplicates.

									LPCTSTR lpstr = OLE2CT(rgbstr[0]);
									if (combo.FindString(-1, lpstr)
											== CB_ERR)
									{
										int iItem = combo.AddString(lpstr);
										if (iItem >= 0)
										{
											combo.SetItemData(iItem, (DWORD)pVarDesc->memid);
											++cProps;
										}
									}

									SysFreeString(rgbstr[0]);
								}
							}
							pTypeInfo->ReleaseVarDesc(pVarDesc);
						}
					}

					pTypeInfo->ReleaseTypeAttr(pTypeAttr);
				}
				pTypeInfo->Release();
			}
		}
	}

	// Select the first one
	m_iPropName = 0;            // Prevents save from happening
	if (combo.SetCurSel(0) != CB_ERR)
		combo.GetLBText(0, m_strPropName);

	// Disable or set the size of the combo, as appropriate
	if (cProps <= 1)
		combo.EnableWindow(FALSE);
	else
		_AfxSizeComboToContent(&combo);

	UpdateData(FALSE);
	SetModifiedFlag(FALSE);
}
	void CModelInputDlg::SetModelInput(CModelInput& modelInput, bool bDefault)
	{
		ASSERT(m_titleCtrlArray.GetSize() == m_varCtrlArray.GetSize());
		ASSERT(m_titleCtrlArray.GetSize() == (int)m_variables.size());

		m_modelInput = modelInput;
		m_bDefault = bDefault;

		for (int i = 0, ii = 0; i < m_variables.size(); i++)
		{
			CStatic* pStatic = (CStatic*)m_titleCtrlArray[i];
			pStatic->EnableWindow(!m_bDefault);

			if (ii < modelInput.size())
			{
				switch (m_variables[i].GetType())
				{
				case CModelInputParameterDef::kMVBool:
				{
					CComboBox* pCombo = (CComboBox*)m_varCtrlArray[i];
					pCombo->SetCurSel(modelInput[ii++].GetBool() ? 0 : 1);
					pCombo->EnableWindow(!m_bDefault);
					break;
				}

				case CModelInputParameterDef::kMVInt:
				case CModelInputParameterDef::kMVReal:
				case CModelInputParameterDef::kMVString:
				case CModelInputParameterDef::kMVFile:
				{
					CCFLEdit* pEdit = (CCFLEdit*)m_varCtrlArray[i];
					pEdit->SetString(modelInput[ii++].GetStr());
					pEdit->EnableWindow(!m_bDefault);
					break;
				}

				case CModelInputParameterDef::kMVListByPos:
				{
					CCFLComboBox* pCombo = (CCFLComboBox*)m_varCtrlArray[i];
					pCombo->SelectFromItemData(modelInput[ii++].GetListIndex());
					pCombo->EnableWindow(!m_bDefault);
					break;
				}

				case CModelInputParameterDef::kMVListByString:
				case CModelInputParameterDef::kMVListByCSV:
				{
					CCFLComboBox* pCombo = (CCFLComboBox*)m_varCtrlArray[i];
					pCombo->SelectStringExact(-1, modelInput[ii++].GetStr());
					pCombo->EnableWindow(!m_bDefault);
					break;
				}

				case CModelInputParameterDef::kMVTitle:
				case CModelInputParameterDef::kMVLine:
				case CModelInputParameterDef::kMVStaticText:
				{
					CStatic* pStatic = (CStatic*)m_varCtrlArray[i];
					pStatic->EnableWindow(!m_bDefault);
					break;
				}

				default: ASSERT(false);
				}
			}
		}
	}
Ejemplo n.º 22
0
/**
* \brief         This function will set the selected channel list
* \param[in]     pnList, contains the list of selected channels
* \return        void
* \authors       Arunkumar Karri
* \date          13.12.2011 Created
*/
void CHardwareListingCAN::vSetSelectedList()
{
    // Insert the selected item in to the selected list
    int nItem;
    CString omStrChannel;//("");
    CString omStrHardware;
	bool bIsChannelSelected = false; //To check for the Selected List
    for ( int i = 0 ; i < m_nSize && m_pnSelList[i]!=-1 ; i++)
    {
        nItem = m_omSelectedHwList.GetItemCount();
        // Format channel information
        omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT,
                             defSTR_CHANNEL_NAME,
                             nItem + 1 );
        // Get the Hardware name
        omStrHardware.Format( getProtocolChannelNameFormat(m_pnSelList[i]).c_str() );
        int nImageIndex = defDISCONNECTED_IMAGE_INDEX;
        // Insert the new item in to the selected list
        m_omSelectedHwList.InsertItem( nItem, omStrHardware , nImageIndex );
        // Set the Hardware Name
        m_omSelectedHwList.SetItemText( nItem, 1, omStrChannel );
        // Set the array index
        m_omSelectedHwList.SetItemData( nItem, m_pnSelList[i] );
		bIsChannelSelected = true;
    }
    // Set the focus to the first item
	if (bIsChannelSelected)
	{
		m_omSelectedHwList.SetItemState( 0,
			LVIS_SELECTED | LVIS_FOCUSED,
			LVIS_SELECTED | LVIS_FOCUSED );
		CComboBox* pEditBaudRateCAN = (CComboBox*)GetDlgItem(IDC_CAN_EDIT_BAUD_RATE);
		CComboBox* pEditBaudRateCANFD = (CComboBox*)GetDlgItem(IDC_CANFD_EDIT_BAUD_RATE);
		if(nullptr!=pEditBaudRateCAN)
		{
			pEditBaudRateCAN ->EnableWindow(TRUE);
		}
		CButton* pChkCANFD = (CButton*)GetDlgItem(IDC_CHECK_CANFD);
		bool ulCANFDEnabled = 0;
		if (m_pControllerDetails != nullptr)
		{
			ulCANFDEnabled = m_pControllerDetails[0].m_bcanFDEnabled;
		}
		std::string omSelectedItem = m_omSelectedHwList.GetItemText( 0, 0);
		std::map<std::string, bool>::iterator itr = m_mapChannelToCANFDStatus.find(omSelectedItem);
		if(m_mapChannelToCANFDStatus.end() !=  itr)
		{
			m_chkCANFD.EnableWindow(itr->second);
		}
		if(nullptr != pChkCANFD || nullptr != pEditBaudRateCANFD)
		{
			if(m_chkCANFD.IsWindowEnabled() == TRUE) // If Channel Supports CANFD
			{
				pChkCANFD->EnableWindow(TRUE);
				if(ulCANFDEnabled == 1) //If User has Enabled CANFD Feature 
				{
					pChkCANFD->SetCheck(BST_CHECKED);
					pEditBaudRateCANFD->EnableWindow(TRUE);
				}
				else
				{
					pChkCANFD->SetCheck(BST_UNCHECKED);
				}
			}
			else
			{
				pChkCANFD->EnableWindow(FALSE);
			}
		}
	}
	else
	{
    m_omHardwareList.SetItemState( 0,
                                   LVIS_SELECTED | LVIS_FOCUSED,
                                   LVIS_SELECTED | LVIS_FOCUSED );
	}
}
BOOL CCalendarSettings::OnInitDialog(){
    CString s1;
    s1.LoadString(IDS_CALENDAR_DETAILS); SetWindowText(s1);
    CDialog::OnInitDialog();

    WindowsSyncSourceConfig* ssconf = ((OutlookConfig*)getConfig())->getSyncSourceConfig(APPOINTMENT_);
    
    editFolder.SetLimitText(EDIT_TEXT_MAXLENGTH);
    editRemote.SetLimitText(EDIT_TEXT_MAXLENGTH);
    
    // Load the syncmodes in the editbox/dropdown
    loadSyncModesBox(APPOINTMENT_);

    // load string resources
    s1.LoadString(IDS_SYNC_DIRECTION);      SetDlgItemText(IDC_CALENDAR_GROUP_DIRECTION, s1);
    s1.LoadString(IDS_CURRENT);             SetDlgItemText(IDC_CALENDAR_STATIC_FOLDER, s1);
    s1.LoadString(IDS_INCLUDE_SUBFOLDERS);  SetDlgItemText(IDC_CALENDAR_CHECK_INCLUDE, s1);
    s1.LoadString(IDS_SELECT_FOLDER);       SetDlgItemText(IDC_CALENDAR_BUT_SELECT, s1);
    s1.LoadString(IDS_REMOTE_NAME);         SetDlgItemText(IDC_CALENDAR_STATIC_REMOTE, s1);
    s1.LoadString(IDS_ADVANCED);            SetDlgItemText(IDC_CALENDAR_GROUP_ADVANCED, s1);
    s1.LoadString(IDS_CALENDAR_FOLDER);     SetDlgItemText(IDC_CALENDAR_GROUP_FOLDER, s1);
    s1.LoadString(IDS_EVENT_FILTER);        SetDlgItemText(IDC_CALENDAR_GROUP_FILTER, s1);
    s1.LoadString(IDS_SYNC_PAST_EVENTS);    SetDlgItemText(IDC_CALENDAR_STATIC_FILTER, s1);
    s1.LoadString(IDS_OK);                  SetDlgItemText(IDC_CALENDAR_BUTOK, s1);
    s1.LoadString(IDS_CANCEL);              SetDlgItemText(IDC_CALENDAR_BUTCANCEL, s1);
    s1.LoadString(IDS_DATA_FORMAT);         SetDlgItemText(IDC_CALENDAR_STATIC_DATAFORMAT, s1);
    s1.LoadString(IDS_USE_VCAL);            SetDlgItemText(IDC_CALENDAR_DATA_FORMAT, s1);
    s1.LoadString(IDS_SHARED);              SetDlgItemText(IDC_CALENDAR_CHECK_SHARED, s1);

    s1.LoadString(IDS_DATE_FILTER_NONE);            lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_LAST_WEEK);       lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_LAST_2_WEEKS);    lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_LAST_MONTH);      lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_LAST_3_MONTHS);   lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_LAST_6_MONTHS);   lstFilter.AddString(s1);
    s1.LoadString(IDS_DATE_FILTER_ALL);             lstFilter.AddString(s1);

    // Set dropdown-lists initial position
    lstSyncType.SetCurSel(getSyncTypeIndex(ssconf->getSync()));
    lstFilter.SetCurSel(getDateFilterIndex(ssconf->getDateFilter().getRelativeLowerDate()));

    
    // Get folder path.
    // Note: use 'toWideChar' because we need UTF-8 conversion.
    WCHAR* olFolder = toWideChar(ssconf->getFolderPath());
    s1 = olFolder;
    delete [] olFolder;

    try {
        if(s1 == ""){
            s1 = getDefaultFolderPath(APPOINTMENT).data();
        }
    }
    catch (...){
        // an exception occured while trying to get the default folder
        EndDialog(-1);
    }

    SetDlgItemText(IDC_CALENDAR_EDIT_FOLDER, s1);

    if(ssconf->getUseSubfolders()) {
        checkInclude.SetCheck(BST_CHECKED);
    }

    // Note: use 'toWideChar' because we need UTF-8 conversion.
    WCHAR* remName = toWideChar(ssconf->getURI());
    s1 = remName;
    delete [] remName;
    SetDlgItemText(IDC_CALENDAR_EDIT_REMOTE, s1);

    if (s1.Right(wcslen(SHARED_SUFFIX)).Compare(SHARED_SUFFIX) == 0) {
        checkShared.SetCheck(BST_CHECKED);
    }


    // Apply customizations
    bool shared             = UICustomization::shared;
    bool lockFilter         = UICustomization::lockCalendarFilter;
    bool forceUseSubfolders = UICustomization::forceUseSubfolders;
    bool hideDataFormats    = UICustomization::hideDataFormats;
    bool hideAllAdvanced    = !SHOW_ADVANCED_SETTINGS;

    if (lockFilter) {
        int lockFilterIndex = UICustomization::lockCalendarFilterValue;
        CComboBox * item = (CComboBox*)GetDlgItem(IDC_CALENDAR_COMBO_FILTER);
        item->EnableWindow(false);
        item->SetCurSel(lockFilterIndex);
    }

    if (forceUseSubfolders) {
        checkInclude.SetCheck(BST_CHECKED);
        checkInclude.ShowWindow(SW_HIDE);

        // Resize things
        CRect rect;
        checkInclude.GetClientRect(&rect);
        int dy = -1 * (rect.Height() + 5);

        resizeItem(GetDlgItem(IDC_CALENDAR_GROUP_FOLDER), 0, dy);

        moveItem(this, &groupAdvanced, 0, dy);
        moveItem(this, &editRemote,    0, dy);
        moveItem(this, &checkShared,   0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_DATA_FORMAT),       0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_GROUP_FILTER),      0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_STATIC_FILTER),     0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_COMBO_FILTER),      0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_STATIC_REMOTE),     0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_STATIC_DATAFORMAT), 0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTOK),             0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTCANCEL),         0, dy);

        setWindowHeight(this, GetDlgItem(IDC_CALENDAR_BUTOK));
    }

    if (hideAllAdvanced) {
        groupAdvanced.ShowWindow(SW_HIDE);
        editRemote.ShowWindow(SW_HIDE);
        GetDlgItem(IDC_CALENDAR_STATIC_REMOTE)->ShowWindow(SW_HIDE);
        GetDlgItem(IDC_CALENDAR_STATIC_DATAFORMAT)->ShowWindow(SW_HIDE);
        GetDlgItem(IDC_CALENDAR_DATA_FORMAT)->ShowWindow(SW_HIDE);

        CRect rect;
        groupAdvanced.GetClientRect(&rect);
        int dy = -1 * (rect.Height() + 10);

        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTOK),     0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTCANCEL), 0, dy);

        setWindowHeight(this, GetDlgItem(IDC_CALENDAR_BUTOK));
    } 
    else if (hideDataFormats) {
        GetDlgItem(IDC_CALENDAR_STATIC_DATAFORMAT)->ShowWindow(SW_HIDE);
        GetDlgItem(IDC_CALENDAR_DATA_FORMAT)->ShowWindow(SW_HIDE);

        // Resize things
        CRect rect;
        GetDlgItem(IDC_CALENDAR_STATIC_DATAFORMAT)->GetClientRect(&rect);
        int dy = -1 * (rect.Height() + 5);

        resizeItem(&groupAdvanced, 0, dy);

        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTOK),     0, dy);
        moveItem(this, GetDlgItem(IDC_CALENDAR_BUTCANCEL), 0, dy);

        setWindowHeight(this, GetDlgItem(IDC_CALENDAR_BUTOK));
    }

    // Shared folders
    if (shared) {
        editRemote.EnableWindow(false);
    } else {
        GetDlgItem(IDC_CALENDAR_CHECK_SHARED)->ShowWindow(SW_HIDE);
    } 


    // disable windows xp theme, otherwise any color setting for groupbox
    // will be overriden by the theme settings
    if(((COutlookPluginApp*)AfxGetApp())->hLib){
        PFNSETWINDOWTHEME pfnSetWindowTheme =
            (PFNSETWINDOWTHEME)GetProcAddress(((COutlookPluginApp*)AfxGetApp())->hLib, "SetWindowTheme");
        pfnSetWindowTheme (groupDirection.m_hWnd,L" ",L" ");
        pfnSetWindowTheme (groupFolder.m_hWnd,L" ",L" ");
        pfnSetWindowTheme (groupAdvanced.m_hWnd,L" ",L" ");
        pfnSetWindowTheme (groupFilter.m_hWnd,L" ",L" ");
    };

    // Accessing Outlook, could be no more in foreground
    SetForegroundWindow();

    wndCalendar = this;
    return FALSE;
}
Ejemplo n.º 24
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;
}
Ejemplo n.º 25
0
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate dialog
	SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
	SetDlgItemText(IDOK, CTSTRING(OK));
	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_DEFAULT, CTSTRING(DEFAULT));
	SetDlgItemText(IDC_ACTIVE, CTSTRING(SETTINGS_DIRECT));
	SetDlgItemText(IDC_PASSIVE, CTSTRING(SETTINGS_FIREWALL_PASSIVE));
	SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));

	// 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->getServer()).c_str());
	SetDlgItemText(IDC_HUBNICK, Text::toT(entry->getNick(false)).c_str());
	SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
	SetDlgItemText(IDC_HUBUSERDESCR, Text::toT(entry->getUserDescription()).c_str());
	CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_RAW_ONE, Text::toT(entry->getRawOne()).c_str());
	SetDlgItemText(IDC_RAW_TWO, Text::toT(entry->getRawTwo()).c_str());
	SetDlgItemText(IDC_RAW_THREE, Text::toT(entry->getRawThree()).c_str());
	SetDlgItemText(IDC_RAW_FOUR, Text::toT(entry->getRawFour()).c_str());
	SetDlgItemText(IDC_RAW_FIVE, Text::toT(entry->getRawFive()).c_str());
	SetDlgItemText(IDC_SERVER, Text::toT(entry->getIP()).c_str());
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(entry->getSearchInterval()).c_str());

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

	const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
	for(FavHubGroups::const_iterator i = favHubGroups.begin(); i != favHubGroups.end(); ++i) {
		const string& name = i->first;
		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());

	if(strnicmp("adc://", entry->getServer().c_str(), 6) == 0 || strnicmp("adcs://", entry->getServer().c_str(), 7) == 0)
	{
		combo.SetCurSel(4); // select UTF-8 for ADC hubs
		combo.EnableWindow(false);
	}
	else
	{
		if(entry->getEncoding().empty())
			combo.SetCurSel(0);
		else
			combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
	}

	combo.Detach();

	if(entry->getMode() == 0)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_DEFAULT);
	else if(entry->getMode() == 1)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_ACTIVE);
	else if(entry->getMode() == 2)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_PASSIVE);

	CEdit tmp;
	tmp.Attach(GetDlgItem(IDC_HUBNAME));
	tmp.SetFocus();
	tmp.SetSel(0,-1);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBNICK));
	tmp.LimitText(35);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBUSERDESCR));
	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(10, 9999);
	updown.Detach();
	
	CenterWindow(GetParent());
	return FALSE;
}
Ejemplo n.º 26
0
static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CComboBox& type, CComboBox& dim, CMediaType& mt)
{
	tfa.RemoveAll();
	type.ResetContent();
	dim.ResetContent();
	type.EnableWindow(FALSE);
	dim.EnableWindow(FALSE);

	if (!pAMSC) {
		return;
	}

	AM_MEDIA_TYPE* pcurmt = NULL;
	pAMSC->GetFormat(&pcurmt);

	int iCount = 0, iSize;
	if (SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
			&& iSize == sizeof(T) && iCount > 0) {
		for (int i = 0; i < iCount; i++) {
			T caps;
			AM_MEDIA_TYPE* pmt = NULL;
			if (SUCCEEDED(pAMSC->GetStreamCaps(i, &pmt, (BYTE*)&caps))) {
				tfa.AddFormat(pmt, caps);
			}
		}

		if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS)) {
			for (int i = 0, cnt = tfa.GetCount(); i < cnt; i++) {
				if (tfa[i]->GetCount() != 1) {
					continue;
				}

				CFormatElem<T>* pfe = tfa[i]->GetAt(0);

				if (pfe->mt.formattype != FORMAT_VideoInfo
						&& pfe->mt.formattype != FORMAT_VideoInfo2) {
					continue;
				}

				static SIZE presets[] = {
					{160, 120}, {192, 144},
					{320, 240}, {384, 288},
					{480, 240}, {512, 288},
					{480, 360}, {512, 384},
					{640, 240}, {768, 288},
					{640, 480}, {768, 576},
					{704, 240}, {704, 288},
					{704, 480}, {704, 576},
					{720, 240}, {720, 288},
					{720, 480}, {720, 576},
					{768, 240}, {768, 288},
					{768, 480}, {768, 576},
				};

				VIDEO_STREAM_CONFIG_CAPS* pcaps = (VIDEO_STREAM_CONFIG_CAPS*)&pfe->caps;
				BITMAPINFOHEADER bihCur;
				ExtractBIH(&pfe->mt, &bihCur);

				for (int j = 0; j < countof(presets); j++) {
					if (presets[j].cx == bihCur.biWidth
							&& presets[j].cy == abs(bihCur.biHeight)
							|| presets[j].cx < pcaps->MinOutputSize.cx
							|| presets[j].cx > pcaps->MaxOutputSize.cx
							|| presets[j].cy < pcaps->MinOutputSize.cy
							|| presets[j].cy > pcaps->MaxOutputSize.cy
							|| presets[j].cx % pcaps->OutputGranularityX
							|| presets[j].cy % pcaps->OutputGranularityY) {
						continue;
					}

					CMediaType mt = pfe->mt;

					if (mt.formattype == FORMAT_VideoInfo) {
						VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
						if (!vih->bmiHeader.biHeight) {
							vih->bmiHeader.biHeight = 1;
						}
						vih->bmiHeader.biWidth = presets[j].cx;
						vih->bmiHeader.biHeight = presets[j].cy*(vih->bmiHeader.biHeight/vih->bmiHeader.biHeight);
						vih->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih->bmiHeader.biBitCount>>3;

						AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
						CopyMediaType(pmt, &mt);
						tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));

						if (presets[j].cx*3 != presets[j].cy*4) {
							int extra = mt.cbFormat - sizeof(VIDEOINFOHEADER);
							int bmiHeaderSize = sizeof(vih->bmiHeader) + extra;
							BYTE* pbmiHeader = DNew BYTE[bmiHeaderSize];
							memcpy(pbmiHeader, &vih->bmiHeader, bmiHeaderSize);
							mt.ReallocFormatBuffer(FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader) + bmiHeaderSize);
							VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
							memcpy(&vih2->bmiHeader, pbmiHeader, bmiHeaderSize);
							delete [] pbmiHeader;
							vih2->dwInterlaceFlags = vih2->dwCopyProtectFlags = 0;
							vih2->dwReserved1 = vih2->dwReserved2 = 0;
							vih2->dwPictAspectRatioX = 4;
							vih2->dwPictAspectRatioY = 3;

							AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
							CopyMediaType(pmt, &mt);
							tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
						}
					} else if (mt.formattype == FORMAT_VideoInfo2) {
						VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
						if (!vih2->bmiHeader.biHeight) {
							vih2->bmiHeader.biHeight = 1;
						}
						vih2->bmiHeader.biWidth = presets[j].cx;
						vih2->bmiHeader.biHeight = presets[j].cy*(vih2->bmiHeader.biHeight/vih2->bmiHeader.biHeight);
						vih2->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih2->bmiHeader.biBitCount>>3;
						vih2->dwPictAspectRatioX = 4;
						vih2->dwPictAspectRatioY = 3;

						AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
						CopyMediaType(pmt, &mt);
						tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
					}
				}
			}