Ejemplo n.º 1
0
LRESULT SpeedPage::onSpeedChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
{
	tstring speed;
	speed.resize(1024);
	speed.resize(GetDlgItemText(wID, &speed[0], 1024));
	if (!speed.empty() && wNotifyCode != CBN_SELENDOK) {
		boost::wregex reg;
		if(speed[speed.size() -1] == '.')
			reg.assign(_T("(\\d+\\.)"));
		else
			reg.assign(_T("(\\d+(\\.\\d+)?)"));
		if (!regex_match(speed, reg)) {
			CComboBox tmp;
			tmp.Attach(hWndCtl);
			DWORD dwSel;
			if ((dwSel = tmp.GetEditSel()) != CB_ERR) {
				tstring::iterator it = speed.begin() +  HIWORD(dwSel)-1;
				speed.erase(it);
				tmp.SetEditSel(0,-1);
				tmp.SetWindowText(speed.c_str());
				tmp.SetEditSel(HIWORD(dwSel)-1, HIWORD(dwSel)-1);
				tmp.Detach();
			}
		}
	}

	updateValues(wNotifyCode);
	validateMCNLimits(wNotifyCode);
	return TRUE;
}
void CInstrumentEditorN163Wave::SelectInstrument(std::shared_ptr<CInstrument> pInst)
{
	m_pInstrument = std::dynamic_pointer_cast<CInstrumentN163>(pInst);
	ASSERT(m_pInstrument);

	CComboBox *pSizeBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_SIZE));
	CComboBox *pPosBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_POS));

	pSizeBox->SelectString(0, MakeIntString(m_pInstrument->GetWaveSize()));
	FillPosBox(m_pInstrument->GetWaveSize());
	pPosBox->SetWindowText(MakeIntString(m_pInstrument->GetWavePos()));

	/*
	if (m_pInstrument->GetAutoWavePos()) {
		CheckDlgButton(IDC_POSITION, 1);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
	}
	else {
		CheckDlgButton(IDC_POSITION, 0);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
	}
	*/

	if (m_pWaveEditor) {
		m_pWaveEditor->SetInstrument(m_pInstrument);
		m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
	}

	m_iWaveIndex = 0;

	PopulateWaveBox();
}
Ejemplo n.º 3
0
void CLogClassFilterEditDlg::SetLogClass(int comboID, UINT c)
{
	CComboBox combo = (HWND)GetDlgItem(comboID);
	CStringW desc = helper::GetLogLevelDescription(c);
	if (combo.SelectString(0, desc) == CB_ERR)
	{
		combo.SetWindowText(desc);
	}
}
BOOL CCreateDownloadFromTorrentFileDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	ASSERT (m_ptszTorrentFile);
	if (m_ptszTorrentFile)
		SetDlgItemText (IDC_TORRENTFILE, m_ptszTorrentFile);
	
	m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER));
	m_btnCreateGroup.SetIcon (SICO (IDI_CREATEGROUP));
	m_btnSetTime.SetIcon (SICO (IDI_SETTIME));
	m_btnSetDefaultFolder.SetIcon (SICO (IDI_SETFOLDERDEFAULT));

	m_schScheduleParam.schTask.hts.enType = HTS_ONCE;
	m_schScheduleParam.schTask.hts.last.dwHighDateTime = m_schScheduleParam.schTask.hts.last.dwLowDateTime = UINT_MAX;
	m_schScheduleParam.schTask.dwFlags = SCHEDULE_ENABLED;
	SYSTEMTIME time;
	GetLocalTime (&time);
	if (++time.wHour > 23)
		time.wHour = 0;
	time.wMinute = 0;
	SystemTimeToFileTime (&time, &m_schScheduleParam.schTask.hts.next);
	m_schScheduleParam.schTask.uWaitForConfirmation = 0;

	m_wndGroups.Fill ();

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (int i = 0; i < _LastFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFolders.GetRecord (i));

	CheckRadioButton (IDC_STARTNOW, IDC_STARTSCHEDULE, IDC_STARTNOW);

	ASSERT (m_dld->pGroup != NULL);
	m_wndGroups.SelectGroup (m_dld->pGroup);

	pDirs->SetWindowText (m_wndGroups.GetSelectedGroup ()->strOutFolder);

	UINT nAS = _App.Last_Autostart ();
	if (nAS == 0)
		nAS = IDC_STARTNOW;
	else
		nAS = nAS == 1 ? IDC_STARTMANUAL : IDC_STARTSCHEDULE;
	CheckRadioButton (IDC_STARTNOW, IDC_STARTSCHEDULE, nAS);

	SetDlgItemText (IDC_COMMENT, m_dld->strComment);

	ApplyLanguage ();

	UpdateEnabled ();

	mfcSetForegroundWindow (this);

	return TRUE;  
	              
}
Ejemplo n.º 5
0
void CMainFrame::OnDropDown()
{
	CString FileName;
	CMFCToolBarComboBoxButton* pComboButton = (CMFCToolBarComboBoxButton*) m_wndLoadFileBar.GetButton(1);
	CComboBox* pLoadFile = pComboButton->GetComboBox();

	pLoadFile->GetWindowText(FileName);
	pLoadFile->ResetContent();
	pLoadFile->Dir(DDL_READWRITE,"*.*");
	pLoadFile->SetWindowText(FileName);
}
Ejemplo n.º 6
0
void CAutoComplete::DoCompletion(CWnd* pWnd, CString s,
								 const CStringArray& arMatches)
								 
{
	
	if (m_iType==ComboBox)
	{
		
		// 这种强制转换从技术上讲是不正确的,但它是一个标准的MFC诀窍.
		
		CComboBox* pComboBox = (CComboBox*)pWnd;
		
		// 更新下拉框以反映可能的匹配
		
		pComboBox->ResetContent();

		
		for (int i=0; i <arMatches.GetSize();i++)
			
			pComboBox->AddString(arMatches[i]);
		
		// 用户箭头光标,这样用户才能选择
		
		::SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW)));
		
		// 显示下拉框
		
		pComboBox->ShowDropDown();
		
		pComboBox->SetWindowText(IgnoreCompletion(s) ? s : arMatches[0]);
		
		pComboBox->SetEditSel(s.GetLength(),-1);  //设置高亮
		
	} 
	else if (m_iType==Edit && !IgnoreCompletion(s)) 
	{
		
		// 这种强制转换从技术上讲是不正确的,但它是一个标准的MFC诀窍.
		
		CEdit* pEdit = (CEdit*)pWnd;
		
		pEdit->SetWindowText(arMatches[0]);
		
		pEdit->SetSel(s.GetLength(),-1);
		
	}

}
Ejemplo n.º 7
0
void CInstrumentEditorN163Wave::SelectInstrument(int Instrument)
{
	m_pInstrument = (CInstrumentN163*)GetDocument()->GetInstrument(Instrument);

	CComboBox *pSizeBox = (CComboBox*)GetDlgItem(IDC_WAVE_SIZE);
	CComboBox *pPosBox = (CComboBox*)GetDlgItem(IDC_WAVE_POS);

	CString SizeStr;
	SizeStr.Format(_T("%i"), m_pInstrument->GetWaveSize());
	pSizeBox->SelectString(0, SizeStr);

	FillPosBox(m_pInstrument->GetWaveSize());

	CString PosStr;
	PosStr.Format(_T("%i"), m_pInstrument->GetWavePos());
	pPosBox->SetWindowText(PosStr);

	/*
	if (m_pInstrument->GetAutoWavePos()) {
		CheckDlgButton(IDC_POSITION, 1);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
	}
	else {
		CheckDlgButton(IDC_POSITION, 0);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
	}
	*/

	if (m_pWaveEditor) {
		m_pWaveEditor->SetInstrument(m_pInstrument);
		m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
	}

	CSpinButtonCtrl *pIndexSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_INDEX_SPIN);
	CSpinButtonCtrl *pWavesSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_WAVES_SPIN);

	int WaveCount = m_pInstrument->GetWaveCount();

	pIndexSpin->SetRange(0, WaveCount - 1);
	pIndexSpin->SetPos(0);
	pWavesSpin->SetPos(WaveCount - 1);

	m_iWaveIndex = 0;
}
Ejemplo n.º 8
0
BOOL CAddressDlg::OnInitDialog()
{
	CComboBox* combo = (CComboBox*)GetDlgItem(IDC_ADDRESS);
	combo->SetWindowText(address);
	GetDlgItem(IDC_PORT)->SetWindowText("23");

	POSITION pos = AppConfig.history.GetHeadPosition();
	CString str;
	while (pos)
	{
		str = AppConfig.history.GetAt(pos);
		int i;
		if ((i = str.ReverseFind(':')) >= 0)
			str = str.Left(i);
		combo->AddString(str);
		AppConfig.history.GetNext(pos);
	}

	return TRUE;
}
int CXTPSyntaxEditPropertiesPageFont::GetLBText(CComboBox& comboBox, CString& csItemText)
{
	UpdateData();

	if (!::IsWindow(comboBox.m_hWnd))
		return CB_ERR;

	int iCurSel = comboBox.GetCurSel();
	if (iCurSel == CB_ERR)
		return CB_ERR;

	comboBox.GetLBText(iCurSel, csItemText);

	if (!csItemText.IsEmpty())
	{
		if (comboBox.SelectString(-1, csItemText) == CB_ERR)
			comboBox.SetWindowText(csItemText);

		return iCurSel;
	}

	return CB_ERR;
}
Ejemplo n.º 10
0
void AccountDlg::Load(int id)
{
	CEdit* edit;
	CComboBox *combobox;

	accountId = id;
	accountSettings.AccountLoad(accountId,account);

#ifndef _GLOBAL_ACCOUNT_SIP_SERVER
	edit = (CEdit*)GetDlgItem(IDC_EDIT_SERVER);
	edit->SetWindowText(account.server);
#endif

#ifndef _GLOBAL_ACCOUNT_SIP_PROXY
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PROXY);
	edit->SetWindowText(account.proxy);
#endif

#ifndef _GLOBAL_ACCOUNT_DOMAIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_DOMAIN);
	//edit->SetWindowText(account.domain);
	// Spidy - set the domain to the hostname if empty (including when first creating an account)
	if (account.domain.IsEmpty()) {
		hostent * host = gethostbyname(NULL); 
		edit->SetWindowText(CString(host->h_name));
	}
	else {
		edit->SetWindowText(account.domain);
	}
#endif

#ifdef _GLOBAL_PROFILE
	combobox= (CComboBox*)GetDlgItem(IDC_EDIT_DOMAIN);
	combobox->AddString(_T("A"));
	combobox->AddString(_T("B"));
#ifdef _GLOBAL_PROFILE_C
	combobox->AddString(_T("C"));
#endif
	if (account.domain==_T(_GLOBAL_PROFILE_B)) {
		combobox->SetCurSel(1);
#ifdef _GLOBAL_PROFILE_C
	} else if (account.domain==_T(_GLOBAL_PROFILE_C)) {
		combobox->SetCurSel(2);
#endif
	} else {
		combobox->SetCurSel(0);
	}
#endif

#ifndef _GLOBAL_ACCOUNT_LOGIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_AUTHID);
	edit->SetWindowText(account.authID);
#endif


#ifndef _GLOBAL_ACCOUNT_PIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
#ifndef _GLOBAL_API

	//edit->SetWindowText(account.username);
	// Spidy - set the username to the hostname if empty (including when first creating an account)
	if (account.username.IsEmpty()) {
		hostent * host = gethostbyname(NULL); 
		edit->SetWindowText(CString(host->h_name));
	}
	else {
		edit->SetWindowText(account.username);
	}

#else
	edit->SetWindowText(account.apiLogin);
#endif
#endif

#ifndef _GLOBAL_ACCOUNT_PASSWORD
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
#ifndef _GLOBAL_API
	edit->SetWindowText(account.password);
#else
	edit->SetWindowText(account.apiPassword);
#endif
#endif

#ifdef _GLOBAL_ACCOUNT_REMEMBER_PASSWORD
	((CButton*)GetDlgItem(IDC_REMEMBER_PASSWORD))->SetCheck(account.rememberPassword);
#endif

#ifdef _GLOBAL_API_ID
	edit = (CEdit*)GetDlgItem(IDC_EDIT_API_ID);
	edit->SetWindowText(account.apiId);
#endif

#ifndef _GLOBAL_ACCOUNT_NAME
	edit = (CEdit*)GetDlgItem(IDC_EDIT_DISPLAYNAME);
	//edit->SetWindowText(account.displayName);
	// Spidy - set the display to the hostname if empty (including when first creating an account)
	if (account.displayName.IsEmpty()) {
		hostent * host = gethostbyname(NULL); 
		edit->SetWindowText(CString(host->h_name));
	}
	else {
		edit->SetWindowText(account.displayName);
	}
#endif

#ifndef _GLOBAL_ACCOUNT_MINI
	int i;
	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	if (account.srtp==_T("optional")) {
		i=1;
	} else if (account.srtp==_T("mandatory")) {
		i=2;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	if (account.transport==_T("udp")) {
		i=1;
	} else if (account.transport==_T("tcp")) {
		i=2;
	} else if (account.transport==_T("tls")) {
		i=3;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	//combobox->AddString(Translate(_T("Auto")));
	//if (account.publicAddr.GetLength()) {
	//	combobox->SetWindowText(account.publicAddr);
	//}

	// Spidy - use the external ip if its available as the default ip.
	if (strlen(uPnP::instance()->getExternalIPAddress()) > 0) {
		CString CStringExternalIPAddress("");
		CStringExternalIPAddress = uPnP::instance()->getExternalIPAddress();
		combobox->AddString(CStringExternalIPAddress);
		combobox->SetWindowText(CStringExternalIPAddress);
	} else if (strlen(uPnP::instance()->getLanIPAddress()) > 0) {
			CString CStringLanIPAddress("");
			CStringLanIPAddress = uPnP::instance()->getLanIPAddress();
			combobox->SetWindowText(CStringLanIPAddress);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_LISTEN_PORT);
	combobox->AddString(Translate(_T("Auto")));
	if (account.listenPort.GetLength()) {
		combobox->SetWindowText(account.listenPort);
	} else {
		combobox->SetCurSel(0);
	}

	((CButton*)GetDlgItem(IDC_PUBLISH))->SetCheck(account.publish);

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->SetWindowText(account.stun);

	((CButton*)GetDlgItem(IDC_ICE))->SetCheck(account.ice);
	((CButton*)GetDlgItem(IDC_REWRITE))->SetCheck(account.allowRewrite);
#endif
	if (id>0) {
		GetDlgItem(IDC_SYSLINK_DELETE)->ShowWindow(SW_SHOW);
	}
}
Ejemplo n.º 11
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.º 12
0
BOOL CSpiderAddPageDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	
	
	m_task.hts.enType = HTS_ONCE;
	m_task.hts.last.dwHighDateTime = m_task.hts.last.dwLowDateTime = UINT_MAX;
	m_task.dwFlags = SCHEDULE_ENABLED;
	SYSTEMTIME time;
	GetLocalTime (&time);
	if (++time.wHour > 23)
		time.wHour = 0;
	time.wMinute = 0;
	SystemTimeToFileTime (&time, &m_task.hts.next);
	m_task.uWaitForConfirmation = 0;

	m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER));
	m_btnCreateGroup.SetIcon (SICO (IDI_CREATEGROUP));
	m_btnSetTime.SetIcon (SICO (IDI_SETTIME));
	m_btnOutFolderSetDefault.SetIcon (SICO (IDI_SETFOLDERDEFAULT));

	m_wndGroups.Fill ();
	m_wndGroups.SelectGroupById (_App.CreateDld_IdOfLastGrpSelected ());

	CheckDlgButton (IDC_KEEP, _App.Spider_Flags () & WPDF_KEEPFOLDERSTRUCTURE ? 
						BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton (IDC_DONTSTOREPAGES, _App.Spider_Flags () & WPDF_DONTSTOREPAGES ? 
						BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton (IDC_DELCOMPLETED, _App.Spider_Flags () & WPDF_DELCOMPLETEDDLDS ?
						BST_CHECKED : BST_UNCHECKED);

	CComboBox *pUrls = (CComboBox*) GetDlgItem (IDC_URL);
	for (int i = 0; i < _LastUrlFiles.GetRecordCount (); i++)
		pUrls->AddString (_LastUrlFiles.GetRecord (i));

	if (m_strStartUrl.GetLength () == 0)
	{
		LPCSTR pszUrl = _ClipbrdMgr.Text ();
		if (pszUrl)
		{
			fsURL url;
			if (url.Crack (pszUrl) == IR_SUCCESS)
				m_strUrl = pszUrl;
		}
		
		if (m_strUrl.GetLength () == 0)
			m_strUrl = "http://";
	}
	else
		m_strUrl = m_strStartUrl;

	pUrls->SetWindowText (m_strUrl);

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (i = 0; i < _LastFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFolders.GetRecord (i));

	GetDlgItem (IDC_URL)->SetFocus ();

	m_bOutFolderChanged = m_bGroupChanged = FALSE;

	ReadAutostart ();
	ApplyLanguage ();

	if (m_bReqTopMost)
	{
		fsSetForegroundWindow (m_hWnd);
		::SetWindowPos (m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
	}

	m_wndDepthSpin.SetRange (0, UD_MAXVAL);
	SetDlgItemInt (IDC_DEPTH, m_wpd->GetWDPS ()->iDepth);

	if (m_wndGroups.SelectGroupById (_App.NewDL_GroupId ()))
		m_bGroupChanged = TRUE;

	OnChangeGroups ();

	BuildOutFolder ();

	UpdateEnabled ();

	return TRUE;  
	              
}
Ejemplo n.º 13
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.º 14
0
//**************************************************************************
BOOL OPCServerDlg::EnumerateNodes(LPNETRESOURCE lpnr)
{
   CComboBox* pNodes = (CComboBox*)GetDlgItem(IDC_NODE);

   HANDLE hEnum = 0;
   DWORD dwResult = WNetOpenEnum(RESOURCE_GLOBALNET,
                     RESOURCETYPE_ANY,
                     RESOURCEUSAGE_CONTAINER,
                     lpnr,              // NULL first time this function is called
                     &hEnum);           // handle to resource

   if (dwResult != NO_ERROR)
   {
      return FALSE;
   }

   DWORD cbBuffer = 16384;      // 16K buffer
   LPNETRESOURCE lpnrLocal = (LPNETRESOURCE) GlobalAlloc(GPTR, cbBuffer);
   do
   {
      DWORD cEntries = 0xFFFFFFFF; // enumerate all possible entries
      dwResult = WNetEnumResource(hEnum,
                                  &cEntries,
                                  lpnrLocal,
                                  &cbBuffer);

      if (dwResult == NO_ERROR)
      {
         for( DWORD i = 0; i < cEntries; i++)
         {
            // If this NETRESOURCE is a container, call the function
            // recursively.
            if(RESOURCEUSAGE_CONTAINER ==
               (lpnrLocal[i].dwUsage & RESOURCEUSAGE_CONTAINER))
            {
               if(RESOURCEDISPLAYTYPE_SERVER == lpnrLocal[i].dwDisplayType )
               {
                  CString node(lpnrLocal[i].lpRemoteName);
                  int index = node.Find( _T("\\") );
                  if( index > -1 )
                     node = node.Mid(index+2);
                  if( pNodes )
                     pNodes->AddString(node);
               }
               else
               {
                  EnumerateNodes(&lpnrLocal[i]);
                  break;   // ONLY enumerate the first "Container"
               }
            }
         }
      }
      else if (dwResult != ERROR_NO_MORE_ITEMS)
      {
         break;
      }
   }
   while(dwResult != ERROR_NO_MORE_ITEMS);

   GlobalFree((HGLOBAL) lpnrLocal);

   dwResult = WNetCloseEnum(hEnum);

   pNodes->SetWindowText(m_Node);

   if (dwResult != NO_ERROR)
   {
      return FALSE;
   }

   return TRUE;
}
Ejemplo n.º 15
0
void AccountDlg::Load(int id)
{
	CEdit* edit;
	CComboBox *combobox;

	accountId = id;
	accountSettings.AccountLoad(accountId,account);

#ifndef _GLOBAL_ACCOUNT_SIP_SERVER
	edit = (CEdit*)GetDlgItem(IDC_EDIT_SERVER);
	edit->SetWindowText(account.server);
#endif

#ifndef _GLOBAL_ACCOUNT_SIP_PROXY
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PROXY);
	edit->SetWindowText(account.proxy);
#endif

#ifndef _GLOBAL_ACCOUNT_DOMAIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_DOMAIN);
	edit->SetWindowText(account.domain);
#endif

#ifdef _GLOBAL_PROFILE
	combobox= (CComboBox*)GetDlgItem(IDC_EDIT_DOMAIN);
	combobox->AddString(_T("A"));
	combobox->AddString(_T("B"));
#ifdef _GLOBAL_PROFILE_C
	combobox->AddString(_T("C"));
#endif
	if (account.domain==_T(_GLOBAL_PROFILE_B)) {
		combobox->SetCurSel(1);
#ifdef _GLOBAL_PROFILE_C
	} else if (account.domain==_T(_GLOBAL_PROFILE_C)) {
		combobox->SetCurSel(2);
#endif
	} else {
		combobox->SetCurSel(0);
	}
#endif

#ifndef _GLOBAL_ACCOUNT_LOGIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_AUTHID);
	edit->SetWindowText(account.authID);
#endif


#ifndef _GLOBAL_ACCOUNT_PIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
#ifndef _GLOBAL_API

	edit->SetWindowText(account.username);
#else
	edit->SetWindowText(account.apiLogin);
#endif
#endif

#ifndef _GLOBAL_ACCOUNT_PASSWORD
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
#ifndef _GLOBAL_API
	edit->SetWindowText(account.password);
#else
	edit->SetWindowText(account.apiPassword);
#endif
#endif

#ifdef _GLOBAL_ACCOUNT_REMEMBER_PASSWORD
	((CButton*)GetDlgItem(IDC_REMEMBER_PASSWORD))->SetCheck(account.rememberPassword);
#endif

#ifdef _GLOBAL_API_ID
	edit = (CEdit*)GetDlgItem(IDC_EDIT_API_ID);
	edit->SetWindowText(account.apiId);
#endif

#ifndef _GLOBAL_ACCOUNT_NAME
	edit = (CEdit*)GetDlgItem(IDC_EDIT_DISPLAYNAME);
	edit->SetWindowText(account.displayName);
#endif

#ifndef _GLOBAL_ACCOUNT_MINI
	int i;
	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	if (account.srtp==_T("optional")) {
		i=1;
	} else if (account.srtp==_T("mandatory")) {
		i=2;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	if (account.transport==_T("udp")) {
		i=1;
	} else if (account.transport==_T("tcp")) {
		i=2;
	} else if (account.transport==_T("tls")) {
		i=3;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	combobox->AddString(Translate(_T("Auto")));
	if (account.publicAddr.GetLength()) {
		combobox->SetWindowText(account.publicAddr);
	}

	combobox= (CComboBox*)GetDlgItem(IDC_LISTEN_PORT);
	if (account.listenPort.GetLength()) {
		combobox->SetWindowText(account.listenPort);
	}

	((CButton*)GetDlgItem(IDC_PUBLISH))->SetCheck(account.publish);

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->SetWindowText(account.stun);

	((CButton*)GetDlgItem(IDC_ICE))->SetCheck(account.ice);
	((CButton*)GetDlgItem(IDC_REWRITE))->SetCheck(account.allowRewrite);
#endif
	if (id>0) {
		GetDlgItem(IDC_SYSLINK_DELETE)->ShowWindow(SW_SHOW);
	}
}
Ejemplo n.º 16
0
BOOL CDlgCreateFlvDownloads::OnInitDialog() 
{
	assert (!m_initialized);
	m_changing_dlg_state = true;

	CDialog::OnInitDialog();

	if (m_selected.size () != m_vDlds.size ())
		m_selected.resize (m_vDlds.size (), true);
	m_selectedByUserItself.resize (m_selected.size ());

	if (m_pUiWindow)
		m_pUiWindow->setWindow (m_hWnd);
	
	SetDlgItemText (IDC_WPURL, m_strWebPageUrl);

	CRect rc; m_wndFlvList.GetClientRect (&rc);

	m_wndFlvList.InsertColumn (0, LS (L_TITLE), LVCFMT_LEFT);
	m_wndFlvList.InsertColumn (1, LS (L_SIZE), LVCFMT_LEFT);
	if (!m_ui_customizations.no_url_column)
		m_wndFlvList.InsertColumn (2, _T("URL"), LVCFMT_LEFT);

	int nMaxW0 = 0;
	int nMaxW1 = 0;

	for (size_t i = 0; i < m_vDlds.size (); i++)
	{
		const auto& dl = m_vDlds [i];

		m_urlToIndex [dl.strUrl] = i;
		if (!dl.strLinkedAudioUrl.IsEmpty ())
		{
			m_urlVideoToAudio [dl.strUrl] = dl.strLinkedAudioUrl;
			m_urlAudioToVideo.insert (std::make_pair (dl.strLinkedAudioUrl, dl.strUrl));
		}

		m_wndFlvList.InsertItem (i, m_vDlds [i].strTitle);
		int nW0 = m_wndFlvList.GetStringWidth (m_vDlds [i].strTitle);
		CString strSize; 
		if (m_vDlds [i].uSize != _UI64_MAX)
			strSize = BytesToString (m_vDlds [i].uSize, true);
		int nW1 = m_wndFlvList.GetStringWidth (strSize);
		m_wndFlvList.SetItemText (i, 1, strSize);
		if (!m_ui_customizations.no_url_column)
			m_wndFlvList.SetItemText (i, 2, m_vDlds [i].strUrl);
		nMaxW0 = max (nMaxW0, nW0);
		nMaxW1 = max (nMaxW1, nW1);
	}
	
	auto vscroll_payload = GetSystemMetrics (SM_CXVSCROLL) + 3;
	if (!m_ui_customizations.no_url_column)
	{
		int n = rc.Width () / 3;
		if (n > nMaxW0)
			n = nMaxW0;
		m_wndFlvList.SetColumnWidth (0, n+20);
		m_wndFlvList.SetColumnWidth (1, nMaxW1+20);
		m_wndFlvList.SetColumnWidth (2, rc.Width () - n-20 - nMaxW1-20 - vscroll_payload);
	}
	else
	{
		nMaxW0 += 20;
		nMaxW1 += 20;
		int n = nMaxW0;
		if (rc.Width () < (nMaxW0 + nMaxW1 + 20 + vscroll_payload))
			n = rc.Width () - nMaxW1 - 20 - vscroll_payload;
		m_wndFlvList.SetColumnWidth (0, n + 20);
		m_wndFlvList.SetColumnWidth (1, nMaxW1);
	}
	
	m_wndFlvList.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_CHECKBOXES);

	
	for (size_t i = 0; i < m_vDlds.size (); i++)
		ListView_SetItemState (m_wndFlvList, i, UINT((int(m_selected [i]) + 1) << 12), LVIS_STATEIMAGEMASK);

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (size_t i = 0; i < (size_t)_LastFlashVideoDstFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFlashVideoDstFolders.GetRecord (i));
	if (_LastFlashVideoDstFolders.GetRecordCount ())
	{
		pDirs->SetCurSel (0);
	}
	else
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroupByExt (_T("flv"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroupByExt (_T("mp4"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroupByExt (_T("avi"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroup (GRP_OTHER_ID);
		ASSERT (pGrp != NULL);
		if (pGrp != NULL)
			pDirs->SetWindowText (pGrp->strOutFolder);
	}

	if (_App.FVDownloads_AutoConvertVideo () && _AppMgr.IsMediaFeaturesInstalled ())
	{
		CheckDlgButton (IDC_USE_AUTO_CONVERT, BST_CHECKED);
		UpdateEnabled ();
	}
	
	vmsMediaConvertMgr::GetDefaultSettings (m_convertSettings);

	ApplyLanguage ();

	if (m_bReqTopMostDialog)
	{
		mfcSetForegroundWindow (this);
		mfcSetTopmostWindow (this);
	}

	m_changing_dlg_state = false;
	m_initialized = true;
	
	return TRUE;  
	              
}
Ejemplo n.º 17
0
void AccountDlg::Load(int id)
{
	CEdit* edit;
	CComboBox *combobox;
	accountId = id;
	if (accountSettings.AccountLoad(id,&m_Account)) {
		accountId = id;
	} else {
		accountId = 0;
	}

	edit = (CEdit*)GetDlgItem(IDC_EDIT_SERVER);
	edit->SetWindowText(m_Account.server);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PROXY);
	edit->SetWindowText(m_Account.proxy);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DOMAIN);
	edit->SetWindowText(m_Account.domain);


	edit = (CEdit*)GetDlgItem(IDC_EDIT_AUTHID);
	edit->SetWindowText(m_Account.authID);


	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
	edit->SetWindowText(m_Account.username);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
	edit->SetWindowText(m_Account.password);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DISPLAYNAME);
	edit->SetWindowText(m_Account.displayName);

int i;

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	if (m_Account.transport==_T("udp")) {
		i=1;
	} else if (m_Account.transport==_T("tcp")) {
		i=2;
	} else if (m_Account.transport==_T("tls")) {
		i=3;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->SetWindowText(m_Account.stun);

	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	if (m_Account.srtp==_T("optional")) {
		i=1;
	} else if (m_Account.srtp==_T("mandatory")) {
		i=2;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}


	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	combobox->AddString(Translate(_T("Auto")));
	if (m_Account.publicAddr.GetLength()) {
		combobox->SetWindowText(m_Account.publicAddr);
	}

	((CButton*)GetDlgItem(IDC_PUBLISH))->SetCheck(m_Account.publish);

	((CButton*)GetDlgItem(IDC_ICE))->SetCheck(m_Account.ice);
	((CButton*)GetDlgItem(IDC_REWRITE))->SetCheck(m_Account.allowRewrite);
	if (accountId>0 && !m_Account.username.IsEmpty()) {
		GetDlgItem(IDC_SYSLINK_DELETE)->ShowWindow(SW_SHOW);
	}
}
Ejemplo n.º 18
0
LRESULT CLoginDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	
	DoDataExchange();

	::ZeroMemory(&m_RegInfo, sizeof(m_RegInfo));
	
	// TODO: Add your message handler code here and/or call default
	HICON hIcon= ::LoadIcon(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDR_MAINFRAME));
	SetIcon(hIcon, FALSE);
	DeleteObject(hIcon);
	
	SetTimer(1,100,NULL);

	CenterWindow();
	m_cfg.m_FileName = System::GetProcessPathName() +  L"\\PSDemo.ini";

	CString ISIP = m_cfg.Get(L"Config", L"ISIP",L"Auto");
	CString UserName = m_cfg.Get(L"Config", L"UserName", L"ps_test");
	CString Password = m_cfg.Get(L"Config", L"Password", L"123123");
	int   AppID		= m_cfg.Get(L"Config", L"AppID",1)
		, SubID		= m_cfg.Get(L"Config", L"SubID",1)
		, MajorVer	= m_cfg.Get(L"Config", L"MajorVer",1)
		, SubVer	= m_cfg.Get(L"Config", L"SubVer",1);
	
	CComboBox box = GetDlgItem(IDC_COMBO1);
	struct ISServer{ wchar_t * server; } Servers[] = {
		L"tcp://60.28.222.89:7788",
		L"tcp://60.28.222.89:7789",
		L"tcp://127.0.0.1:7788",
		L"auto",
		L"tcp://192.168.1.252:7788",
		L"tcp://192.168.1.13:7788",
		NULL,
	};
	for(u_int a=0; a<sizeof(Servers)/sizeof(ISServer); a++)
	{
		box.InsertString(0,Servers[a].server);
	}
	box.SetWindowText(ISIP);

	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);


	box = GetDlgItem(IDC_APPID);
	for(int a=0; a<10; a++)
	{
		CString s;
		s.Format(L"%d", a);
		int nItem = box.InsertString(a, s);
		box.SetItemData(nItem, a);
	}
	box.SetCurSel(AppID);
	box = GetDlgItem(IDC_SUBID);
	for(int a=0; a<10; a++)
	{
		CString s;
		s.Format(L"%d", a);
		int nItem = box.InsertString(a, s);
		box.SetItemData(nItem, a);
	}
	box.SetCurSel(SubID);
	
	GetFramework()->SetUIClient(this);
	
	SetDlgItemText(IDC_USERNAME, UserName);
	SetDlgItemText(IDC_PASSWORD, Password);



	CString s;
	s.Format(L"PS - %s %s", _T(__DATE__), _T(__TIME__) );
	SetWindowText(s);

	m_mbtn.SubclassWindow(GetDlgItem(IDC_Game));
	m_mbtn.SpecailMenu(IDR_LOGINOPT);

	UIAddChildWindowContainer(m_hWnd);
//	logwin.Create(NULL,CWindow::rcDefault, L"LogWin");
	return TRUE;
}