Moved selection to be a service

This commit is contained in:
Vulpovile
2022-10-03 19:30:24 -07:00
parent b2db375ecf
commit f46e24d8f1
18 changed files with 177 additions and 140 deletions

View File

@@ -172,8 +172,8 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
CHAR ListItem[256];
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
propWind->ClearProperties();
g_usableApp->selectInstance(children.at(ItemIndex),propWind);
g_dataModel->getSelectionService()->clearSelection();
g_dataModel->getSelectionService()->addSelected(children.at(ItemIndex));
}
}
break;
@@ -203,13 +203,12 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
void PropertyWindow::refreshExplorer(Instance* selectedInstance)
void PropertyWindow::refreshExplorer(std::vector<Instance*> selectedInstances)
{
Instance * instance = selectedInstances[0];
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
parent = NULL;
children.clear();
//g_selectedInstances.clear();
//for (unsigned int i=0;i<g_selectedInstances.size();i++) {
children.push_back(selectedInstance);
SendMessage(_explorerComboBox, CB_ADDSTRING, 0, (LPARAM)selectedInstance->name.c_str());
if(selectedInstance->getParent() != NULL)
@@ -221,7 +220,6 @@ void PropertyWindow::refreshExplorer(Instance* selectedInstance)
parent = selectedInstance->getParent();
children.push_back(selectedInstance->getParent());
}
//children = g_selectedInstances[i]->getChildren();
std::vector<Instance*> selectedChildren = selectedInstance->getChildren();
for(size_t z = 0; z < selectedChildren.size(); z++)
@@ -338,8 +336,14 @@ void PropertyWindow::_resize()
SetWindowPos(_explorerComboBox, NULL, 0, 0, rect.right, 400, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
void PropertyWindow::UpdateSelected(Instance * instance)
void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
{
if(instances.size() < 0)
{
ClearProperties();
return;
}
Instance * instance = instances[0];
PropGrid_ResetContent(_propGrid);
prop = instance->getProperties();
//if (selectedInstance != instance)
@@ -356,7 +360,7 @@ void PropertyWindow::UpdateSelected(Instance * instance)
PropGrid_ExpandAllCatalogs(_propGrid);
//SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
refreshExplorer(instance);
refreshExplorer(instances);
_resize();
}
}