|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshsoundtextcolumn.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshsoundtextlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshleveltypes.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshSoundTextColumn::TXshSoundTextColumn()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshSoundTextColumn::~TXshSoundTextColumn()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshColumn::ColumnType TXshSoundTextColumn::getColumnType() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return eSoundTextType;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshSoundTextColumn::createSoundTextLevel(int row, QList<qstring> textList)</qstring>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TXshSoundTextLevel *level = new TXshSoundTextLevel();
|
|
Toshihiro Shimizu |
890ddd |
level->setType(SND_TXT_XSHLEVEL);
|
|
Toshihiro Shimizu |
890ddd |
int i = 0;
|
|
Toshihiro Shimizu |
890ddd |
TXshCell cell;
|
|
Toshihiro Shimizu |
890ddd |
for (i; i < textList.size(); i++, row++) {
|
|
Toshihiro Shimizu |
890ddd |
QString str = textList.at(i);
|
|
Toshihiro Shimizu |
890ddd |
QString precStr = (i > 0) ? level->getFrameText(i - 1) : QString();
|
|
Toshihiro Shimizu |
890ddd |
if (str == QString("<none>")) {</none>
|
|
Toshihiro Shimizu |
890ddd |
if (i > 0) {
|
|
Toshihiro Shimizu |
890ddd |
setCell(row, cell);
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
str = QString();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
level->setFrameText(i, str);
|
|
Toshihiro Shimizu |
890ddd |
TFrameId fid(i + 1);
|
|
Toshihiro Shimizu |
890ddd |
cell = TXshCell(level, fid);
|
|
Toshihiro Shimizu |
890ddd |
setCell(row, cell);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TXshSoundTextColumn::canSetCell(const TXshCell &cell) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshColumn *TXshSoundTextColumn::clone() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TXshSoundTextColumn *column = new TXshSoundTextColumn();
|
|
Toshihiro Shimizu |
890ddd |
column->setXsheet(getXsheet());
|
|
Toshihiro Shimizu |
890ddd |
column->setStatusWord(getStatusWord());
|
|
Toshihiro Shimizu |
890ddd |
column->m_cells = m_cells;
|
|
Toshihiro Shimizu |
890ddd |
column->m_first = m_first;
|
|
Toshihiro Shimizu |
890ddd |
return column;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshSoundTextColumn::loadData(TIStream &is)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string tagName;
|
|
Toshihiro Shimizu |
890ddd |
while (is.openChild(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "cells") {
|
|
Toshihiro Shimizu |
890ddd |
while (is.openChild(tagName)) {
|
|
Toshihiro Shimizu |
890ddd |
if (tagName == "cell") {
|
|
Toshihiro Shimizu |
890ddd |
TPersist *p = 0;
|
|
Toshihiro Shimizu |
890ddd |
int row = 1;
|
|
Toshihiro Shimizu |
890ddd |
int fidNumber = 1;
|
|
Toshihiro Shimizu |
890ddd |
TFilePath path;
|
|
Toshihiro Shimizu |
890ddd |
is >> row >> fidNumber >> p;
|
|
Toshihiro Shimizu |
890ddd |
TXshLevel *xshLevel = dynamic_cast<txshlevel *="">(p);</txshlevel>
|
|
Toshihiro Shimizu |
890ddd |
TXshCell cell(xshLevel, TFrameId(fidNumber));
|
|
Toshihiro Shimizu |
890ddd |
setCell(row, cell);
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("TXshLevelColumn, unknown tag(2): " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
throw TException("TXshLevelColumn, unknown tag: " + tagName);
|
|
Toshihiro Shimizu |
890ddd |
is.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TXshSoundTextColumn::saveData(TOStream &os)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int r0, r1;
|
|
Toshihiro Shimizu |
890ddd |
if (getRange(r0, r1)) {
|
|
Toshihiro Shimizu |
890ddd |
os.openChild("cells");
|
|
Toshihiro Shimizu |
890ddd |
for (int r = r0; r <= r1; r++) {
|
|
Toshihiro Shimizu |
890ddd |
TXshCell cell = getCell(r);
|
|
Toshihiro Shimizu |
890ddd |
if (cell.isEmpty())
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
TFrameId fid = cell.m_frameId;
|
|
Toshihiro Shimizu |
890ddd |
os.child("cell") << r << fid.getNumber() << cell.m_level.getPointer();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
os.closeChild();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PERSIST_IDENTIFIER(TXshSoundTextColumn, "soundTextColumn")
|