[apps] Code cleaning

This commit is contained in:
Léa Saviot
2019-08-30 13:49:49 +02:00
parent 66ef85239d
commit 2071a65d43
3 changed files with 11 additions and 39 deletions

View File

@@ -33,14 +33,6 @@ void GraphController::viewWillAppear() {
selectFunctionWithCursor(indexFunctionSelectedByCursor()); // update the color of the cursor
}
bool GraphController::displayDerivativeInBanner() const {
return m_displayDerivativeInBanner;
}
void GraphController::setDisplayDerivativeInBanner(bool displayDerivative) {
m_displayDerivativeInBanner = displayDerivative;
}
float GraphController::interestingXHalfRange() const {
float characteristicRange = 0.0f;
Poincare::Context * context = textFieldDelegateApp()->localContext();
@@ -54,20 +46,12 @@ float GraphController::interestingXHalfRange() const {
return (characteristicRange > 0.0f ? 1.6f*characteristicRange : InteractiveCurveViewRangeDelegate::interestingXHalfRange());
}
int GraphController::estimatedBannerNumberOfLines() const {
return 1 + m_displayDerivativeInBanner;
}
void GraphController::selectFunctionWithCursor(int functionIndex) {
FunctionGraphController::selectFunctionWithCursor(functionIndex);
ExpiringPointer<CartesianFunction> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(functionIndex));
m_cursorView.setColor(f->color());
}
BannerView * GraphController::bannerView() {
return &m_bannerView;
}
void GraphController::reloadBannerView() {
FunctionGraphController::reloadBannerView();
if (!m_displayDerivativeInBanner) {
@@ -82,16 +66,4 @@ bool GraphController::moveCursorHorizontally(int direction) {
return privateMoveCursorHorizontally(m_cursor, direction, m_graphRange, k_numberOfCursorStepsInGradUnit, record);
}
InteractiveCurveViewRange * GraphController::interactiveCurveViewRange() {
return m_graphRange;
}
GraphView * GraphController::functionGraphView() {
return &m_view;
}
CurveParameterController * GraphController::curveParameterController() {
return &m_curveParameterController;
}
}

View File

@@ -18,18 +18,18 @@ public:
GraphController(Responder * parentResponder, ::InputEventHandlerDelegate * inputEventHandlerDelegate, CartesianFunctionStore * functionStore, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion, ButtonRowController * header);
I18n::Message emptyMessage() override;
void viewWillAppear() override;
bool displayDerivativeInBanner() const;
void setDisplayDerivativeInBanner(bool displayDerivative);
bool displayDerivativeInBanner() const { return m_displayDerivativeInBanner; }
void setDisplayDerivativeInBanner(bool displayDerivative) { m_displayDerivativeInBanner = displayDerivative; }
float interestingXHalfRange() const override;
private:
int estimatedBannerNumberOfLines() const override;
int estimatedBannerNumberOfLines() const override { return 1 + m_displayDerivativeInBanner; }
void selectFunctionWithCursor(int functionIndex) override;
BannerView * bannerView() override;
BannerView * bannerView() override { return &m_bannerView; }
void reloadBannerView() override;
bool moveCursorHorizontally(int direction) override;
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override;
GraphView * functionGraphView() override;
CurveParameterController * curveParameterController() override;
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override { return m_graphRange; }
GraphView * functionGraphView() override { return &m_view; }
CurveParameterController * curveParameterController() override { return &m_curveParameterController; }
CartesianFunctionStore * functionStore() const override { return static_cast<CartesianFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
Shared::RoundCursorView m_cursorView;
BannerView m_bannerView;

View File

@@ -28,10 +28,10 @@ void BannerView::layoutSubviews() {
return;
}
/* We iterate on subviews, adding their width until we exceed the view bound.
* The last subview that exceeds the bound is recorded as the first subview of
* the next line. For the current line, we scan again the subviews and frame
* them by equally distributing the remaining width. We then jump to the next
* line and iterate the process. */
* The last subview that exceeds the bound is recorded as the first subview of
* the next line. For the current line, we scan again the subviews and frame
* them by equally distributing the remaining width. We then jump to the next
* line and iterate the process. */
const KDCoordinate lineWidth = m_frame.width();
KDCoordinate remainingWidth = lineWidth;
int indexOfFirstViewOfCurrentLine = 0;