void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) { if (!editId) { return; } SDRDeviceInfo *dev = getSelectedDevice(editId); if (editId && event.GetProperty() == devSettings["name"]) { DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId()); wxString devName = event.GetPropertyValue().GetString(); devConfig->setDeviceName(devName.ToStdString()); if (editId) { devTree->SetItemText(editId, devConfig->getDeviceName()); } if (devName == "") { event.GetProperty()->SetValueFromString(devConfig->getDeviceName()); } } if (dev && event.GetProperty() == devSettings["offset"]) { DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId()); long offset = event.GetPropertyValue().GetInteger(); devConfig->setOffset(offset); } }
/////////////////////////////////////////////////////////////////////////////// /// /// Wird aufgerufen, wenn der Benutzer eine Property geändert hat. /// /// @param ev PropertyGrid-Event /// /////////////////////////////////////////////////////////////////////////////// void PropertyGridControllerMotionCapture::OnPropertyChanged(wxPropertyGridEvent& ev) { if(ev.GetProperty()->GetName().compare("Name") == 0) { wxString newName = ev.GetProperty()->GetValueAsString(); motionCapture->SetName(newName.c_str()); } }
bool ObjectsPropgridHelper::OnPropertyChanged(gd::Object * object, gd::Layout * layout, wxPropertyGridEvent& event) { if ( !grid || !object ) return false; auto readEnumPropertyString = [&event](std::map<gd::String, gd::PropertyDescriptor> properties) { const std::vector<gd::String> & choices = properties[event.GetProperty()->GetLabel()].GetExtraInfo(); unsigned int id = event.GetPropertyValue().GetLong(); if (id < choices.size()) { return gd::String(choices[id]); } return gd::String(""); }; if ( event.GetPropertyName().substr(0,10) == "AUTO_PROP:" ) { gd::String autoName = event.GetPropertyName().substr(10); if ( !object->HasBehaviorNamed(autoName)) { event.Veto(); return false; } gd::Behavior & behavior = object->GetBehavior(autoName); gd::String value = event.GetPropertyValue().GetString(); //Special case for enums. if (wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty())) value = readEnumPropertyString(behavior.GetProperties(project)); if (!behavior.UpdateProperty(event.GetProperty()->GetLabel(), value, project)) { event.Veto(); return false; } } else if ( event.GetPropertyName().substr(0,8) == "OBJ_PROP" ) { gd::String value = event.GetPropertyValue().GetString(); //Special case for enums. if (wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty())) value = readEnumPropertyString(object->GetProperties(project)); if (!object->UpdateProperty(event.GetProperty()->GetLabel(), value, project)) { event.Veto(); return false; } } return false; }
//--------------------------------------------------------- void CParameters_Control::On_PG_Changed(wxPropertyGridEvent &event) { _Set_Parameter(event.GetPropertyName()); if( event.GetProperty() ) { m_pPG->SelectProperty(event.GetProperty()); } event.Skip(); }
void rePropertyInspector::OnPropertyValueChanged(wxPropertyGridEvent& event){ wxPGProperty* property = event.GetProperty(); wxStringClientData* propertyInfo = static_cast<wxStringClientData*>(property->GetClientObject()); wxStringTokenizer tokenizer(propertyInfo->GetData(), ":"); wxString propertyType = tokenizer.GetNextToken(); wxString propertyName = tokenizer.GetNextToken(); wxAny anyVal; if (propertyType == "vector3"){ wxVariant x = GetProperty(propertyName + ".x")->GetValue(); wxVariant y = GetProperty(propertyName + ".y")->GetValue(); wxVariant z = GetProperty(propertyName + ".z")->GetValue(); rVector3 vec3(x.GetDouble(), y.GetDouble(), z.GetDouble()); anyVal = vec3; } else if (propertyType == "color"){ wxAny colorVal = property->GetValue(); wxColor cpv = colorVal.As<wxColor>(); rColor c(cpv.Red(), cpv.Green(), cpv.Blue(), cpv.Alpha()); anyVal = c; } else if (propertyType == "int" || propertyType == "float" || propertyType == "string" || propertyType == "bool"){ anyVal = property->GetValueAsString(); } m_component->SubmitCommand(new reSetPropertyCommand(m_actorName, propertyName, anyVal, m_component)); }
void VisualizationPanel::onPropertySelected( wxPropertyGridEvent& event ) { wxPGProperty* pg_property = event.GetProperty(); selected_display_ = NULL; if ( !pg_property ) { return; } void* client_data = pg_property->GetClientData(); if ( client_data ) { PropertyBase* property = reinterpret_cast<PropertyBase*>(client_data); void* user_data = property->getUserData(); if ( user_data ) { Display* display = reinterpret_cast<Display*>(user_data); if ( manager_->isValidDisplay( display ) ) { selected_display_ = display; } } } }
bool EditorChoiceWindowT::HandlePGChange(wxPropertyGridEvent& Event, GuiEditor::ChildFrameT* ChildFrame) { if (EditorWindowT::HandlePGChange(Event, ChildFrame)) return true; const wxPGProperty* Prop =Event.GetProperty(); const wxString PropName=Prop->GetName(); if (PropName=="Choices") { ArrayT<std::string> NewStrings; wxStringTokenizer Tokenizer(Prop->GetValueAsString(), "\r\n"); while (Tokenizer.HasMoreTokens()) NewStrings.PushBack(std::string(Tokenizer.GetNextToken())); ChildFrame->SubmitCommand(new CommandSetWinPropT< ArrayT<std::string> >(m_GuiDoc, this, PropName, m_Choice->m_Choices, NewStrings)); return true; } if (PropName=="DefaultChoice") { wxASSERT(m_Choice->GetMemberVar("selectedChoice").Member!=NULL); ChildFrame->SubmitCommand(new CommandModifyWindowT(m_GuiDoc, m_Choice, PropName, m_Choice->GetMemberVar("selectedChoice"), Prop->GetValue().GetLong())); return true; } return false; }
//----------------------------------------------------------------------------- void Property::OnChange (wxPropertyGridEvent &event) { wxPGProperty *id = event.GetProperty(); PX2_UNUSED(id); const wxString &name = event.GetPropertyName(); std::string stdName = std::string(name); wxVariant variant = event.GetPropertyValue(); if (name != wxString(mName.c_str())) return; if (variant.IsNull()) return; if (!mData) return; if (mType == PT_INT) { *((int*)mData) = wxPGVariantToInt(variant); } else if (mType == PT_FLOAT) { double value = 0; wxPGVariantToDouble(variant, &value); *((float*)mData) = (float)value; } else if (mType == PT_BOOL) { bool value = (bool)(event.GetPropertyValueAsBool()!=0); *((bool*)mData) = value; } else if (mType == PT_BOOLCHECK) { bool value = (bool)(event.GetPropertyValueAsBool()!=0); *((bool*)mData) = value; } else if (PT_COLOR3FLOAT3 == mType) { wxString strColor = event.GetPropertyValueAsString(); wxColor color = StringToColor(strColor); Float3 float3Color((float)color.Red()/255.0f, (float)color.Green()/255.0f, (float)color.Blue()/255.0f); *((Float3*)mData) = float3Color; } else if (PT_FLOAT3 == mType) { *((Float3*)mData) = Float3FromVariant(variant); } else if (mType == PT_STRING) { std::string value; wxString wxValue = event.GetPropertyValueAsString(); value = std::string(wxValue.ToAscii()); *((std::string*)mData) = value; } }
//----------------------------------------------------------------------------- void EMFloatProperty::OnChange (wxPropertyGridEvent &event) { wxPGProperty *prop = event.GetProperty(); const wxString &wxName = event.GetPropertyName(); wxVariant var = prop->GetValue(); if (var.IsNull()) return; float fValue = (float)(var.GetDouble()); if (mPropertyInVal == prop) { mPoint->InVal = fValue; } else if (mPropertyOutVal == prop) { mPoint->OutVal = fValue; } else if (mPropertyArriveTangent == prop) { mPoint->ArriveTangent = fValue; } else if (mPropertyLeaveTangent == prop) { mPoint->LeaveTangent = fValue; } else if (mInterpMode == prop) { int val = var.GetInteger(); mPoint->InterpMode = (InterpCurveMode)val; } }
//------------------------------------------------------------------------ // //------------------------------------------------------------------------ void CPropertyWindow::OnPropertyGridSelect( wxPropertyGridEvent& event ) { SetFocus(); wxPGProperty* pProp = event.GetProperty(); RET(!pProp); wxString name = pProp->GetName(); SPropItem *pItemData = (SPropItem*)pProp->GetClientData(); if (pItemData && pItemData->typeData.vt == VT_EMPTY && pProp->GetChildCount() <= 0) { IDiaSymbol *pSym = dia::FindType(pItemData->symbolTypeName); if (!pSym) return; DWORD ptr = (DWORD)pItemData->typeData.ptr; if (SymTagPointerType == pItemData->typeData.symtag) ptr = visualizer::Point2PointValue((DWORD)pItemData->typeData.ptr); SSymbolInfo symbol( pSym, memmonitor::SMemInfo("*", (void*)ptr, 0) ); visualizer::MakePropertyChild_DefaultForm( visualizer::SVisDispDesc(this,pProp), symbol, true, 2 ); //if (!FindSymbolUpward( pProp, &symbol )) // return; //if (visualizer::MakePropertyChild_DefaultForm( this, pProp, symbol)) //{ //pProp->Expand(); //AdjustLayout(); //} } }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void PropertiesView::onPropertyGridChanging(wxPropertyGridEvent& _event) { wxPGProperty* const pWXProperty = _event.GetProperty(); // TODO Don't assume this is a string. std::string newValue = wx2std(_event.GetValue().GetString()); if (pWXProperty->GetClientData() != NULL) { I_Property* pProperty = static_cast<I_Property*>(pWXProperty->GetClientData()); assert(pProperty != NULL); if (!pProperty->getPublisher().getController().canChangeProperty(*pProperty, newValue)) { // Veto the event. _event.Veto(); // Set the validation failure behavior. _event.SetValidationFailureBehavior(wxPG_VFB_STAY_IN_PROPERTY //| wxPG_VFB_BEEP //| wxPG_VFB_SHOW_MESSAGE ); } } }
//----------------------------------------------------------------------------- void UIPicBoxPropGrid::OnPropertyGridChange (wxPropertyGridEvent &event) { ObjectPropertyGrid::OnPropertyGridChange(event); wxPGProperty *prop = event.GetProperty(); if (prop->GetName() == PX2_LM.GetValue("Color")) { mUIPicBox->SetColor(mColor); } else if (prop->GetName() == PX2_LM.GetValue("Alpha01")) { mUIPicBox->SetAlpha(mAlpha); } else if (prop->GetName() == PX2_LM.GetValue("AnchorX") || prop->GetName() == PX2_LM.GetValue("AnchorZ")) { mUIPicBox->SetAnchorPoint(mAnchorPoint); } else if (prop->GetName() == PX2_LM.GetValue("Width")) { mUIPicBox->SetWidth(mWidth); } else if (prop->GetName() == PX2_LM.GetValue("Height")) { mUIPicBox->SetHeight(mHeight); } else if (prop->GetName() == PX2_LM.GetValue("DoubleSide")) { mUIPicBox->SetDoubleSide(mIsDoubleSide); } }
void TweaksSettingsDlg::OnColourChanged(wxPropertyGridEvent& event) { event.Skip(); wxPGProperty* prop = event.GetProperty(); CHECK_PTR_RET(prop); if ( prop == m_pgPropGlobalTabBG ) { // Global tab bg colour was modified wxColourPropertyValue cpv; cpv << prop->GetValue(); m_settings.SetGlobalBgColour( cpv.m_colour ); } else if ( prop == m_pgPropGlobalTabFG ) { // Global tab colour was modified wxColourPropertyValue cpv; cpv << prop->GetValue(); m_settings.SetGlobalFgColour( cpv.m_colour ); } else if ( prop->GetParent() ) { // project specific colour was changed wxColourPropertyValue cpv; cpv << prop->GetValue(); if ( prop->GetLabel().Contains("text colour") ) { m_settings.GetProjectTweaks(prop->GetParent()->GetLabel()).SetTabFgColour( cpv.m_colour ); } else if ( prop->GetLabel().Contains("background colour") ) { m_settings.GetProjectTweaks(prop->GetParent()->GetLabel()).SetTabBgColour( cpv.m_colour ); } } }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void PropertiesView::onPropertyGridChanged(wxPropertyGridEvent& _event) { wxPGProperty* const pWXProperty = _event.GetProperty(); // TODO Don't assume this is a string. std::string newValue = wx2std(_event.GetProperty()->GetValueAsString()); if (pWXProperty->GetClientData() != NULL) { I_Property* pProperty = static_cast<I_Property*>(pWXProperty->GetClientData()); assert(pProperty != NULL); pProperty->getPublisher().getController().setPropertyValue(*pProperty, newValue); } }
void EntityPropertyGridPage::propertyChange(wxPropertyGridEvent& event) { wxPGId id = event.GetProperty(); if(id == mDisplaySkeleton) { mEntity->setDisplaySkeleton(event.GetPropertyValueAsBool()); } }
void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) { if (editId && event.GetProperty() == devSettings["name"]) { DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId()); wxString devName = event.GetPropertyValue().GetString(); devConfig->setDeviceName(devName.ToStdString()); if (editId) { devTree->SetItemText(editId, devConfig->getDeviceName()); } if (devName == "") { event.GetProperty()->SetValueFromString(devConfig->getDeviceName()); } } else if (dev && event.GetProperty() == devSettings["offset"]) { DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId()); long offset = event.GetPropertyValue().GetInteger(); devConfig->setOffset(offset); } else if (editId && dev) { wxPGProperty *prop = event.GetProperty(); for (std::map<std::string, wxPGProperty *>::iterator rtp = runtimeProps.begin(); rtp != runtimeProps.end(); rtp++) { if (rtp->second == prop) { SoapySDR::Device *soapyDev = dev->getSoapyDevice(); std::string settingValue = prop->GetValueAsString().ToStdString(); SoapySDR::ArgInfo arg = runtimeArgs[rtp->first]; if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) { settingValue = arg.options[prop->GetChoiceSelection()]; } else if (arg.type == SoapySDR::ArgInfo::BOOL) { settingValue = (prop->GetValueAsString()=="True")?"true":"false"; } else { settingValue = prop->GetValueAsString(); } soapyDev->writeSetting(rtp->first, settingValue); if (dev->isActive()) { wxGetApp().getSDRThread()->writeSetting(rtp->first, settingValue); } refreshDeviceProperties(); return; } } } }
void wxPropertyGridManager::OnPropertyGridSelect( wxPropertyGridEvent& event ) { // Check id. wxASSERT_MSG( GetId() == m_pPropGrid->GetId(), wxT("wxPropertyGridManager id must be set with wxPropertyGridManager::SetId (not wxWindow::SetId).") ); SetDescribedProperty(event.GetProperty()); event.Skip(); }
void SelectionPanel::onPropertyChanging( wxPropertyGridEvent& event ) { wxPGProperty* property = event.GetProperty(); if ( !property ) { return; } property_manager_->propertyChanging( event ); }
void VisualizationPanel::onPropertyChanging( wxPropertyGridEvent& event ) { wxPGProperty* property = event.GetProperty(); if ( !property ) { return; } manager_->getPropertyManager()->propertyChanging( event ); }
void MaterialPropertyGridPage::propertyChange(wxPropertyGridEvent& event) { wxPGId id = event.GetProperty(); if(id == mReceiveShadowsId) { mMaterial->setReceiveShadows(event.GetPropertyValueAsBool()); } else if(id == mTransparencyShadowsId) { mMaterial->setTransparencyCastsShadows(event.GetPropertyValueAsBool()); } }
void ProjectPropertiesPnl::OnPropertyChanged(wxPropertyGridEvent& event) { if (project) project->OnChangeInPropertyGrid(propertyGrid, event); if ( event.GetPropertyName() == _("Name of the project") && associatedTree != NULL) associatedTree->SetItemText(associatedTreeItem, event.GetProperty()->GetValue()); if ( event.GetPropertyName() == _("Activate the use of C++ source files") && associatedProjectManager != NULL) associatedProjectManager->Refresh(); if (project) project->SetDirty(); }
//------------------------------------------------------------------------ // Property Change Event Handler //------------------------------------------------------------------------ void CPropertyWindow::OnPropertyGridChange( wxPropertyGridEvent& event ) { wxPGProperty* pProp = event.GetProperty(); SPropItem *pItemData = (SPropItem*)pProp->GetClientData(); if (pItemData && pItemData->typeData.ptr) { const wxVariant curVar = pProp->GetValue(); _variant_t var = wxVariant2Variant(pItemData->typeData.vt, curVar); // write memory dia::SetValue( pItemData->typeData.ptr, var); } }
void DlgDbgBuffers::OnBufferSelection(wxPropertyGridEvent& e) { const wxPGProperty *p = e.GetProperty(); if (p == NULL) return; const wxPGProperty *q = p->GetParent(); if (q->GetLabel() == "<Root>") currentBuffer = p->GetLabel(); else currentBuffer = q->GetLabel(); setBufferData(); }
//----------------------------------------------------------------------------- void EMFloat3Property::OnChange (wxPropertyGridEvent &event) { wxPGProperty *prop = event.GetProperty(); const wxString &wxName = event.GetPropertyName(); wxVariant var = prop->GetValue(); PX2_UNUSED(wxName); if (var.IsNull()) return; if (mPropertyInVal == prop) { float fValue = (float)(var.GetDouble()); mPoint->InVal = fValue; if (mPropertyInVal) mPropertyInVal->SetValue(fValue); } else if (mPropertyOutVal == prop) { if (mIsColor) { wxColor color = wxANY_AS(var.GetAny(), wxColor); Float3 float3Color((float)color.Red()/255.0f, (float)color.Green()/255.0f, (float)color.Blue()/255.0f); mPoint->OutVal = float3Color; } else { mPoint->OutVal = Float3RefFromVariant(var); } } else if (mPropertyArriveTangent == prop) { mPoint->ArriveTangent = Float3RefFromVariant(var); } else if (mPropertyLeaveTangent == prop) { mPoint->LeaveTangent = Float3RefFromVariant(var); } else if (mInterpMode == prop) { int val = var.GetInteger(); mPoint->InterpMode = (InterpCurveMode)val; } }
void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) { wxPGProperty* p = event.GetProperty(); if ( p ) { wxLogVerbose("OnPropertyGridChange(%s, value=%s)", p->GetName(), p->GetValueAsString()); } else { wxLogVerbose("OnPropertyGridChange(NULL)"); } }
void TechniquePropertyGridPage::propertyChanged(wxPropertyGridEvent& event) { wxPGId id = event.GetProperty(); if(id == mNameId) { mController->setName(event.GetPropertyValueAsString().c_str()); } else if(id == mSchemeNameId) { mController->setSchemeName(event.GetPropertyValueAsString().c_str()); } else if(id = mLodIndexId) { mController->setLodIndex(event.GetPropertyValueAsInt()); } }
//----------------------------------------------------------------------------- void Property::OnChange (wxPropertyGridEvent &event) { wxPGProperty *property = event.GetProperty(); const wxString &name = event.GetPropertyName(); std::string stdName = std::string(name); wxAny anyValue = property->GetValue(); if (name != wxString(mName.c_str())) return; if (!mData) return; if (mType == PT_INT) { *((int*)mData) = wxANY_AS(anyValue, int); }
void CompilersModifiedDlg::OnValueChanged(wxPropertyGridEvent& event) { event.Skip(); wxString newCompiler = event.GetProperty()->GetValueAsString(); wxString oldCompiler = event.GetPropertyName(); m_table.erase( oldCompiler ); m_table[ oldCompiler ] = newCompiler; m_enableOKButton = true; wxStringMap_t::iterator iter = m_table.begin(); for(; iter != m_table.end(); ++iter ) { if ( iter->second == SELECT_COMPILER ) { m_enableOKButton = false; break; } } }
void TweaksSettingsDlg::OnImageSelected(wxPropertyGridEvent& event) { wxPGProperty* prop = event.GetProperty(); CHECK_PTR_RET(prop); wxString projectName = prop->GetLabel(); m_settings.GetProjectTweaks(projectName).SetBitmapFilename( prop->GetValueAsString() ); if ( !m_settings.HasFlag( TweaksSettings::kDontPromptForProjectReload ) ) { wxRichMessageDialog dlg(this, _("Icon changes require a workspace reload"), "CodeLite", wxOK|wxOK_DEFAULT|wxCANCEL|wxICON_INFORMATION); dlg.ShowCheckBox(_("Remember my answer")); if ( dlg.ShowModal() == wxID_OK ) { if ( dlg.IsCheckBoxChecked() ) { m_settings.EnableFlag( TweaksSettings::kDontPromptForProjectReload, true ); } } } }
void InspectorPropertyGridPage::OnPropertyChanged(wxPropertyGridEvent& event) { wxPGProperty* property = event.GetProperty(); if (property == nameID) { sceneNode->SetNodeName(std::string(property->GetValue().GetString().c_str())); } else if (property == positionID) { Vector3 val = Vector3RefFromVariant(property->GetValue()); sceneNode->SetPosition(val._x, val._y, val._z); } else if (property == scaleID) { Vector3 val = Vector3RefFromVariant(property->GetValue()); sceneNode->SetScale(val._x, val._y, val._z); } }