mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/graph] Added a color menu in graph and list (#189)
* Revert "[github/workflows] Update Metrics to remove NumWorksBot" This reverts commit110f333122. * Added a color menu in graph and list * Fixed color select display issue and build issue * Changed color_cell to a circle * Revert "Changed color_cell to a circle" This reverts commit28dddb42af. * Color_cell with mask * Fixed build issue * Color selection : Added right handle and color name display in menu * Fixed constexpr static colorMask * Changed font in color_parameter_controller * Fix building without debug * Re-Fix building without debug * Update colors Co-authored-by: Hugo Saint-Vignes <hugo.saint-vignes@numworks.com> Co-authored-by: Joachim LF <joachimlf@pm.me>
This commit is contained in:
@@ -41,7 +41,7 @@ bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
if (event == Ion::Events::Right) {
|
||||
int selectedR = selectedRow();
|
||||
if (selectedR == 0 || selectedR == 1) {
|
||||
if (selectedR == 0 || selectedR == 1 || selectedR == 3) {
|
||||
// Go in the submenu
|
||||
return handleEnterOnRow(selectedR);
|
||||
}
|
||||
|
||||
@@ -24,38 +24,18 @@ const char * ListParameterController::title() {
|
||||
|
||||
bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
bool hasAdditionalRow = hasInitialRankRow();
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 1)) {
|
||||
#else
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 0)) {
|
||||
#endif
|
||||
int selectedRowIndex = selectedRow();
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
if (selectedRowIndex == 0) {
|
||||
return handleEnterOnRow(selectedRowIndex);
|
||||
}
|
||||
if (selectedRowIndex == 1) {
|
||||
#else
|
||||
if (selectedRowIndex == 0) {
|
||||
#endif
|
||||
StackViewController * stack = (StackViewController *)(parentResponder());
|
||||
m_typeParameterController.setRecord(m_record);
|
||||
stack->push(&m_typeParameterController);
|
||||
return true;
|
||||
}
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
if (selectedRowIndex == 2+hasAdditionalRow) {
|
||||
|
||||
#else
|
||||
if (selectedRowIndex == 1+hasAdditionalRow) {
|
||||
#endif
|
||||
if (selectedRowIndex == 1+hasAdditionalRow || selectedRowIndex == 2+hasAdditionalRow) {
|
||||
return handleEnterOnRow(selectedRowIndex-hasAdditionalRow-1);
|
||||
}
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
if (selectedRowIndex == 3+hasAdditionalRow) {
|
||||
#else
|
||||
if (selectedRowIndex == 2+hasAdditionalRow) {
|
||||
#endif
|
||||
App::app()->localContext()->resetCache();
|
||||
return handleEnterOnRow(selectedRowIndex-hasAdditionalRow-1);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,7 @@ public:
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
private:
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
constexpr static int k_totalNumberOfCell = 5;
|
||||
#else
|
||||
constexpr static int k_totalNumberOfCell = 4;
|
||||
#endif
|
||||
int totalNumberOfCells() const override;
|
||||
Shared::Sequence * sequence() { return static_cast<Shared::Sequence *>(function().pointer()); }
|
||||
bool hasInitialRankRow() const;
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Kein Symbol "
|
||||
ExamModeModeNoSymNoText = "Kein Symbol kein Text "
|
||||
ExamModeModeDutch = "Niederländisch "
|
||||
ColorRed = "Rot "
|
||||
ColorBlue = "Blau "
|
||||
ColorGreen = "Grün "
|
||||
ColorYellow = "Gelb "
|
||||
ColorPurple = "Violett "
|
||||
ColorPink = "Rosa "
|
||||
ColorOrange = "Orange "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "No sym "
|
||||
ExamModeModeNoSymNoText = "No sym no text "
|
||||
ExamModeModeDutch = "Dutch "
|
||||
ColorRed = "Red "
|
||||
ColorBlue = "Blue "
|
||||
ColorGreen = "Green "
|
||||
ColorYellow = "Yellow "
|
||||
ColorPurple = "Purple "
|
||||
ColorPink = "Pink "
|
||||
ColorOrange = "Orange "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Estándar "
|
||||
ExamModeModeNoSym = "Sin simbólico "
|
||||
ExamModeModeNoSymNoText = "Sin simbólico sin texto "
|
||||
ExamModeModeDutch = "Holandés "
|
||||
ColorRed = "Rojo "
|
||||
ColorBlue = "Azul "
|
||||
ColorGreen = "Verde "
|
||||
ColorYellow = "Amarillo "
|
||||
ColorPurple = "Púrpura "
|
||||
ColorPink = "Rosa "
|
||||
ColorOrange = "Naranja "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Sans symbolique "
|
||||
ExamModeModeNoSymNoText = "Sans symbolique ni texte "
|
||||
ExamModeModeDutch = "Dutch "
|
||||
ColorRed = "Rouge "
|
||||
ColorBlue = "Bleu "
|
||||
ColorGreen = "Vert "
|
||||
ColorYellow = "Jaune "
|
||||
ColorPurple = "Violet "
|
||||
ColorPink = "Rose "
|
||||
ColorOrange = "Orange "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Normál "
|
||||
ExamModeModeNoSym = "Szimbólikus nélkül "
|
||||
ExamModeModeNoSymNoText = "Szimbólikus és szöveg nélkül "
|
||||
ExamModeModeDutch = "Holland "
|
||||
ColorRed = "Piros "
|
||||
ColorBlue = "Kék "
|
||||
ColorGreen = "Zöld "
|
||||
ColorYellow = "Sárga "
|
||||
ColorPurple = "Lila "
|
||||
ColorPink = "Rózsaszín "
|
||||
ColorOrange = "Narancssárga "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Nessun simbolo "
|
||||
ExamModeModeNoSymNoText = "Nessun simbolo nessun testo "
|
||||
ExamModeModeDutch = "Olandese "
|
||||
ColorRed = "Rosso "
|
||||
ColorBlue = "Blu "
|
||||
ColorGreen = "Verde "
|
||||
ColorYellow = "Giallo "
|
||||
ColorPurple = "Viola "
|
||||
ColorPink = "Rosa "
|
||||
ColorOrange = "Arancia "
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Standaard "
|
||||
ExamModeModeNoSym = "Geen sym "
|
||||
ExamModeModeNoSymNoText = "Geen sym geen tekst "
|
||||
ExamModeModeDutch = "Nederlands "
|
||||
ColorRed = "rood"
|
||||
ColorBlue = "Blauw"
|
||||
ColorGreen = "Groente"
|
||||
ColorYellow = "Geel"
|
||||
ColorPurple = "Purper"
|
||||
ColorPink = "Roze"
|
||||
ColorOrange = "Oranje"
|
||||
|
||||
@@ -89,3 +89,10 @@ ExamModeModeStandard = "Padrão "
|
||||
ExamModeModeNoSym = "Sem sym "
|
||||
ExamModeModeNoSymNoText = "Sem sym sem texto "
|
||||
ExamModeModeDutch = "holandês "
|
||||
ColorRed = "Vermelho "
|
||||
ColorBlue = "Azul "
|
||||
ColorGreen = "Verde "
|
||||
ColorYellow = "Amarelo "
|
||||
ColorPurple = "Roxa "
|
||||
ColorPink = "Cor de rosa "
|
||||
ColorOrange = "Laranja "
|
||||
|
||||
@@ -29,6 +29,8 @@ app_shared_src = $(addprefix apps/shared/,\
|
||||
buffer_function_title_cell.cpp \
|
||||
buffer_text_view_with_text_field.cpp \
|
||||
button_with_separator.cpp \
|
||||
color_cell.cpp \
|
||||
color_parameter_controller.cpp \
|
||||
cursor_view.cpp \
|
||||
editable_cell_table_view_controller.cpp \
|
||||
expression_field_delegate_app.cpp \
|
||||
|
||||
51
apps/shared/color_cell.cpp
Normal file
51
apps/shared/color_cell.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "color_cell.h"
|
||||
|
||||
namespace Shared {
|
||||
|
||||
constexpr const I18n::Message MessageTableCellWithColor::k_textForIndex[Palette::numberOfDataColors()];
|
||||
|
||||
constexpr const uint8_t colorMask[MessageTableCellWithColor::ColorView::k_colorSize][MessageTableCellWithColor::ColorView::k_colorSize] = { // FIXME Can't link with constexpr static
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0xFF, 0xFF, 0xE1, 0x0C, 0x00, 0x00, 0x0C, 0xE1, 0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0xFF, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xFF, 0xFF},
|
||||
{0xFF, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xFF},
|
||||
{0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xFF},
|
||||
{0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF},
|
||||
{0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF},
|
||||
{0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xFF},
|
||||
{0xFF, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xFF},
|
||||
{0xFF, 0xFF, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xFF, 0xFF},
|
||||
{0xFF, 0xFF, 0xFF, 0xE1, 0x0C, 0x00, 0x00, 0x0C, 0xE1, 0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
};
|
||||
|
||||
MessageTableCellWithColor::MessageTableCellWithColor() :
|
||||
MessageTableCell(),
|
||||
m_accessoryView()
|
||||
{}
|
||||
|
||||
View * MessageTableCellWithColor::accessoryView() const {
|
||||
return (View *)&m_accessoryView;
|
||||
}
|
||||
|
||||
void MessageTableCellWithColor::setColor(int i) {
|
||||
m_accessoryView.setColor(i);
|
||||
MessageTextView * label = (MessageTextView*)(labelView());
|
||||
return label->setMessage(k_textForIndex[i]);
|
||||
}
|
||||
|
||||
MessageTableCellWithColor::ColorView::ColorView() :
|
||||
m_index(0)
|
||||
{}
|
||||
|
||||
void MessageTableCellWithColor::ColorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor Buffer[MessageTableCellWithColor::ColorView::k_colorSize*MessageTableCellWithColor::ColorView::k_colorSize];
|
||||
KDRect Frame(bounds().x(), bounds().y() + bounds().height()/2 - k_colorSize/2, k_colorSize, k_colorSize);
|
||||
ctx->blendRectWithMask(Frame, Palette::DataColor[m_index], (const uint8_t *)colorMask, Buffer);
|
||||
}
|
||||
|
||||
KDSize MessageTableCellWithColor::ColorView::minimalSizeForOptimalDisplay() const {
|
||||
return KDSize(k_colorSize, k_colorSize);
|
||||
}
|
||||
|
||||
}
|
||||
42
apps/shared/color_cell.h
Normal file
42
apps/shared/color_cell.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef SHARED_COLOR_CELL_CONTROLLER_H
|
||||
#define SHARED_COLOR_CELL_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class MessageTableCellWithColor : public MessageTableCell {
|
||||
public:
|
||||
MessageTableCellWithColor();
|
||||
View * accessoryView() const override;
|
||||
void setColor(int i);
|
||||
int color() { return m_accessoryView.color(); }
|
||||
constexpr static I18n::Message k_textForIndex[Palette::numberOfDataColors()] = {
|
||||
I18n::Message::ColorRed,
|
||||
I18n::Message::ColorBlue,
|
||||
I18n::Message::ColorGreen,
|
||||
I18n::Message::ColorYellow,
|
||||
I18n::Message::ColorPurple,
|
||||
I18n::Message::ColorBlue,
|
||||
I18n::Message::ColorPink,
|
||||
I18n::Message::ColorOrange
|
||||
};
|
||||
class ColorView : public TransparentView {
|
||||
public:
|
||||
ColorView();
|
||||
void setColor(int i) { m_index = i; }
|
||||
int color() { return m_index; }
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
constexpr static KDCoordinate k_colorSize = 12;
|
||||
private:
|
||||
int m_index;
|
||||
};
|
||||
private:
|
||||
ColorView m_accessoryView;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
86
apps/shared/color_parameter_controller.cpp
Normal file
86
apps/shared/color_parameter_controller.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "color_parameter_controller.h"
|
||||
|
||||
#include "function_app.h"
|
||||
#include "../apps_container.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
ColorParameterController::ColorParameterController(Responder * parentResponder, I18n::Message title) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this),
|
||||
m_record(),
|
||||
m_title(title)
|
||||
{}
|
||||
|
||||
void ColorParameterController::viewWillAppear() {
|
||||
ViewController::viewWillAppear();
|
||||
// Restore the selected color
|
||||
KDColor FunctionColor = function()->color();
|
||||
uint8_t cellXPosition = 0;
|
||||
// TODO: Improve this if possible
|
||||
for (uint8_t i = 0; i < sizeof(Palette::DataColor)/sizeof(Palette::DataColor[0]); i++) {
|
||||
if (Palette::DataColor[i] == FunctionColor) {
|
||||
cellXPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(Palette::DataColor[cellXPosition] == FunctionColor);
|
||||
selectCellAtLocation(0, cellXPosition);
|
||||
m_selectableTableView.reloadData();
|
||||
}
|
||||
|
||||
void ColorParameterController::didBecomeFirstResponder() {
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
bool ColorParameterController::handleEvent(Ion::Events::Event event) {
|
||||
StackViewController * stack = (StackViewController *)(parentResponder());
|
||||
if (event == Ion::Events::Left) {
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
handleEnterOnRow(selectedRow());
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
KDCoordinate ColorParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
HighlightCell * ColorParameterController::reusableCell(int index) {
|
||||
assert(index < numberOfRows());
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
void ColorParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithColor * myCell = (MessageTableCellWithColor *)cell;
|
||||
myCell->setColor(index);
|
||||
myCell->setMessageFont(KDFont::LargeFont);
|
||||
cell->reloadCell();
|
||||
}
|
||||
|
||||
bool ColorParameterController::handleEnterOnRow(int rowIndex) {
|
||||
function()->setColor(Palette::DataColor[rowIndex]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorParameterController::setRecord(Ion::Storage::Record record) {
|
||||
m_record = record;
|
||||
selectCellAtLocation(0, 0);
|
||||
}
|
||||
|
||||
ExpiringPointer<Function> ColorParameterController::function() {
|
||||
return functionStore()->modelForRecord(m_record);
|
||||
}
|
||||
|
||||
FunctionStore * ColorParameterController::functionStore() {
|
||||
return FunctionApp::app()->functionStore();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
44
apps/shared/color_parameter_controller.h
Normal file
44
apps/shared/color_parameter_controller.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef SHARED_COLOR_PARAM_CONTROLLER_H
|
||||
#define SHARED_COLOR_PARAM_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "function_store.h"
|
||||
#include "color_cell.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
class ColorParameterController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
ColorParameterController(Responder * parentResponder, I18n::Message title);
|
||||
|
||||
View * view() override { return &m_selectableTableView; }
|
||||
void viewWillAppear() override;
|
||||
void didBecomeFirstResponder() override;
|
||||
|
||||
const char * title() override { return I18n::translate(m_title); }
|
||||
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
|
||||
TELEMETRY_ID("ColorParameter");
|
||||
|
||||
void setRecord(Ion::Storage::Record record);
|
||||
|
||||
int numberOfRows() const override { return Palette::numberOfDataColors(); }
|
||||
KDCoordinate cellHeight() override;
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override { return Palette::numberOfDataColors(); } // FIXME Display issue
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index);
|
||||
private:
|
||||
bool handleEnterOnRow(int rowIndex);
|
||||
FunctionStore * functionStore();
|
||||
ExpiringPointer<Function> function();
|
||||
SelectableTableView m_selectableTableView;
|
||||
Ion::Storage::Record m_record;
|
||||
I18n::Message m_title;
|
||||
MessageTableCellWithColor m_cells[Palette::numberOfDataColors()];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -55,6 +55,10 @@ void Function::setActive(bool active) {
|
||||
}
|
||||
}
|
||||
|
||||
void Function::setColor(KDColor color) {
|
||||
recordData()->setColor(color);
|
||||
}
|
||||
|
||||
int Function::printValue(double cursorT, double cursorX, double cursorY, char * buffer, int bufferSize, int precision, Poincare::Context * context) {
|
||||
return PoincareHelpers::ConvertFloatToText<double>(cursorY, buffer, bufferSize, precision);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
bool isActive() const;
|
||||
KDColor color() const;
|
||||
void setActive(bool active);
|
||||
void setColor(KDColor color);
|
||||
|
||||
// Definition Interval
|
||||
virtual bool shouldClipTRangeToXRange() const { return true; } // Returns true if the function will not be displayed if t is outside x range.
|
||||
@@ -76,6 +77,7 @@ protected:
|
||||
KDColor color() const {
|
||||
return KDColor::RGB16(m_color);
|
||||
}
|
||||
void setColor(KDColor color) { m_color = color; }
|
||||
bool isActive() const { return m_active; }
|
||||
void setActive(bool active) { m_active = active; }
|
||||
private:
|
||||
|
||||
@@ -8,12 +8,12 @@ ListParameterController::ListParameterController(Responder * parentResponder, I1
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this, this, this, tableDelegate),
|
||||
m_record(),
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
m_colorCell(functionColorMessage),
|
||||
#endif
|
||||
m_colorCell(),
|
||||
m_enableCell(I18n::Message::ActivateDeactivate),
|
||||
m_deleteCell(deleteFunctionMessage)
|
||||
m_deleteCell(deleteFunctionMessage),
|
||||
m_colorParameterController(parentResponder, functionColorMessage)
|
||||
{
|
||||
m_colorCell.setMessage(functionColorMessage);
|
||||
}
|
||||
|
||||
const char * ListParameterController::title() {
|
||||
@@ -38,6 +38,16 @@ void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int
|
||||
if (cell == &m_enableCell) {
|
||||
SwitchView * switchView = (SwitchView *)m_enableCell.accessoryView();
|
||||
switchView->setState(function()->isActive());
|
||||
} else if(cell == &m_colorCell) {
|
||||
int index = -1;
|
||||
KDColor color = function()->color();
|
||||
for(int i = 0; i < Palette::numberOfDataColors(); i++) {
|
||||
if(color == Palette::DataColor[i]) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
assert(index >= 0);
|
||||
m_colorCell.setSubtitle(MessageTableCellWithColor::k_textForIndex[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +74,7 @@ int ListParameterController::indexFromCumulatedHeight(KDCoordinate offsetY) {
|
||||
HighlightCell * ListParameterController::reusableCell(int index, int type) {
|
||||
assert(index == 0);
|
||||
assert(index < totalNumberOfCells());
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
HighlightCell * cells[] = {&m_colorCell, &m_enableCell, &m_deleteCell};
|
||||
#else
|
||||
HighlightCell * cells[] = {&m_enableCell, &m_deleteCell};
|
||||
#endif
|
||||
return cells[type];
|
||||
}
|
||||
|
||||
@@ -78,22 +84,17 @@ int ListParameterController::typeAtLocation(int i, int j) {
|
||||
|
||||
bool ListParameterController::handleEnterOnRow(int rowIndex) {
|
||||
switch (rowIndex) {
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
case 0:
|
||||
/* TODO: implement function color choice */
|
||||
case 0: {
|
||||
StackViewController * stack = (StackViewController *)(parentResponder());
|
||||
m_colorParameterController.setRecord(m_record);
|
||||
stack->push(&m_colorParameterController);
|
||||
return true;
|
||||
}
|
||||
case 1:
|
||||
#else
|
||||
case 0:
|
||||
#endif
|
||||
function()->setActive(!function()->isActive());
|
||||
m_selectableTableView.reloadData();
|
||||
return true;
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
case 2:
|
||||
#else
|
||||
case 1:
|
||||
#endif
|
||||
case 2:
|
||||
{
|
||||
assert(functionStore()->numberOfModels() > 0);
|
||||
functionStore()->removeModel(m_record);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <escher.h>
|
||||
#include "function_store.h"
|
||||
#include "color_parameter_controller.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Shared {
|
||||
@@ -31,22 +32,17 @@ public:
|
||||
protected:
|
||||
virtual bool handleEnterOnRow(int rowIndex);
|
||||
virtual int totalNumberOfCells() const {
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
return 3;
|
||||
#else
|
||||
return 2;
|
||||
#endif
|
||||
}
|
||||
FunctionStore * functionStore();
|
||||
ExpiringPointer<Function> function();
|
||||
SelectableTableView m_selectableTableView;
|
||||
Ion::Storage::Record m_record;
|
||||
private:
|
||||
#if FUNCTION_COLOR_CHOICE
|
||||
MessageTableCellWithChevron m_colorCell;
|
||||
#endif
|
||||
MessageTableCellWithChevronAndMessage m_colorCell;
|
||||
MessageTableCellWithSwitch m_enableCell;
|
||||
MessageTableCell m_deleteCell;
|
||||
ColorParameterController m_colorParameterController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user