mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[escher] [apps] Get rid of magic numbers
Change-Id: Iad192d24324dda37b3d739830cc8ead7a032e22f
This commit is contained in:
@@ -42,14 +42,14 @@ bool ScrollableExpressionView::rightViewIsInvisible() {
|
||||
bool ScrollableExpressionView::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Right && rightViewIsInvisible()) {
|
||||
KDCoordinate rightSpace = m_expressionView.bounds().width() - m_manualScrolling - bounds().width();
|
||||
KDCoordinate scrollAdd = rightSpace > 10 ? 10 : rightSpace;
|
||||
KDCoordinate scrollAdd = rightSpace > Metric::ScrollStep ? Metric::ScrollStep : rightSpace;
|
||||
m_manualScrolling += scrollAdd;
|
||||
setContentOffset(KDPoint(m_manualScrolling, 0));
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Left && m_manualScrolling > 0) {
|
||||
KDCoordinate leftSpace = m_manualScrolling;
|
||||
KDCoordinate scrollSubstract = leftSpace > 10 ? 10 : leftSpace;
|
||||
KDCoordinate scrollSubstract = leftSpace > Metric::ScrollStep ? Metric::ScrollStep : leftSpace;
|
||||
m_manualScrolling -= scrollSubstract;
|
||||
setContentOffset(KDPoint(m_manualScrolling, 0));
|
||||
return true;
|
||||
|
||||
@@ -12,8 +12,8 @@ CurveParameterController::CurveParameterController(InteractiveCurveViewRange * g
|
||||
m_calculationCell(PointerTableCellWithChevron((char*)"Calculer")),
|
||||
m_goToCell(PointerTableCellWithChevron((char*)"Aller a")),
|
||||
m_derivativeCell(PointerTableCellWithSwitch((char*)"Nombre derivee")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_goToParameterController(GoToParameterController(this, graphRange, cursor))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace Graph {
|
||||
|
||||
InitialisationParameterController::InitialisationParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_graphRange(graphRange)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ AbscissaParameterController::AbscissaParameterController(Responder * parentRespo
|
||||
m_deleteColumn(PointerTableCell((char*)"Effacer la colonne")),
|
||||
m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")),
|
||||
m_setInterval(PointerTableCellWithChevron((char*)"Regler l'intervalle")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_intervalParameterController(intervalParameterController)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ DerivativeParameterController::DerivativeParameterController(ValuesController *
|
||||
m_pageTitle{"Colonne f'(x)"},
|
||||
m_hideColumn(PointerTableCell((char*)"Masquer la colonne de la derivee")),
|
||||
m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_function(nullptr),
|
||||
m_valuesController(valuesController)
|
||||
{
|
||||
|
||||
@@ -9,8 +9,8 @@ FunctionParameterController::FunctionParameterController(ValuesController * valu
|
||||
m_pageTitle{"Colonne f(x)"},
|
||||
m_displayDerivativeColumn(PointerTableCellWithSwitch((char*)"Colonne de la fonction derivee")),
|
||||
m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_function(nullptr),
|
||||
m_valuesController(valuesController)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ View * AppCell::subviewAtIndex(int index) {
|
||||
}
|
||||
|
||||
void AppCell::layoutSubviews() {
|
||||
m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, 18, k_iconWidth,k_iconHeight));
|
||||
m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, k_iconMargin, k_iconWidth,k_iconHeight));
|
||||
KDSize nameSize = m_nameView.minimalSizeForOptimalDisplay();
|
||||
m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin));
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
void reloadCell() override;
|
||||
void setApp(::App * app);
|
||||
private:
|
||||
static constexpr KDCoordinate k_iconMargin = 18;
|
||||
static constexpr KDCoordinate k_iconWidth = 55;
|
||||
static constexpr KDCoordinate k_iconHeight = 56;
|
||||
static constexpr KDCoordinate k_nameWidthMargin = 4;
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace Home {
|
||||
Controller::Controller(Responder * parentResponder, ::AppsContainer * container) :
|
||||
ViewController(parentResponder),
|
||||
m_container(container),
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, 4, 0, 4, this, true, true, KDColorWhite, 28, Palette::YellowDark, Palette::GreyMiddle, 116))
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, k_sideMargin, 0, k_sideMargin, this, true, true,
|
||||
KDColorWhite, k_indicatorThickness, Palette::YellowDark, Palette::GreyMiddle, k_indicatorMargin))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ private:
|
||||
int numberOfIcons();
|
||||
AppsContainer * m_container;
|
||||
SelectableTableView m_selectableTableView;
|
||||
static constexpr KDCoordinate k_sideMargin = 4;
|
||||
static constexpr KDCoordinate k_indicatorThickness = 28;
|
||||
static constexpr KDCoordinate k_indicatorMargin = 116;
|
||||
static constexpr int k_numberOfColumns = 4;
|
||||
static constexpr int k_numberOfApps = 10;
|
||||
static constexpr int k_maxNumberOfCells = 16;
|
||||
|
||||
@@ -53,8 +53,8 @@ static const char * sMessages[] = {
|
||||
|
||||
LawController::LawController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin-ContentView::k_titleMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin-ContentView::k_titleMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_contentView(&m_selectableTableView),
|
||||
m_law(nullptr),
|
||||
m_parametersController(ParametersController(nullptr))
|
||||
|
||||
@@ -37,7 +37,7 @@ PointerTextView * ParametersController::ContentView::parameterDefinitionAtIndex(
|
||||
}
|
||||
|
||||
void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
int tableHeight = m_selectableTableView->size().height()+ Metric::TopMargin + Metric::BottomMargin;
|
||||
int tableHeight = m_selectableTableView->size().height()+ Metric::CommonTopMargin + Metric::CommonBottomMargin;
|
||||
ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), Palette::WallScreen);
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ View * ParametersController::ContentView::subviewAtIndex(int index) {
|
||||
void ParametersController::ContentView::layoutSubviews() {
|
||||
KDCoordinate titleHeight = KDText::stringSize("", KDText::FontSize::Small).height()+k_titleMargin;
|
||||
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
|
||||
KDCoordinate tableHeight = m_selectableTableView->size().height() + Metric::TopMargin + Metric::BottomMargin;
|
||||
KDCoordinate tableHeight = m_selectableTableView->size().height() + Metric::CommonTopMargin + Metric::CommonBottomMargin;
|
||||
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), tableHeight));
|
||||
m_nextButton.setFrame(KDRect(Metric::LeftMargin, titleHeight+tableHeight, bounds().width() - Metric::RightMargin - Metric::LeftMargin, k_buttonHeight));
|
||||
m_nextButton.setFrame(KDRect(Metric::CommonLeftMargin, titleHeight+tableHeight, bounds().width() - Metric::CommonRightMargin - Metric::CommonLeftMargin, k_buttonHeight));
|
||||
KDCoordinate textHeight = KDText::stringSize("", KDText::FontSize::Small).height();
|
||||
KDCoordinate defOrigin = (titleHeight+tableHeight+k_buttonHeight)/2+(bounds().height()-textHeight)/2;
|
||||
m_secondParameterDefinition.setFrame(KDRectZero);
|
||||
|
||||
@@ -15,8 +15,8 @@ CalculationController::CalculationController(Responder * parentResponder, Header
|
||||
EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small)},
|
||||
m_columnTitleCell(EvenOddDoubleBufferTextCell(&m_selectableTableView)),
|
||||
m_calculationCells{EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small)},
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin, this, true, true, Palette::WallScreenDark)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin, this, true, true, Palette::WallScreenDark)),
|
||||
m_store(store)
|
||||
{
|
||||
for (int k = 0; k < k_maxNumberOfDisplayableRows/2; k++) {
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
constexpr static int k_totalNumberOfColumns = 2;
|
||||
constexpr static int k_maxNumberOfDisplayableRows = 10;
|
||||
static constexpr KDCoordinate k_cellHeight = 25;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
EvenOddPointerTextCell m_titleCells[k_maxNumberOfDisplayableRows];
|
||||
EvenOddDoubleBufferTextCell m_columnTitleCell;
|
||||
EvenOddDoubleBufferTextCell m_doubleCalculationCells[k_maxNumberOfDisplayableRows/2];
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Regression {
|
||||
|
||||
InitialisationParameterController::InitialisationParameterController(Responder * parentResponder, Store * store) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_store(store)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Regression {
|
||||
|
||||
PredictionParameterController::PredictionParameterController(Responder * parentResponder, Store * store, CurveViewCursor * cursor) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_goToParameterController(GoToParameterController(this, store, cursor))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ int ListController::sequenceDefinitionForRow(int j) {
|
||||
}
|
||||
|
||||
void ListController::addEmptyFunction() {
|
||||
app()->displayModalViewController(&m_typeStackController, 0.f, 0.f, 32, 20, 20, 20);
|
||||
app()->displayModalViewController(&m_typeStackController, 0.f, 0.f, Metric::TabHeight+Metric::ModalTopMargin, Metric::CommonRightMargin, Metric::ModalBottomMargin, Metric::CommonLeftMargin);
|
||||
}
|
||||
|
||||
void ListController::editExpression(Shared::Function * function, Ion::Events::Event event) {
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Sequence {
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore) :
|
||||
Shared::ListParameterController(parentResponder, sequenceStore),
|
||||
m_typeCell(PointerTableCellWithChevronAndExpression((char *)"Type de suite")),
|
||||
m_typeParameterController(TypeParameterController(this, sequenceStore, TableCell::Layout::Horizontal, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin))
|
||||
m_typeParameterController(TypeParameterController(this, sequenceStore, TableCell::Layout::Horizontal, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ MainController::MainController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_cells{PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large),
|
||||
PointerTableCellWithChevronAndPointer(KDText::FontSize::Large), PointerTableCellWithChevronAndPointer(KDText::FontSize::Large)},
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_nodeModel((Node *)&model),
|
||||
m_subController(this)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ SubController::SubController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_cells{PointerTableCell(nullptr, KDText::FontSize::Large), PointerTableCell(nullptr, KDText::FontSize::Large),
|
||||
PointerTableCell(nullptr, KDText::FontSize::Large)},
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_nodeModel(nullptr),
|
||||
m_preferenceIndex(0)
|
||||
{
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Shared {
|
||||
|
||||
FloatParameterController::FloatParameterController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin, this))
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin, this))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Shared {
|
||||
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, FunctionStore * functionStore) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_functionStore(functionStore),
|
||||
m_colorCell(PointerTableCellWithChevron((char*)"Couleur de la fonction")),
|
||||
m_enableCell(PointerTableCellWithSwitch((char*)"Activer/Desactiver")),
|
||||
|
||||
@@ -8,7 +8,7 @@ using namespace Poincare;
|
||||
namespace Shared {
|
||||
|
||||
StoreController::StoreController(Responder * parentResponder, FloatPairStore * store, HeaderViewController * header) :
|
||||
EditableCellTableViewController(parentResponder, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin),
|
||||
EditableCellTableViewController(parentResponder, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin),
|
||||
HeaderViewDelegate(header),
|
||||
m_editableCells{EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer),
|
||||
EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer), EvenOddEditableTextCell(&m_selectableTableView, this, m_draftTextBuffer),
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
protected:
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
constexpr static int k_maxNumberOfEditableCells = 22;
|
||||
constexpr static int k_numberOfTitleCells = 2;
|
||||
Responder * tabController() const;
|
||||
|
||||
@@ -8,8 +8,8 @@ StoreParameterController::StoreParameterController(Responder * parentResponder,
|
||||
m_deleteColumn(PointerTableCell((char*)"Effacer la colonne")),
|
||||
m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")),
|
||||
m_importList(PointerTableCellWithChevron((char*)"Importer une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_store(store),
|
||||
m_xColumnSelected(true)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ CalculationController::CalculationController(Responder * parentResponder, Header
|
||||
EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small), EvenOddPointerTextCell(KDText::FontSize::Small)},
|
||||
m_calculationCells{EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small),
|
||||
EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small), EvenOddBufferTextCell(KDText::FontSize::Small)},
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin, Metric::BottomMargin, Metric::LeftMargin,
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin,
|
||||
nullptr, true, true, Palette::WallScreenDark)),
|
||||
m_store(store)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
constexpr static int k_totalNumberOfRows = 13;
|
||||
constexpr static int k_maxNumberOfDisplayableRows = 11;
|
||||
static constexpr KDCoordinate k_cellHeight = 20;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::RightMargin/2 - Metric::LeftMargin/2;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
EvenOddPointerTextCell m_titleCells[k_maxNumberOfDisplayableRows];
|
||||
EvenOddBufferTextCell m_calculationCells[k_maxNumberOfDisplayableRows];
|
||||
SelectableTableView m_selectableTableView;
|
||||
|
||||
@@ -23,7 +23,6 @@ objs += $(addprefix escher/src/,\
|
||||
invocation.o\
|
||||
input_view_controller.o\
|
||||
list_view_data_source.o\
|
||||
metric.o\
|
||||
modal_view_controller.o\
|
||||
palette.o\
|
||||
pointer_table_cell.o\
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
|
||||
class Metric {
|
||||
public:
|
||||
constexpr static KDCoordinate LeftMargin = 20;
|
||||
constexpr static KDCoordinate RightMargin = 20;
|
||||
constexpr static KDCoordinate TopMargin = 15;
|
||||
constexpr static KDCoordinate BottomMargin = 15;
|
||||
constexpr static KDCoordinate CommonLeftMargin = 20;
|
||||
constexpr static KDCoordinate CommonRightMargin = 20;
|
||||
constexpr static KDCoordinate CommonTopMargin = 15;
|
||||
constexpr static KDCoordinate CommonBottomMargin = 15;
|
||||
constexpr static KDCoordinate ParameterCellHeight = 35;
|
||||
constexpr static KDCoordinate ModalTopMargin = 5;
|
||||
constexpr static KDCoordinate ModalBottomMargin = 20;
|
||||
constexpr static KDCoordinate TabHeight = 27;
|
||||
constexpr static KDCoordinate ScrollStep = 10;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -31,7 +31,6 @@ private:
|
||||
const char * className() const override;
|
||||
#endif
|
||||
private:
|
||||
static constexpr KDCoordinate k_tabHeight = 27;
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews() override;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#include <escher/metric.h>
|
||||
|
||||
constexpr KDCoordinate Metric::LeftMargin;
|
||||
constexpr KDCoordinate Metric::RightMargin;
|
||||
constexpr KDCoordinate Metric::TopMargin;
|
||||
constexpr KDCoordinate Metric::BottomMargin;
|
||||
constexpr KDCoordinate Metric::ParameterCellHeight;
|
||||
@@ -2,6 +2,7 @@ extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
#include <escher/tab_view_controller.h>
|
||||
#include <escher/metric.h>
|
||||
#include <escher/app.h>
|
||||
|
||||
TabViewController::ContentView::ContentView() :
|
||||
@@ -19,14 +20,14 @@ void TabViewController::ContentView::setActiveView(View * view) {
|
||||
void TabViewController::ContentView::layoutSubviews() {
|
||||
KDRect tabViewFrame = KDRect(
|
||||
0, 0,
|
||||
m_frame.width(), k_tabHeight
|
||||
m_frame.width(), Metric::TabHeight
|
||||
);
|
||||
m_tabView.setFrame(tabViewFrame);
|
||||
if (m_activeView) {
|
||||
KDRect activeViewFrame = KDRect(
|
||||
0, k_tabHeight,
|
||||
0, Metric::TabHeight,
|
||||
m_frame.width(),
|
||||
m_frame.height() - k_tabHeight
|
||||
m_frame.height() - Metric::TabHeight
|
||||
);
|
||||
m_activeView->setFrame(activeViewFrame);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user