9 m_contentView(curveView),
10 m_interactiveRange(interactiveRange)
19 return &m_contentView;
24 float meanX = (m_interactiveRange->
xMin()+m_interactiveRange->
xMax())/2.0f;
25 float meanY = (m_interactiveRange->
yMin()+m_interactiveRange->
yMax())/2.0f;
26 m_interactiveRange->
zoom(2.0f/3.0f, meanX, meanY);
27 m_contentView.curveView()->reload();
31 float meanX = (m_interactiveRange->
xMin()+m_interactiveRange->
xMax())/2.0f;
32 float meanY = (m_interactiveRange->
yMin()+m_interactiveRange->
yMax())/2.0f;
33 m_interactiveRange->
zoom(3.0f/2.0f, meanX, meanY);
34 m_contentView.curveView()->reload();
39 m_contentView.curveView()->reload();
44 m_contentView.curveView()->reload();
49 m_contentView.curveView()->reload();
54 m_contentView.curveView()->reload();
62 m_contentView.curveView()->setOkView(
nullptr);
66 m_contentView.layoutSubviews();
71 ZoomParameterController::ContentView::ContentView(
CurveView * curveView) :
72 m_curveView(curveView)
76 int ZoomParameterController::ContentView::numberOfSubviews()
const {
80 View * ZoomParameterController::ContentView::subviewAtIndex(
int index) {
81 assert(index >= 0 && index < 2);
88 void ZoomParameterController::ContentView::layoutSubviews() {
89 m_curveView->setFrame(
KDRect(0, 0, bounds().width(), bounds().height() - k_legendHeight));
90 m_legendView.setFrame(
KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight));
93 CurveView * ZoomParameterController::ContentView::curveView() {
99 ZoomParameterController::ContentView::LegendView::LegendView()
101 I18n::Message messages[k_numberOfLegends] = {I18n::Message::Move, I18n::Message::ToZoom, I18n::Message::Or};
102 float horizontalAlignments[k_numberOfLegends] = {1.0f, 1.0f, 0.5f};
103 for (
int i = 0; i < k_numberOfLegends; i++) {
105 m_legends[i].setMessage(messages[i]);
107 m_legends[i].setAlignment(horizontalAlignments[i], 0.5f);
110 for (
int i = 0; i < k_numberOfTokens ; i++) {
111 m_legendPictograms[i].setType(tokenTypes[i]);
115 void ZoomParameterController::ContentView::LegendView::drawRect(
KDContext * ctx,
KDRect rect)
const {
119 int ZoomParameterController::ContentView::LegendView::numberOfSubviews()
const {
120 return k_numberOfLegends+k_numberOfTokens;
123 View * ZoomParameterController::ContentView::LegendView::subviewAtIndex(
int index) {
124 assert(index >= 0 && index < k_numberOfTokens+k_numberOfLegends);
125 if (index < k_numberOfLegends) {
126 return &m_legends[index];
128 return &m_legendPictograms[index-k_numberOfLegends];
131 void ZoomParameterController::ContentView::LegendView::layoutSubviews() {
134 KDCoordinate legendWidth = m_legends[0].minimalSizeForOptimalDisplay().width();
135 m_legends[0].setFrame(
KDRect(xOrigin, 0, legendWidth, height));
136 xOrigin += legendWidth;
137 for (
int i = 0; i < k_numberOfTokens - 2; i++) {
138 m_legendPictograms[i].setFrame(
KDRect(xOrigin, 0, k_tokenWidth, height));
139 xOrigin += k_tokenWidth;
141 xOrigin = bounds().width()/2;
142 for (
int i = 1; i < k_numberOfLegends; i++) {
143 KDCoordinate legendWidth = m_legends[i].minimalSizeForOptimalDisplay().width();
144 m_legends[i].setFrame(
KDRect(xOrigin, 0, legendWidth, height));
145 xOrigin += legendWidth;
146 m_legendPictograms[k_numberOfTokens - 3 + i].setFrame(
KDRect(xOrigin, 0, k_tokenWidth, height));
147 xOrigin += k_tokenWidth;
ZoomParameterController(Responder *parentResponder, InteractiveCurveViewRange *interactiveCurveViewRange, CurveView *curveView)
void viewWillAppear() override
bool handleEvent(Ion::Events::Event event) override
void zoom(float ratio, float x, float y)
void didBecomeFirstResponder() override
float xGridUnit() override
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
void panWithVector(float x, float y)
const char * title() override
void fillRect(KDRect rect, KDColor color)
float yGridUnit() override
static constexpr KDColor GreyBright