Skip to content

Commit

Permalink
Remove invalid properties when controller is changed #5025
Browse files Browse the repository at this point in the history
  • Loading branch information
derwin12 authored and dkulp committed Jan 19, 2025
1 parent ffbe4b7 commit 92107f1
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions xLights/models/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,10 @@ void Model::AddControllerProperties(wxPropertyGridInterface* grid)
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
} else {
if (node->HasAttribute("brightness")) {
node->DeleteAttribute("brightness");
}
}

if (caps == nullptr || caps->SupportsPixelPortGamma()) {
Expand All @@ -1352,6 +1356,10 @@ void Model::AddControllerProperties(wxPropertyGridInterface* grid)
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
} else {
if (node->HasAttribute("gamma")) {
node->DeleteAttribute("gamma");
}
}

if (caps == nullptr || caps->SupportsPixelPortColourOrder()) {
Expand All @@ -1363,7 +1371,11 @@ void Model::AddControllerProperties(wxPropertyGridInterface* grid)
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
}
} else {
if (node->HasAttribute("colorOrder")) {
node->DeleteAttribute("colorOrder");
}
}

if (caps == nullptr || caps->SupportsPixelPortDirection()) {
sp = grid->AppendIn(p, new wxBoolProperty("Set Pixel Direction", "ModelControllerConnectionPixelSetDirection", node->HasAttribute("reverse")));
Expand All @@ -1374,20 +1386,28 @@ void Model::AddControllerProperties(wxPropertyGridInterface* grid)
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
}
} else {
if (node->HasAttribute("reverse")) {
node->DeleteAttribute("reverse");
}
}

if (caps == nullptr || caps->SupportsPixelPortGrouping()) {
sp = grid->AppendIn(p, new wxBoolProperty("Set Group Count", "ModelControllerConnectionPixelSetGroupCount", node->HasAttribute("groupCount")));
sp->SetAttribute("UseCheckbox", true);
auto sp2 = grid->AppendIn(sp, new wxUIntProperty("Group Count", "ModelControllerConnectionPixelGroupCount",
wxAtoi(GetControllerConnection()->GetAttribute("groupCount", "1"))));
sp2->SetAttribute("Min", 0);
sp2->SetAttribute("Min", 1);
sp2->SetAttribute("Max", 500);
sp2->SetEditor("SpinCtrl");
if (!node->HasAttribute("groupCount")) {
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
} else {
if (node->HasAttribute("groupCount")) {
node->DeleteAttribute("groupCount");
}
}

if (caps == nullptr || caps->SupportsPixelZigZag()) {
Expand All @@ -1402,6 +1422,10 @@ void Model::AddControllerProperties(wxPropertyGridInterface* grid)
grid->DisableProperty(sp2);
grid->Collapse(sp);
}
} else {
if (node->HasAttribute("zigZag")) {
node->DeleteAttribute("zigZag");
}
}

if (caps == nullptr || caps->SupportsTs()) {
Expand Down Expand Up @@ -2025,8 +2049,8 @@ int Model::OnPropertyGridChange(wxPropertyGridInterface* grid, wxPropertyGridEve
wxPGProperty* prop = grid->GetFirstChild(event.GetProperty());
grid->EnableProperty(prop, event.GetValue().GetBool());
if (event.GetValue().GetBool()) {
GetControllerConnection()->AddAttribute("groupCount", "0");
prop->SetValueFromInt(0);
GetControllerConnection()->AddAttribute("groupCount", "1");
prop->SetValueFromInt(1);
grid->Expand(event.GetProperty());
} else {
grid->Collapse(event.GetProperty());
Expand Down

0 comments on commit 92107f1

Please sign in to comment.