|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshchildlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshleveltypes.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheet.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/imagemanager.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshcolumn.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tconvert.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "timagecache.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DEFINE_CLASS_CODE(TXshChildLevel, 50)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PERSIST_IDENTIFIER(TXshChildLevel, "childLevel")
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// TXshChildLevel
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshChildLevel::TXshChildLevel(wstring name)
|
|
Toshihiro Shimizu |
890ddd |
: TXshLevel(m_classCode, name), m_xsheet(new TXsheet()), m_iconId()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->addRef();
|
|
Toshihiro Shimizu |
890ddd |
m_type = CHILD_XSHLEVEL;
|
|
Toshihiro Shimizu |
890ddd |
//static int count = 0;
|
|
Toshihiro Shimizu |
890ddd |
//m_name = L"sub" + toWideString(++count);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshChildLevel::~TXshChildLevel()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->release();
|
|
Toshihiro Shimizu |
890ddd |
if (m_iconId != "") {
|
|
Toshihiro Shimizu |
890ddd |
ImageManager::instance()->bind(m_iconId, 0);
|
|
Toshihiro Shimizu |
890ddd |
TImageCache::instance()->remove(m_iconId);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshChildLevel::loadData(TIStream &is)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheet)
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->release();
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet = 0;
|
|
Toshihiro Shimizu |
890ddd |
is >> m_xsheet;
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->addRef();
|
|
Toshihiro Shimizu |
890ddd |
string tagName;
|
|
Toshihiro Shimizu |
890ddd |
if (is.matchTag(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "name") {
|
|
Toshihiro Shimizu |
890ddd |
wstring name;
|
|
Toshihiro Shimizu |
890ddd |
is >> name;
|
|
Toshihiro Shimizu |
890ddd |
setName(name);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshChildLevel::saveData(TOStream &os)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
os << m_xsheet;
|
|
Toshihiro Shimizu |
890ddd |
os.child("name") << getName();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshChildLevel::setXsheet(TXsheet *xsheet)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
xsheet->addRef();
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->release();
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet = xsheet;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshChildLevel::setScene(ToonzScene *scene)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TXshLevel::setScene(scene);
|
|
Toshihiro Shimizu |
890ddd |
assert(m_xsheet);
|
|
Toshihiro Shimizu |
890ddd |
if (!m_xsheet)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->setScene(scene);
|
|
Toshihiro Shimizu |
890ddd |
int i, columnCount = m_xsheet->getColumnCount();
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < columnCount; i++)
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheet->getColumn(i))
|
|
Toshihiro Shimizu |
890ddd |
m_xsheet->getColumn(i)->setXsheet(m_xsheet);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TXshChildLevel::getFrameCount() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheet)
|
|
Toshihiro Shimizu |
890ddd |
return m_xsheet->getFrameCount();
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshChildLevel::getFids(std::vector<tframeid> &fids) const</tframeid>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 1; i <= getFrameCount(); i++)
|
|
Toshihiro Shimizu |
890ddd |
fids.push_back(TFrameId(i));
|
|
Toshihiro Shimizu |
890ddd |
}
|