Blame view

epsilon-master/apps/shared/interactive_curve_view_range.h 1.87 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
  #ifndef SHARED_INTERACTIVE_CURVE_VIEW_RANGE_H
  #define SHARED_INTERACTIVE_CURVE_VIEW_RANGE_H
  
  #include <stdint.h>
  #include "memoized_curve_view_range.h"
  #include "curve_view_cursor.h"
  #include "interactive_curve_view_range_delegate.h"
  
  namespace Shared {
  
  class InteractiveCurveViewRange : public MemoizedCurveViewRange {
  public:
    InteractiveCurveViewRange(CurveViewCursor * cursor, InteractiveCurveViewRangeDelegate * delegate = nullptr);
    void setDelegate(InteractiveCurveViewRangeDelegate * delegate);
    void setCursor(CurveViewCursor * cursor);
    uint32_t rangeChecksum() override;
  
    //CurveViewWindow
    bool yAuto();
    void setXMin(float f) override;
    void setXMax(float f) override;
    void setYMin(float f) override;
    void setYMax(float f) override;
    void setYAuto(bool yAuto);
  
    // Window
    void zoom(float ratio, float x, float y);
    void panWithVector(float x, float y);
    virtual void roundAbscissa();
    virtual void normalize();
    virtual void setTrigonometric();
    virtual void setDefault();
    void centerAxisAround(Axis axis, float position);
    void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation);
    bool isCursorVisible(float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation);
  protected:
    bool m_yAuto;
    static float clipped(float f, bool isMax);
    InteractiveCurveViewRangeDelegate * m_delegate;
  private:
    constexpr static float k_minFloat = 1E-8f;
    constexpr static float k_upperMaxFloat = 1E+8f;
    constexpr static float k_lowerMaxFloat = 9E+7f;
    constexpr static float k_maxRatioPositionRange = 1E5f;
    CurveViewCursor * m_cursor;
  };
  
  typedef void (InteractiveCurveViewRange::*ParameterSetterPointer)(float);
  typedef float (InteractiveCurveViewRange::*ParameterGetterPointer)();
  typedef void (InteractiveCurveViewRange::*RangeMethodPointer)();
  
  }
  
  #endif