mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Add shift activated text (Fix #22)
This adds the text 'shift' when the shift key is activated. No functionality changes were made.
This commit is contained in:
@@ -13,7 +13,6 @@ include apps/code/Makefile
|
||||
#include apps/picview/Makefile
|
||||
|
||||
app_objs += $(addprefix apps/,\
|
||||
alpha_lock_view.o\
|
||||
apps_container.o\
|
||||
apps_window.o\
|
||||
battery_timer.o\
|
||||
@@ -29,6 +28,7 @@ app_objs += $(addprefix apps/,\
|
||||
main.o\
|
||||
math_toolbox.o\
|
||||
node.o\
|
||||
shift_alpha_lock_view.o\
|
||||
suspend_timer.o\
|
||||
title_bar_view.o\
|
||||
toolbox_node.o\
|
||||
|
||||
@@ -316,12 +316,13 @@ constexpr static char leftIntegralFirstLegend[] = {'P', '(', 'X', Ion::Charset::
|
||||
constexpr static char finiteIntegralLegend[] = {Ion::Charset::LessEqual, 'X', Ion::Charset::LessEqual, 0};
|
||||
|
||||
|
||||
const char * universalMessages[241] {
|
||||
const char * universalMessages[242] {
|
||||
"",
|
||||
"Python",
|
||||
"PYTHON (BETA)",
|
||||
"alpha",
|
||||
"ALPHA",
|
||||
"shift",
|
||||
"x",
|
||||
"y",
|
||||
"n",
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace I18n {
|
||||
ValueNotReachedBySequence,
|
||||
NColumn,
|
||||
|
||||
/* Statistics */
|
||||
/* Statistics */
|
||||
StatsApp,
|
||||
StatsAppCapital,
|
||||
DataTab,
|
||||
@@ -276,6 +276,7 @@ namespace I18n {
|
||||
CodeAppCapital,
|
||||
Alpha,
|
||||
CapitalAlpha,
|
||||
Shift,
|
||||
X,
|
||||
Y,
|
||||
N,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "alpha_lock_view.h"
|
||||
#include "shift_alpha_lock_view.h"
|
||||
|
||||
AlphaLockView::AlphaLockView() :
|
||||
View(),
|
||||
m_alphaView(KDText::FontSize::Small, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
|
||||
m_modifierView(KDText::FontSize::Small, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
|
||||
m_status(Ion::Events::ShiftAlphaStatus::Default)
|
||||
{
|
||||
}
|
||||
@@ -14,18 +14,21 @@ void AlphaLockView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
bool AlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
|
||||
if (status != m_status) {
|
||||
m_status = status;
|
||||
switch (status) {
|
||||
switch (m_status) {
|
||||
case Ion::Events::ShiftAlphaStatus::Alpha:
|
||||
case Ion::Events::ShiftAlphaStatus::AlphaLock:
|
||||
case Ion::Events::ShiftAlphaStatus::AlphaLockShift:
|
||||
m_alphaView.setMessage(I18n::Message::Alpha);
|
||||
m_modifierView.setMessage(I18n::Message::Alpha);
|
||||
break;
|
||||
case Ion::Events::ShiftAlphaStatus::ShiftAlpha:
|
||||
case Ion::Events::ShiftAlphaStatus::ShiftAlphaLock:
|
||||
m_alphaView.setMessage(I18n::Message::CapitalAlpha);
|
||||
m_modifierView.setMessage(I18n::Message::CapitalAlpha);
|
||||
break;
|
||||
default:
|
||||
m_alphaView.setMessage(I18n::Message::Default);
|
||||
case Ion::Events::ShiftAlphaStatus::Shift:
|
||||
m_modifierView.setMessage(I18n::Message::Shift);
|
||||
break;
|
||||
case Ion::Events::ShiftAlphaStatus::Default:
|
||||
m_modifierView.setMessage(I18n::Message::Default);
|
||||
break;
|
||||
}
|
||||
markRectAsDirty(bounds());
|
||||
@@ -35,37 +38,38 @@ bool AlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
|
||||
}
|
||||
|
||||
KDSize AlphaLockView::minimalSizeForOptimalDisplay() const {
|
||||
KDSize alphaSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha));
|
||||
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
|
||||
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();
|
||||
KDCoordinate height = lockSize.height() > alphaSize.height() ? lockSize.height() : alphaSize.height();
|
||||
return KDSize(alphaSize.width() + lockSize.width() + k_lockRightMargin, height);
|
||||
KDCoordinate height = lockSize.height() > modifierSize.height() ? lockSize.height() : modifierSize.height();
|
||||
return KDSize(modifierSize.width() + lockSize.width() + k_lockRightMargin, height);
|
||||
}
|
||||
|
||||
int AlphaLockView::numberOfSubviews() const {
|
||||
switch (m_status) {
|
||||
case Ion::Events::ShiftAlphaStatus::Alpha:
|
||||
case Ion::Events::ShiftAlphaStatus::Shift:
|
||||
case Ion::Events::ShiftAlphaStatus::ShiftAlpha:
|
||||
return 1;
|
||||
case Ion::Events::ShiftAlphaStatus::AlphaLock:
|
||||
case Ion::Events::ShiftAlphaStatus::AlphaLockShift:
|
||||
case Ion::Events::ShiftAlphaStatus::ShiftAlphaLock:
|
||||
return 2;
|
||||
default:
|
||||
case Ion::Events::ShiftAlphaStatus::Default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
View * AlphaLockView::subviewAtIndex(int index) {
|
||||
if (index == 0) {
|
||||
return &m_alphaView;
|
||||
return &m_modifierView;
|
||||
}
|
||||
return &m_lockView;
|
||||
}
|
||||
|
||||
void AlphaLockView::layoutSubviews() {
|
||||
KDSize alphaSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
|
||||
m_alphaView.setFrame(KDRect(bounds().width() - alphaSize.width(), (bounds().height()- alphaSize.height())/2, alphaSize));
|
||||
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
|
||||
m_modifierView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize));
|
||||
|
||||
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();
|
||||
m_lockView.setFrame(KDRect(bounds().width() - alphaSize.width() - lockSize.width() - k_lockRightMargin, (bounds().height()- lockSize.height())/2, lockSize));
|
||||
m_lockView.setFrame(KDRect(bounds().width() - modifierSize.width() - lockSize.width() - k_lockRightMargin, (bounds().height()- lockSize.height())/2, lockSize));
|
||||
}
|
||||
@@ -17,7 +17,7 @@ private:
|
||||
void layoutSubviews() override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
LockView m_lockView;
|
||||
MessageTextView m_alphaView;
|
||||
MessageTextView m_modifierView;
|
||||
Ion::Events::ShiftAlphaStatus m_status;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <escher.h>
|
||||
#include "battery_view.h"
|
||||
#include "alpha_lock_view.h"
|
||||
#include "shift_alpha_lock_view.h"
|
||||
#include "i18n.h"
|
||||
|
||||
class TitleBarView : public View {
|
||||
|
||||
Reference in New Issue
Block a user