[escher] Metric: change name TableCellLabelTopMargin to

TableCellHorizontalMargin and add TableCellHorizontalMargin
This commit is contained in:
Émilie Feral
2019-12-27 17:45:01 +01:00
committed by Léa Saviot
parent d0e2e71e10
commit 5974149162
5 changed files with 9 additions and 8 deletions

View File

@@ -362,7 +362,7 @@ KDCoordinate PythonToolbox::rowHeight(int j) {
* children of the toolbox, which is the only menu that has special height
* rows. */
const ToolboxMessageTree * messageTree = static_cast<const ToolboxMessageTree *>(m_messageTreeModel->children(j));
return k_font->stringSize(I18n::translate(messageTree->label())).height() + 2*Metric::TableCellLabelTopMargin + (messageTree->text() == I18n::Message::Default ? 0 : Toolbox::rowHeight(j));
return k_font->stringSize(I18n::translate(messageTree->label())).height() + 2*Metric::TableCellVerticalMargin + (messageTree->text() == I18n::Message::Default ? 0 : Toolbox::rowHeight(j));
}
return Toolbox::rowHeight(j);
}

View File

@@ -23,12 +23,12 @@ 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_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(m_scriptNode->name(), KDPoint(0, Metric::TableCellVerticalMargin), 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_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), Metric::TableCellVerticalMargin), k_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
}
ctx->drawString(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).fullName(), KDPoint(0, Metric::TableCellLabelTopMargin + nameSize.height() + k_verticalMargin), k_font, Palette::GreyDark, isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).fullName(), KDPoint(0, Metric::TableCellVerticalMargin + nameSize.height() + k_verticalMargin), k_font, Palette::GreyDark, isHighlighted()? Palette::Select : KDColorWhite);
}
KDSize ScriptNodeCell::ScriptNodeView::minimalSizeForOptimalDisplay() const {
@@ -41,7 +41,7 @@ KDSize ScriptNodeCell::ScriptNodeView::minimalSizeForOptimalDisplay() const {
if (m_scriptNode->type() == ScriptNode::Type::Function) {
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());
return KDSize(size1.width() + size3.width() > size2.width() ? size1.width() + size3.width() : size2.width(), Metric::TableCellVerticalMargin + size1.width() + k_verticalMargin + size2.width());
}
ScriptNodeCell::ScriptNodeCell() :

View File

@@ -89,7 +89,7 @@ void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int
constexpr int bufferSize = BufferTextView::k_maxNumberOfChar;
char buffer[bufferSize];
int glyphLength = writeInterval(buffer, bufferSize, min, max, Preferences::VeryShortNumberOfSignificantDigits, Preferences::sharedPreferences()->displayMode());
int numberOfAvailableGlyphs = (m_functionDomain.bounds().width() - m_functionDomain.labelView()->bounds().width() - m_functionDomain.accessoryView()->bounds().width() - TableCell::k_labelMargin - TableCell::k_accessoryMargin)/KDFont::SmallFont->glyphSize().width();
int numberOfAvailableGlyphs = (m_functionDomain.bounds().width() - m_functionDomain.labelView()->bounds().width() - m_functionDomain.accessoryView()->bounds().width() - 2*Metric::TableCellHorizontalMargin)/KDFont::SmallFont->glyphSize().width();
if (glyphLength > numberOfAvailableGlyphs) {
writeInterval(buffer, bufferSize, min, max, Preferences::VeryShortNumberOfSignificantDigits-1, Preferences::PrintFloatMode::Scientific);
}

View File

@@ -17,7 +17,8 @@ public:
constexpr static KDCoordinate ParameterCellHeight = 35;
constexpr static KDCoordinate ModalTopMargin = 5;
constexpr static KDCoordinate ModalBottomMargin = 18;
constexpr static KDCoordinate TableCellLabelTopMargin = 3;
constexpr static KDCoordinate TableCellVerticalMargin = 3;
constexpr static KDCoordinate TableCellHorizontalMargin = 10;
constexpr static KDCoordinate TabHeight = 27;
constexpr static KDCoordinate ScrollStep = 10;
constexpr static KDCoordinate PopUpLeftMargin = 32;

View File

@@ -50,7 +50,7 @@ void TableCell::layoutSubviews(bool force) {
case Layout::Vertical:
{
KDCoordinate x = k_separatorThickness+labelMargin();
KDCoordinate y = k_separatorThickness+Metric::TableCellLabelTopMargin;
KDCoordinate y = k_separatorThickness+Metric::TableCellVerticalMargin;
label->setFrame(KDRect(
x,
y,