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; }