Files
Upsilon/apps/home/controller.h
circuit10 b44a95a9b3 Casio fx-CG series port (#324)
* Initial test - working on Linux

* Try to make it work with liba

* Stop using liba and the filesystem

* IT WORKS

* Key input, full res, fix some of the crashes

* Fix the hang when doing calculations

* Add some more key mappings

* Fix the square root issue

* Icons

* Better key mappings, brightness control, better gamma correction, more effficient framebuffer

* Cleanup stage 1

* Cleanup stage 2

* Make the build system build a g3a

* Make it not exit when you press the menu button

* Add Casio port to README

* Use omega-master instead of omega-dev

* Fix mistake with cherry-picking in the README

* Fix internal storage crash

* Fix compile error on Numworks calculators

* Upsilon branding

* Sharper icon

* Make the CI work

* Add power off and improve menu

* Map Alpha + up/down to the brightness shortcut

* Add missing file

* Fix web CI build

* Revert "Fix web CI build"

This reverts commit f19657d9fc.

* Change "prizm" to "fxcg"

* Add FASTLOAD option for Add-in Push

* Add some charatcers to the catalog on Casio and improve key mappings

* Build with -Os -flto

* Disable LTO for now as it's causing crashes

* Put back the fonts I accidently changed

I'd like to add an option for this though as I prefer the ones from Epsilon
2023-05-10 18:28:18 +02:00

71 lines
2.6 KiB
C++

#ifndef HOME_CONTROLLER_H
#define HOME_CONTROLLER_H
#include <escher.h>
#include "selectable_table_view_with_background.h"
#include "app_cell.h"
namespace Home {
class Controller : public ViewController, public SimpleTableViewDataSource, public SelectableTableViewDelegate {
public:
Controller(Responder * parentResponder, SelectableTableViewDataSource * selectionDataSource, App * app);
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
void viewWillAppear() override;
void viewDidDisappear() override;
int numberOfRows() const override;
int numberOfColumns() const override;
KDCoordinate cellHeight() override;
KDCoordinate cellWidth() override;
HighlightCell * reusableCell(int index) override;
int reusableCellCount() const override;
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY, bool withinTemporarySelection) override;
void tableViewDidChangeSelectionAndDidScroll(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY, bool withinTemporarySelection) override;
private:
int numberOfIcons() const;
SelectableTableViewDataSource * selectionDataSource() const;
class ContentView : public View {
public:
ContentView(Controller * controller, SelectableTableViewDataSource * selectionDataSource);
SelectableTableView * selectableTableView();
void drawRect(KDContext * ctx, KDRect rect) const override;
void reloadBottomRow(SimpleTableViewDataSource * dataSource, int numberOfIcons, int numberOfColumns);
BackgroundView * backgroundView();
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
SelectableTableViewWithBackground m_selectableTableView;
BackgroundView m_backgroundView;
};
static constexpr KDCoordinate k_sideMargin = 4;
static constexpr KDCoordinate k_bottomMargin = 14;
static constexpr KDCoordinate k_indicatorMargin = 61;
#ifndef _FXCG
static constexpr int k_numberOfColumns = 3;
static constexpr int k_cellHeight = 104;
static constexpr int k_cellWidth = 104;
#else
// A different screen resolution so different dimensions
static constexpr int k_numberOfColumns = 4;
static constexpr int k_cellHeight = 96;
static constexpr int k_cellWidth = 97;
#endif
static constexpr int k_maxNumberOfCells = 16;
ContentView m_view;
AppCell m_cells[k_maxNumberOfCells];
App * m_app;
};
}
#endif