Removed useless class, properties work

This commit is contained in:
andreja6
2018-10-23 13:42:10 -07:00
parent e4529a949a
commit 52d2cbf5dd
8 changed files with 30 additions and 67 deletions

View File

@@ -176,7 +176,7 @@
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
SubSystem="2"
SubSystem="1"
TargetMachine="1"
/>
<Tool
@@ -290,10 +290,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Property.cpp"
>
</File>
<File
RelativePath=".\propertyGrid.cpp"
>
@@ -407,10 +403,6 @@
RelativePath=".\PartType.h"
>
</File>
<File
RelativePath=".\Property.h"
>
</File>
<File
RelativePath=".\propertyGrid.h"
>

View File

@@ -41,26 +41,26 @@ PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc,
return pItem;
}
void Instance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
void Instance::PropUpdate(LPPROPGRIDITEM item)
{
if((DWORD)&name == addr)
if(strcmp(item->lpszPropName, "Name") == 0)
{
name = pItem.lpCurValue;
name = item->lpCurValue;
}
}
std::vector<Property> Instance::getProperties()
std::vector<PROPGRIDITEM> Instance::getProperties()
{
std::vector<Property> properties;
std::vector<PROPGRIDITEM> properties;
properties.push_back(Property(createPGI(
properties.push_back(createPGI(
"Properties",
"Name",
"The name of this instance",
(LPARAM)name.c_str(),
PIT_EDIT
), (DWORD)&name));
));
return properties;
}

View File

@@ -1,7 +1,7 @@
#pragma once
#include <G3DAll.h>
#include "Property.h"
#include "propertyGrid.h"
class Instance
{
public:
@@ -20,8 +20,8 @@ public:
void removeChild(Instance*);
Instance* getParent();
virtual Instance* clone() const { return new Instance(*this); }
virtual std::vector<Property> getProperties();
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem);
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM pItem);
protected:
std::string className;
Instance* parent; // Another pointer.

View File

@@ -214,35 +214,35 @@ PhysicalInstance::~PhysicalInstance(void)
}
void PhysicalInstance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM item)
{
if((DWORD)&name == addr)
if(strcmp(item->lpszPropName, "Name") == 0)
{
name = pItem.lpCurValue;
name = (LPTSTR)item->lpCurValue;
}
}
std::vector<Property> PhysicalInstance::getProperties()
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
{
std::vector<Property> properties;
std::vector<PROPGRIDITEM> properties;
properties.push_back(Property(createPGI(
properties.push_back(createPGI(
"Properties",
"Name",
"The name of this instance",
(LPARAM)name.c_str(),
PIT_EDIT
), (DWORD)&name));
));
char pso[512];
properties.push_back(Property(createPGI(
properties.push_back(createPGI(
"Item",
"Offset",
"The position of the object in the workspace",
(LPARAM)"Coming soon",
PIT_EDIT
), (DWORD)&position));
));
return properties;
}

View File

@@ -33,8 +33,8 @@ public:
bool anchored;
Vector3 rotVelocity;
bool collides(Box);
virtual std::vector<Property> getProperties();
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem);
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM pItem);
private:
Vector3 position;
Vector3 size;

View File

@@ -1,15 +0,0 @@
#include "Property.h"
Property::Property(PROPGRIDITEM item, DWORD addr)
{
this->addr = addr;
this->item = item;
}
Property::~Property(void)
{
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include <windows.h>
#include "propertyGrid.h"
class Property
{
public:
PROPGRIDITEM item;
DWORD addr;
Property(PROPGRIDITEM item, DWORD addr);
~Property(void);
};

View File

@@ -1,7 +1,6 @@
#define _WINSOCKAPI_
#include <windows.h>
#include "WindowFunctions.h"
#include "Property.h"
#include "resource.h"
#include "PropertyWindow.h"
@@ -10,7 +9,7 @@
Property &prop;
} PRGP;*/
std::vector<Property> prop;
std::vector<PROPGRIDITEM> prop;
Instance* selectedInstance;
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -32,13 +31,11 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case PGN_PROPERTYCHANGE:
{
if(selectedInstance != NULL)
{
for(size_t i = 0; i < prop.size(); i++)
{
MessageBox(NULL, (LPCSTR)prop.at(i).item.lpCurValue, "A", MB_OK);
selectedInstance->PropUpdate(prop.at(i).addr, prop.at(i).item);
}
if (IDC_PROPERTYGRID==wParam) {
LPNMHDR pnm = (LPNMHDR)lParam;
LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
selectedInstance->PropUpdate(item);
}
}
break;
@@ -143,7 +140,7 @@ void PropertyWindow::SetProperties(Instance * instance)
selectedInstance = instance;
for(size_t i = 0; i < prop.size(); i++)
{
::PROPGRIDITEM item = prop.at(i).item;
::PROPGRIDITEM item = prop.at(i);
PropGrid_AddItem(_propGrid, &item);
//PRGP propgp;
//propgp.instance = instance;