diff --git a/apps/code/console_controller.cpp b/apps/code/console_controller.cpp index 1041630f9..d8e8a2ee6 100644 --- a/apps/code/console_controller.cpp +++ b/apps/code/console_controller.cpp @@ -5,7 +5,8 @@ #include #include #include -#include "../apps_container.h" +#include +#include extern "C" { #include @@ -27,7 +28,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe TextFieldDelegate(), MicroPython::ExecutionEnvironment(), m_pythonDelegate(pythonDelegate), - m_rowHeight(k_font->glyphSize().height()), + m_rowHeight(GlobalPreferences::sharedGlobalPreferences()->font()->glyphSize().height()), m_importScriptsWhenViewAppears(false), m_selectableTableView(this, this, this, this), m_editCell(this, pythonDelegate, this), diff --git a/apps/code/console_controller.h b/apps/code/console_controller.h index 1c32f4f04..60dcf67b5 100644 --- a/apps/code/console_controller.h +++ b/apps/code/console_controller.h @@ -16,8 +16,6 @@ class App; class ConsoleController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource, public SelectableTableViewDelegate, public TextFieldDelegate, public MicroPython::ExecutionEnvironment { public: - static constexpr const KDFont * k_font = KDFont::LargeFont; - ConsoleController(Responder * parentResponder, App * pythonDelegate, ScriptStore * scriptStore #if EPSILON_GETOPT , bool m_lockOnConsole diff --git a/apps/code/console_edit_cell.cpp b/apps/code/console_edit_cell.cpp index d1b55c9d5..e5a4a2708 100644 --- a/apps/code/console_edit_cell.cpp +++ b/apps/code/console_edit_cell.cpp @@ -2,6 +2,7 @@ #include "console_controller.h" #include #include +#include #include namespace Code { @@ -9,8 +10,8 @@ namespace Code { ConsoleEditCell::ConsoleEditCell(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate) : HighlightCell(), Responder(parentResponder), - m_promptView(ConsoleController::k_font, nullptr, 0, 0.5), - m_textField(this, nullptr, TextField::maxBufferSize(), TextField::maxBufferSize(), inputEventHandlerDelegate, delegate, ConsoleController::k_font) + m_promptView(GlobalPreferences::sharedGlobalPreferences()->font(), nullptr, 0, 0.5), + m_textField(this, nullptr, TextField::maxBufferSize(), TextField::maxBufferSize(), inputEventHandlerDelegate, delegate, GlobalPreferences::sharedGlobalPreferences()->font()) { } diff --git a/apps/code/console_line_cell.cpp b/apps/code/console_line_cell.cpp index 784875875..99042762b 100644 --- a/apps/code/console_line_cell.cpp +++ b/apps/code/console_line_cell.cpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace Code { @@ -18,11 +19,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_font, textColor(m_line), isHighlighted()? Palette::Select : KDColorWhite); + ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? Palette::Select : KDColorWhite); } KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const { - return ConsoleController::k_font->stringSize(m_line->text()); + return GlobalPreferences::sharedGlobalPreferences()->font()->stringSize(m_line->text()); } ConsoleLineCell::ScrollableConsoleLineView::ScrollableConsoleLineView(Responder * parentResponder) : @@ -34,7 +35,7 @@ ConsoleLineCell::ScrollableConsoleLineView::ScrollableConsoleLineView(Responder ConsoleLineCell::ConsoleLineCell(Responder * parentResponder) : HighlightCell(), Responder(parentResponder), - m_promptView(ConsoleController::k_font, I18n::Message::ConsolePrompt, 0, 0.5), + m_promptView(GlobalPreferences::sharedGlobalPreferences()->font(), I18n::Message::ConsolePrompt, 0, 0.5), m_scrollableView(this), m_line() { @@ -79,7 +80,7 @@ View * ConsoleLineCell::subviewAtIndex(int index) { void ConsoleLineCell::layoutSubviews(bool force) { if (m_line.isCommand()) { - KDSize promptSize = ConsoleController::k_font->stringSize(I18n::translate(I18n::Message::ConsolePrompt)); + KDSize promptSize = GlobalPreferences::sharedGlobalPreferences()->font()->stringSize(I18n::translate(I18n::Message::ConsolePrompt)); m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()), force); m_scrollableView.setFrame(KDRect(KDPoint(promptSize.width(), 0), bounds().width() - promptSize.width(), bounds().height()), force); return;