[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

@@ -25,7 +25,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe
TextFieldDelegate(),
MicroPython::ExecutionEnvironment(),
m_pythonDelegate(pythonDelegate),
m_rowHeight(KDText::charSize(k_fontSize).height()),
m_rowHeight(k_font->glyphSize().height()),
m_importScriptsWhenViewAppears(false),
m_selectableTableView(this, this, this, this),
m_editCell(this, this),

View File

@@ -16,7 +16,7 @@ class App;
class ConsoleController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource, public SelectableTableViewDelegate, public TextFieldDelegate, public MicroPython::ExecutionEnvironment {
public:
static constexpr KDText::FontSize k_fontSize = KDText::FontSize::Large;
static constexpr const KDFont * k_font = KDFont::LargeFont;
ConsoleController(Responder * parentResponder, App * pythonDelegate, ScriptStore * scriptStore
#if EPSILON_GETOPT

View File

@@ -10,8 +10,8 @@ ConsoleEditCell::ConsoleEditCell(Responder * parentResponder, TextFieldDelegate
HighlightCell(),
Responder(parentResponder),
m_textBuffer{0},
m_promptView(ConsoleController::k_fontSize, nullptr, 0, 0.5),
m_textField(this, m_textBuffer, m_textBuffer, TextField::maxBufferSize(), delegate, false, ConsoleController::k_fontSize)
m_promptView(ConsoleController::k_font, nullptr, 0, 0.5),
m_textField(this, m_textBuffer, m_textBuffer, TextField::maxBufferSize(), delegate, false, ConsoleController::k_font)
{
}
@@ -55,4 +55,4 @@ bool ConsoleEditCell::insertText(const char * text) {
return m_textField.handleEventWithText(text);
}
}
}

View File

@@ -18,11 +18,11 @@ void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::setLine(Consol
void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), KDColorWhite);
ctx->drawString(m_line->text(), KDPointZero, ConsoleController::k_fontSize, textColor(m_line), isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(m_line->text(), KDPointZero, ConsoleController::k_font, textColor(m_line), isHighlighted()? Palette::Select : KDColorWhite);
}
KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const {
return KDText::stringSize(m_line->text(), ConsoleController::k_fontSize);
return ConsoleController::k_font->stringSize(m_line->text());
}
ConsoleLineCell::ScrollableConsoleLineView::ScrollableConsoleLineView(Responder * parentResponder) :
@@ -38,7 +38,7 @@ KDSize ConsoleLineCell::ScrollableConsoleLineView::minimalSizeForOptimalDisplay(
ConsoleLineCell::ConsoleLineCell(Responder * parentResponder) :
HighlightCell(),
Responder(parentResponder),
m_promptView(ConsoleController::k_fontSize, I18n::Message::ConsolePrompt, 0, 0.5),
m_promptView(ConsoleController::k_font, I18n::Message::ConsolePrompt, 0, 0.5),
m_scrollableView(this),
m_line()
{
@@ -83,7 +83,7 @@ View * ConsoleLineCell::subviewAtIndex(int index) {
void ConsoleLineCell::layoutSubviews() {
if (m_line.isCommand()) {
KDSize promptSize = KDText::stringSize(I18n::translate(I18n::Message::ConsolePrompt), ConsoleController::k_fontSize);
KDSize promptSize = ConsoleController::k_font->stringSize(I18n::translate(I18n::Message::ConsolePrompt));
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()));
m_scrollableView.setFrame(KDRect(KDPoint(promptSize.width(), 0), bounds().width() - promptSize.width(), bounds().height()));
return;

View File

@@ -6,13 +6,13 @@ namespace Code {
/* EditorView */
constexpr KDText::FontSize editorFontSize = KDText::FontSize::Large;
static constexpr const KDFont * editorFont = KDFont::LargeFont;
EditorView::EditorView(Responder * parentResponder, App * pythonDelegate) :
Responder(parentResponder),
View(),
m_textArea(parentResponder, pythonDelegate, editorFontSize),
m_gutterView(editorFontSize)
m_textArea(parentResponder, pythonDelegate, editorFont),
m_gutterView(editorFont)
{
m_textArea.setScrollViewDelegate(this);
}
@@ -49,9 +49,9 @@ void EditorView::layoutSubviews() {
/* EditorView::GutterView */
EditorView::GutterView::GutterView(KDText::FontSize fontSize) :
EditorView::GutterView::GutterView(const KDFont * font) :
View(),
m_fontSize(fontSize),
m_font(font),
m_offset(0)
{
}
@@ -62,21 +62,21 @@ void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, backgroundColor);
KDSize charSize = KDText::charSize(m_fontSize);
KDSize glyphSize = m_font->glyphSize();
KDCoordinate firstLine = m_offset / charSize.height();
KDCoordinate firstLinePixelOffset = m_offset - firstLine * charSize.height();
KDCoordinate firstLine = m_offset / glyphSize.height();
KDCoordinate firstLinePixelOffset = m_offset - firstLine * glyphSize.height();
char lineNumber[4];
int numberOfLines = bounds().height() / charSize.height() + 1;
int numberOfLines = bounds().height() / glyphSize.height() + 1;
for (int i=0; i<numberOfLines; i++) {
Poincare::Integer line(i + firstLine + 1);
line.serialize(lineNumber, 4);
KDCoordinate leftPadding = (2 - strlen(lineNumber)) * charSize.width();
KDCoordinate leftPadding = (2 - strlen(lineNumber)) * glyphSize.width();
ctx->drawString(
lineNumber,
KDPoint(k_margin + leftPadding, i*charSize.height() - firstLinePixelOffset),
m_fontSize,
KDPoint(k_margin + leftPadding, i*glyphSize.height() - firstLinePixelOffset),
m_font,
textColor,
backgroundColor
);
@@ -94,7 +94,7 @@ void EditorView::GutterView::setOffset(KDCoordinate offset) {
KDSize EditorView::GutterView::minimalSizeForOptimalDisplay() const {
int numberOfChars = 2; // TODO: Could be computed
return KDSize(2 * k_margin + numberOfChars * KDText::charSize(m_fontSize).width(), 0);
return KDSize(2 * k_margin + numberOfChars * m_font->glyphSize().width(), 0);
}
}

View File

@@ -30,13 +30,13 @@ private:
class GutterView : public View {
public:
GutterView(KDText::FontSize fontSize);
GutterView(const KDFont * font);
void drawRect(KDContext * ctx, KDRect rect) const override;
void setOffset(KDCoordinate offset);
KDSize minimalSizeForOptimalDisplay() const override;
private:
static constexpr KDCoordinate k_margin = 2;
KDText::FontSize m_fontSize;
const KDFont * m_font;
KDCoordinate m_offset;
};

View File

@@ -18,7 +18,7 @@ MenuController::MenuController(Responder * parentResponder, App * pythonDelegate
menu->consoleController()->setAutoImport(true);
menu->stackViewController()->push(menu->consoleController());
return;
}, this), KDText::FontSize::Large),
}, this), KDFont::LargeFont),
m_selectableTableView(this, this, this, this),
m_scriptParameterController(nullptr, I18n::Message::ScriptOptions, this),
m_editorController(this, pythonDelegate),

View File

@@ -9,9 +9,9 @@ class App;
class PythonTextArea : public TextArea {
public:
PythonTextArea(Responder * parentResponder, App * pythonDelegate, KDText::FontSize fontSize) :
TextArea(parentResponder, &m_contentView, fontSize),
m_contentView(pythonDelegate, fontSize)
PythonTextArea(Responder * parentResponder, App * pythonDelegate, const KDFont * font) :
TextArea(parentResponder, &m_contentView, font),
m_contentView(pythonDelegate, font)
{
}
void loadSyntaxHighlighter() { m_contentView.loadSyntaxHighlighter(); }
@@ -19,8 +19,8 @@ public:
protected:
class ContentView : public TextArea::ContentView {
public:
ContentView(App * pythonDelegate, KDText::FontSize fontSize) :
TextArea::ContentView(fontSize),
ContentView(App * pythonDelegate, const KDFont * font) :
TextArea::ContentView(font),
m_pythonDelegate(pythonDelegate)
{
}

View File

@@ -282,7 +282,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 KDText::stringSize(I18n::translate(messageTree->label()), k_fontSize).height() + 2*Metric::TableCellLabelTopMargin + (messageTree->text() == I18n::Message::Default ? 0 : Toolbox::rowHeight(j));
return k_font->stringSize(I18n::translate(messageTree->label())).height() + 2*Metric::TableCellLabelTopMargin + (messageTree->text() == I18n::Message::Default ? 0 : Toolbox::rowHeight(j));
}
return Toolbox::rowHeight(j);
}

View File

@@ -23,7 +23,7 @@ protected:
// 13 = minimal string height size
// 3 = vertical margins
private:
constexpr static KDText::FontSize k_fontSize = KDText::FontSize::Small;
constexpr static const KDFont * k_font = KDFont::SmallFont;
void scrollToLetter(char letter);
void scrollToAndSelectChild(int i);
MessageTableCellWithMessage m_leafCells[k_maxNumberOfDisplayedRows];

View File

@@ -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());
}

View File

@@ -37,7 +37,7 @@ protected:
return m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).name();
}
private:
constexpr static KDText::FontSize k_fontSize = KDText::FontSize::Small;
constexpr static const KDFont * k_font = KDFont::SmallFont;
constexpr static KDCoordinate k_verticalMargin = 7;
ScriptNode * m_scriptNode;
ScriptStore * m_scriptStore;

View File

@@ -13,7 +13,7 @@ EmptyBatteryWindow::EmptyBatteryWindow() :
void EmptyBatteryWindow::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), KDColorWhite);
const char * warningMessage = I18n::translate(I18n::Message::LowBattery, GlobalPreferences::sharedGlobalPreferences()->language());
KDSize warningSize = KDText::stringSize(warningMessage, KDText::FontSize::Large);
ctx->drawString(warningMessage, KDPoint((Ion::Display::Width - warningSize.width())/2, (Ion::Display::Height - warningSize.height())/2), KDText::FontSize::Large);
KDSize warningSize = KDFont::LargeFont->stringSize(warningMessage);
ctx->drawString(warningMessage, KDPoint((Ion::Display::Width - warningSize.width())/2, (Ion::Display::Height - warningSize.height())/2), KDFont::LargeFont);
}

View File

@@ -50,7 +50,7 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
ExamPopUpController * controller = (ExamPopUpController *)context;
Container * container = (Container *)controller->app()->container();
container->activeApp()->dismissModalViewController();
}, parentResponder), KDText::FontSize::Small),
}, parentResponder), KDFont::SmallFont),
m_okButton(parentResponder, I18n::Message::Ok, Invocation([](void * context, void * sender) {
ExamPopUpController * controller = (ExamPopUpController *)context;
GlobalPreferences::ExamMode nextExamMode = controller->isActivatingExamMode() ? GlobalPreferences::ExamMode::Activate : GlobalPreferences::ExamMode::Desactivate;
@@ -65,11 +65,11 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
}
container->refreshPreferences();
container->activeApp()->dismissModalViewController();
}, parentResponder), KDText::FontSize::Small),
m_warningTextView(KDText::FontSize::Small, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView1(KDText::FontSize::Small, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView2(KDText::FontSize::Small, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView3(KDText::FontSize::Small, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack)
}, parentResponder), KDFont::SmallFont),
m_warningTextView(KDFont::SmallFont, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView1(KDFont::SmallFont, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView2(KDFont::SmallFont, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView3(KDFont::SmallFont, I18n::Message::Default, 0.5, 0.5, KDColorWhite, KDColorBlack)
{
}
@@ -133,7 +133,7 @@ View * ExamPopUpController::ContentView::subviewAtIndex(int index) {
void ExamPopUpController::ContentView::layoutSubviews() {
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight));
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight));
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight));

View File

@@ -4,12 +4,12 @@
namespace Graph {
BannerView::BannerView() :
m_abscissaView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_functionView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_derivativeView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_tangentEquationView(KDText::FontSize::Small, I18n::Message::LinearRegressionFormula, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_aView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_bView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_abscissaView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_functionView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_derivativeView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_tangentEquationView(KDFont::SmallFont, I18n::Message::LinearRegressionFormula, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_aView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_bView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_numberOfSubviews(2)
{
}

View File

@@ -13,7 +13,7 @@ CalculationGraphController::CalculationGraphController(Responder * parentRespond
m_graphRange(curveViewRange),
m_cursor(cursor),
m_function(nullptr),
m_defaultBannerView(KDText::FontSize::Small, defaultMessage, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_defaultBannerView(KDFont::SmallFont, defaultMessage, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_isActive(false)
{
}

View File

@@ -39,7 +39,7 @@ double IntegralGraphController::cursorNextStep(double x, int direction) {
Layout IntegralGraphController::createFunctionLayout(const char * functionName) {
char buffer[7] = "0(x)dx";
buffer[0] = functionName[0];
return LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Small);
return LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont);
}
}

View File

@@ -18,7 +18,7 @@ ValuesController::ValuesController(Responder * parentResponder, CartesianFunctio
{
for (int i = 0; i < k_maxNumberOfFunctions; i++) {
m_functionTitleCells[i].setOrientation(FunctionTitleCell::Orientation::HorizontalIndicator);
m_functionTitleCells[i].setFontSize(KDText::FontSize::Small);
m_functionTitleCells[i].setFont(KDFont::SmallFont);
}
}

View File

@@ -66,9 +66,9 @@ void BatteryTestController::updateBatteryState(float batteryLevel, bool batteryC
BatteryTestController::ContentView::ContentView() :
SolidColorView(KDColorWhite),
m_batteryStateView(KDText::FontSize::Large),
m_batteryLevelView(KDText::FontSize::Small),
m_batteryChargingView(KDText::FontSize::Small)
m_batteryStateView(KDFont::LargeFont),
m_batteryLevelView(KDFont::SmallFont),
m_batteryChargingView(KDFont::SmallFont)
{
}
@@ -93,7 +93,7 @@ void BatteryTestController::ContentView::setColor(KDColor color) {
void BatteryTestController::ContentView::layoutSubviews() {
m_batteryStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height/2));
KDSize textSize = KDText::charSize(KDText::FontSize::Small);
KDSize textSize = KDFont::SmallFont->glyphSize();
m_batteryLevelView.setFrame(KDRect(0, Ion::Display::Height-2*textSize.height(), Ion::Display::Width, textSize.height()));
m_batteryChargingView.setFrame(KDRect(0, Ion::Display::Height-textSize.height(), Ion::Display::Width, textSize.height()));
}

View File

@@ -48,7 +48,7 @@ LEDTestController::ContentView::ContentView() :
SolidColorView(KDColorWhite),
m_ledColorIndicatorView(KDColorBlack),
m_ledColorOutlineView(KDColorBlack),
m_ledView(KDText::FontSize::Large),
m_ledView(KDFont::LargeFont),
m_arrowView()
{
m_ledView.setText("LED");

View File

@@ -36,17 +36,17 @@ PopUpController::ContentView::ContentView(Responder * parentResponder) :
m_cancelButton(this, I18n::Message::Cancel, Invocation([](void * context, void * sender) {
PopUpController::ContentView * view = (PopUpController::ContentView *)context;
view->app()->dismissModalViewController();
}, this), KDText::FontSize::Small),
}, this), KDFont::SmallFont),
m_okButton(this, I18n::Message::Ok, Invocation([](void * context, void * sender) {
PopUpController::ContentView * view = (PopUpController::ContentView *)context;
AppsContainer * appsContainer = (AppsContainer *)view->app()->container();
appsContainer->switchTo(appsContainer->hardwareTestAppSnapshot());
}, this), KDText::FontSize::Small),
m_warningTextView(KDText::FontSize::Small, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView1(KDText::FontSize::Small, I18n::Message::HardwareTestLaunch1, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView2(KDText::FontSize::Small, I18n::Message::HardwareTestLaunch2, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView3(KDText::FontSize::Small, I18n::Message::HardwareTestLaunch3, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView4(KDText::FontSize::Small, I18n::Message::HardwareTestLaunch4, 0.5, 0.5, KDColorWhite, KDColorBlack)
}, this), KDFont::SmallFont),
m_warningTextView(KDFont::SmallFont, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView1(KDFont::SmallFont, I18n::Message::HardwareTestLaunch1, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView2(KDFont::SmallFont, I18n::Message::HardwareTestLaunch2, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView3(KDFont::SmallFont, I18n::Message::HardwareTestLaunch3, 0.5, 0.5, KDColorWhite, KDColorBlack),
m_messageTextView4(KDFont::SmallFont, I18n::Message::HardwareTestLaunch4, 0.5, 0.5, KDColorWhite, KDColorBlack)
{
}
@@ -100,7 +100,7 @@ View * PopUpController::ContentView::subviewAtIndex(int index) {
void PopUpController::ContentView::layoutSubviews() {
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight));
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight));
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight));

View File

@@ -5,7 +5,7 @@ namespace Home {
AppCell::AppCell() :
HighlightCell(),
m_nameView(KDText::FontSize::Small, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, KDColorWhite),
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, KDColorWhite),
m_visible(true)
{
}

View File

@@ -6,7 +6,7 @@ namespace OnBoarding {
UpdateController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor * colors, uint8_t numberOfMessages) :
MessageView(messages, colors, numberOfMessages),
m_skipView(KDText::FontSize::Small, I18n::Message::Skip, 1.0f, 0.5f),
m_skipView(KDFont::SmallFont, I18n::Message::Skip, 1.0f, 0.5f),
m_okView()
{
}
@@ -36,7 +36,7 @@ void UpdateController::MessageViewWithSkip::layoutSubviews() {
// Layout the "skip (OK)"
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
KDSize okSize = m_okView.minimalSizeForOptimalDisplay();
m_skipView.setFrame(KDRect(0, height-k_bottomMargin-textHeight, width-okSize.width()-k_okMargin-k_skipMargin, textHeight));
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize));

View File

@@ -6,7 +6,7 @@
namespace Probability {
CalculationCell::CalculationCell(Responder * parentResponder, char * draftTextBuffer, TextFieldDelegate * textFieldDelegate) :
m_text(KDText::FontSize::Large, I18n::Message::Default, 0.5f, 0.5f),
m_text(KDFont::LargeFont, I18n::Message::Default, 0.5f, 0.5f),
m_calculation(parentResponder, textFieldDelegate, draftTextBuffer),
m_isResponder(true)
{
@@ -30,7 +30,10 @@ void CalculationCell::setHighlighted(bool highlight) {
KDSize CalculationCell::minimalSizeForOptimalDisplay() const {
KDSize textSize = m_text.minimalSizeForOptimalDisplay();
return KDSize(2*k_margin+textSize.width()+calculationCellWidth()+2*ResponderImageCell::k_outline, KDText::charSize().height());
return KDSize(
2 * k_margin + textSize.width() + calculationCellWidth() + 2 * ResponderImageCell::k_outline,
KDFont::LargeFont->glyphSize().height()
);
}
void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const {
@@ -69,7 +72,10 @@ void CalculationCell::layoutSubviews() {
KDCoordinate CalculationCell::calculationCellWidth() const {
KDCoordinate calculationCellWidth = m_calculation.minimalSizeForOptimalDisplay().width();
return min(k_maxTextFieldWidth, max(k_minTextFieldWidth, calculationCellWidth));
KDCoordinate glyphWidth = KDFont::LargeFont->glyphSize().width();
KDCoordinate minTextFieldWidth = 4 * glyphWidth + TextCursorView::k_width;
KDCoordinate maxTextFieldWidth = 14 * glyphWidth + TextCursorView::k_width;
return min(maxTextFieldWidth, max(minTextFieldWidth, calculationCellWidth));
}
}

View File

@@ -20,8 +20,6 @@ public:
}
private:
constexpr static KDCoordinate k_margin = 5;
constexpr static KDCoordinate k_minTextFieldWidth = 4*KDText::charSize().width()+TextCursorView::k_width;
constexpr static KDCoordinate k_maxTextFieldWidth = 14*KDText::charSize().width()+TextCursorView::k_width;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;

View File

@@ -24,7 +24,7 @@ using namespace Shared;
namespace Probability {
CalculationController::ContentView::ContentView(SelectableTableView * selectableTableView, Law * law, Calculation * calculation) :
m_titleView(KDText::FontSize::Small, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_selectableTableView(selectableTableView),
m_lawCurveView(law, calculation)
{
@@ -46,7 +46,7 @@ View * CalculationController::ContentView::subviewAtIndex(int index) {
}
void CalculationController::ContentView::layoutSubviews() {
KDCoordinate titleHeight = KDText::charSize(KDText::FontSize::Small).height()+k_titleHeightMargin;
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleHeightMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
KDCoordinate calculationHeight = ResponderImageCell::k_oneCellHeight+2*k_tableMargin;
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), calculationHeight));

View File

@@ -5,7 +5,7 @@ namespace Probability {
Cell::Cell() :
HighlightCell(),
m_labelView(KDText::FontSize::Large, (I18n::Message)0, 0, 0.5, KDColorBlack, KDColorWhite),
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, KDColorBlack, KDColorWhite),
m_icon(nullptr),
m_focusedIcon(nullptr)
{

View File

@@ -21,7 +21,7 @@
namespace Probability {
LawController::ContentView::ContentView(SelectableTableView * selectableTableView) :
m_titleView(KDText::FontSize::Small, I18n::Message::ChooseLaw, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_titleView(KDFont::SmallFont, I18n::Message::ChooseLaw, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_selectableTableView(selectableTableView)
{
}
@@ -39,7 +39,7 @@ View * LawController::ContentView::subviewAtIndex(int index) {
}
void LawController::ContentView::layoutSubviews() {
KDCoordinate titleHeight = KDText::charSize(KDText::FontSize::Small).height()+k_titleMargin;
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), bounds().height()-titleHeight));
}

View File

@@ -8,9 +8,9 @@ namespace Probability {
ParametersController::ContentView::ContentView(Responder * parentResponder, SelectableTableView * selectableTableView) :
m_numberOfParameters(1),
m_titleView(KDText::FontSize::Small, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_firstParameterDefinition(KDText::FontSize::Small, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_secondParameterDefinition(KDText::FontSize::Small, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_selectableTableView(selectableTableView)
{
}
@@ -51,11 +51,11 @@ View * ParametersController::ContentView::subviewAtIndex(int index) {
}
void ParametersController::ContentView::layoutSubviews() {
KDCoordinate titleHeight = KDText::charSize(KDText::FontSize::Small).height()+k_titleMargin;
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
KDCoordinate tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height() + Metric::CommonTopMargin + Metric::CommonBottomMargin;
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), tableHeight));
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
KDCoordinate defOrigin = (titleHeight+tableHeight)/2+(bounds().height()-textHeight)/2;
m_secondParameterDefinition.setFrame(KDRectZero);
if (m_numberOfParameters == 2) {

View File

@@ -6,15 +6,15 @@ constexpr KDColor BannerView::k_textColor;
constexpr KDColor BannerView::k_backgroundColor;
BannerView::BannerView() :
m_dotNameView(k_fontSize, 0.0f, 0.5f, k_textColor, k_backgroundColor),
m_xView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_yView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_regressionTypeView(k_fontSize, (I18n::Message)0, 0.0f, 0.5f, k_textColor,k_backgroundColor),
m_subText1(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText2(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText3(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText4(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText5(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor)
m_dotNameView(k_font, 0.0f, 0.5f, k_textColor, k_backgroundColor),
m_xView(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_yView(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_regressionTypeView(k_font, (I18n::Message)0, 0.0f, 0.5f, k_textColor,k_backgroundColor),
m_subText1(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText2(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText3(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText4(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor),
m_subText5(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor)
{
}

View File

@@ -10,9 +10,9 @@ class BannerView : public Shared::BannerView {
public:
BannerView();
int numberOfTextviews() const { return k_numberOfTextViews; }
KDText::FontSize fontSize() const { return k_fontSize; }
const KDFont * font() const { return k_font; }
private:
static constexpr KDText::FontSize k_fontSize = KDText::FontSize::Small;
static constexpr const KDFont * k_font = KDFont::SmallFont;
static constexpr KDColor k_textColor = KDColorBlack;
static constexpr KDColor k_backgroundColor = Palette::GreyMiddle;
static constexpr int k_numberOfTextViews = 9;

View File

@@ -25,7 +25,7 @@ CalculationController::CalculationController(Responder * parentResponder, Button
m_hideableCell(),
m_store(store)
{
m_r2Layout = HorizontalLayout(CharLayout('r', KDText::FontSize::Small), VerticalOffsetLayout(CharLayout('2', KDText::FontSize::Small), VerticalOffsetLayoutNode::Type::Superscript));
m_r2Layout = HorizontalLayout(CharLayout('r', KDFont::SmallFont), VerticalOffsetLayout(CharLayout('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Type::Superscript));
m_selectableTableView.setVerticalCellOverlap(0);
m_selectableTableView.setBackgroundColor(Palette::WallScreenDark);
m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);

View File

@@ -9,8 +9,8 @@ EvenOddDoubleBufferTextCellWithSeparator::EvenOddDoubleBufferTextCellWithSeparat
EvenOddCell(),
Responder(parentResponder),
m_firstTextSelected(true),
m_firstBufferTextView(KDText::FontSize::Small, horizontalAlignment, verticalAlignment),
m_secondBufferTextView(KDText::FontSize::Small, horizontalAlignment, verticalAlignment)
m_firstBufferTextView(KDFont::SmallFont, horizontalAlignment, verticalAlignment),
m_secondBufferTextView(KDFont::SmallFont, horizontalAlignment, verticalAlignment)
{
}

View File

@@ -173,7 +173,7 @@ void GraphController::reloadBannerView() {
}
if (!coefficientsAreDefined) {
// Force the "Data not suitable" message to be on the next line
int numberOfCharToCompleteLine = maxInt(Ion::Display::Width/(KDText::charSize(m_bannerView.fontSize()).width())- strlen(I18n::translate(formula)), 0);
int numberOfCharToCompleteLine = maxInt(Ion::Display::Width/(m_bannerView.font()->glyphSize().width())- strlen(I18n::translate(formula)), 0);
numberOfChar = 0;
for (int i = 0; i < numberOfCharToCompleteLine-1; i++) {
buffer[numberOfChar++] = ' ';
@@ -384,9 +384,9 @@ float GraphController::displayBottomMarginRatio() {
float GraphController::estimatedBannerHeight() const {
if (selectedSeriesIndex() < 0) {
return KDText::charSize(KDText::FontSize::Small).height() * 3;
return KDFont::SmallFont->glyphSize().height() * 3;
}
float result = KDText::charSize(KDText::FontSize::Small).height() * m_store->modelForSeries(selectedSeriesIndex())->bannerLinesCount();
float result = KDFont::SmallFont->glyphSize().height() * m_store->modelForSeries(selectedSeriesIndex())->bannerLinesCount();
return result;
}

View File

@@ -11,27 +11,27 @@ namespace Regression {
Layout CubicModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('3', KDText::FontSize::Small),
CharLayout('3', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('2', KDText::FontSize::Small),
CharLayout('2', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('c', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('d', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('c', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('d', KDFont::SmallFont),
};
m_layout = HorizontalLayout(layoutChildren, 15);
}

View File

@@ -9,14 +9,14 @@ namespace Regression {
Layout ExponentialModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('e', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('e', KDFont::SmallFont),
VerticalOffsetLayout(
HorizontalLayout(
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small)
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont)
),
VerticalOffsetLayoutNode::Type::Superscript
)

View File

@@ -10,11 +10,11 @@ namespace Regression {
Layout LinearModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
};
m_layout = HorizontalLayout(layoutChildren, 5);
}

View File

@@ -10,15 +10,15 @@ namespace Regression {
Layout LogarithmicModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('l', KDText::FontSize::Small),
CharLayout('n', KDText::FontSize::Small),
CharLayout('(', KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout(')', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small)
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('l', KDFont::SmallFont),
CharLayout('n', KDFont::SmallFont),
CharLayout('(', KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout(')', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont)
};
m_layout = HorizontalLayout(layoutChildren, 9);
}

View File

@@ -9,24 +9,24 @@ namespace Regression {
Layout LogisticModel::layout() {
if (m_layout.isUninitialized()) {
const Layout exponentLayoutChildren[] = {
CharLayout('-', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small)
CharLayout('-', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont)
};
const Layout layoutChildren[] = {
CharLayout('1', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('e', KDText::FontSize::Small),
CharLayout('1', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('e', KDFont::SmallFont),
VerticalOffsetLayout(
HorizontalLayout(exponentLayoutChildren, 4),
VerticalOffsetLayoutNode::Type::Superscript
)
};
m_layout = FractionLayout(
CharLayout('c', KDText::FontSize::Small),
CharLayout('c', KDFont::SmallFont),
HorizontalLayout(layoutChildren, 6)
);
}

View File

@@ -10,11 +10,11 @@ namespace Regression {
Layout PowerModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('b', KDText::FontSize::Small),
CharLayout('b', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
};

View File

@@ -11,19 +11,19 @@ namespace Regression {
Layout QuadraticModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('2', KDText::FontSize::Small),
CharLayout('2', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('c', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('c', KDFont::SmallFont),
};
m_layout = HorizontalLayout(layoutChildren, 10);
}

View File

@@ -11,35 +11,35 @@ namespace Regression {
Layout QuarticModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('4', KDText::FontSize::Small),
CharLayout('4', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('3', KDText::FontSize::Small),
CharLayout('3', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('c', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('c', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('2', KDText::FontSize::Small),
CharLayout('2', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Superscript
),
CharLayout('+', KDText::FontSize::Small),
CharLayout('d', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('e', KDText::FontSize::Small),
CharLayout('+', KDFont::SmallFont),
CharLayout('d', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('e', KDFont::SmallFont),
};
m_layout = HorizontalLayout(layoutChildren, 20);
}

View File

@@ -12,20 +12,20 @@ namespace Regression {
Layout TrigonometricModel::layout() {
if (m_layout.isUninitialized()) {
const Layout layoutChildren[] = {
CharLayout('a', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('s', KDText::FontSize::Small),
CharLayout('i', KDText::FontSize::Small),
CharLayout('n', KDText::FontSize::Small),
CharLayout('(', KDText::FontSize::Small),
CharLayout('b', KDText::FontSize::Small),
CharLayout(Ion::Charset::MiddleDot, KDText::FontSize::Small),
CharLayout('X', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('c', KDText::FontSize::Small),
CharLayout(')', KDText::FontSize::Small),
CharLayout('+', KDText::FontSize::Small),
CharLayout('d', KDText::FontSize::Small)
CharLayout('a', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('s', KDFont::SmallFont),
CharLayout('i', KDFont::SmallFont),
CharLayout('n', KDFont::SmallFont),
CharLayout('(', KDFont::SmallFont),
CharLayout('b', KDFont::SmallFont),
CharLayout(Ion::Charset::MiddleDot, KDFont::SmallFont),
CharLayout('X', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('c', KDFont::SmallFont),
CharLayout(')', KDFont::SmallFont),
CharLayout('+', KDFont::SmallFont),
CharLayout('d', KDFont::SmallFont)
};
m_layout = HorizontalLayout(layoutChildren, 14);
}

View File

@@ -3,8 +3,8 @@
namespace Sequence {
BannerView::BannerView() :
m_abscissaView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sequenceView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle)
m_abscissaView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sequenceView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle)
{
}

View File

@@ -48,9 +48,9 @@ double TermSumController::cursorNextStep(double x, int direction) {
Layout TermSumController::createFunctionLayout(const char * functionName) {
return HorizontalLayout(
CharLayout(functionName[0], KDText::FontSize::Small),
CharLayout(functionName[0], KDFont::SmallFont),
VerticalOffsetLayout(
CharLayout('n', KDText::FontSize::Small),
CharLayout('n', KDFont::SmallFont),
VerticalOffsetLayoutNode::Type::Subscript
)
);

View File

@@ -74,19 +74,19 @@ void SequenceToolbox::buildExtraCellsLayouts(const char * sequenceName, int recu
for (int j = 0; j < recurrenceDepth; j++) {
const char * indice = j == 0 ? "n" : "n+1";
m_addedCellLayout[j] = HorizontalLayout(
CharLayout(sequenceName[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(sequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
m_addedCellLayout[j+recurrenceDepth] = HorizontalLayout(
CharLayout(otherSequenceName[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(otherSequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
if (recurrenceDepth < 2) {
const char * indice = recurrenceDepth == 0 ? "n" : (recurrenceDepth == 1 ? "n+1" : "n+2");
m_addedCellLayout[2*recurrenceDepth] = HorizontalLayout(
CharLayout(otherSequenceName[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(otherSequenceName[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String(indice, strlen(indice), KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
}

View File

@@ -107,15 +107,15 @@ KDCoordinate TypeParameterController::cellHeight() {
void TypeParameterController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
const char * nextName = m_sequenceStore->firstAvailableName();
KDText::FontSize size = KDText::FontSize::Large;
const KDFont * font = KDFont::LargeFont;
if (m_sequence) {
nextName = m_sequence->name();
size = KDText::FontSize::Small;
font = KDFont::SmallFont;
}
const char * subscripts[3] = {"n", "n+1", "n+2"};
m_layouts[j] = HorizontalLayout(
CharLayout(nextName[0], size),
VerticalOffsetLayout(LayoutHelper::String(subscripts[j], strlen(subscripts[j]), size), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(nextName[0], font),
VerticalOffsetLayout(LayoutHelper::String(subscripts[j], strlen(subscripts[j]), font), VerticalOffsetLayoutNode::Type::Subscript)
);
ExpressionTableCellWithPointer * myCell = (ExpressionTableCellWithPointer *)cell;
myCell->setLayout(m_layouts[j]);

View File

@@ -147,8 +147,8 @@ int Sequence::numberOfElements() {
Poincare::Layout Sequence::nameLayout() {
if (m_nameLayout.isUninitialized()) {
m_nameLayout = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Small),
VerticalOffsetLayout(CharLayout('n', KDText::FontSize::Small), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(name()[0], KDFont::SmallFont),
VerticalOffsetLayout(CharLayout('n', KDFont::SmallFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
return m_nameLayout;
@@ -158,20 +158,20 @@ Poincare::Layout Sequence::definitionName() {
if (m_definitionName.isUninitialized()) {
if (m_type == Type::Explicit) {
m_definitionName = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String("n", 1, KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(name()[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String("n", 1, KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
if (m_type == Type::SingleRecurrence) {
m_definitionName = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String("n+1", 3, KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(name()[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String("n+1", 3, KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
if (m_type == Type::DoubleRecurrence) {
m_definitionName = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Large),
VerticalOffsetLayout(LayoutHelper::String("n+2", 3, KDText::FontSize::Large), VerticalOffsetLayoutNode::Type::Subscript)
CharLayout(name()[0], KDFont::LargeFont),
VerticalOffsetLayout(LayoutHelper::String("n+2", 3, KDFont::LargeFont), VerticalOffsetLayoutNode::Type::Subscript)
);
}
}
@@ -185,9 +185,9 @@ Poincare::Layout Sequence::firstInitialConditionName() {
&& (m_type == Type::SingleRecurrence
|| m_type == Type::DoubleRecurrence))
{
Layout indexLayout = LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Large);
Layout indexLayout = LayoutHelper::String(buffer, strlen(buffer), KDFont::LargeFont);
m_firstInitialConditionName = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Large),
CharLayout(name()[0], KDFont::LargeFont),
VerticalOffsetLayout(indexLayout, VerticalOffsetLayoutNode::Type::Subscript)
);
}
@@ -199,9 +199,9 @@ Poincare::Layout Sequence::secondInitialConditionName() {
Integer(m_initialRank+1).serialize(buffer, k_initialRankNumberOfDigits+1);
if (m_secondInitialConditionName.isUninitialized()) {
if (m_type == Type::DoubleRecurrence) {
Layout indexLayout = LayoutHelper::String(buffer, strlen(buffer), KDText::FontSize::Large);
Layout indexLayout = LayoutHelper::String(buffer, strlen(buffer), KDFont::LargeFont);
m_secondInitialConditionName = HorizontalLayout(
CharLayout(name()[0], KDText::FontSize::Large),
CharLayout(name()[0], KDFont::LargeFont),
VerticalOffsetLayout(indexLayout, VerticalOffsetLayoutNode::Type::Subscript)
);
}

View File

@@ -39,9 +39,9 @@ const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp
MainController::MainController(Responder * parentResponder) :
ViewController(parentResponder),
#if EPSILON_SOFTWARE_UPDATE_PROMPT
m_updateCell(I18n::Message::Default, KDText::FontSize::Large),
m_updateCell(I18n::Message::Default, KDFont::LargeFont),
#endif
m_brightnessCell(I18n::Message::Default, KDText::FontSize::Large),
m_brightnessCell(I18n::Message::Default, KDFont::LargeFont),
m_selectableTableView(this),
m_messageTreeModel((MessageTree *)&model),
m_preferencesController(this),
@@ -51,7 +51,7 @@ MainController::MainController(Responder * parentResponder) :
m_aboutController(this)
{
for (int i = 0; i < k_numberOfSimpleChevronCells; i++) {
m_cells[i].setMessageFontSize(KDText::FontSize::Large);
m_cells[i].setMessageFont(KDFont::LargeFont);
}
}

View File

@@ -11,8 +11,8 @@ AboutController::AboutController(Responder * parentResponder) :
GenericSubController(parentResponder)
{
for (int i = 0; i < k_totalNumberOfCell; i++) {
m_cells[i].setMessageFontSize(KDText::FontSize::Large);
m_cells[i].setAccessoryFontSize(KDText::FontSize::Small);
m_cells[i].setMessageFont(KDFont::LargeFont);
m_cells[i].setAccessoryFont(KDFont::SmallFont);
m_cells[i].setAccessoryTextColor(Palette::GreyDark);
}
}

View File

@@ -13,7 +13,7 @@ DisplayModeController::DisplayModeController(Responder * parentResponder) :
m_editableCell(&m_selectableTableView, this, m_draftTextBuffer)
{
m_editableCell.messageTableCellWithEditableText()->setMessage(I18n::Message::SignificantFigures);
m_editableCell.messageTableCellWithEditableText()->setMessageFontSize(KDText::FontSize::Large);
m_editableCell.messageTableCellWithEditableText()->setMessageFont(KDFont::LargeFont);
}
KDCoordinate DisplayModeController::rowHeight(int j) {

View File

@@ -11,7 +11,7 @@ namespace Settings {
ExamModeController::ExamModeController(Responder * parentResponder) :
GenericSubController(parentResponder),
m_cell(I18n::Message::ExamModeActive, KDText::FontSize::Large)
m_cell(I18n::Message::ExamModeActive, KDFont::LargeFont)
{
}

View File

@@ -12,7 +12,7 @@ PreferencesController::PreferencesController(Responder * parentResponder) :
GenericSubController(parentResponder)
{
for (int i = 0; i < k_totalNumberOfCell; i++) {
m_cells[i].setMessageFontSize(KDText::FontSize::Large);
m_cells[i].setMessageFont(KDFont::LargeFont);
}
}
@@ -51,45 +51,45 @@ Layout layoutForPreferences(I18n::Message message) {
case I18n::Message::Degres:
{
const char degEx[] = {'9', '0', Ion::Charset::Degree};
return LayoutHelper::String(degEx, sizeof(degEx), KDText::FontSize::Small);
return LayoutHelper::String(degEx, sizeof(degEx), KDFont::SmallFont);
}
case I18n::Message::Radian:
{
const char pi[] = {Ion::Charset::SmallPi};
return FractionLayout(
LayoutHelper::String(pi, sizeof(pi), KDText::FontSize::Small),
LayoutHelper::String("2", 1, KDText::FontSize::Small)
LayoutHelper::String(pi, sizeof(pi), KDFont::SmallFont),
LayoutHelper::String("2", 1, KDFont::SmallFont)
);
}
// Display Mode format
case I18n::Message::Decimal:
return LayoutHelper::String("12.34", 5, KDText::FontSize::Small);
return LayoutHelper::String("12.34", 5, KDFont::SmallFont);
case I18n::Message::Scientific:
{
const char text[] = {'1','.', '2', '3', '4', Ion::Charset::Exponent, '1'};
return LayoutHelper::String(text, sizeof(text), KDText::FontSize::Small);
return LayoutHelper::String(text, sizeof(text), KDFont::SmallFont);
}
// Edition mode
case I18n::Message::Edition2D:
return HorizontalLayout(
LayoutHelper::String("1+", 2, KDText::FontSize::Small),
FractionLayout(LayoutHelper::String("2", 1, KDText::FontSize::Small), LayoutHelper::String("3", 1, KDText::FontSize::Small))
LayoutHelper::String("1+", 2, KDFont::SmallFont),
FractionLayout(LayoutHelper::String("2", 1, KDFont::SmallFont), LayoutHelper::String("3", 1, KDFont::SmallFont))
);
case I18n::Message::EditionLinear:
return LayoutHelper::String("1+2/3", 5, KDText::FontSize::Small);
return LayoutHelper::String("1+2/3", 5, KDFont::SmallFont);
// Complex format
case I18n::Message::Cartesian:
{
const char text[] = {'a','+', Ion::Charset::IComplex, 'b'};
return LayoutHelper::String(text, sizeof(text), KDText::FontSize::Small);
return LayoutHelper::String(text, sizeof(text), KDFont::SmallFont);
}
case I18n::Message::Polar:
{
const char base[] = {'r', Ion::Charset::Exponential};
const char superscript[] = {Ion::Charset::IComplex, Ion::Charset::SmallTheta};
return HorizontalLayout(
LayoutHelper::String(base, sizeof(base), KDText::FontSize::Small),
VerticalOffsetLayout(LayoutHelper::String(superscript, sizeof(superscript), KDText::FontSize::Small), VerticalOffsetLayoutNode::Type::Superscript)
LayoutHelper::String(base, sizeof(base), KDFont::SmallFont),
VerticalOffsetLayout(LayoutHelper::String(superscript, sizeof(superscript), KDFont::SmallFont), VerticalOffsetLayoutNode::Type::Superscript)
);
}
default:

View File

@@ -22,7 +22,7 @@ void BannerView::setMessageAtIndex(I18n::Message text, int index) {
}
KDSize BannerView::minimalSizeForOptimalDisplay() const {
return KDSize(0, KDText::charSize(KDText::FontSize::Small).height()*numberOfLines());
return KDSize(0, KDFont::SmallFont->glyphSize().height()*numberOfLines());
}
int BannerView::numberOfSubviews() const {
@@ -81,7 +81,7 @@ int BannerView::numberOfLines() const {
KDCoordinate usedWidth = 0;
KDCoordinate lineNumber = 0;
for (int i = 0; i < numberOfSubviews(); i++) {
KDCoordinate textWidth = KDText::stringSize(textViewAtIndex(i)->text(), KDText::FontSize::Small).width();
KDCoordinate textWidth = KDFont::SmallFont->stringSize(textViewAtIndex(i)->text()).width();
if (usedWidth+textWidth > width) {
usedWidth = textWidth;
lineNumber++;

View File

@@ -3,9 +3,9 @@
namespace Shared {
BufferFunctionTitleCell::BufferFunctionTitleCell(Orientation orientation, KDText::FontSize size) :
BufferFunctionTitleCell::BufferFunctionTitleCell(Orientation orientation, const KDFont * font) :
FunctionTitleCell(orientation),
m_bufferTextView(size, 0.5f, 0.5f)
m_bufferTextView(font, 0.5f, 0.5f)
{
}

View File

@@ -7,12 +7,12 @@ namespace Shared {
class BufferFunctionTitleCell : public FunctionTitleCell {
public:
BufferFunctionTitleCell(Orientation orientation = Orientation::VerticalIndicator, KDText::FontSize size = KDText::FontSize::Large);
BufferFunctionTitleCell(Orientation orientation = Orientation::VerticalIndicator, const KDFont * font = KDFont::LargeFont);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setColor(KDColor color) override;
void setText(const char * textContent);
void setFontSize(KDText::FontSize size) { m_bufferTextView.setFontSize(size); }
void setFont(const KDFont * font) { m_bufferTextView.setFont(font); }
const char * text() const override {
return m_bufferTextView.text();
}

View File

@@ -3,11 +3,11 @@
namespace Shared {
BufferTextViewWithTextField::BufferTextViewWithTextField(Responder * parentResponder, TextFieldDelegate * delegate, KDText::FontSize size) :
BufferTextViewWithTextField::BufferTextViewWithTextField(Responder * parentResponder, TextFieldDelegate * delegate, const KDFont * font) :
View(),
Responder(parentResponder),
m_bufferTextView(size, 0.0f, 0.5f),
m_textField(this, m_textFieldBuffer, m_textFieldBuffer, k_textFieldBufferSize, delegate, false, size, 0.0f, 0.5f),
m_bufferTextView(font, 0.0f, 0.5f),
m_textField(this, m_textFieldBuffer, m_textFieldBuffer, k_textFieldBufferSize, delegate, false, font, 0.0f, 0.5f),
m_textFieldBuffer{}
{
}

View File

@@ -6,7 +6,7 @@ namespace Shared {
class BufferTextViewWithTextField : public View, public Responder {
public:
BufferTextViewWithTextField(Responder * parentResponder, TextFieldDelegate * delegate = nullptr, KDText::FontSize size = KDText::FontSize::Large);
BufferTextViewWithTextField(Responder * parentResponder, TextFieldDelegate * delegate = nullptr, const KDFont * font = KDFont::LargeFont);
KDSize minimalSizeForOptimalDisplay() const override;
TextField * textField() { return &m_textField; }
void setBufferText(const char * text);

View File

@@ -1,7 +1,7 @@
#include "button_with_separator.h"
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
Button(parentResponder, message, invocation, KDText::FontSize::Large, KDColorBlack)
Button(parentResponder, message, invocation, KDFont::LargeFont, KDColorBlack)
{
}

View File

@@ -162,7 +162,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
graduation = KDRect(horizontalCoordinate-(k_labelGraduationLength-2)/2, std::round(floatToPixel(Axis::Vertical, x)), k_labelGraduationLength, 1);
}
if (!graduationOnly) {
KDSize textSize = KDText::stringSize(label(axis, i), KDText::FontSize::Small);
KDSize textSize = KDFont::SmallFont->stringSize(label(axis, i));
KDPoint origin(std::round(floatToPixel(Axis::Horizontal, x)) - textSize.width()/2, verticalCoordinate + k_labelMargin);
if (axis == Axis::Vertical) {
origin = KDPoint(horizontalCoordinate + k_labelMargin, std::round(floatToPixel(Axis::Vertical, x)) - textSize.height()/2);
@@ -170,8 +170,8 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
if (-step < x && x < step && shiftOrigin) {
origin = KDPoint(horizontalCoordinate + k_labelMargin, verticalCoordinate + k_labelMargin);
}
if (rect.intersects(KDRect(origin, KDText::stringSize(label(axis, i), KDText::FontSize::Small)))) {
ctx->blendString(label(axis, i), origin, KDText::FontSize::Small, KDColorBlack);
if (rect.intersects(KDRect(origin, KDFont::SmallFont->stringSize(label(axis, i))))) {
ctx->drawString(label(axis, i), origin, KDFont::SmallFont, KDColorBlack);
}
}
ctx->fillRect(graduation, KDColorBlack);

View File

@@ -27,7 +27,7 @@ KDCoordinate ExpressionModelListController::expressionRowHeight(int j) {
return Metric::StoreRowHeight;
}
KDCoordinate modelSize = m->layout().layoutSize().height();
return modelSize + Metric::StoreRowHeight - KDText::charSize().height();
return modelSize + Metric::StoreRowHeight - KDFont::LargeFont->glyphSize().height();
}
void ExpressionModelListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {

View File

@@ -13,12 +13,12 @@ FunctionListController::FunctionListController(Responder * parentResponder, Func
FunctionListController * list = (FunctionListController *)context;
TabViewController * tabController = list->tabController();
tabController->setActiveTab(1);
}, this), KDText::FontSize::Small, Palette::PurpleBright),
}, this), KDFont::SmallFont, Palette::PurpleBright),
m_valuesButton(this, I18n::Message::DisplayValues, Invocation([](void * context, void * sender) {
FunctionListController * list = (FunctionListController *)context;
TabViewController * tabController = list->tabController();
tabController->setActiveTab(2);
}, this), KDText::FontSize::Small, Palette::PurpleBright)
}, this), KDFont::SmallFont, Palette::PurpleBright)
{
m_selectableTableView.setMargins(0);
m_selectableTableView.setVerticalCellOverlap(0);

View File

@@ -18,17 +18,17 @@ InteractiveCurveViewController::InteractiveCurveViewController(Responder * paren
InteractiveCurveViewController * graphController = (InteractiveCurveViewController *) context;
StackViewController * stack = graphController->stackController();
stack->push(graphController->rangeParameterController());
}, this), KDText::FontSize::Small),
}, this), KDFont::SmallFont),
m_zoomButton(this, I18n::Message::Zoom, Invocation([](void * context, void * sender) {
InteractiveCurveViewController * graphController = (InteractiveCurveViewController *) context;
StackViewController * stack = graphController->stackController();
stack->push(graphController->zoomParameterController());
}, this), KDText::FontSize::Small),
}, this), KDFont::SmallFont),
m_defaultInitialisationButton(this, I18n::Message::Initialization, Invocation([](void * context, void * sender) {
InteractiveCurveViewController * graphController = (InteractiveCurveViewController *) context;
StackViewController * stack = graphController->stackController();
stack->push(graphController->initialisationParameterController());
}, this), KDText::FontSize::Small)
}, this), KDFont::SmallFont)
{
}

View File

@@ -12,7 +12,7 @@ LanguageController::LanguageController(Responder * parentResponder, KDCoordinate
m_selectableTableView.setTopMargin(topMargin);
m_selectableTableView.setBottomMargin(0);
for (int i = 0; i < I18n::NumberOfLanguages; i++) {
m_cells[i].setMessageFontSize(KDText::FontSize::Large);
m_cells[i].setMessageFont(KDFont::LargeFont);
}
}

View File

@@ -7,8 +7,8 @@ namespace Shared {
class MarginEvenOddMessageTextCell : public EvenOddMessageTextCell {
public:
MarginEvenOddMessageTextCell(KDText::FontSize size = KDText::FontSize::Small) :
EvenOddMessageTextCell(size)
MarginEvenOddMessageTextCell(const KDFont * font = KDFont::SmallFont) :
EvenOddMessageTextCell(font)
{}
void layoutSubviews() override;
private:

View File

@@ -4,7 +4,7 @@
MessageView::MessageView(I18n::Message * messages, KDColor * colors, uint8_t numberOfMessages) {
m_numberOfMessages = numberOfMessages < k_maxNumberOfMessages ? numberOfMessages : k_maxNumberOfMessages;
for (uint8_t i = 0; i < m_numberOfMessages; i++) {
m_messageTextViews[i].setFontSize(i == 0 ? KDText::FontSize::Large : KDText::FontSize::Small);
m_messageTextViews[i].setFont(i == 0 ? KDFont::LargeFont : KDFont::SmallFont);
m_messageTextViews[i].setMessage(messages[i]);
m_messageTextViews[i].setAlignment(0.5f, 0.5f);
m_messageTextViews[i].setTextColor(colors[i]);
@@ -29,7 +29,7 @@ void MessageView::layoutSubviews() {
}
KDCoordinate width = bounds().width();
KDCoordinate titleHeight = m_messageTextViews[0].minimalSizeForOptimalDisplay().height();
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_messageTextViews[0].setFrame(KDRect(0, k_titleMargin, width, titleHeight));
for (uint8_t i = 1; i < m_numberOfMessages; i++) {
m_messageTextViews[i].setFrame(KDRect(0, k_paragraphHeight + (i-1) * textHeight, width, textHeight));

View File

@@ -7,7 +7,7 @@ namespace Shared {
ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() :
m_approximateExpressionView(),
m_approximateSign(KDText::FontSize::Large, I18n::Message::AlmostEqual, 0.5f, 0.5f, Palette::GreyVeryDark),
m_approximateSign(KDFont::LargeFont, I18n::Message::AlmostEqual, 0.5f, 0.5f, Palette::GreyVeryDark),
m_exactExpressionView(),
m_selectedSubviewType((SubviewType)0)
{

View File

@@ -8,7 +8,7 @@ namespace Shared {
class StoreTitleCell : public BufferFunctionTitleCell {
public:
StoreTitleCell() :
BufferFunctionTitleCell(Orientation::HorizontalIndicator, KDText::FontSize::Small),
BufferFunctionTitleCell(Orientation::HorizontalIndicator, KDFont::SmallFont),
m_separatorLeft(false)
{}
void setSeparatorLeft(bool separator);

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);

View File

@@ -61,8 +61,6 @@ private:
void setSumSymbol(Step step, double start = NAN, double end = NAN, double result = NAN, Poincare::Layout sequenceName = Poincare::Layout());
private:
constexpr static KDCoordinate k_legendHeight = 35;
constexpr static KDCoordinate k_editableZoneWidth = 12*KDText::charSize(KDText::FontSize::Small).width();
constexpr static KDCoordinate k_editableZoneHeight = KDText::charSize(KDText::FontSize::Small).height();
constexpr static KDCoordinate k_symbolHeightMargin = 8;
constexpr static KDCoordinate k_sigmaHeight = 18;
int numberOfSubviews() const override;

View File

@@ -23,7 +23,7 @@ ValuesController::ValuesController(Responder * parentResponder, ButtonRowControl
ValuesController * valuesController = (ValuesController *) context;
StackViewController * stack = ((StackViewController *)valuesController->stackController());
stack->push(valuesController->intervalParameterController());
}, this), KDText::FontSize::Small)
}, this), KDFont::SmallFont)
{
m_selectableTableView.setVerticalCellOverlap(0);
m_selectableTableView.setTopMargin(k_topMargin);
@@ -32,12 +32,12 @@ ValuesController::ValuesController(Responder * parentResponder, ButtonRowControl
m_selectableTableView.setLeftMargin(k_leftMargin);
m_selectableTableView.setBackgroundColor(Palette::WallScreenDark);
m_selectableTableView.setIndicatorThickness(13);
m_abscissaTitleCell.setMessageFontSize(KDText::FontSize::Small);
m_abscissaTitleCell.setMessageFont(KDFont::SmallFont);
for (int i = 0; i < k_maxNumberOfAbscissaCells; i++) {
m_abscissaCells[i].setParentResponder(&m_selectableTableView);
m_abscissaCells[i].editableTextCell()->textField()->setDelegate(this);
m_abscissaCells[i].editableTextCell()->textField()->setDraftTextBuffer(m_draftTextBuffer);
m_abscissaCells[i].editableTextCell()->textField()->setFontSize(KDText::FontSize::Small);
m_abscissaCells[i].editableTextCell()->textField()->setFont(KDFont::SmallFont);
}
}

View File

@@ -101,7 +101,7 @@ ZoomParameterController::ContentView::LegendView::LegendView()
I18n::Message messages[k_numberOfLegends] = {I18n::Message::Move, I18n::Message::ToZoom, I18n::Message::Or};
float horizontalAlignments[k_numberOfLegends] = {1.0f, 1.0f, 0.5f};
for (int i = 0; i < k_numberOfLegends; i++) {
m_legends[i].setFontSize(KDText::FontSize::Small);
m_legends[i].setFont(KDFont::SmallFont);
m_legends[i].setMessage(messages[i]);
m_legends[i].setBackgroundColor(Palette::GreyBright);
m_legends[i].setAlignment(horizontalAlignments[i], 0.5f);

View File

@@ -2,7 +2,7 @@
ShiftAlphaLockView::ShiftAlphaLockView() :
View(),
m_shiftAlphaView(KDText::FontSize::Small, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
m_shiftAlphaView(KDFont::SmallFont, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
m_status(Ion::Events::ShiftAlphaStatus::Default)
{
}
@@ -37,7 +37,7 @@ bool ShiftAlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
}
KDSize ShiftAlphaLockView::minimalSizeForOptimalDisplay() const {
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
KDSize modifierSize = KDFont::SmallFont->stringSize(I18n::translate(I18n::Message::Alpha));
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();
KDCoordinate height = lockSize.height() > modifierSize.height() ? lockSize.height() : modifierSize.height();
return KDSize(modifierSize.width() + lockSize.width() + k_lockRightMargin, height);
@@ -66,7 +66,7 @@ View * ShiftAlphaLockView::subviewAtIndex(int index) {
}
void ShiftAlphaLockView::layoutSubviews() {
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
KDSize modifierSize = KDFont::SmallFont->stringSize(I18n::translate(I18n::Message::Alpha));
m_shiftAlphaView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize));
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();

View File

@@ -13,7 +13,7 @@ constexpr const char * EquationModelsParameterController::k_models[k_numberOfMod
EquationModelsParameterController::EquationModelsParameterController(Responder * parentResponder, EquationStore * equationStore, ListController * listController) :
ViewController(parentResponder),
m_emptyModelCell(I18n::Message::Empty, KDText::FontSize::Large),
m_emptyModelCell(I18n::Message::Empty, KDFont::LargeFont),
m_layouts{},
m_selectableTableView(this),
m_equationStore(equationStore),

View File

@@ -7,8 +7,8 @@
namespace Solver {
IntervalController::ContentView::ContentView(SelectableTableView * selectableTableView) :
m_instructions0(KDText::FontSize::Small, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_instructions1(KDText::FontSize::Small, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_selectableTableView(selectableTableView)
{
}
@@ -33,7 +33,7 @@ View * IntervalController::ContentView::subviewAtIndex(int index) {
}
void IntervalController::ContentView::layoutSubviews() {
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_instructions0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight));
m_instructions1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight));
m_selectableTableView->setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin));

View File

@@ -15,7 +15,7 @@ ListController::ListController(Responder * parentResponder, EquationStore * equa
m_resolveButton(this, equationStore->numberOfDefinedModels() > 1 ? I18n::Message::ResolveSystem : I18n::Message::ResolveEquation, Invocation([](void * context, void * sender) {
ListController * list = (ListController *)context;
list->resolveEquations();
}, this), KDText::FontSize::Large, Palette::PurpleBright),
}, this), KDFont::LargeFont, Palette::PurpleBright),
m_modelsParameterController(this, equationStore, this),
m_modelsStackController(nullptr, &m_modelsParameterController, KDColorWhite, Palette::PurpleDark, Palette::PurpleDark)
{

View File

@@ -11,8 +11,8 @@ using namespace Shared;
namespace Solver {
SolutionsController::ContentView::ContentView(SolutionsController * controller) :
m_warningMessageView0(KDText::FontSize::Small, I18n::Message::OnlyFirstSolutionsDisplayed0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_warningMessageView1(KDText::FontSize::Small, I18n::Message::OnlyFirstSolutionsDisplayed1, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_warningMessageView0(KDFont::SmallFont, I18n::Message::OnlyFirstSolutionsDisplayed0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_warningMessageView1(KDFont::SmallFont, I18n::Message::OnlyFirstSolutionsDisplayed1, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_selectableTableView(controller),
m_displayWarningMoreSolutions(false)
{
@@ -50,7 +50,7 @@ View * SolutionsController::ContentView::subviewAtIndex(int index) {
void SolutionsController::ContentView::layoutSubviews() {
if (m_displayWarningMoreSolutions) {
KDCoordinate textHeight = KDText::charSize(KDText::FontSize::Small).height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningMessageView0.setFrame(KDRect(0, k_topMargin/2-textHeight, bounds().width(), textHeight));
m_warningMessageView1.setFrame(KDRect(0, k_topMargin/2, bounds().width(), textHeight));
m_selectableTableView.setFrame(KDRect(0, k_topMargin, bounds().width(), bounds().height()-k_topMargin));
@@ -66,14 +66,14 @@ SolutionsController::SolutionsController(Responder * parentResponder, EquationSt
m_delta2Layout(),
m_contentView(this)
{
m_delta2Layout = HorizontalLayout(VerticalOffsetLayout(CharLayout('2', KDText::FontSize::Small), VerticalOffsetLayoutNode::Type::Superscript), LayoutHelper::String("-4ac", 4, KDText::FontSize::Small));
m_delta2Layout = HorizontalLayout(VerticalOffsetLayout(CharLayout('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Type::Superscript), LayoutHelper::String("-4ac", 4, KDFont::SmallFont));
char deltaB[] = {Ion::Charset::CapitalDelta, '=', 'b'};
static_cast<HorizontalLayout&>(m_delta2Layout).addOrMergeChildAtIndex(LayoutHelper::String(deltaB, 3, KDText::FontSize::Small), 0, false);
static_cast<HorizontalLayout&>(m_delta2Layout).addOrMergeChildAtIndex(LayoutHelper::String(deltaB, 3, KDFont::SmallFont), 0, false);
for (int i = 0; i < EquationStore::k_maxNumberOfExactSolutions; i++) {
m_exactValueCells[i].setParentResponder(m_contentView.selectableTableView());
}
for (int i = 0; i < EquationStore::k_maxNumberOfApproximateSolutions; i++) {
m_approximateValueCells[i].setFontSize(KDText::FontSize::Large);
m_approximateValueCells[i].setFont(KDFont::LargeFont);
}
for (int i = 0; i < EquationStore::k_maxNumberOfSolutions; i++) {
m_symbolCells[i].setAlignment(0.5f, 0.5f);
@@ -148,7 +148,7 @@ void SolutionsController::willDisplayCellAtLocation(HighlightCell * cell, int i,
deltaCell->setLayout(m_delta2Layout);
} else {
EvenOddBufferTextCell * symbolCell = static_cast<EvenOddBufferTextCell *>(cell);
symbolCell->setFontSize(KDText::FontSize::Large);
symbolCell->setFont(KDFont::LargeFont);
char bufferSymbol[10]; // hold at maximum Delta = b^2-4ac
switch (m_equationStore->type()) {
case EquationStore::Type::LinearSystem:

View File

@@ -3,9 +3,9 @@
namespace Statistics {
BoxBannerView::BoxBannerView() :
m_seriesName(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_calculationName(KDText::FontSize::Small, I18n::Message::Minimum, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_calculationValue(KDText::FontSize::Small, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle)
m_seriesName(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_calculationName(KDFont::SmallFont, I18n::Message::Minimum, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_calculationValue(KDFont::SmallFont, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle)
{
}

View File

@@ -6,12 +6,12 @@
namespace Statistics {
HistogramBannerView::HistogramBannerView() :
m_intervalLegendView(KDText::FontSize::Small, I18n::Message::Interval, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_intervalView(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sizeLegendView(KDText::FontSize::Small, I18n::Message::Size, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sizeView(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_frequencyLegendView(KDText::FontSize::Small, I18n::Message::Frequency, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_frequencyView(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle)
m_intervalLegendView(KDFont::SmallFont, I18n::Message::Interval, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_intervalView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sizeLegendView(KDFont::SmallFont, I18n::Message::Size, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sizeView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_frequencyLegendView(KDFont::SmallFont, I18n::Message::Frequency, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_frequencyView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle)
{
}

View File

@@ -10,8 +10,8 @@ using namespace Poincare;
TitleBarView::TitleBarView() :
View(),
m_titleView(KDText::FontSize::Small, I18n::Message::Default, 0.5f, 0.5f, KDColorWhite, Palette::YellowDark),
m_preferenceView(KDText::FontSize::Small, 1.0f, 0.5, KDColorWhite, Palette::YellowDark)
m_titleView(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorWhite, Palette::YellowDark),
m_preferenceView(KDFont::SmallFont, 1.0f, 0.5, KDColorWhite, Palette::YellowDark)
{
m_examModeIconView.setImage(ImageStore::ExamIcon);
}

View File

@@ -5,8 +5,8 @@ using namespace Poincare;
VariableBoxLeafCell::VariableBoxLeafCell() :
HighlightCell(),
m_labelView(KDText::FontSize::Small, 0, 0.5, KDColorBlack, KDColorWhite),
m_subtitleView(KDText::FontSize::Small, 0, 0.5, Palette::GreyDark, KDColorWhite),
m_labelView(KDFont::SmallFont, 0, 0.5, KDColorBlack, KDColorWhite),
m_subtitleView(KDFont::SmallFont, 0, 0.5, Palette::GreyDark, KDColorWhite),
m_expressionView(1.0f, 0.5f),
m_displayExpression(false)
{

View File

@@ -5,7 +5,7 @@
class BufferTextView : public TextView {
public:
BufferTextView(KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f,
BufferTextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setText(const char * text) override;
const char * text() const override;

View File

@@ -10,7 +10,7 @@
class Button : public HighlightCell, public Responder {
public:
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, KDText::FontSize size = KDText::FontSize::Small, KDColor textColor = KDColorBlack);
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = KDColorBlack);
void setMessage(I18n::Message message);
bool handleEvent(Ion::Events::Event event) override;
void setHighlighted(bool highlight) override;
@@ -29,7 +29,7 @@ private:
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
Invocation m_invocation;
KDText::FontSize m_size;
const KDFont * m_font;
};
#endif

View File

@@ -8,7 +8,7 @@
class EditableTextCell : public HighlightCell, public Responder {
public:
EditableTextCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr, char * draftTextBuffer = nullptr, KDText::FontSize size = KDText::FontSize::Large,
EditableTextCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr, char * draftTextBuffer = nullptr, const KDFont * font = KDFont::LargeFont,
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
TextField * textField();
void setMargins(KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);

View File

@@ -6,10 +6,10 @@
class EvenOddBufferTextCell : public EvenOddCell {
public:
EvenOddBufferTextCell(KDText::FontSize size = KDText::FontSize::Small, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f);
EvenOddBufferTextCell(const KDFont * font = KDFont::SmallFont, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f);
const char * text() const override;
void setFontSize(KDText::FontSize fontSize) {
m_bufferTextView.setFontSize(fontSize);
void setFont(const KDFont * font) {
m_bufferTextView.setFont(font);
}
void setAlignment(float horizontalAlignment, float verticalAlignment) {
m_bufferTextView.setAlignment(horizontalAlignment, verticalAlignment);

View File

@@ -7,7 +7,7 @@
class EvenOddEditableTextCell : public EvenOddCell, public Responder {
public:
EvenOddEditableTextCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr, char * draftTextBuffer = nullptr, KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
EvenOddEditableTextCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr, char * draftTextBuffer = nullptr, const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
EditableTextCell * editableTextCell();
void setEven(bool even) override;
void setHighlighted(bool highlight) override;

View File

@@ -7,12 +7,12 @@
class EvenOddMessageTextCell : public EvenOddCell {
public:
EvenOddMessageTextCell(KDText::FontSize size = KDText::FontSize::Large);
EvenOddMessageTextCell(const KDFont * font = KDFont::LargeFont);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setMessage(I18n::Message textContent, KDColor textColor = KDColorBlack);
void setAlignment(float horizontalAlignment, float verticalAlignment);
void setMessageFontSize(KDText::FontSize size) { m_messageTextView.setFontSize(size); }
void setMessageFont(const KDFont * font) { m_messageTextView.setFont(font); }
protected:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;

View File

@@ -7,12 +7,12 @@
class MessageTableCell : public TableCell {
public:
MessageTableCell(I18n::Message label = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small, Layout layout = Layout::Horizontal);
MessageTableCell(I18n::Message label = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, Layout layout = Layout::Horizontal);
View * labelView() const override;
virtual void setHighlighted(bool highlight) override;
void setMessage(I18n::Message message);
virtual void setTextColor(KDColor color);
void setMessageFontSize(KDText::FontSize fontSize);
void setMessageFont(const KDFont * font);
private:
MessageTextView m_messageTextView;
};

View File

@@ -6,14 +6,18 @@
class MessageTableCellWithBuffer : public MessageTableCell {
public:
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, KDText::FontSize fontSize = KDText::FontSize::Small, KDText::FontSize accessoryFontSize = KDText::FontSize::Large, KDColor accessoryTextColor = KDColorBlack);
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = KDColorBlack);
View * accessoryView() const override;
void setHighlighted(bool highlight) override;
void setAccessoryText(const char * textBody);
const char * accessoryText();
void setTextColor(KDColor color) override;
void setAccessoryTextColor(KDColor color);
void setAccessoryFontSize(KDText::FontSize fontSize);
void setAccessoryTextColor(KDColor color) {
m_accessoryView.setTextColor(color);
}
void setAccessoryFont(const KDFont * font) {
m_accessoryView.setFont(font);
}
const char * text() const override {
return m_accessoryView.text();
}

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithChevron : public MessageTableCell {
public:
MessageTableCellWithChevron(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
MessageTableCellWithChevron(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont);
View * accessoryView() const override;
private:
ChevronView m_accessoryView;

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithChevronAndExpression : public MessageTableCellWithChevron {
public:
MessageTableCellWithChevronAndExpression(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
MessageTableCellWithChevronAndExpression(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont);
View * subAccessoryView() const override;
void setHighlighted(bool highlight) override;
void setLayout(Poincare::Layout layoutR);

View File

@@ -5,7 +5,7 @@
class MessageTableCellWithChevronAndMessage : public MessageTableCellWithChevron {
public:
MessageTableCellWithChevronAndMessage(KDText::FontSize labelSize = KDText::FontSize::Small, KDText::FontSize contentSize = KDText::FontSize::Small);
MessageTableCellWithChevronAndMessage(const KDFont * labelFont = KDFont::SmallFont, const KDFont * contentFont = KDFont::SmallFont);
View * subAccessoryView() const override;
void setHighlighted(bool highlight) override;
void setSubtitle(I18n::Message text);

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithExpression : public MessageTableCell {
public:
MessageTableCellWithExpression(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
MessageTableCellWithExpression(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont);
View * accessoryView() const override;
void setHighlighted(bool highlight) override;
void setLayout(Poincare::Layout layout);

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithGauge : public MessageTableCell {
public:
MessageTableCellWithGauge(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
MessageTableCellWithGauge(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont);
View * accessoryView() const override;
void setHighlighted(bool highlight) override;
private:

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithSwitch : public MessageTableCell {
public:
MessageTableCellWithSwitch(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
MessageTableCellWithSwitch(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont);
View * accessoryView() const override;
private:
SwitchView m_accessoryView;

View File

@@ -6,7 +6,7 @@
class MessageTextView : public TextView {
public:
MessageTextView(KDText::FontSize size = KDText::FontSize::Large, I18n::Message message = (I18n::Message)0, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
MessageTextView(const KDFont * font = KDFont::LargeFont, I18n::Message message = (I18n::Message)0, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setText(const char * text) override;
void setMessage(I18n::Message message);

View File

@@ -6,7 +6,7 @@
class PointerTextView : public TextView {
public:
PointerTextView(KDText::FontSize size = KDText::FontSize::Large, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
PointerTextView(const KDFont * font = KDFont::LargeFont, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
const char * text() const override { return m_text; }
void setText(const char * text) override;

View File

@@ -8,15 +8,15 @@
class SolidTextArea : public TextArea {
public:
SolidTextArea(Responder * parentResponder, KDText::FontSize fontSize = KDText::FontSize::Large,
SolidTextArea(Responder * parentResponder, const KDFont * font = KDFont::LargeFont,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite) :
TextArea(parentResponder, &m_contentView, fontSize),
m_contentView(fontSize, textColor, backgroundColor) {}
TextArea(parentResponder, &m_contentView, font),
m_contentView(font, textColor, backgroundColor) {}
protected:
class ContentView : public TextArea::ContentView {
public:
ContentView(KDText::FontSize fontSize, KDColor textColor, KDColor backgroundColor) :
TextArea::ContentView(fontSize),
ContentView(const KDFont * font, KDColor textColor, KDColor backgroundColor) :
TextArea::ContentView(font),
m_textColor(textColor),
m_backgroundColor(backgroundColor)
{

View File

@@ -8,7 +8,7 @@
class TextArea : public TextInput {
public:
TextArea(Responder * parentResponder, View * contentView, KDText::FontSize fontSize = KDText::FontSize::Large);
TextArea(Responder * parentResponder, View * contentView, const KDFont * font = KDFont::LargeFont);
void setDelegate(TextAreaDelegate * delegate) { m_delegate = delegate; }
bool handleEvent(Ion::Events::Event event) override;
bool handleEventWithText(const char * text, bool indentation = false, bool forceCursorRightOfText = false) override;
@@ -93,8 +93,8 @@ protected:
class ContentView : public TextInput::ContentView {
public:
ContentView(KDText::FontSize fontSize) :
TextInput::ContentView(fontSize),
ContentView(const KDFont * font) :
TextInput::ContentView(font),
m_text(nullptr, 0)
{
}

View File

@@ -8,7 +8,7 @@
class TextField : public TextInput {
public:
TextField(Responder * parentResponder, char * textBuffer, char * draftTextBuffer, size_t textBufferSize,
TextFieldDelegate * delegate = nullptr, bool hasTwoBuffers = true, KDText::FontSize size = KDText::FontSize::Large,
TextFieldDelegate * delegate = nullptr, bool hasTwoBuffers = true, const KDFont * font = KDFont::LargeFont,
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setBackgroundColor(KDColor backgroundColor) override;
void setTextColor(KDColor textColor);
@@ -30,7 +30,7 @@ public:
protected:
class ContentView : public TextInput::ContentView {
public:
ContentView(char * textBuffer, char * draftTextBuffer, size_t textBufferSize, KDText::FontSize size, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite);
ContentView(char * textBuffer, char * draftTextBuffer, size_t textBufferSize, const KDFont * font, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite);
void setBackgroundColor(KDColor backgroundColor);
KDColor backgroundColor() const { return m_backgroundColor; }
void setTextColor(KDColor textColor);

Some files were not shown because too many files have changed in this diff Show More