Skip to content

Commit

Permalink
Fix total nodes tooltip for groups #4481 (#4496)
Browse files Browse the repository at this point in the history
Co-authored-by: darylE <[email protected]>
  • Loading branch information
derwin12 and derwin12 authored Apr 12, 2024
1 parent 5e5c541 commit d8c71b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions xLights/LayoutPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5843,14 +5843,14 @@ std::vector<Model *> LayoutPanel::GetSelectedModelsFromGroup(wxTreeListItem grou
}

// The will return unique selected models for edit, useful when groups are also selected in model tree
std::vector<Model*> LayoutPanel::GetSelectedModelsForEdit() {
std::vector<Model*> LayoutPanel::GetSelectedModelsForEdit(bool incSubModels) {
std::vector<Model*> modelsForEdit;

for (const auto& groupItem : selectedTreeGroups) {
std::vector<Model*> groupModels = GetSelectedModelsFromGroup(groupItem);
for (Model* model: groupModels) {
if (std::find(modelsForEdit.begin(), modelsForEdit.end(), model) == modelsForEdit.end()) {
if (model->GetDisplayAs() != "SubModel") {
if (model->GetDisplayAs() != "SubModel" || incSubModels) {
modelsForEdit.push_back(model);
}
}
Expand Down Expand Up @@ -9070,7 +9070,6 @@ int LayoutPanel::calculateNodeCountOfSelected()
int totalNodeCount = 0;
std::vector<Model*> modelsProcessed;
//We can break the selected groups into their components for processing. GetSelectedModelsForEdit already does this, even though we aren't editing. We can reuse that logic. This gives us all models, so I want to split this back up into models and submodels
std::vector<Model*> modelsToProcess = GetSelectedModelsForEdit();
std::vector<Model*> selectedModels;
std::vector<Model*> selectedSubModels;

Expand All @@ -9082,7 +9081,7 @@ int LayoutPanel::calculateNodeCountOfSelected()
}

//Now parse the group elements into their perspective groups for processing
std::vector<Model*> sgModels = GetSelectedModelsForEdit();
std::vector<Model*> sgModels = GetSelectedModelsForEdit(true);
for (const auto& item : sgModels){
if (item->GetDisplayAs() == "SubModel") {
selectedSubModels.push_back(item);
Expand Down
2 changes: 1 addition & 1 deletion xLights/LayoutPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class LayoutPanel: public wxPanel
Model* GetModelFromTreeItem(wxTreeListItem treeItem);
wxTreeListItem GetTreeItemFromModel(Model* model);
std::vector<Model*> GetSelectedModelsFromGroup(wxTreeListItem groupItem, bool nested = true);
std::vector<Model*> GetSelectedModelsForEdit();
std::vector<Model*> GetSelectedModelsForEdit(bool incSubModels = false);
void SetTreeModelSelected(Model* model, bool isPrimary);
void SetTreeGroupModelsSelected(Model* model, bool isPrimary);
void SetTreeSubModelSelected(Model* model, bool isPrimary);
Expand Down

0 comments on commit d8c71b3

Please sign in to comment.