mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[kandinsky] Move to KDFont
This commit is contained in:
committed by
LeaNumworks
parent
29882768bd
commit
f8beae3b86
@@ -23,23 +23,23 @@ void ScriptNodeCell::ScriptNodeView::setScriptStore(ScriptStore * scriptStore) {
|
||||
}
|
||||
|
||||
void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->drawString(m_scriptNode->name(), KDPoint(0, Metric::TableCellLabelTopMargin), k_fontSize, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
KDSize nameSize = KDText::stringSize(m_scriptNode->name(), k_fontSize);
|
||||
ctx->drawString(m_scriptNode->name(), KDPoint(0, Metric::TableCellLabelTopMargin), k_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
KDSize nameSize = k_font->stringSize(m_scriptNode->name());
|
||||
if (m_scriptNode->type() == ScriptNode::Type::Function) {
|
||||
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), Metric::TableCellLabelTopMargin), k_fontSize, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), Metric::TableCellLabelTopMargin), k_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
}
|
||||
ctx->drawString(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).name(), KDPoint(0, Metric::TableCellLabelTopMargin + nameSize.height() + k_verticalMargin), k_fontSize, Palette::GreyDark, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
ctx->drawString(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).name(), KDPoint(0, Metric::TableCellLabelTopMargin + nameSize.height() + k_verticalMargin), k_font, Palette::GreyDark, isHighlighted()? Palette::Select : KDColorWhite);
|
||||
}
|
||||
|
||||
KDSize ScriptNodeCell::ScriptNodeView::minimalSizeForOptimalDisplay() const {
|
||||
if (m_scriptNode->name() == nullptr) {
|
||||
return KDSizeZero;
|
||||
}
|
||||
KDSize size1 = KDText::stringSize(m_scriptNode->name(), k_fontSize);
|
||||
KDSize size2 = KDText::stringSize(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).name(), k_fontSize);
|
||||
KDSize size1 = k_font->stringSize(m_scriptNode->name());
|
||||
KDSize size2 = k_font->stringSize(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).name());
|
||||
KDSize size3 = KDSizeZero;
|
||||
if (m_scriptNode->type() == ScriptNode::Type::Function) {
|
||||
size3 = KDText::stringSize(ScriptNodeCell::k_parentheses, k_fontSize);
|
||||
size3 = k_font->stringSize(ScriptNodeCell::k_parentheses);
|
||||
}
|
||||
return KDSize(size1.width() + size3.width() > size2.width() ? size1.width() + size3.width() : size2.width(), Metric::TableCellLabelTopMargin + size1.width() + k_verticalMargin + size2.width());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user