Blame toonz/sources/toonzqt/styledata.cpp
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "styledata.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcolorstyles.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// StyleData
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StyleData::StyleData() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StyleData::~StyleData() {
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < (int)m_styles.size(); i++) delete m_styles[i].second;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void StyleData::addStyle(int styleIndex, TColorStyle *style) {
|
|
Shinya Kitaoka |
120a6e |
m_styles.push_back(std::make_pair(styleIndex, style));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TColorStyle *StyleData::getStyle(int index) const {
|
|
Shinya Kitaoka |
120a6e |
assert(0 <= index && index < (int)m_styles.size());
|
|
Shinya Kitaoka |
120a6e |
return m_styles[index].second;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int StyleData::getStyleIndex(int index) const {
|
|
Shinya Kitaoka |
120a6e |
assert(0 <= index && index < (int)m_styles.size());
|
|
Shinya Kitaoka |
120a6e |
return m_styles[index].first;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StyleData *StyleData::clone() const {
|
|
Shinya Kitaoka |
120a6e |
StyleData *data = new StyleData();
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < getStyleCount(); i++)
|
|
Shinya Kitaoka |
120a6e |
data->addStyle(getStyleIndex(i), getStyle(i)->clone());
|
|
Shinya Kitaoka |
120a6e |
return data;
|
|
Toshihiro Shimizu |
890ddd |
}
|