Browse Source

plMultistageStage => plString

Michael Hansen 11 years ago
parent
commit
cbea492457
  1. 12
      Sources/Tools/MaxComponent/plMultistageBehComponent.cpp
  2. 45
      Sources/Tools/MaxComponent/plMultistageStage.cpp
  3. 16
      Sources/Tools/MaxComponent/plMultistageStage.h

12
Sources/Tools/MaxComponent/plMultistageBehComponent.cpp

@ -306,7 +306,7 @@ void plMultistageBehComponent::IInitDlg()
for (int i = 0; i < fStages.size(); i++)
{
plBaseStage* stage = fStages[i];
ListView_AddString(hList, stage->GetName());
ListView_AddString(hList, stage->GetName().c_str());
}
// Make sure the column is wide enough
@ -326,16 +326,14 @@ void plMultistageBehComponent::FixStageNames()
if (fStages.size() > 0)
{
plBaseStage* stage = fStages[0];
const char * stageName = stage->GetName();
plString stageName = stage->GetName();
if(strcmp(stageName, "Stage 1") == 0)
if (stageName == "Stage 1")
{
for (int i = 0; i < fStages.size(); i++)
{
plBaseStage* stage = fStages[i];
char buf[64];
sprintf(buf, "Stage %d", i);
stage->SetName(buf);
stage->SetName(plString::Format("Stage %d", i));
}
}
}
@ -362,7 +360,7 @@ BOOL plMultistageBehComponent::IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
// Add the new stage to the list and make sure the list is wide enough
HWND hList = GetDlgItem(fDlg, IDC_STAGE_LIST);
int idx = ListView_AddString(hList, stage->GetName());
int idx = ListView_AddString(hList, stage->GetName().c_str());
ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
ListView_SetItemState(hList, idx, LVIS_SELECTED, LVIS_SELECTED);

45
Sources/Tools/MaxComponent/plMultistageStage.cpp

@ -53,16 +53,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plMultistageStage.h"
#include "plAvatar/plAnimStage.h"
plBaseStage::plBaseStage()
{
fName = nil;
}
plBaseStage::~plBaseStage()
{
delete [] fName;
}
BOOL plBaseStage::IStaticDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_INITDIALOG)
@ -96,24 +86,17 @@ void plBaseStage::IDestroyDlg(HWND hDlg)
GetCOREInterface()->DeleteRollupPage(hDlg);
}
const char* plBaseStage::GetName()
plString plBaseStage::GetName()
{
if (!fName)
fName = hsStrcpy("DefaultName");
if (fName.IsEmpty())
fName = "DefaultName";
return fName;
}
void plBaseStage::SetName(const char* name)
{
delete [] fName;
fName = hsStrcpy(name);
}
void plBaseStage::Read(hsStream *stream)
{
stream->ReadLE16();
delete [] fName;
fName = stream->ReadSafeString();
fName = stream->ReadSafeString_TEMP();
}
void plBaseStage::Write(hsStream *stream)
@ -124,7 +107,7 @@ void plBaseStage::Write(hsStream *stream)
void plBaseStage::IBaseClone(plBaseStage* clone)
{
clone->fName = hsStrcpy(fName);
clone->fName = fName;
}
////////////////////////////////////////////////////////////////////////////////
@ -134,7 +117,6 @@ HWND plStandardStage::fDlg = NULL;
plStandardStage::plStandardStage()
{
fAnimName = nil;
fNumLoops = 0;
fLoopForever = false;
fForward = 0;
@ -149,19 +131,13 @@ plStandardStage::plStandardStage()
fRegressTo = 0;
}
plStandardStage::~plStandardStage()
{
delete [] fAnimName;
}
void plStandardStage::Read(hsStream *stream)
{
plBaseStage::Read(stream);
uint16_t version = stream->ReadLE16();
delete [] fAnimName;
fAnimName = stream->ReadSafeString();
fAnimName = stream->ReadSafeString_TEMP();
fNumLoops = stream->ReadLE32();
fLoopForever = stream->ReadBool();
fForward = stream->ReadByte();
@ -329,10 +305,9 @@ void plStandardStage::IGetAnimName()
char buf[256];
edit->GetText(buf, sizeof(buf));
if (strcmp(buf, fAnimName) != 0)
if (fAnimName != buf)
{
delete [] fAnimName;
fAnimName = hsStrcpy(buf);
fAnimName = buf;
SetSaveRequiredFlag();
}
@ -387,7 +362,7 @@ static void LoadCombo(HWND hCombo, NameType* nameInt, int size, int curVal)
void plStandardStage::IInitDlg()
{
ICustEdit* edit = GetICustEdit(GetDlgItem(fDlg, IDC_ANIM_NAME));
edit->SetText(fAnimName);
edit->SetText(fAnimName.c_str());
HWND hForward = GetDlgItem(fDlg, IDC_FORWARD_COMBO);
LoadCombo(hForward, gForward, sizeof(gForward), fForward);
@ -446,7 +421,7 @@ plAnimStage* plStandardStage::CreateStage()
plBaseStage* plStandardStage::Clone()
{
plStandardStage* clone = new plStandardStage;
clone->fAnimName = hsStrcpy(fAnimName);
clone->fAnimName = fAnimName;
clone->fNumLoops = fNumLoops;
clone->fLoopForever = fLoopForever;
clone->fForward = fForward;

16
Sources/Tools/MaxComponent/plMultistageStage.h

@ -40,6 +40,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "plString.h"
class plAnimStage;
class plBaseStage;
class hsStream;
@ -56,7 +58,7 @@ enum StageTypes
class plBaseStage
{
protected:
char* fName;
plString fName;
static BOOL CALLBACK IStaticDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
virtual BOOL IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@ -67,8 +69,8 @@ protected:
void IBaseClone(plBaseStage* clone);
public:
plBaseStage();
virtual ~plBaseStage();
plBaseStage() { }
virtual ~plBaseStage() { }
// From StageTypes
virtual int GetType()=0;
@ -84,8 +86,8 @@ public:
virtual plBaseStage* Clone()=0;
const char* GetName();
void SetName(const char* name);
plString GetName(); // NOT const (this could change fName)
void SetName(const plString& name) { fName = name; }
};
class plStandardStage : public plBaseStage
@ -93,7 +95,7 @@ class plStandardStage : public plBaseStage
protected:
static HWND fDlg;
char *fAnimName;
plString fAnimName;
uint32_t fNumLoops;
bool fLoopForever;
uint8_t fForward;
@ -114,7 +116,7 @@ protected:
public:
plStandardStage();
~plStandardStage();
~plStandardStage() { }
int GetType() { return kStandard; }

Loading…
Cancel
Save