mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/code] Improve code style in syntax highlighting setting
This commit is contained in:
@@ -25,7 +25,7 @@ constexpr KDColor HighlightColor = Palette::CodeBackgroundSelected;
|
||||
constexpr KDColor AutocompleteColor = KDColor::RGB24(0xC6C6C6); // TODO Palette change
|
||||
|
||||
static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
if(!GlobalPreferences::sharedGlobalPreferences()->syntaxhighlighting()) {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->syntaxhighlighting()) {
|
||||
return Palette::CodeText;
|
||||
}
|
||||
if (tokenKind == MP_TOKEN_STRING) {
|
||||
@@ -309,7 +309,7 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
tokenFrom += tokenLength;
|
||||
|
||||
KDColor color = CommentColor;
|
||||
if(!GlobalPreferences::sharedGlobalPreferences()->syntaxhighlighting()) {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->syntaxhighlighting()) {
|
||||
color = Palette::CodeText;
|
||||
}
|
||||
// Even if the token is being autocompleted, use CommentColor
|
||||
|
||||
@@ -10,9 +10,9 @@ CodeOptionsController::CodeOptionsController(Responder * parentResponder) :
|
||||
GenericSubController(parentResponder),
|
||||
m_preferencesController(this)
|
||||
{
|
||||
m_chevronCell.setMessageFont(KDFont::LargeFont);
|
||||
m_switchCell.setMessageFont(KDFont::LargeFont);
|
||||
m_switchCell_syntax_highlighting.setMessageFont(KDFont::LargeFont);
|
||||
m_chevronCellFontSize.setMessageFont(KDFont::LargeFont);
|
||||
m_switchCellAutoCompletion.setMessageFont(KDFont::LargeFont);
|
||||
m_switchCellSyntaxHighlighting.setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
|
||||
bool CodeOptionsController::handleEvent(Ion::Events::Event event) {
|
||||
@@ -26,7 +26,6 @@ bool CodeOptionsController::handleEvent(Ion::Events::Event event) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setSyntaxhighlighting(!GlobalPreferences::sharedGlobalPreferences()->syntaxhighlighting());
|
||||
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
break;
|
||||
|
||||
default:
|
||||
GenericSubController * subController = nullptr;
|
||||
subController = &m_preferencesController;
|
||||
@@ -46,12 +45,12 @@ HighlightCell * CodeOptionsController::reusableCell(int index, int type) {
|
||||
assert(type == 0);
|
||||
assert(index >= 0 && index < k_totalNumberOfCell);
|
||||
if (index == 0) {
|
||||
return &m_chevronCell;
|
||||
return &m_chevronCellFontSize;
|
||||
}
|
||||
else if (index == 1) {
|
||||
return &m_switchCell;
|
||||
return &m_switchCellAutoCompletion;
|
||||
}
|
||||
return &m_switchCell_syntax_highlighting;
|
||||
return &m_switchCellSyntaxHighlighting;
|
||||
}
|
||||
|
||||
int CodeOptionsController::reusableCellCount(int type) {
|
||||
|
||||
@@ -16,9 +16,9 @@ public:
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
PreferencesController m_preferencesController;
|
||||
MessageTableCellWithChevronAndMessage m_chevronCell;
|
||||
MessageTableCellWithSwitch m_switchCell;
|
||||
MessageTableCellWithSwitch m_switchCell_syntax_highlighting;
|
||||
MessageTableCellWithChevronAndMessage m_chevronCellFontSize;
|
||||
MessageTableCellWithSwitch m_switchCellAutoCompletion;
|
||||
MessageTableCellWithSwitch m_switchCellSyntaxHighlighting;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user