Blame view

build3/apps/sequence/graph/curve_parameter_controller.cpp 1.62 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  #include "curve_parameter_controller.h"
  #include "graph_controller.h"
  #include <assert.h>
  
  using namespace Shared;
  
  namespace Sequence {
  
  CurveParameterController::CurveParameterController(GraphController * graphController, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) :
    FunctionCurveParameterController(graphRange, cursor),
    m_goToParameterController(this, graphRange, cursor, I18n::Message::N),
    m_sumCell(I18n::Message::TermSum),
    m_graphController(graphController)
  {
  }
  
  const char * CurveParameterController::title() {
    return I18n::translate(I18n::Message::SequenceOptions);
  }
  
  bool CurveParameterController::handleEvent(Ion::Events::Event event) {
    if (event == Ion::Events::OK || event == Ion::Events::EXE || (event == Ion::Events::Right && selectedRow() == 1)) {
      switch (selectedRow()) {
        case 0:
        {
          StackViewController * stack = (StackViewController *)parentResponder();
          stack->pop();
          stack->push(m_graphController->termSumController());
          return true;
        }
        case 1:
          return handleGotoSelection();
        default:
          return false;
      }
    }
    return false;
  }
  
  int CurveParameterController::numberOfRows() {
    return k_totalNumberOfCells;
  };
  
  HighlightCell * CurveParameterController::reusableCell(int index) {
    assert(index >= 0);
    assert(index < k_totalNumberOfCells);
    HighlightCell * cells[] = {&m_sumCell, &m_goToCell};
    return cells[index];
  }
  
  int CurveParameterController::reusableCellCount() {
    return k_totalNumberOfCells;
  }
  
  GoToParameterController * CurveParameterController::goToParameterController() {
    return &m_goToParameterController;
  }
  
  }