Ejemplo n.º 1
0
void CDlgGongShi3::OnBnClickedOk()
{
	// 公示类型
	CComboBox * pCombo = (CComboBox *)GetDlgItem(IDC_COMBO1);
	m_nClass = pCombo->GetCurSel();
	pCombo->GetWindowText(m_strGSLX);
	// 公示栏目
	pCombo = (CComboBox *)GetDlgItem(IDC_COMBO2);
	m_nGSLM = pCombo->GetCurSel();
	pCombo->GetWindowText(m_strGSLM);

	CAcUiDialog::OnOK();
}
Ejemplo n.º 2
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;
}
int CXTPCalendarEventRecurrenceDlg::GetChangedComboTimeInMin(CComboBox& wndCb)
{
	CString strCBtext;
	wndCb.GetWindowText(strCBtext);

	return CXTPCalendarUtils::ParceTimeString_min(strCBtext);
}
Ejemplo n.º 4
0
void CfsclientwDlg::OnBnClickedButconn()
{
	//m_logoWin.setImage(icon_doing);
	//m_logoWin.refresh();
	m_gifWin.setText("...");
	m_gifWin.refresh();
	//Sleep(100000);
	CComboBox * pcb = (CComboBox*)GetDlgItem(IDC_COMBOSRV);
	CString cstr;
	pcb->GetWindowText(cstr);
	if (cstr == "")
	{
		MessageBox("please select or input a server", "error");
		return;
	}
	if (m_dwM->connectServer(cstr.GetBuffer()) < 0)
	{
		MessageBox("failed to connect this server", "error");
		return;
	}

	dir("/home");
	enableButton("server",   false);
	enableButton("download", true);
	enableButton("connect",  false);
	//Sleep(3000);
	//m_logoWin.setImage(icon_ok);
	m_gifWin.setText("ok");
}
Ejemplo n.º 5
0
BOOL CFileDialogEx::OnCommand( WPARAM wParam, LPARAM lParam )
{
	if (HIWORD (wParam) == CBN_SELCHANGE)
	{
		if (LOWORD (wParam) == IDC_DIRLIST)
		{
			// The combo box
			CString text;
			CComboBox combo;
			combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));
			combo.GetWindowText (text);
			combo.Detach ();

			// Set the new directory			
			TCHAR s[MAX_PATH];

			// Backup contents of 'edt1'
			HWND parent = *GetParent ();
			::GetDlgItemText (parent, edt1, s, MAX_PATH);
			
			// Replace with the directory name
			::SendMessage (parent, CDM_SETCONTROLTEXT, edt1, (LPARAM)(const char*)text);
			
			// Click on the OK button
			::SendMessage (parent, WM_COMMAND, IDOK, 0);
			
			// Restore contents of 'edt1'
			::SendMessage (parent, CDM_SETCONTROLTEXT, edt1, (LPARAM)s);
		}
	}
	return CFileDialog::OnCommand (wParam, lParam);
}
Ejemplo n.º 6
0
//gets the text from the style dropdown
CString CPropPageOptionsControls::GetStyleName()
{
	//first off get the text of the dropdown
	CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_PRESET_STYLES);

	CString sStyle;
	pCombo->GetWindowText(sStyle);

	return sStyle;
}
Ejemplo n.º 7
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.º 8
0
void SettingsDlg::OnBnClickedPreview()
{
	CComboBox *combobox;
	combobox = (CComboBox*)GetDlgItem(IDC_VID_CAP_DEV);
	CString name;
	combobox->GetWindowText(name);
	if (!microsipDlg->previewWin) {
		microsipDlg->previewWin = new Preview(microsipDlg);
	}
	microsipDlg->previewWin->Start(microsipDlg->VideoCaptureDeviceId(name));
}
Ejemplo n.º 9
0
//widget event handlers
void TextStyleDialog::OnCbnSelchangeFont()
{
	CWnd* cwnd = this->GetFocus();
	CComboBox* p = (CComboBox*)GetDlgItem(IDC_FONT);
	int sel = p->GetCurSel();
TRACE("SEL: %d", sel);
	CString tmp;
	p->GetWindowText(tmp);
	p->GetLBText(sel, tmp);
TRACE(tmp);
	triggerVirtualKeyStroke(p);
}
Ejemplo n.º 10
0
UINT CLogClassFilterEditDlg::GetLogClass(int comboID)
{
	CComboBox combo = (HWND)GetDlgItem(comboID);
	int index = combo.GetCurSel();
	if (index >= 0)
	{
		return combo.GetItemData(index);
	}

	CStringW text;
	combo.GetWindowText(text);
	return wcstoul(text, NULL, 10);
}
Ejemplo n.º 11
0
DWORD NetCfg::GetTick()
{
	CComboBox *hCombo;
	CString strout;
	DWORD val;
	char *pbuf;

	hCombo = (CComboBox*)GetDlgItem(IDC_COMBO_TICK);
	hCombo->GetWindowText(strout);
	pbuf = strout.GetBuffer();
	val = atoi(pbuf);
	return val;
}
Ejemplo n.º 12
0
void CNewSvrDlg::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类
	UpdateData(TRUE);
	CComboBox *pBox =(CComboBox *) GetDlgItem(IDC_COMBO_HOST_IP);
	ASSERT(pBox);
	if(pBox)
	{	 
		pBox->GetWindowText(m_szLocalIp);
//		m_dwLocalIp = htonl( inet_addr(CW2A(szIp)));
	}


	CBCGPDialog::OnOK();
}
Ejemplo n.º 13
0
void CModuleDialog::OnSelchangePlist() 
{
	CComboBox *lb; 
	CString s; 
	char Buf[256]; 
	DWORD idProcess; 

	lb = (CComboBox *)GetDlgItem(IDC_PLIST); 
	lb->GetWindowText(Buf, 255); 

	idProcess = strtoul((LPCTSTR)Buf, NULL, 16); 

	// TODO: Add your control notification handler code here
	GetModuleList((CListBox *)GetDlgItem(IDC_MLIST), idProcess); 
}
Ejemplo n.º 14
0
//=================================================
// Helper Functions
//=================================================
CString CMainDlg::GetOutputFileName()
{
	CString strFile = _T("");
	
	GetControlValues();

	switch(m_iNamingOpt) 
	{
		case 0: // Use entered prefix
		{
			strFile = m_strImageName;
			break;
		}
		case 1: // Always ask for prefix
		{
			CGetDataDlg dlg;
			dlg.SetTitle(_T("Enter File Prefix"));
			if(dlg.DoModal() == IDOK)
				strFile = dlg.GetData();
			break;
		}
		case 2: // No prefix
			break;
	}
	if(strFile.GetLength() > 0)
		strFile += _T("_");

	// Add time stamp
	COleDateTime dtNow = COleDateTime::GetCurrentTime();
	CString strDT = dtNow.Format(_T("%d-%m-%y_%H-%M-%S"));
	strFile += strDT;

	// Add file extension
	//strFile += _T(".jpg");
	CComboBox* pCombo = NULL;
	VERIFY(pCombo = (CComboBox*)GetDlgItem(IDC_IMAGE_EXT));
    strFile += _T(".");
	CString strExt = _T("");
	pCombo->GetWindowText(strExt);
	strFile += strExt;

	return strFile;
}
Ejemplo n.º 15
0
LRESULT CLoginDlg::OnBnConnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	// TODO: Add your control notification handler code here
	if(GetFramework()->IsConnected())
	{
		GetFramework()->Disconnect();
		GetDlgItem(IDC_BUTTON4).SetWindowText(L"Connect");
		GetDlgItem(IDC_APPID).EnableWindow(TRUE);
		GetDlgItem(IDC_SUBID).EnableWindow(TRUE);
		GetDlgItem(IDC_COMBO1).EnableWindow(TRUE);
	}
	else
	{
		CComboBox box = GetDlgItem(IDC_COMBO1);
		BSTR text = NULL;
		box.GetWindowText(text);
		if(text == NULL)
		{
			AtlMessageBox(m_hWnd, L"Please select a interface server!");
			return 0;
		}
		box = GetDlgItem(IDC_APPID);
		int AppID = box.GetCurSel();
		box = GetDlgItem(IDC_SUBID);
		int SubID = box.GetCurSel();
		GetFramework()->SetAppInfo(AppID, SubID,1,1);
		if(CString(L"auto") != text)
		{
			GetFramework()->SetISAddress(ClientCommon::StrToAddress(text));
		}
		GetProcessor()->ConnectToIS();
		GetDlgItem(IDC_BUTTON4).EnableWindow(FALSE);
	}
	

	return 0;
}
Ejemplo n.º 16
0
//===========================================================================
void CFAVConnectDlg::OnBnClickedConnectConnectbtn()
//===========================================================================
{
	// TODO: Add your control notification handler code here
	CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_CONNECT_COMSEL);
	CString str;
	CString	strCOM;
	char	chMsg[MSGBUFSIZE];

	if(!m_bConnectFlag)
	{
		m_bConnectFlag = TRUE;
		GetDlgItem(IDC_CONNECT_DISP_U)->SetWindowText(_T("Searching the Reader..."));
		GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(TRUE);
		GetDlgItem(IDC_CONNECT_DISP_D)->SetWindowText(_T(" "));
		GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(FALSE);
		if(m_bCOMSel)
		{
			//pCbox->GetLBText(pCbox->GetCurSel(), str);
			pCbox->GetWindowText(str);
			// Contrast string
			if(!COMContrast(str)){
				_stprintf_s(chMsg, _T("The communication port %s could not be opened.\r\nDevice not available"), str);
				AfxMessageBox(chMsg, MB_ICONHAND);
				GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(TRUE);
				GetDlgItem(IDC_CONNECT_DISP_U)->SetWindowText(_T(" "));
				m_bConnectFlag = FALSE;
			}
			else
			{
				if(!m_UARTComm.COMPortMC(str))
				{
					m_bConnectFlag = FALSE;
					GetDlgItem(IDC_CONNECT_DISP_D)->SetWindowText(_T("Communication port fail. Please plug in Reader again or ") \
						_T("configuring the serial port connection manually."));
					//GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(FALSE);
					GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(TRUE);
				}
				else
				{
					strCOM.Format(_T("Communication %s open."), m_UARTComm.GetCOM());
					g_strCOMPORT = m_UARTComm.GetCOM();
					GetDlgItem(IDC_CONNECT_DISP_D)->SetWindowText(strCOM);
					//GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(FALSE);
					GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(FALSE);
					GetDlgItem(IDC_CONNECT_OKBTN)->EnableWindow(TRUE);
				}
				GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(FALSE);
			}
		}
		else
		{
			if(!m_UARTComm.COMPortAC())
			{
				m_bConnectFlag = FALSE;
				GetDlgItem(IDC_CONNECT_DISP_D)->SetWindowText(_T("Communication port fail. Please plug in Reader again or ") \
					_T("configuring the serial port connection manually."));
				GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(FALSE);
				GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(TRUE);
			}
			else
			{
				strCOM.Format(_T("Communication %s open."), m_UARTComm.GetCOM());
				g_strCOMPORT = m_UARTComm.GetCOM();
				GetDlgItem(IDC_CONNECT_DISP_D)->SetWindowText(strCOM);
				GetDlgItem(IDC_CONNECT_DISP_U)->EnableWindow(FALSE);
				GetDlgItem(IDC_CONNECT_CONNECTBTN)->EnableWindow(FALSE);
				GetDlgItem(IDC_CONNECT_OKBTN)->EnableWindow(TRUE);
			}
		}
	}
}
Ejemplo n.º 17
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.º 18
0
bool FavHubGeneralPage::write() {
	TCHAR buf[1024];
	GetDlgItemText(IDC_HUBADDR, buf, 256);
	if (buf[0] == '\0') {
		WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
		return false;
	}

	//check the primary address for dupes
	string addresses = Text::fromT(buf);
	size_t pos = addresses.find(";");

	if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())) {
		WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
		return false;
	}

	//validate the encoding
	GetDlgItemText(IDC_ENCODING, buf, 512);
	if (_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && ctrlEncoding.GetCurSel() != 0)
	{
		WinUtil::showMessageBox(TSTRING_F(INVALID_ENCODING, buf), MB_ICONWARNING);
		return false;
	}

	//set the values
	entry->get(HubSettings::NmdcEncoding) = ctrlEncoding.GetCurSel() != 0 ? Text::fromT(buf) : Util::emptyString;
	entry->setServer(addresses);

	GetDlgItemText(IDC_HUBNAME, buf, 256);
	entry->setName(Text::fromT(buf));
	GetDlgItemText(IDC_HUBDESCR, buf, 256);
	entry->setDescription(Text::fromT(buf));
	GetDlgItemText(IDC_HUBPASS, buf, 256);
	entry->setPassword(Text::fromT(buf));

	//Hub settings
	GetDlgItemText(IDC_NICK, buf, 256);
	entry->get(HubSettings::Nick) = Text::fromT(buf);

	GetDlgItemText(IDC_USERDESC, buf, 256);
	entry->get(HubSettings::Description) = Text::fromT(buf);

	GetDlgItemText(IDC_EMAIL, buf, 256);
	entry->get(HubSettings::Email) = Text::fromT(buf);

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));

	if (combo.GetCurSel() == 0)
	{
		entry->setGroup(Util::emptyString);
	}
	else
	{
		tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
		combo.GetWindowText(&text[0], text.size());
		text.resize(text.size() - 1);
		entry->setGroup(Text::fromT(text));
	}
	combo.Detach();

	auto p = ShareManager::getInstance()->getProfiles();

	ProfileToken token = HUB_SETTING_DEFAULT_INT;
	if (hideShare) {
		token = SP_HIDDEN;
	}
	else if (entry->isAdcHub() && ctrlProfile.GetCurSel() != 0) {
		token = p[ctrlProfile.GetCurSel() - 1]->getToken();
	}

	entry->get(HubSettings::ShareProfile) = token;

	//FavoriteManager::getInstance()->save();

	return true;
}
Ejemplo n.º 19
0
void AccountDlg::OnBnClickedOk()
{
	CEdit* edit;
	CString str;
	CComboBox *combobox;
	int i;

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

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

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

#ifdef _GLOBAL_PROFILE
	combobox= (CComboBox*)GetDlgItem(IDC_EDIT_DOMAIN);
	switch (combobox->GetCurSel()) {
		case 1:
			account.domain=_T(_GLOBAL_PROFILE_B);
			break;
#ifdef _GLOBAL_PROFILE_C
		case 2:
			account.domain=_T(_GLOBAL_PROFILE_C);
			break;
#endif
		default:
			account.domain=_T(_GLOBAL_PROFILE_A);
	}
	account.server=account.domain;
	account.proxy=account.domain;
#endif

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

#ifndef _GLOBAL_ACCOUNT_PIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
#else
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
#endif
	edit->GetWindowText(str);
#ifndef _GLOBAL_API
	account.username=str.Trim();
#else
	account.apiLogin=str.Trim();
#endif

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

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

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

#ifdef _GLOBAL_ACCOUNT_REMEMBER_PASSWORD
	account.rememberPassword = ((CButton*)GetDlgItem(IDC_REMEMBER_PASSWORD))->GetCheck();
#else
	account.rememberPassword = 1;
#endif

#ifndef _GLOBAL_ACCOUNT_MINI
	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			account.srtp=_T("optional");
			break;
		case 2:
			account.srtp=_T("mandatory");
			break;
		default:
			account.srtp=_T("");
	}

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			account.transport=_T("udp");
			break;
		case 2:
			account.transport=_T("tcp");
			break;
		case 3:
			account.transport=_T("tls");
			break;
		default:
			account.transport=_T("");
	}

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

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->GetWindowText(str);
	account.stun=str.Trim();

	account.ice = ((CButton*)GetDlgItem(IDC_ICE))->GetCheck();

	account.allowRewrite = ((CButton*)GetDlgItem(IDC_REWRITE))->GetCheck();

	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	i = combobox->GetCurSel();
	combobox->GetWindowText(account.publicAddr);
	if (account.publicAddr==Translate(_T("Auto")))
	{
		account.publicAddr = _T("");
	}

	// Spidy - capture port differences for upnp update
	OldNewUpnpSpec OldNewUpnpSpec;
	OldNewUpnpSpec.oldPort = getRealPort(account);
	combobox= (CComboBox*)GetDlgItem(IDC_LISTEN_PORT);
	i = combobox->GetCurSel();
	combobox->GetWindowText(account.listenPort);
	int port = atoi(CStringA(account.listenPort));
	if (port<=0 || port>65535 || account.listenPort==Translate(_T("Auto")))
	{
		account.listenPort = _T("");
	}
#endif

	if (account.domain.IsEmpty() || account.username.IsEmpty()) {
		// Spidy - allow users to specify empty details as some just wanna call - dont wanna register an account
		//return;
	}

	if (account.domain.IsEmpty()) {
		// Spidy - allow users to specify empty details as some just wanna call - dont wanna register an account
		//return;
		hostent * host = gethostbyname(NULL); 
		account.domain.SetString(CString(host->h_name));
	}

	this->ShowWindow(SW_HIDE);

	if (!accountId) {
		Account account;
		int i = 1;
		while (true) {
			if (!accountSettings.AccountLoad(i,account)) {
				break;
			}
			i++;
		}
		accountId = i;
	}

	accountSettings.AccountSave(accountId,&account);
	
	if (accountSettings.accountId) {
		microsipDlg->PJAccountDelete();
	}
	accountSettings.accountId = accountId;
	accountSettings.account = account;
	accountSettings.SettingsSave();
	microsipDlg->PJAccountAdd();

	// Spidy - grab listen port for update.
	//OldNewUpnpSpec.newPort = atoi((CStringA)(accountSettings.account.listenPort)) == 0 ? 5060: atoi((CStringA)(accountSettings.account.listenPort));
	OldNewUpnpSpec.newPort = getRealPort(accountSettings.account);

	uPnP::instance()->updateAllPortsMultiThreaded(OldNewUpnpSpec.oldPort, OldNewUpnpSpec.newPort, 6);

	OnClose();
}
Ejemplo n.º 20
0
void AccountDlg::OnBnClickedOk()
{
	CEdit* edit;
	CString str;
	CComboBox *combobox;
	int i;

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

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

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

#ifdef _GLOBAL_PROFILE
	combobox= (CComboBox*)GetDlgItem(IDC_EDIT_DOMAIN);
	switch (combobox->GetCurSel()) {
		case 1:
			account.domain=_T(_GLOBAL_PROFILE_B);
			break;
#ifdef _GLOBAL_PROFILE_C
		case 2:
			account.domain=_T(_GLOBAL_PROFILE_C);
			break;
#endif
		default:
			account.domain=_T(_GLOBAL_PROFILE_A);
	}
	account.server=account.domain;
	account.proxy=account.domain;
#endif

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

#ifndef _GLOBAL_ACCOUNT_PIN
	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
#else
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
#endif
	edit->GetWindowText(str);
#ifndef _GLOBAL_API
	account.username=str.Trim();
#else
	account.apiLogin=str.Trim();
#endif

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

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

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

#ifdef _GLOBAL_ACCOUNT_REMEMBER_PASSWORD
	account.rememberPassword = ((CButton*)GetDlgItem(IDC_REMEMBER_PASSWORD))->GetCheck();
#else
	account.rememberPassword = 1;
#endif

#ifndef _GLOBAL_ACCOUNT_MINI
	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			account.srtp=_T("optional");
			break;
		case 2:
			account.srtp=_T("mandatory");
			break;
		default:
			account.srtp=_T("");
	}

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			account.transport=_T("udp");
			break;
		case 2:
			account.transport=_T("tcp");
			break;
		case 3:
			account.transport=_T("tls");
			break;
		default:
			account.transport=_T("");
	}

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

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->GetWindowText(str);
	account.stun=str.Trim();

	account.ice = ((CButton*)GetDlgItem(IDC_ICE))->GetCheck();

	account.allowRewrite = ((CButton*)GetDlgItem(IDC_REWRITE))->GetCheck();

	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	i = combobox->GetCurSel();
	combobox->GetWindowText(account.publicAddr);
	if (account.publicAddr==Translate(_T("Auto")))
	{
		account.publicAddr = _T("");
	}

	combobox= (CComboBox*)GetDlgItem(IDC_LISTEN_PORT);
	i = combobox->GetCurSel();
	combobox->GetWindowText(account.listenPort);
	int port = atoi(CStringA(account.listenPort));
	if (port<=0 || port>65535 || account.listenPort==Translate(_T("Auto")))
	{
		account.listenPort = _T("");
	}
#endif

	if (account.domain.IsEmpty() || account.username.IsEmpty()) {
		return;
	}

	this->ShowWindow(SW_HIDE);

	if (!accountId) {
		Account account;
		int i = 1;
		while (true) {
			if (!accountSettings.AccountLoad(i,account)) {
				break;
			}
			i++;
		}
		accountId = i;
	}

	accountSettings.AccountSave(accountId,&account);
	
	if (accountSettings.accountId) {
		microsipDlg->PJAccountDelete();
	}
	accountSettings.accountId = accountId;
	accountSettings.account = account;
	accountSettings.SettingsSave();
	microsipDlg->PJAccountAdd();

	OnClose();
}
Ejemplo n.º 21
0
void AccountDlg::OnBnClickedOk()
{
	CEdit* edit;
	CString str;
	CComboBox *combobox;
	int i;

	edit = (CEdit*)GetDlgItem(IDC_EDIT_SERVER);
	edit->GetWindowText(str);
	m_Account.server=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PROXY);
	edit->GetWindowText(str);
	m_Account.proxy=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DOMAIN);
	edit->GetWindowText(str);
	m_Account.domain=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_AUTHID);
	edit->GetWindowText(str);
	m_Account.authID=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
	edit->GetWindowText(str);
	m_Account.username=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
	edit->GetWindowText(str);
	m_Account.password=str.Trim();

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DISPLAYNAME);
	edit->GetWindowText(str);
	m_Account.displayName=str.Trim();

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			m_Account.transport=_T("udp");
			break;
		case 2:
			m_Account.transport=_T("tcp");
			break;
		case 3:
			m_Account.transport=_T("tls");
			break;
		default:
			m_Account.transport=_T("");
	}

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->GetWindowText(str);
	m_Account.stun=str.Trim();

	m_Account.rememberPassword = 1;

	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	i = combobox->GetCurSel();
	switch (i) {
		case 1:
			m_Account.srtp=_T("optional");
			break;
		case 2:
			m_Account.srtp=_T("mandatory");
			break;
		default:
			m_Account.srtp=_T("");
	}

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

	m_Account.ice = ((CButton*)GetDlgItem(IDC_ICE))->GetCheck();

	m_Account.allowRewrite = ((CButton*)GetDlgItem(IDC_REWRITE))->GetCheck();

	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	i = combobox->GetCurSel();
	combobox->GetWindowText(m_Account.publicAddr);
	if (m_Account.publicAddr==Translate(_T("Auto")))
	{
		m_Account.publicAddr = _T("");
	}

	if (
		m_Account.domain.IsEmpty() ||
		m_Account.username.IsEmpty()) {
		CString str;
		str.Append(Translate(_T("Please fill out at least the required fields marked with *.")));
		str.AppendFormat(_T(" %s"),Translate(_T("Ask your SIP provider how to configure the account correctly.")));
		AfxMessageBox(str);
		return;
	}

	this->ShowWindow(SW_HIDE);

	if (!accountId) {
		Account dummy;
		int i = 1;
		while (true) {
			if (!accountSettings.AccountLoad(i,&dummy)) {
				break;
			}
			i++;
		}
		accountId = i;
	}

	accountSettings.AccountSave(accountId,&m_Account);
	
	if (accountSettings.accountId) {
		mainDlg->PJAccountDelete();
	}

	accountSettings.accountId = accountId;
	accountSettings.AccountLoad(accountSettings.accountId,&accountSettings.account);
	accountSettings.SettingsSave();
	mainDlg->PJAccountAdd();
	OnClose();
}
Ejemplo n.º 22
0
void CSpellBaseParmDlg::OnAddTotem() 
{
	CString sTotem;
	CString sLevel;	
	CString sRequires;
	CComboBox *pBox;
	CListBox *pList;

	pBox   = (CComboBox *)GetDlgItem(IDC_TOTEMS);
	pBox->GetWindowText(sTotem);

	pBox   = (CComboBox *)GetDlgItem(IDC_LEVELS);
	pBox->GetWindowText(sLevel);

	pList = (CListBox *)GetDlgItem(IDC_REQUIRESTOTEM);

	if (sLevel == "Any Level")
	{
		sRequires = sTotem;
		sRequires += " of any level";
	}
	else
	{
		sRequires = sTotem;
		sRequires += " level ";
		sRequires += sLevel;
	}

	// Check before we add this totem

	for (int i = 0; i < pList->GetCount(); i ++)
	{
		CString sListString;
		pList->GetText(i, sListString);

		CString sString = sListString;

		BOOL bOkayToAdd = TRUE;
		
		if (sRequires == sString)
		{
			AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
			return;
		}

		CString sCheckTotem = strtok((char *)(LPCSTR)sString, " ");

		if (sCheckTotem == sTotem)
		{
			AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
			return;
		}
	}

	pList->AddString(sRequires);
	
	TOTEM_REQUIREMENT tr;
	tr.m_sRequirement = sRequires;

	m_pSpell->GetTotemRequirements()->AddTail(tr);
}
void CNetworkControllView::OnBnClickedButtonUpdatetimeserver()
{
	BeginWaitCursor();

	BOOL bSyncSuccess = FALSE;
	CComboBox* pCbx = (CComboBox*)GetDlgItem(IDC_COMBO_TIMESERVERLIST);
	CString strTimeServer;
	//pCbx->GetLBText(pCbx->GetCurSel(), strTimeServer);
	pCbx->GetWindowText(strTimeServer);

	CString strTips = _T("NC is synchronizing internet time server, please wait.");
	SetPaneString(1, strTips);



	USES_CONVERSION;
	LPCSTR szIP = W2A(strTimeServer);
	struct hostent* pHost = NULL;
	SOCKADDR_IN sockaddr;
	//TestFunc(strTimeServer);

	//return;
	//////////////////////////////////////////////////////////////////////////
	if(isalpha(szIP[0]))  // by domain name
	{
	
		pHost = gethostbyname(szIP);
		if(pHost != NULL)
		{
			sockaddr.sin_addr.S_un.S_addr = (*(DWORD*)pHost->h_addr_list[0]);
		}
		else
		{
			AfxMessageBox(_T("Time synchronization needs in the internet, please check your net work settings."));
			return;
		}

	}
	else // by ip
	{		
		sockaddr.sin_addr.S_un.S_addr =inet_addr(szIP);
	}
	// write to nc
	int n=write_one(g_tstat_id,178, BYTE(sockaddr.sin_addr.S_un.S_un_b.s_b1 ));
	n=write_one(g_tstat_id,179,BYTE(sockaddr.sin_addr.S_un.S_un_b.s_b2 ));
	n=write_one(g_tstat_id,180,BYTE(sockaddr.sin_addr.S_un.S_un_b.s_b3 ));
	n=write_one(g_tstat_id,181,BYTE(sockaddr.sin_addr.S_un.S_un_b.s_b4 ));

	n=write_one(g_tstat_id,177,6); // 命令寄存器,同步命令

	Sleep(5000);  // 等待NC 同步
	AddNewTimeServer(strTimeServer);

	int nCount = 0;
	while(nCount < 5)
	{
		int nRet = Read_One(m_IDaddress, 199);
		if(nRet == 1)
		{
			bSyncSuccess = TRUE;
			break;
		}
		nCount++;
		Sleep(1000);
	}

	if (bSyncSuccess)
	{
		strTips = _T("NC synchronize internet time server success.");		
	}
	else
	{
		strTips = _T("NC synchronize internet time server failed.");		
	}
	AfxMessageBox(strTips);
	SetPaneString(1, strTips);


	EndWaitCursor();
	
}
Ejemplo n.º 24
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.º 25
0
void CCompileEditView::SaveDataMenu(UINT nID)
{
	if(g_pSaveMenu.m_hMenu == NULL)
		return;

	CString strComm;
	g_pSaveMenu.GetMenuString(nID,strComm,MF_BYCOMMAND);
	if(strComm.IsEmpty())
		return;

	int nPos = strComm.Find(":");
	if( nPos != -1 )
	{
		strComm = strComm.Mid(nPos+1);
	}
	if(strComm.IsEmpty())
		return;

	if(!IsCompileEdit(COMPILE))
		return;

	CTreeCtrlFormula* pHxTreeCtrl = NULL;

	HTREEITEM hFloatTreeItem = NULL;
	CTreeCtrlFormula* pFloatTree = NULL;
	CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
	if(pMain != NULL)
	{
		if(pMain->GetIndividualInfo() != NULL)
		{
			pFloatTree = pMain->GetIndividualInfo();
		}
	}

	HTREEITEM hTreeItem = NULL;
	char	  cType = 0;
	
	nID -= SAVEMENU_BEGIN;
	if(nID >= 0 && nID < 100)
	{
		cType = Tech;
		if(pHxTreeCtrl != NULL)
		{				
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 100 && nID < 200 )
	{
		cType = Condition;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 200 && nID < 300 )
	{
		cType = Exchange;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 300 && nID < 400 )
	{
		cType = MoreKLine;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}		
	if( nID >= 400 && nID < 500 )
	{
		cType = ExpressBin;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}

	CString strName;
	CComboBox* pBox = NULL;
	if(m_pwndDlgMainBar != NULL)
	{
		pBox = (CComboBox*)m_pwndDlgMainBar->GetDlgItem(IDC_NAMECOMBO);
		if(pBox != NULL)
		{			
			pBox->GetWindowText(strName);
			strName.MakeUpper();
			if( pBox->FindString(0,strName) != CB_ERR )
			{
				CValue* valoare;
				if ( m_pExternExpression->Lookup(strName,valoare) ) // 外部表达式表
				{
				}
			}
			else
			{
				pBox->AddString(strName);
			}
		}
	}
	

	if( pHxTreeCtrl != NULL && hTreeItem != NULL && !strName.IsEmpty())
	{
		m_hExpressInTreePos = pHxTreeCtrl->AddItem(strName,cType,hTreeItem/*pHxTreeCtrl->GetCurSavePos(hTreeItem)*/,m_pExternExpression);
	}

	// 浮动窗口	
	if( pFloatTree != NULL && hFloatTreeItem != NULL && !strName.IsEmpty())
	{
		pFloatTree->AddItem(strName,cType,hFloatTreeItem/*pFloatTree->GetCurSavePos(hFloatTreeItem)*/,m_pExternExpression);
	}

	::SendMessage( g_hParentWnd,HX_USER_UPDATEDATA,0,(LPARAM)&strName );
}
Ejemplo n.º 26
0
LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if(wID == IDOK)
	{
		TCHAR buf[1024];
		GetDlgItemText(IDC_HUBADDR, buf, 256);
		if(buf[0] == '\0') {
			WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
			return 0;
		}

		//check the primary address for dupes
		string addresses = Text::fromT(buf);
		size_t pos = addresses.find(";");

		if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())){
			WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
			return 0;
		}

		//validate the encoding
		GetDlgItemText(IDC_ENCODING, buf, 512);
		if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
		{
			WinUtil::showMessageBox(TSTRING(INVALID_ENCODING), MB_ICONWARNING);
			return 0;
		}

		//set the values
		entry->setEncoding(Text::fromT(buf));
		entry->setServerStr(addresses);

		GetDlgItemText(IDC_HUBNAME, buf, 256);
		entry->setName(Text::fromT(buf));
		GetDlgItemText(IDC_HUBDESCR, buf, 256);
		entry->setDescription(Text::fromT(buf));
		GetDlgItemText(IDC_HUBPASS, buf, 256);
		entry->setPassword(Text::fromT(buf));
		entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
		entry->setFavNoPM(IsDlgButtonChecked(IDC_FAV_NO_PM) == 1);

		//Hub settings
		GetDlgItemText(IDC_NICK, buf, 256);
		entry->get(HubSettings::Nick) = Text::fromT(buf);

		GetDlgItemText(IDC_USERDESC, buf, 256);
		entry->get(HubSettings::Description) = Text::fromT(buf);

		GetDlgItemText(IDC_EMAIL, buf, 256);
		entry->get(HubSettings::Email) = Text::fromT(buf);

		GetDlgItemText(IDC_AWAY_MSG, buf, 1024);
		entry->get(HubSettings::AwayMsg) = Text::fromT(buf);

		entry->get(HubSettings::ShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
		entry->get(HubSettings::FavShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
		entry->get(HubSettings::LogMainChat) = to3bool(IsDlgButtonChecked(IDC_LOGMAINCHAT));
		entry->get(HubSettings::ChatNotify) = to3bool(IsDlgButtonChecked(IDC_CHAT_NOTIFY));
		entry->get(HubSettings::AcceptFailovers) = to3bool(IsDlgButtonChecked(IDC_FAILOVER));

		auto val = HubSettings::getMinInt();
		if (!IsDlgButtonChecked(IDC_SEARCH_INTERVAL_DEFAULT)) {
			GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
			val = Util::toInt(Text::fromT(buf));
		}
		entry->get(HubSettings::SearchInterval) = val;

		
		CComboBox combo;
		combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
	
		if(combo.GetCurSel() == 0)
		{
			entry->setGroup(Util::emptyString);
		}
		else
		{
			tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
			combo.GetWindowText(&text[0], text.size());
			text.resize(text.size()-1);
			entry->setGroup(Text::fromT(text));
		}
		combo.Detach();


		// connection modes
		auto getConnMode = [](const CComboBox& combo) -> int {
			 if (combo.GetCurSel() == 1)
				return SettingsManager::INCOMING_DISABLED;
			else if (combo.GetCurSel() == 2)
				return SettingsManager::INCOMING_ACTIVE;
			else if (combo.GetCurSel() == 3)
				return SettingsManager::INCOMING_PASSIVE;

			return HubSettings::getMinInt();
		};

		entry->get(HubSettings::Connection) = getConnMode(modeCombo4);
		entry->get(HubSettings::Connection6) = getConnMode(modeCombo6);

		//external ip addresses
		GetDlgItemText(IDC_SERVER4, buf, 512);
		entry->get(HubSettings::UserIp) = Text::fromT(buf);

		GetDlgItemText(IDC_SERVER6, buf, 512);
		entry->get(HubSettings::UserIp6) = Text::fromT(buf);

		auto p = ShareManager::getInstance()->getProfiles();

		if(hideShare) {
			entry->setShareProfile(*(p.end()-1));
		} else {
			if(entry->isAdcHub()) {
				entry->setShareProfile(p[ctrlProfile.GetCurSel()]);
			} else {
				entry->setShareProfile(p[0]);
			}
		}

		FavoriteManager::getInstance()->save();
	}
	loaded = false;
	EndDialog(wID);
	return 0;
}
Ejemplo n.º 27
0
LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if(wID == IDOK)
	{
		TCHAR buf[512];
		GetDlgItemText(IDC_HUBADDR, buf, 256);
		if(buf[0] == '\0') {
			MessageBox(CTSTRING(INCOMPLETE_FAV_HUB), _T(""), MB_ICONWARNING | MB_OK);
			return 0;
		}
		entry->setServer(Text::fromT(buf));
		GetDlgItemText(IDC_HUBNAME, buf, 256);
		entry->setName(Text::fromT(buf));
		GetDlgItemText(IDC_HUBDESCR, buf, 256);
		entry->setDescription(Text::fromT(buf));
		GetDlgItemText(IDC_HUBNICK, buf, 256);
		entry->setNick(Text::fromT(buf));
		GetDlgItemText(IDC_HUBPASS, buf, 256);
		entry->setPassword(Text::fromT(buf));
		GetDlgItemText(IDC_HUBUSERDESCR, buf, 256);
		entry->setUserDescription(Text::fromT(buf));
		entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
		GetDlgItemText(IDC_RAW_ONE, buf, 512);
		entry->setRawOne(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_TWO, buf, 512);
		entry->setRawTwo(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_THREE, buf, 512);
		entry->setRawThree(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_FOUR, buf, 512);
		entry->setRawFour(Text::fromT(buf));
		GetDlgItemText(IDC_RAW_FIVE, buf, 512);
		entry->setRawFive(Text::fromT(buf));
		GetDlgItemText(IDC_SERVER, buf, 512);
		entry->setIP(Text::fromT(buf));
		GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
		entry->setSearchInterval(Util::toUInt32(Text::fromT(buf)));
		
		GetDlgItemText(IDC_ENCODING, buf, 512);
		if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
		{
			MessageBox(_T("Invalid encoding!"), _T(""), MB_ICONWARNING | MB_OK);
			return 0;
		}
		entry->setEncoding(Text::fromT(buf));
		
		CComboBox combo;
		combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
	
		if(combo.GetCurSel() == 0)
		{
			entry->setGroup(Util::emptyString);
		}
		else
		{
			tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
			combo.GetWindowText(&text[0], text.size());
			text.resize(text.size()-1);
			entry->setGroup(Text::fromT(text));
		}
		combo.Detach();

		int	ct = -1;
		if(IsDlgButtonChecked(IDC_DEFAULT))
			ct = 0;
		else if(IsDlgButtonChecked(IDC_ACTIVE))
			ct = 1;
		else if(IsDlgButtonChecked(IDC_PASSIVE))
			ct = 2;

		entry->setMode(ct);

		FavoriteManager::getInstance()->save();
	}
	EndDialog(wID);
	return 0;
}