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

View File

@@ -41,26 +41,26 @@ PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc,
return pItem; 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", "Properties",
"Name", "Name",
"The name of this instance", "The name of this instance",
(LPARAM)name.c_str(), (LPARAM)name.c_str(),
PIT_EDIT PIT_EDIT
), (DWORD)&name)); ));
return properties; return properties;
} }

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <G3DAll.h> #include <G3DAll.h>
#include "Property.h" #include "propertyGrid.h"
class Instance class Instance
{ {
public: public:
@@ -20,8 +20,8 @@ public:
void removeChild(Instance*); void removeChild(Instance*);
Instance* getParent(); Instance* getParent();
virtual Instance* clone() const { return new Instance(*this); } virtual Instance* clone() const { return new Instance(*this); }
virtual std::vector<Property> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM pItem);
protected: protected:
std::string className; std::string className;
Instance* parent; // Another pointer. 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", "Properties",
"Name", "Name",
"The name of this instance", "The name of this instance",
(LPARAM)name.c_str(), (LPARAM)name.c_str(),
PIT_EDIT PIT_EDIT
), (DWORD)&name)); ));
char pso[512]; char pso[512];
properties.push_back(Property(createPGI( properties.push_back(createPGI(
"Item", "Item",
"Offset", "Offset",
"The position of the object in the workspace", "The position of the object in the workspace",
(LPARAM)"Coming soon", (LPARAM)"Coming soon",
PIT_EDIT PIT_EDIT
), (DWORD)&position)); ));
return properties; return properties;
} }

View File

@@ -33,8 +33,8 @@ public:
bool anchored; bool anchored;
Vector3 rotVelocity; Vector3 rotVelocity;
bool collides(Box); bool collides(Box);
virtual std::vector<Property> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM pItem);
private: private:
Vector3 position; Vector3 position;
Vector3 size; 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_ #define _WINSOCKAPI_
#include <windows.h> #include <windows.h>
#include "WindowFunctions.h" #include "WindowFunctions.h"
#include "Property.h"
#include "resource.h" #include "resource.h"
#include "PropertyWindow.h" #include "PropertyWindow.h"
@@ -10,7 +9,7 @@
Property &prop; Property &prop;
} PRGP;*/ } PRGP;*/
std::vector<Property> prop; std::vector<PROPGRIDITEM> prop;
Instance* selectedInstance; Instance* selectedInstance;
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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: case PGN_PROPERTYCHANGE:
{ {
if(selectedInstance != NULL) if (IDC_PROPERTYGRID==wParam) {
{ LPNMHDR pnm = (LPNMHDR)lParam;
for(size_t i = 0; i < prop.size(); i++) LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
{ LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
MessageBox(NULL, (LPCSTR)prop.at(i).item.lpCurValue, "A", MB_OK); selectedInstance->PropUpdate(item);
selectedInstance->PropUpdate(prop.at(i).addr, prop.at(i).item);
}
} }
} }
break; break;
@@ -143,7 +140,7 @@ void PropertyWindow::SetProperties(Instance * instance)
selectedInstance = instance; selectedInstance = instance;
for(size_t i = 0; i < prop.size(); i++) for(size_t i = 0; i < prop.size(); i++)
{ {
::PROPGRIDITEM item = prop.at(i).item; ::PROPGRIDITEM item = prop.at(i);
PropGrid_AddItem(_propGrid, &item); PropGrid_AddItem(_propGrid, &item);
//PRGP propgp; //PRGP propgp;
//propgp.instance = instance; //propgp.instance = instance;