mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps] Remove "Preadjustments" menu for curves
Change-Id: I1a30efd502c5db36325d87fa0f1dffacc37a4f1c
This commit is contained in:
committed by
Émilie Feral
parent
d2b36be846
commit
5a07db3452
@@ -31,7 +31,6 @@ app_regression_src = $(addprefix apps/regression/,\
|
||||
graph_options_controller.cpp \
|
||||
graph_view.cpp \
|
||||
go_to_parameter_controller.cpp \
|
||||
initialisation_parameter_controller.cpp \
|
||||
regression_controller.cpp \
|
||||
store_controller.cpp \
|
||||
store_parameter_controller.cpp \
|
||||
|
||||
@@ -18,7 +18,6 @@ GraphController::GraphController(Responder * parentResponder, InputEventHandlerD
|
||||
m_bannerView(this, inputEventHandlerDelegate, this),
|
||||
m_view(store, m_cursor, &m_bannerView, &m_crossCursorView),
|
||||
m_store(store),
|
||||
m_initialisationParameterController(this, m_store),
|
||||
m_graphOptionsController(this, inputEventHandlerDelegate, m_store, m_cursor, this),
|
||||
m_selectedDotIndex(selectedDotIndex),
|
||||
m_selectedSeriesIndex(selectedSeriesIndex)
|
||||
@@ -29,10 +28,6 @@ GraphController::GraphController(Responder * parentResponder, InputEventHandlerD
|
||||
m_store->setDelegate(this);
|
||||
}
|
||||
|
||||
ViewController * GraphController::initialisationParameterController() {
|
||||
return &m_initialisationParameterController;
|
||||
}
|
||||
|
||||
bool GraphController::isEmpty() const {
|
||||
return m_store->isEmpty();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "store.h"
|
||||
#include "graph_options_controller.h"
|
||||
#include "graph_view.h"
|
||||
#include "initialisation_parameter_controller.h"
|
||||
#include "../shared/interactive_curve_view_controller.h"
|
||||
#include "../shared/curve_view_cursor.h"
|
||||
#include "../shared/cursor_view.h"
|
||||
@@ -17,7 +16,6 @@ class GraphController : public Shared::InteractiveCurveViewController {
|
||||
|
||||
public:
|
||||
GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, Store * store, Shared::CurveViewCursor * cursor, uint32_t * modelVersion, uint32_t * previousModelsVersions, uint32_t * rangeVersion, int * selectedDotIndex, int * selectedSeriesIndex);
|
||||
ViewController * initialisationParameterController() override;
|
||||
bool isEmpty() const override;
|
||||
I18n::Message emptyMessage() override;
|
||||
void viewWillAppear() override;
|
||||
@@ -63,7 +61,6 @@ private:
|
||||
BannerView m_bannerView;
|
||||
GraphView m_view;
|
||||
Store * m_store;
|
||||
InitialisationParameterController m_initialisationParameterController;
|
||||
GraphOptionsController m_graphOptionsController;
|
||||
/* The selectedDotIndex is -1 when no dot is selected, m_numberOfPairs when
|
||||
* the mean dot is selected and the dot index otherwise */
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "initialisation_parameter_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace Shared;
|
||||
|
||||
namespace Regression {
|
||||
|
||||
InitialisationParameterController::InitialisationParameterController(Responder * parentResponder, Store * store) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this),
|
||||
m_store(store)
|
||||
{
|
||||
}
|
||||
|
||||
const char * InitialisationParameterController::title() {
|
||||
return I18n::translate(I18n::Message::Initialization);
|
||||
}
|
||||
|
||||
View * InitialisationParameterController::view() {
|
||||
return &m_selectableTableView;
|
||||
}
|
||||
|
||||
void InitialisationParameterController::didBecomeFirstResponder() {
|
||||
selectCellAtLocation(0, 0);
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
bool InitialisationParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
RangeMethodPointer rangeMethods[k_totalNumberOfCells] = {&InteractiveCurveViewRange::roundAbscissa,
|
||||
&InteractiveCurveViewRange::normalize, &InteractiveCurveViewRange::setDefault};
|
||||
(m_store->*rangeMethods[selectedRow()])();
|
||||
StackViewController * stack = (StackViewController *)parentResponder();
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int InitialisationParameterController::numberOfRows() const {
|
||||
return k_totalNumberOfCells;
|
||||
};
|
||||
|
||||
|
||||
HighlightCell * InitialisationParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_totalNumberOfCells);
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
int InitialisationParameterController::reusableCellCount() const {
|
||||
return k_totalNumberOfCells;
|
||||
}
|
||||
|
||||
KDCoordinate InitialisationParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
void InitialisationParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCell * myCell = (MessageTableCell *)cell;
|
||||
I18n::Message titles[3] = {I18n::Message::RoundAbscissa, I18n::Message::Orthonormal, I18n::Message::DefaultSetting};
|
||||
myCell->setMessage(titles[index]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef REGRESSION_INITIALISATION_PARAMETER_CONTROLLER_H
|
||||
#define REGRESSION_INITIALISATION_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "store.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Regression {
|
||||
|
||||
class InitialisationParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
InitialisationParameterController(Responder * parentResponder, Store * store);
|
||||
View * view() override;
|
||||
const char * title() override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void didBecomeFirstResponder() override;
|
||||
int numberOfRows() const override;
|
||||
KDCoordinate cellHeight() override;
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCells = 3;
|
||||
MessageTableCell m_cells[k_totalNumberOfCells];
|
||||
SelectableTableView m_selectableTableView;
|
||||
Store * m_store;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,23 +15,6 @@ CurveViewRange::CurveViewRange(InteractiveCurveViewRangeDelegate * delegate) :
|
||||
MemoizedCurveViewRange::protectedSetXMin(-k_displayLeftMarginRatio * xMax(), k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
|
||||
void CurveViewRange::roundAbscissa() {
|
||||
int roundedXMean = std::round(xCenter());
|
||||
float halfScreenWidth = ((float)Ion::Display::Width)/2.0f;
|
||||
float newXMin = roundedXMean - halfScreenWidth;
|
||||
float newXMax = roundedXMean + halfScreenWidth - 1.0f;
|
||||
float interestingXMin = m_delegate->interestingXMin();
|
||||
if (newXMin < interestingXMin) {
|
||||
newXMin = interestingXMin - k_displayLeftMarginRatio * (float)Ion::Display::Width;
|
||||
newXMax = newXMin + (float)Ion::Display::Width;
|
||||
}
|
||||
if (std::isnan(newXMin) || std::isnan(newXMax)) {
|
||||
return;
|
||||
}
|
||||
m_xRange.setMax(newXMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
setXMin(newXMin);
|
||||
}
|
||||
|
||||
void CurveViewRange::normalize() {
|
||||
float xMean = xCenter();
|
||||
float yMean = yCenter();
|
||||
@@ -63,16 +46,4 @@ void CurveViewRange::normalize() {
|
||||
}
|
||||
}
|
||||
|
||||
void CurveViewRange::setTrigonometric() {
|
||||
float interestingXMin = m_delegate->interestingXMin();
|
||||
float interestingXRange = Preferences::sharedPreferences()->angleUnit() == Preferences::AngleUnit::Degree ? 1200.0f : 21.0f;
|
||||
m_xRange.setMax(interestingXMin + interestingXRange, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetXMin(interestingXMin - k_displayLeftMarginRatio * interestingXRange, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
|
||||
m_yAuto = false;
|
||||
constexpr float y = 1.6f;
|
||||
m_yRange.setMax(y, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetYMin(-y, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ namespace Sequence {
|
||||
class CurveViewRange : public Shared::InteractiveCurveViewRange {
|
||||
public:
|
||||
CurveViewRange(Shared::InteractiveCurveViewRangeDelegate * delegate = nullptr);
|
||||
void roundAbscissa() override;
|
||||
void normalize() override;
|
||||
void setTrigonometric() override;
|
||||
private:
|
||||
constexpr static float k_displayLeftMarginRatio = 0.1f;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Sie sind dabei den Hardwaretest zu"
|
||||
HardwareTestLaunch2 = "starten. Um ihn wieder zu verlassen,"
|
||||
HardwareTestLaunch3 = "müssen Sie einen Reset durchfuhren,"
|
||||
HardwareTestLaunch4 = "der Ihre Daten löschen wird."
|
||||
Initialization = "Initialisierung"
|
||||
IntervalSet = "Intervall einstellen"
|
||||
Language = "Sprache"
|
||||
LowBattery = "Batterie erschöpft"
|
||||
@@ -70,7 +69,6 @@ Plot = "Graphen zeichnen"
|
||||
PoolMemoryFull1 = "Der Arbeitsspeicher ist voll."
|
||||
PoolMemoryFull2 = "Versuchen Sie es erneut."
|
||||
Rename = "Umbenennen"
|
||||
RoundAbscissa = "Ganzzahl"
|
||||
Sci = "wiss"
|
||||
SortValues = "Nach steigenden Werten sortieren"
|
||||
SortSizes = "Nach steigenden Frequenzen sortieren"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ Endwert"
|
||||
ThetaStart = "θ Startwert"
|
||||
TStart = "T Startwert"
|
||||
ToZoom = "Zoom: "
|
||||
Trigonometric = "Trigonometrisch"
|
||||
UndefinedValue = "Nicht definierter Wert"
|
||||
ValuesTab = "Tabelle"
|
||||
Warning = "Achtung"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "You are starting the hardware"
|
||||
HardwareTestLaunch2 = " test. At the end of the test, you"
|
||||
HardwareTestLaunch3 = "will have to reset the device and"
|
||||
HardwareTestLaunch4 = "all your data will be deleted."
|
||||
Initialization = "Preadjustment"
|
||||
IntervalSet = "Set the interval"
|
||||
Language = "Language"
|
||||
LowBattery = "Low battery"
|
||||
@@ -70,7 +69,6 @@ Plot = "Plot graph"
|
||||
PoolMemoryFull1 = "The working memory is full."
|
||||
PoolMemoryFull2 = "Try again."
|
||||
Rename = "Rename"
|
||||
RoundAbscissa = "Integer"
|
||||
Sci = "sci"
|
||||
SortValues = "Sort by increasing values"
|
||||
SortSizes = "Sort by increasing sizes"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ end"
|
||||
ThetaStart = "θ start"
|
||||
TStart = "T start"
|
||||
ToZoom = "Zoom: "
|
||||
Trigonometric = "Trigonometrical"
|
||||
UndefinedValue = "Undefined value"
|
||||
ValuesTab = "Table"
|
||||
Warning = "Warning"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Esta iniciando la prueba de"
|
||||
HardwareTestLaunch2 = "fabrica. Para quitar la prueba,"
|
||||
HardwareTestLaunch3 = "debera resetear su equipo."
|
||||
HardwareTestLaunch4 = ""
|
||||
Initialization = "Inicialización"
|
||||
IntervalSet = "Ajustar el intervalo"
|
||||
Language = "Idioma"
|
||||
LowBattery = "Batería baja"
|
||||
@@ -70,7 +69,6 @@ Plot = "Dibujar el gráfico"
|
||||
PoolMemoryFull1 = "La memoria de trabajo está llena."
|
||||
PoolMemoryFull2 = "Intente de nuevo."
|
||||
Rename = "Renombrar"
|
||||
RoundAbscissa = "Abscisas enteras"
|
||||
Sci = "cie"
|
||||
SortValues = "Ordenar por valores crecientes"
|
||||
SortSizes = "Ordenar por frecuencias crecientes"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ fin"
|
||||
ThetaStart = "θ inicio"
|
||||
TStart = "T inicio"
|
||||
ToZoom = "Zoom : "
|
||||
Trigonometric = "Trigonométrico"
|
||||
UndefinedValue = "Valor indefinido"
|
||||
ValuesTab = "Tabla"
|
||||
Warning = "Cuidado"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Vous allez lancer le test usine."
|
||||
HardwareTestLaunch2 = "Pour en sortir vous devrez"
|
||||
HardwareTestLaunch3 = "appuyer sur le bouton reset"
|
||||
HardwareTestLaunch4 = "ce qui supprimera vos données."
|
||||
Initialization = "Initialisation"
|
||||
IntervalSet = "Régler l'intervalle"
|
||||
Language = "Langue"
|
||||
LowBattery = "Batterie faible"
|
||||
@@ -70,7 +69,6 @@ Plot = "Tracer le graphique"
|
||||
PoolMemoryFull1 = "La mémoire de travail est pleine."
|
||||
PoolMemoryFull2 = "Réessayez."
|
||||
Rename = "Renommer"
|
||||
RoundAbscissa = "Abscisses entières"
|
||||
Sci = "sci"
|
||||
SortValues = "Trier par valeurs croissantes"
|
||||
SortSizes = "Trier par effectifs croissants"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ fin"
|
||||
ThetaStart = "θ début"
|
||||
TStart = "T début"
|
||||
ToZoom = "Zoomer : "
|
||||
Trigonometric = "Trigonométrique"
|
||||
UndefinedValue = "Valeur non définie"
|
||||
ValuesTab = "Tableau"
|
||||
Warning = "Attention"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Farete il test hardware."
|
||||
HardwareTestLaunch2 = "Per uscire dovrete"
|
||||
HardwareTestLaunch3 = "premere il tasto reset"
|
||||
HardwareTestLaunch4 = "che cancellerà i vostri dati."
|
||||
Initialization = "Pre-regolazione"
|
||||
IntervalSet = "Imposta l'intervallo"
|
||||
Language = "Lingua"
|
||||
LowBattery = "Batteria bassa"
|
||||
@@ -70,7 +69,6 @@ Plot = "Traccia grafico"
|
||||
PoolMemoryFull1 = "La memoria di lavoro è piena."
|
||||
PoolMemoryFull2 = "Riprovare."
|
||||
Rename = "Rinominare"
|
||||
RoundAbscissa = "Ascisse intere"
|
||||
Sci = "sci"
|
||||
SortValues = "Ordinare per valori crescenti"
|
||||
SortSizes = "Ordinare per frequenze crescenti"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ finale"
|
||||
ThetaStart = "θ iniziale"
|
||||
TStart = "T iniziale"
|
||||
ToZoom = "Ingrandire : "
|
||||
Trigonometric = "Trigonometrica"
|
||||
UndefinedValue = "Valore non definito"
|
||||
ValuesTab = "Tabella"
|
||||
Warning = "Attenzione"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Je start de hardware test. "
|
||||
HardwareTestLaunch2 = "Aan het eind van de test moet "
|
||||
HardwareTestLaunch3 = "je de rekenmachine resetten en "
|
||||
HardwareTestLaunch4 = "worden al je gegevens verwijderd."
|
||||
Initialization = "Voorgedefinieerd"
|
||||
IntervalSet = "Stel het interval in"
|
||||
Language = "Taal"
|
||||
LowBattery = "Batterij bijna leeg"
|
||||
@@ -70,7 +69,6 @@ Plot = "Grafiek plotten"
|
||||
PoolMemoryFull1 = "Het werkgeheugen is vol."
|
||||
PoolMemoryFull2 = "Opnieuw proberen."
|
||||
Rename = "Hernoem"
|
||||
RoundAbscissa = "Geheel getal"
|
||||
Sci = "sci"
|
||||
SortValues = "Sorteer waarden oplopend"
|
||||
SortSizes = "Sorteer frequenties oplopend"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ einde"
|
||||
ThetaStart = "θ begin"
|
||||
TStart = "T begin"
|
||||
ToZoom = "Zoom: "
|
||||
Trigonometric = "Goniometrisch"
|
||||
UndefinedValue = "Ongedefinieerde waarde"
|
||||
ValuesTab = "Tabel"
|
||||
Warning = "Waarschuwing"
|
||||
|
||||
@@ -48,7 +48,6 @@ HardwareTestLaunch1 = "Vai executar o teste da planta."
|
||||
HardwareTestLaunch2 = "Para sair tem que executar"
|
||||
HardwareTestLaunch3 = "uma redefinição, que irá apagar"
|
||||
HardwareTestLaunch4 = "os seus dados."
|
||||
Initialization = "Inicialização"
|
||||
IntervalSet = "Ajustar o intervalo"
|
||||
Language = "Idioma"
|
||||
LowBattery = "Bateria fraca"
|
||||
@@ -70,7 +69,6 @@ Plot = "Traçar o gráfico"
|
||||
PoolMemoryFull1 = "A memória de trabalho está cheia."
|
||||
PoolMemoryFull2 = "Tente novamente."
|
||||
Rename = "Renomear"
|
||||
RoundAbscissa = "Inteiro"
|
||||
Sci = "cie"
|
||||
SortValues = "Ordenar por ordem crescente"
|
||||
SortSizes = "Ordenar por ordem crescente"
|
||||
@@ -87,7 +85,6 @@ ThetaEnd = "θ fim"
|
||||
ThetaStart = "θ início"
|
||||
TStart = "T início"
|
||||
ToZoom = "Zoom : "
|
||||
Trigonometric = "Trigonométrico"
|
||||
UndefinedValue = "Valor indefinido"
|
||||
ValuesTab = "Tabela"
|
||||
Warning = "Atenção"
|
||||
|
||||
@@ -48,7 +48,6 @@ app_shared_src = $(addprefix apps/shared/,\
|
||||
hideable_even_odd_buffer_text_cell.cpp \
|
||||
hideable_even_odd_cell.cpp \
|
||||
hideable_even_odd_editable_text_cell.cpp \
|
||||
initialisation_parameter_controller.cpp \
|
||||
input_event_handler_delegate_app.cpp \
|
||||
interactive_curve_view_controller.cpp \
|
||||
interval.cpp \
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Shared {
|
||||
|
||||
FunctionGraphController::FunctionGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, InteractiveCurveViewRange * interactiveRange, CurveView * curveView, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * previousModelsVersions, uint32_t * rangeVersion, Preferences::AngleUnit * angleUnitVersion) :
|
||||
InteractiveCurveViewController(parentResponder, inputEventHandlerDelegate, header, interactiveRange, curveView, cursor, modelVersion, previousModelsVersions, rangeVersion),
|
||||
m_initialisationParameterController(this, interactiveRange),
|
||||
m_angleUnitVersion(angleUnitVersion),
|
||||
m_indexFunctionSelectedByCursor(indexFunctionSelectedByCursor)
|
||||
{
|
||||
@@ -26,10 +25,6 @@ bool FunctionGraphController::isEmpty() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
ViewController * FunctionGraphController::initialisationParameterController() {
|
||||
return &m_initialisationParameterController;
|
||||
}
|
||||
|
||||
void FunctionGraphController::didBecomeFirstResponder() {
|
||||
if (curveView()->isMainViewSelected()) {
|
||||
bannerView()->abscissaValue()->setParentResponder(this);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define SHARED_FUNCTION_GRAPH_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "initialisation_parameter_controller.h"
|
||||
#include "function_banner_delegate.h"
|
||||
#include "interactive_curve_view_controller.h"
|
||||
#include "function_store.h"
|
||||
@@ -16,7 +15,6 @@ public:
|
||||
static constexpr size_t sNumberOfMemoizedModelVersions = 5;
|
||||
FunctionGraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, InteractiveCurveViewRange * interactiveRange, CurveView * curveView, CurveViewCursor * cursor, int * indexFunctionSelectedByCursor, uint32_t * modelVersion, uint32_t * previousModelsVersions, uint32_t * rangeVersion, Poincare::Preferences::AngleUnit * angleUnitVersion);
|
||||
bool isEmpty() const override;
|
||||
ViewController * initialisationParameterController() override;
|
||||
void didBecomeFirstResponder() override;
|
||||
void viewWillAppear() override;
|
||||
|
||||
@@ -57,7 +55,6 @@ private:
|
||||
uint32_t rangeVersion() override;
|
||||
size_t numberOfMemoizedVersions() const override { return sNumberOfMemoizedModelVersions; }
|
||||
|
||||
InitialisationParameterController m_initialisationParameterController;
|
||||
Poincare::Preferences::AngleUnit * m_angleUnitVersion;
|
||||
int * m_indexFunctionSelectedByCursor;
|
||||
};
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#include "initialisation_parameter_controller.h"
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
View * InitialisationParameterController::view() {
|
||||
return &m_selectableTableView;
|
||||
}
|
||||
|
||||
const char * InitialisationParameterController::title() {
|
||||
return I18n::translate(I18n::Message::Initialization);
|
||||
}
|
||||
|
||||
bool InitialisationParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
RangeMethodPointer rangeMethods[k_totalNumberOfCells] = {
|
||||
&InteractiveCurveViewRange::setTrigonometric,
|
||||
&InteractiveCurveViewRange::roundAbscissa,
|
||||
&InteractiveCurveViewRange::normalize,
|
||||
&InteractiveCurveViewRange::setDefault};
|
||||
(m_graphRange->*rangeMethods[selectedRow()])();
|
||||
StackViewController * stack = (StackViewController *)parentResponder();
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InitialisationParameterController::didBecomeFirstResponder() {
|
||||
m_selectableTableView.selectCellAtLocation(0, 0);
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
int InitialisationParameterController::numberOfRows() const {
|
||||
return k_totalNumberOfCells;
|
||||
}
|
||||
|
||||
KDCoordinate InitialisationParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
HighlightCell * InitialisationParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_totalNumberOfCells);
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
int InitialisationParameterController::reusableCellCount() const {
|
||||
return k_totalNumberOfCells;
|
||||
}
|
||||
|
||||
void InitialisationParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
I18n::Message titles[4] = {
|
||||
I18n::Message::Trigonometric,
|
||||
I18n::Message::RoundAbscissa,
|
||||
I18n::Message::Orthonormal,
|
||||
I18n::Message::DefaultSetting};
|
||||
((MessageTableCell *)cell)->setMessage(titles[index]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef SHARED_INITIALISATION_PARAMETER_CONTROLLER_H
|
||||
#define SHARED_INITIALISATION_PARAMETER_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "interactive_curve_view_range.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class InitialisationParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
InitialisationParameterController(Responder * parentResponder, Shared::InteractiveCurveViewRange * graphRange) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this, this, this),
|
||||
m_graphRange(graphRange)
|
||||
{}
|
||||
View * view() override;
|
||||
const char * title() override;
|
||||
TELEMETRY_ID("Initialization");
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void didBecomeFirstResponder() override;
|
||||
int numberOfRows() const override;
|
||||
KDCoordinate cellHeight() override;
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCells = 4;
|
||||
MessageTableCell m_cells[k_totalNumberOfCells];
|
||||
SelectableTableView m_selectableTableView;
|
||||
InteractiveCurveViewRange * m_graphRange;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -29,12 +29,6 @@ InteractiveCurveViewController::InteractiveCurveViewController(Responder * paren
|
||||
StackViewController * stack = graphController->stackController();
|
||||
stack->push(graphController->zoomParameterController());
|
||||
return true;
|
||||
}, this), KDFont::SmallFont),
|
||||
m_defaultInitialisationButton(this, I18n::Message::Initialization, Invocation([](void * context, void * sender) {
|
||||
InteractiveCurveViewController * graphController = (InteractiveCurveViewController *) context;
|
||||
StackViewController * stack = graphController->stackController();
|
||||
stack->push(graphController->initialisationParameterController());
|
||||
return true;
|
||||
}, this), KDFont::SmallFont)
|
||||
{
|
||||
}
|
||||
@@ -129,11 +123,11 @@ int InteractiveCurveViewController::numberOfButtons(ButtonRowController::Positio
|
||||
if (isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
|
||||
Button * InteractiveCurveViewController::buttonAtIndex(int index, ButtonRowController::Position position) const {
|
||||
const Button * buttons[3] = {&m_rangeButton, &m_zoomButton, &m_defaultInitialisationButton};
|
||||
const Button * buttons[] = {&m_rangeButton, &m_zoomButton};
|
||||
return (Button *)buttons[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
|
||||
RangeParameterController * rangeParameterController();
|
||||
ViewController * zoomParameterController();
|
||||
virtual ViewController * initialisationParameterController() = 0;
|
||||
|
||||
int numberOfButtons(ButtonRowController::Position position) const override;
|
||||
Button * buttonAtIndex(int index, ButtonRowController::Position position) const override;
|
||||
@@ -81,7 +80,6 @@ private:
|
||||
InteractiveCurveViewRange * m_interactiveRange;
|
||||
Button m_rangeButton;
|
||||
Button m_zoomButton;
|
||||
Button m_defaultInitialisationButton;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -76,17 +76,6 @@ void InteractiveCurveViewRange::panWithVector(float x, float y) {
|
||||
MemoizedCurveViewRange::protectedSetYMin(yMin() + y, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::roundAbscissa() {
|
||||
// Set x range
|
||||
float newXMin = std::round(xCenter()) - (float)Ion::Display::Width/2.0f;
|
||||
float newXMax = std::round(xCenter()) + (float)Ion::Display::Width/2.0f-1.0f;
|
||||
if (std::isnan(newXMin) || std::isnan(newXMax)) {
|
||||
return;
|
||||
}
|
||||
m_xRange.setMax(newXMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
setXMin(newXMin);
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::normalize() {
|
||||
/* We center the ranges on the current range center, and put each axis so that
|
||||
* 1cm = 2 current units. */
|
||||
@@ -116,18 +105,6 @@ void InteractiveCurveViewRange::normalize() {
|
||||
}
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::setTrigonometric() {
|
||||
m_yAuto = false;
|
||||
// Set x range
|
||||
float x = (Preferences::sharedPreferences()->angleUnit() == Preferences::AngleUnit::Degree) ? 600.0f : 10.5f;
|
||||
m_xRange.setMax(x, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetXMin(-x, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
// Set y range
|
||||
float y = 1.6f;
|
||||
m_yRange.setMax(y, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetYMin(-y, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::setDefault() {
|
||||
if (m_delegate == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -32,9 +32,7 @@ public:
|
||||
// Window
|
||||
void zoom(float ratio, float x, float y);
|
||||
void panWithVector(float x, float y);
|
||||
virtual void roundAbscissa();
|
||||
virtual void normalize();
|
||||
virtual void setTrigonometric();
|
||||
virtual void setDefault();
|
||||
void centerAxisAround(Axis axis, float position);
|
||||
void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation, float pixelWidth);
|
||||
|
||||
Reference in New Issue
Block a user