mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Do not display varbox source name if it does not fit
This commit is contained in:
@@ -41,10 +41,19 @@ KDSize ScriptNodeCell::ScriptNodeView::minimalSizeForOptimalDisplay() const {
|
||||
return KDSizeZero;
|
||||
}
|
||||
return KDSize(
|
||||
Ion::Display::Width - Metric::PopUpLeftMargin - Metric::PopUpRightMargin,
|
||||
k_optimalWidth,
|
||||
m_scriptNode->description() == nullptr ? k_simpleItemHeight : k_complexItemHeight);
|
||||
}
|
||||
|
||||
bool ScriptNodeCell::CanDisplayNameAndSource(int nameLength, const char * source) {
|
||||
if (source == nullptr) {
|
||||
return true;
|
||||
}
|
||||
assert(nameLength > 0);
|
||||
const KDFont * font = ScriptNodeView::k_font;
|
||||
return font->glyphSize().width()*(nameLength + 1) + font->stringSize(source).width() <= ScriptNodeView::k_optimalWidth; // + 1 for the separating space
|
||||
}
|
||||
|
||||
void ScriptNodeCell::setScriptNode(ScriptNode * scriptNode) {
|
||||
m_scriptNodeView.setScriptNode(scriptNode);
|
||||
reloadCell();
|
||||
|
||||
Reference in New Issue
Block a user