[apps/poincare] Inline some methods

This commit is contained in:
Léa Saviot
2018-11-05 14:11:29 +01:00
committed by Émilie Feral
parent fbe4c14d0d
commit 7c4b7495f3
8 changed files with 26 additions and 125 deletions

View File

@@ -36,10 +36,6 @@ App::Descriptor * App::Snapshot::descriptor() {
return &descriptor;
}
CalculationStore * App::Snapshot::calculationStore() {
return &m_calculationStore;
}
void App::Snapshot::tidy() {
m_calculationStore.tidy();
}

View File

@@ -22,7 +22,7 @@ public:
App * unpack(Container * container) override;
void reset() override;
Descriptor * descriptor() override;
CalculationStore * calculationStore();
CalculationStore * calculationStore() { return &m_calculationStore; }
private:
void tidy() override;
CalculationStore m_calculationStore;

View File

@@ -5,34 +5,6 @@ GlobalPreferences * GlobalPreferences::sharedGlobalPreferences() {
return &globalPreferences;
}
I18n::Language GlobalPreferences::language() const {
return m_language;
}
void GlobalPreferences::setLanguage(I18n::Language language) {
m_language = language;
}
GlobalPreferences::ExamMode GlobalPreferences::examMode() const {
return m_examMode;
}
void GlobalPreferences::setExamMode(ExamMode examMode) {
m_examMode = examMode;
}
#ifdef EPSILON_BOOT_PROMPT
void GlobalPreferences::setShowPopUp(bool showPopUp) {
m_showPopUp = showPopUp;
}
#endif
int GlobalPreferences::brightnessLevel() const {
return m_brightnessLevel;
}
void GlobalPreferences::setBrightnessLevel(int brightnessLevel) {
if (m_brightnessLevel != brightnessLevel) {
brightnessLevel = brightnessLevel < 0 ? 0 : brightnessLevel;

View File

@@ -10,15 +10,15 @@ public:
Deactivate
};
static GlobalPreferences * sharedGlobalPreferences();
I18n::Language language() const;
void setLanguage(I18n::Language language);
ExamMode examMode() const;
void setExamMode(ExamMode examMode);
I18n::Language language() const { return m_language; }
void setLanguage(I18n::Language language) { m_language = language; }
ExamMode examMode() const { return m_examMode; }
void setExamMode(ExamMode examMode) { m_examMode = examMode; }
#ifdef EPSILON_BOOT_PROMPT
bool showPopUp() const { return m_showPopUp; }
void setShowPopUp(bool showPopUp);
void setShowPopUp(bool showPopUp) { m_showPopUp = showPopUp; }
#endif
int brightnessLevel() const;
int brightnessLevel() const { return m_brightnessLevel; }
void setBrightnessLevel(int brightnessLevel);
constexpr static int NumberOfBrightnessStates = 5;
private:

View File

@@ -18,30 +18,6 @@ StorageFunctionApp::Snapshot::Snapshot() :
m_interval.setStep(1);
}
CurveViewCursor * StorageFunctionApp::Snapshot::cursor() {
return &m_cursor;
}
uint32_t * StorageFunctionApp::Snapshot::modelVersion() {
return &m_modelVersion;
}
uint32_t * StorageFunctionApp::Snapshot::rangeVersion() {
return &m_rangeVersion;
}
Preferences::AngleUnit * StorageFunctionApp::Snapshot::angleUnitVersion() {
return &m_angleUnitVersion;
}
Interval * StorageFunctionApp::Snapshot::interval() {
return &m_interval;
}
int * StorageFunctionApp::Snapshot::indexFunctionSelectedByCursor() {
return &m_indexFunctionSelectedByCursor;
}
void StorageFunctionApp::Snapshot::reset() {
m_interval.setStart(0);
m_interval.setEnd(10);
@@ -52,11 +28,6 @@ void StorageFunctionApp::Snapshot::reset() {
setActiveTab(0);
}
StorageFunctionApp::StorageFunctionApp(Container * container, Snapshot * snapshot, ViewController * rootViewController) :
ExpressionFieldDelegateApp(container, snapshot, rootViewController)
{
}
void StorageFunctionApp::willBecomeInactive() {
if (m_modalViewController.isDisplayingModal()) {
m_modalViewController.dismissModalViewController();

View File

@@ -15,12 +15,12 @@ public:
class Snapshot : public ::App::Snapshot, public TabViewDataSource {
public:
Snapshot();
CurveViewCursor * cursor();
uint32_t * modelVersion();
uint32_t * rangeVersion();
Poincare::Preferences::AngleUnit * angleUnitVersion();
Interval * interval();
int * indexFunctionSelectedByCursor();
CurveViewCursor * cursor() { return &m_cursor; }
uint32_t * modelVersion() { return &m_modelVersion; }
uint32_t * rangeVersion() { return &m_rangeVersion; }
Poincare::Preferences::AngleUnit * angleUnitVersion() { return &m_angleUnitVersion; }
Interval * interval() { return &m_interval; }
int * indexFunctionSelectedByCursor() { return &m_indexFunctionSelectedByCursor; }
void reset() override;
protected:
CurveViewCursor m_cursor;
@@ -36,7 +36,9 @@ public:
virtual InputViewController * inputViewController() = 0;
void willBecomeInactive() override;
protected:
StorageFunctionApp(Container * container, Snapshot * snapshot, ViewController * rootViewController);
StorageFunctionApp(Container * container, Snapshot * snapshot, ViewController * rootViewController) :
ExpressionFieldDelegateApp(container, snapshot, rootViewController)
{}
bool isAcceptableExpression(const Poincare::Expression expression, Responder * responder) override;
};

View File

@@ -28,16 +28,16 @@ public:
};
Preferences();
static Preferences * sharedPreferences();
AngleUnit angleUnit() const;
void setAngleUnit(AngleUnit angleUnit);
PrintFloatMode displayMode() const;
void setDisplayMode(PrintFloatMode mode);
EditionMode editionMode() const;
void setEditionMode(EditionMode editionMode);
ComplexFormat complexFormat() const;
void setComplexFormat(Preferences::ComplexFormat complexFormat);
char numberOfSignificantDigits() const;
void setNumberOfSignificantDigits(char numberOfSignificantDigits);
AngleUnit angleUnit() const { return m_angleUnit; }
void setAngleUnit(AngleUnit angleUnit) { m_angleUnit = angleUnit; }
PrintFloatMode displayMode() const { return m_displayMode; }
void setDisplayMode(PrintFloatMode mode) { m_displayMode = mode; }
EditionMode editionMode() const { return m_editionMode; }
void setEditionMode(EditionMode editionMode) { m_editionMode = editionMode; }
ComplexFormat complexFormat() const { return m_complexFormat; }
void setComplexFormat(Preferences::ComplexFormat complexFormat) { m_complexFormat = complexFormat; }
char numberOfSignificantDigits() const { return m_numberOfSignificantDigits; }
void setNumberOfSignificantDigits(char numberOfSignificantDigits) { m_numberOfSignificantDigits = numberOfSignificantDigits; }
private:
AngleUnit m_angleUnit;
PrintFloatMode m_displayMode;

View File

@@ -17,44 +17,4 @@ Preferences * Preferences::sharedPreferences() {
return &preferences;
}
Preferences::AngleUnit Preferences::angleUnit() const {
return m_angleUnit;
}
void Preferences::setAngleUnit(AngleUnit angleUnit) {
m_angleUnit = angleUnit;
}
Preferences::PrintFloatMode Preferences::displayMode() const {
return m_displayMode;
}
void Preferences::setDisplayMode(Preferences::PrintFloatMode mode) {
m_displayMode = mode;
}
Preferences::EditionMode Preferences::editionMode() const {
return m_editionMode;
}
void Preferences::setEditionMode(Preferences::EditionMode editionMode) {
m_editionMode = editionMode;
}
Preferences::ComplexFormat Preferences::complexFormat() const {
return m_complexFormat;
}
void Preferences::setComplexFormat(ComplexFormat complexFormat) {
m_complexFormat = complexFormat;
}
char Preferences::numberOfSignificantDigits() const {
return m_numberOfSignificantDigits;
}
void Preferences::setNumberOfSignificantDigits(char numberOfSignificantDigits) {
m_numberOfSignificantDigits = numberOfSignificantDigits;
}
}