2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Removed anim::cvalue and ColorAnimation, all done by fvalue now.

Also moved style::interpolate to anim::color/anim::pen/anim::brush.
This commit is contained in:
John Preston
2016-11-07 14:24:19 +03:00
parent 0326976473
commit 23c2e5364a
55 changed files with 483 additions and 602 deletions

View File

@@ -284,7 +284,6 @@ QString Generator::typeToString(structure::Type type) const {
case Tag::Color: return "style::color";
case Tag::Point: return "style::point";
case Tag::Size: return "style::size";
case Tag::Transition: return "style::transition";
case Tag::Cursor: return "style::cursor";
case Tag::Align: return "style::align";
case Tag::Margins: return "style::margins";
@@ -306,7 +305,6 @@ QString Generator::typeToDefaultValue(structure::Type type) const {
case Tag::Color: return "{ Qt::Uninitialized }";
case Tag::Point: return "{ 0, 0 }";
case Tag::Size: return "{ 0, 0 }";
case Tag::Transition: return "anim::linear";
case Tag::Cursor: return "style::cur_default";
case Tag::Align: return "style::al_topleft";
case Tag::Margins: return "{ 0, 0, 0, 0 }";
@@ -357,7 +355,6 @@ QString Generator::valueAssignmentCode(structure::Value value) const {
auto v(value.Size());
return QString("{ %1, %2 }").arg(pxValueName(v.width)).arg(pxValueName(v.height));
} break;
case Tag::Transition: return QString("anim::%1").arg(value.String().c_str());
case Tag::Cursor: return QString("style::cur_%1").arg(value.String().c_str());
case Tag::Align: return QString("style::al_%1").arg(value.String().c_str());
case Tag::Margins: {
@@ -1114,7 +1111,6 @@ bool Generator::collectUniqueValues() {
case Tag::Double:
case Tag::String:
case Tag::Color:
case Tag::Transition:
case Tag::Cursor:
case Tag::Align: break;
case Tag::Pixels: pxValues_.insert(value.Int(), true); break;

View File

@@ -120,7 +120,6 @@ std::string logType(const structure::Type &type) {
{ structure::TypeTag::Color , "color" },
{ structure::TypeTag::Point , "point" },
{ structure::TypeTag::Size , "size" },
{ structure::TypeTag::Transition, "transition" },
{ structure::TypeTag::Cursor , "cursor" },
{ structure::TypeTag::Align , "align" },
{ structure::TypeTag::Margins , "margins" },
@@ -138,10 +137,6 @@ bool validateAnsiString(const QString &value) {
return true;
}
bool validateTransitionString(const QString &value) {
return QRegularExpression("^[a-zA-Z_]+$").match(value).hasMatch();
}
bool validateCursorString(const QString &value) {
return QRegularExpression("^[a-z_]+$").match(value).hasMatch();
}
@@ -313,8 +308,6 @@ structure::Value ParsedFile::readValue() {
return pointValue;
} else if (auto sizeValue = readSizeValue()) {
return sizeValue;
} else if (auto transitionValue = readTransitionValue()) {
return transitionValue;
} else if (auto cursorValue = readCursorValue()) {
return cursorValue;
} else if (auto alignValue = readAlignValue()) {
@@ -606,26 +599,6 @@ structure::Value ParsedFile::readSizeValue() {
return {};
}
structure::Value ParsedFile::readTransitionValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "transition") {
assertNextToken(BasicType::LeftParenthesis);
auto transition = tokenValue(assertNextToken(BasicType::Name));
assertNextToken(BasicType::RightParenthesis);
if (validateTransitionString(transition)) {
return { structure::TypeTag::Transition, transition.toStdString() };
} else {
logError(kErrorBadString) << "bad transition value";
}
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readCursorValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "cursor") {

View File

@@ -93,7 +93,6 @@ private:
structure::Value readColorValue();
structure::Value readPointValue();
structure::Value readSizeValue();
structure::Value readTransitionValue();
structure::Value readCursorValue();
structure::Value readAlignValue();
structure::Value readMarginsValue();
@@ -131,7 +130,6 @@ private:
{ "color" , { structure::TypeTag::Color } },
{ "point" , { structure::TypeTag::Point } },
{ "size" , { structure::TypeTag::Size } },
{ "transition", { structure::TypeTag::Transition } },
{ "cursor" , { structure::TypeTag::Cursor } },
{ "align" , { structure::TypeTag::Align } },
{ "margins" , { structure::TypeTag::Margins } },

View File

@@ -179,7 +179,6 @@ Value::Value(TypeTag type, int value) : Value(type, std::make_shared<DataTypes::
Value::Value(TypeTag type, std::string value) : Value(type, std::make_shared<DataTypes::TString>(value)) {
if (type_.tag != TypeTag::String &&
type_.tag != TypeTag::Transition &&
type_.tag != TypeTag::Cursor &&
type_.tag != TypeTag::Align) {
type_.tag = TypeTag::Invalid;
@@ -197,7 +196,6 @@ Value::Value(Type type, Qt::Initialization) : type_(type) {
case TypeTag::Color: data_ = std::make_shared<DataTypes::TColor>(data::color { 0, 0, 0, 255 }); break;
case TypeTag::Point: data_ = std::make_shared<DataTypes::TPoint>(data::point { 0, 0 }); break;
case TypeTag::Size: data_ = std::make_shared<DataTypes::TSize>(data::size { 0, 0 }); break;
case TypeTag::Transition: data_ = std::make_shared<DataTypes::TString>("linear"); break;
case TypeTag::Cursor: data_ = std::make_shared<DataTypes::TString>("default"); break;
case TypeTag::Align: data_ = std::make_shared<DataTypes::TString>("topleft"); break;
case TypeTag::Margins: data_ = std::make_shared<DataTypes::TMargins>(data::margins { 0, 0, 0, 0 }); break;

View File

@@ -48,7 +48,6 @@ enum class TypeTag {
Color,
Point,
Size,
Transition,
Cursor,
Align,
Margins,