LRESULT CServerParamsDlg::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { std::map<std::string,std::string>::iterator it; CString login = GuiTools::GetDlgItemText(m_hWnd, IDC_LOGINEDIT); serverProfile_.setProfileName(login); ServerSettingsStruct &serverSettings = serverProfile_.serverSettings(); serverSettings.authData.DoAuth = GuiTools::GetCheck(m_hWnd, IDC_DOAUTH); serverSettings.authData.Login = WCstringToUtf8( login ); serverSettings.authData.Password = WCstringToUtf8( GuiTools::GetDlgItemText(m_hWnd, IDC_PASSWORDEDIT) ); for(it = m_paramNameList.begin(); it!= m_paramNameList.end(); ++it) { CString name = it->first.c_str(); CString humanName = it->second.c_str(); HPROPERTY pr = m_wndParamList.FindProperty(humanName); CComVariant vValue; pr->GetValue(&vValue); serverSettings.params[WCstringToUtf8(name)]= WCstringToUtf8(vValue.bstrVal); } EndDialog(wID); return 0; }
LRESULT CDialogProperty::OnDelBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl) { int idx = m_properties.GetCurSel(); if (idx >= 0) { HPROPERTY hproperty = m_properties.GetProperty(idx); pfc::stringcvt::string_utf8_from_os uname = hproperty->GetName(); m_properties.DeleteItem(hproperty); m_dup_prop_map.remove(uname); } return 0; }
LRESULT CPropertyView::ItemUpdate(HPROPERTY hProperty, BOOL bCommit) { LPCSTR Name = hProperty->GetName(); HPROPERTY hCategory = hProperty->GetCategory(); SProperty *pP = m_PropertyList.FindProperty(Name, hCategory?hCategory->GetName():""); ASSERT(pP); if(!pP) return 0; VARIANT value; memset(&value,0,sizeof(VARIANT)); value.vt = VT_I4; if( pP->eType == SProperty::ptString || pP->eType == SProperty::ptUCString || pP->eType == SProperty::ptLCString ) value.vt = VT_BSTR; if(!hProperty->GetValue(&value)) return 0; switch(pP->eType) { case SProperty::ptUCString: case SProperty::ptLCString: case SProperty::ptString: strncpy(pP->szString, COLE2CT(value.bstrVal), pP->uMDL-1); pP->bChanged = true; break; case SProperty::ptRGBColor: case SProperty::ptARGBColor: pP->rgbColor = ARGBCOLOR(*(RGBQUAD*)&(value.intVal)); pP->bChanged = true; break; case SProperty::ptRangeValue: case SProperty::ptValue: pP->nValue = value.intVal; pP->bChanged = true; break; case SProperty::ptBoolean: pP->bBoolean = !(value.boolVal==FALSE); pP->bChanged = true; break; case SProperty::ptList: pP->nIndex = value.intVal; pP->bChanged = true; break; } CONSOLE_DEBUG("Property changed, updating...\n"); int idx = m_ctrlComboBox.GetFirstSel(); int items = 0; while(idx != -1) { IPropertyEnabled *pProperty = (IPropertyEnabled *)m_ctrlComboBox.GetItemDataPtr(idx); if((int)pProperty == -1) return 0; if(pProperty->SetProperties(m_PropertyList)) { if(bCommit==TRUE) { pProperty->Commit(); } items++; } idx = m_ctrlComboBox.GetNextSel(); } m_PropertyList.Touch(); // cleans all changed flags in the property list. CONSOLE_DEBUG("%d items changed%s.\n", items, (bCommit==TRUE)?" but all commited":""); // Update the list: OnUpdate(); // Update the linked window if(::IsWindow(m_hWndLinked)) { ::InvalidateRect(m_hWndLinked, NULL, TRUE); } return 0; }