Blame view

Modif/epsilon-master/apps/graph/app.cpp 2.86 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  #include "app.h"
  #include "../apps_container.h"
  #include "graph_icon.h"
  #include "../i18n.h"
  
  using namespace Poincare;
  using namespace Shared;
  
  namespace Graph {
  
  I18n::Message App::Descriptor::name() {
    return I18n::Message::FunctionApp;
  }
  
  I18n::Message App::Descriptor::upperName() {
    return I18n::Message::FunctionAppCapital;
  }
  
  const Image * App::Descriptor::icon() {
    return ImageStore::GraphIcon;
  }
  
  App::Snapshot::Snapshot() :
    Shared::FunctionApp::Snapshot::Snapshot(),
    m_functionStore(),
    m_graphRange(&m_cursor)
  {
  }
  
  App * App::Snapshot::unpack(Container * container) {
    return new App(container, this);
  }
  
  void App::Snapshot::reset() {
    FunctionApp::Snapshot::reset();
    m_functionStore.removeAll();
    m_graphRange.setDefault();
  }
  
  App::Descriptor * App::Snapshot::descriptor() {
    static Descriptor descriptor;
    return &descriptor;
  }
  
  CartesianFunctionStore * App::Snapshot::functionStore() {
    return &m_functionStore;
  }
  
  InteractiveCurveViewRange * App::Snapshot::graphRange() {
    return &m_graphRange;
  }
  
  void App::Snapshot::tidy() {
    m_functionStore.tidy();
    m_graphRange.setDelegate(nullptr);
  }
  
  App::App(Container * container, Snapshot * snapshot) :
    FunctionApp(container, snapshot, &m_inputViewController),
    m_listController(&m_listFooter, snapshot->functionStore(), &m_listHeader, &m_listFooter),
    m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey),
    m_listHeader(&m_listStackViewController, &m_listFooter, &m_listController),
    m_listStackViewController(&m_tabViewController, &m_listHeader),
    m_graphController(&m_graphAlternateEmptyViewController, snapshot->functionStore(), snapshot->graphRange(), snapshot->cursor(), snapshot->indexFunctionSelectedByCursor(), snapshot->modelVersion(), snapshot->rangeVersion(), snapshot->angleUnitVersion(), &m_graphHeader),
    m_graphAlternateEmptyViewController(&m_graphHeader, &m_graphController, &m_graphController),
    m_graphHeader(&m_graphStackViewController, &m_graphAlternateEmptyViewController, &m_graphController),
    m_graphStackViewController(&m_tabViewController, &m_graphHeader),
    m_valuesController(&m_valuesAlternateEmptyViewController, snapshot->functionStore(), snapshot->interval(), &m_valuesHeader),
    m_valuesAlternateEmptyViewController(&m_valuesHeader, &m_valuesController, &m_valuesController),
    m_valuesHeader(&m_valuesStackViewController, &m_valuesAlternateEmptyViewController, &m_valuesController),
    m_valuesStackViewController(&m_tabViewController, &m_valuesHeader),
    m_tabViewController(&m_inputViewController, snapshot, &m_listStackViewController, &m_graphStackViewController, &m_valuesStackViewController),
    m_inputViewController(&m_modalViewController, &m_tabViewController, this, this)
  {
  }
  
  InputViewController * App::inputViewController() {
    return &m_inputViewController;
  }
  
  const char * App::XNT() {
    return "x";
  }
  
  }