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

Divider added to new profiles. Icons from new styles can fill rects.

This commit is contained in:
John Preston
2016-05-20 18:35:58 +03:00
parent 92c720ddc3
commit c42b142884
16 changed files with 250 additions and 25 deletions

View File

@@ -535,8 +535,8 @@ structure::Value ParsedFile::readPointValue() {
if (tokenValue(font) == "point") {
assertNextToken(BasicType::LeftParenthesis);
auto x = readNumericValue(); assertNextToken(BasicType::Comma);
auto y = readNumericValue();
auto x = readNumericOrNumericCopyValue(); assertNextToken(BasicType::Comma);
auto y = readNumericOrNumericCopyValue();
if (x.type().tag != structure::TypeTag::Pixels ||
y.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected two px values for the point";
@@ -581,8 +581,8 @@ structure::Value ParsedFile::readSizeValue() {
if (tokenValue(font) == "size") {
assertNextToken(BasicType::LeftParenthesis);
auto w = readNumericValue(); assertNextToken(BasicType::Comma);
auto h = readNumericValue();
auto w = readNumericOrNumericCopyValue(); assertNextToken(BasicType::Comma);
auto h = readNumericOrNumericCopyValue();
if (w.type().tag != structure::TypeTag::Pixels ||
h.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected two px values for the size";
@@ -662,10 +662,10 @@ structure::Value ParsedFile::readMarginsValue() {
if (tokenValue(font) == "margins") {
assertNextToken(BasicType::LeftParenthesis);
auto l = readNumericValue(); assertNextToken(BasicType::Comma);
auto t = readNumericValue(); assertNextToken(BasicType::Comma);
auto r = readNumericValue(); assertNextToken(BasicType::Comma);
auto b = readNumericValue();
auto l = readNumericOrNumericCopyValue(); assertNextToken(BasicType::Comma);
auto t = readNumericOrNumericCopyValue(); assertNextToken(BasicType::Comma);
auto r = readNumericOrNumericCopyValue(); assertNextToken(BasicType::Comma);
auto b = readNumericOrNumericCopyValue();
if (l.type().tag != structure::TypeTag::Pixels ||
t.type().tag != structure::TypeTag::Pixels ||
r.type().tag != structure::TypeTag::Pixels ||
@@ -701,18 +701,10 @@ structure::Value ParsedFile::readFontValue() {
file_.putBack();
}
}
if (auto familyValue = readStringValue()) {
if (auto familyValue = readStringOrStringCopyValue()) {
family = familyValue;
} else if (auto sizeValue = readNumericValue()) {
} else if (auto sizeValue = readNumericOrNumericCopyValue()) {
size = sizeValue;
} else if (auto copyValue = readCopyValue()) {
if (copyValue.type().tag == structure::TypeTag::String) {
family = copyValue;
} else if (copyValue.type().tag == structure::TypeTag::Pixels) {
size = copyValue;
} else {
logErrorUnexpectedToken() << "font family, font size or ')'";
}
} else if (file_.getToken(BasicType::RightParenthesis)) {
break;
} else {
@@ -776,7 +768,37 @@ structure::Value ParsedFile::readCopyValue() {
if (auto variable = module_->findVariable(name)) {
return variable->value.makeCopy(variable->name);
}
logError(kErrorIdentifierNotFound) << "identifier '" << logFullName(name) << "' not found";
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readNumericOrNumericCopyValue() {
if (auto result = readNumericValue()) {
return result;
} else if (auto copy = readCopyValue()) {
auto type = copy.type().tag;
if (type == structure::TypeTag::Int
|| type == structure::TypeTag::Double
|| type == structure::TypeTag::Pixels) {
return copy;
} else {
file_.putBack();
}
}
return {};
}
structure::Value ParsedFile::readStringOrStringCopyValue() {
if (auto result = readStringValue()) {
return result;
} else if (auto copy = readCopyValue()) {
auto type = copy.type().tag;
if (type == structure::TypeTag::String) {
return copy;
} else {
file_.putBack();
}
}
return {};
}

View File

@@ -98,6 +98,9 @@ private:
structure::Value readIconValue();
structure::Value readCopyValue();
structure::Value readNumericOrNumericCopyValue();
structure::Value readStringOrStringCopyValue();
structure::data::monoicon readMonoIconFields();
QString readMonoIconFilename();