Made instances call parent function on properties, Deselecting everything opens Datamodel in the property grid
Instances now call the parent method after setting/getting properties, Made delete no longer delete workspace
This commit is contained in:
@@ -45,7 +45,7 @@ void Instance::PropUpdate(LPPROPGRIDITEM &item)
|
|||||||
{
|
{
|
||||||
if(strcmp(item->lpszPropName, "Name") == 0)
|
if(strcmp(item->lpszPropName, "Name") == 0)
|
||||||
{
|
{
|
||||||
name = item->lpCurValue;
|
name = (LPSTR)item->lpCurValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,11 +218,7 @@ char pto2[512];
|
|||||||
|
|
||||||
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
{
|
{
|
||||||
if(strcmp(item->lpszPropName, "Name") == 0)
|
if(strcmp(item->lpszPropName, "Color3") == 0)
|
||||||
{
|
|
||||||
name = (LPTSTR)item->lpCurValue;
|
|
||||||
}
|
|
||||||
else if(strcmp(item->lpszPropName, "Color3") == 0)
|
|
||||||
{
|
{
|
||||||
color = Color3(GetRValue(item->lpCurValue)/255.0F,GetGValue(item->lpCurValue)/255.0F,GetBValue(item->lpCurValue)/255.0F);
|
color = Color3(GetRValue(item->lpCurValue)/255.0F,GetGValue(item->lpCurValue)/255.0F,GetBValue(item->lpCurValue)/255.0F);
|
||||||
}
|
}
|
||||||
@@ -283,21 +279,15 @@ void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
|||||||
setSize(size);
|
setSize(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else Instance::PropUpdate(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
|
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
|
||||||
{
|
{
|
||||||
std::vector<PROPGRIDITEM> properties;
|
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
|
||||||
|
|
||||||
|
|
||||||
properties.push_back(createPGI(
|
|
||||||
"Properties",
|
|
||||||
"Name",
|
|
||||||
"The name of this instance",
|
|
||||||
(LPARAM)name.c_str(),
|
|
||||||
PIT_EDIT
|
|
||||||
));
|
|
||||||
|
|
||||||
properties.push_back(createPGI(
|
properties.push_back(createPGI(
|
||||||
"Properties",
|
"Properties",
|
||||||
"Color3",
|
"Color3",
|
||||||
|
|||||||
19
main.cpp
19
main.cpp
@@ -295,17 +295,26 @@ void deleteInstance()
|
|||||||
{
|
{
|
||||||
if(g_selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
while(g_selectedInstances.size() > 0)
|
int undeletable = 0;
|
||||||
|
while(g_selectedInstances.size() > undeletable)
|
||||||
{
|
{
|
||||||
|
if(g_selectedInstances.at(0) != dataModel && g_selectedInstances.at(0) != dataModel->getWorkspace())
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
||||||
Instance* selectedInstance = g_selectedInstances.at(0);
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
if(selectedInstance->getParent() != NULL)
|
if(selectedInstance->getParent() != NULL)
|
||||||
selectedInstance->getParent()->removeChild(selectedInstance);
|
selectedInstance->getParent()->removeChild(selectedInstance);
|
||||||
delete selectedInstance;
|
delete selectedInstance;
|
||||||
selectedInstance = NULL;
|
selectedInstance = NULL;
|
||||||
g_selectedInstances.erase(g_selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
undeletable++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(g_selectedInstances.size() == 0)
|
||||||
usableApp->_propWindow->ClearProperties();
|
usableApp->_propWindow->ClearProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,7 +838,7 @@ void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
|||||||
if(obj != NULL)
|
if(obj != NULL)
|
||||||
{
|
{
|
||||||
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
||||||
if(g_selectedInstances.size() <= 0)
|
if(g_selectedInstances.size() <= 0 || g_selectedInstances.at(0) == dataModel->getWorkspace())
|
||||||
button->disabled = true;
|
button->disabled = true;
|
||||||
else
|
else
|
||||||
button->disabled = false;
|
button->disabled = false;
|
||||||
@@ -1308,7 +1317,9 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
{
|
{
|
||||||
while(g_selectedInstances.size() > 0)
|
while(g_selectedInstances.size() > 0)
|
||||||
g_selectedInstances.erase(g_selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
_propWindow->ClearProperties();
|
g_selectedInstances.push_back(dataModel->getWorkspace());
|
||||||
|
_propWindow->SetProperties(dataModel->getWorkspace());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user