[kandinsky] Move to KDFont

This commit is contained in:
Romain Goyet
2018-10-09 16:41:24 +02:00
committed by LeaNumworks
parent 29882768bd
commit f8beae3b86
149 changed files with 564 additions and 610 deletions

View File

@@ -203,8 +203,8 @@ bool SumGraphController::handleEnter() {
SumGraphController::LegendView::LegendView(SumGraphController * controller, char sumSymbol) :
m_sum(0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sumLayout(),
m_legend(KDText::FontSize::Small, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_editableZone(controller, m_draftText, m_draftText, TextField::maxBufferSize(), controller, false, KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_legend(KDFont::SmallFont, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_editableZone(controller, m_draftText, m_draftText, TextField::maxBufferSize(), controller, false, KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sumSymbol(sumSymbol)
{
m_draftText[0] = 0;
@@ -239,15 +239,15 @@ void SumGraphController::LegendView::setSumSymbol(Step step, double start, doubl
PrintFloat::convertFloatToText<double>(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
m_sumLayout = CondensedSumLayout(
LayoutHelper::String(sigma, sizeof(sigma)),
LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small),
EmptyLayout(EmptyLayoutNode::Color::Yellow, false, KDText::FontSize::Small, false));
LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont),
EmptyLayout(EmptyLayoutNode::Color::Yellow, false, KDFont::SmallFont, false));
} else {
m_sumLayout = LayoutHelper::String(sigma, sizeof(sigma));
char buffer[2+PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
PrintFloat::convertFloatToText<double>(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
Layout start = LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small);
Layout start = LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont);
PrintFloat::convertFloatToText<double>(end, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal);
Layout end = LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small);
Layout end = LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont);
m_sumLayout = CondensedSumLayout(
LayoutHelper::String(sigma, sizeof(sigma)),
start,
@@ -257,7 +257,7 @@ void SumGraphController::LegendView::setSumSymbol(Step step, double start, doubl
m_sumLayout = HorizontalLayout(
m_sumLayout,
functionLayout,
LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small));
LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont));
}
m_sum.setLayout(m_sumLayout);
if (step == Step::Result) {
@@ -300,13 +300,26 @@ void SumGraphController::LegendView::layoutSubviews(Step step) {
m_legend.setFrame(KDRectZero);
}
KDSize largeCharSize = KDText::charSize();
KDCoordinate largeGlyphWidth = KDFont::LargeFont->glyphSize().width();
KDCoordinate editableZoneWidth = 12 * KDFont::SmallFont->glyphSize().width();
KDCoordinate editableZoneHeight = KDFont::SmallFont->glyphSize().height();
switch(step) {
case Step::FirstParameter:
m_editableZone.setFrame(KDRect(2*largeCharSize.width(), k_symbolHeightMargin+k_sigmaHeight/2, k_editableZoneWidth, k_editableZoneHeight));
m_editableZone.setFrame(KDRect(
2 * largeGlyphWidth,
k_symbolHeightMargin + k_sigmaHeight/2,
editableZoneWidth,
editableZoneHeight
));
return;
case Step::SecondParameter:
m_editableZone.setFrame(KDRect(2*largeCharSize.width(), k_symbolHeightMargin+k_sigmaHeight/2-k_editableZoneHeight, k_editableZoneWidth, k_editableZoneHeight));
m_editableZone.setFrame(KDRect(
2 * largeGlyphWidth,
k_symbolHeightMargin + k_sigmaHeight/2 - editableZoneHeight,
editableZoneWidth,
editableZoneHeight
));
return;
default:
m_editableZone.setFrame(KDRectZero);