-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathauto_draw.h
60 lines (45 loc) · 1.48 KB
/
auto_draw.h
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
//---------------------------------------------------------------------------
#pragma once
#include JAVELIN_BOARD_CONFIG
#include "javelin/processor/passthrough.h"
#include "javelin/static_allocate.h"
#include "javelin/timer_manager.h"
//---------------------------------------------------------------------------
#if JAVELIN_DISPLAY_DRIVER
enum class AutoDraw : uint8_t {
NONE,
PAPER_TAPE,
STENO_LAYOUT,
WPM,
STROKES,
};
class StenoStrokeCapture final : public StenoPassthrough, private TimerHandler {
private:
using super = StenoPassthrough;
public:
StenoStrokeCapture(StenoProcessorElement *next) : super(next) {}
void Process(const StenoKeyState &value, StenoAction action) override;
void Update(bool onStrokeInput);
static void SetAutoDraw_Binding(void *context, const char *commandLine);
void SetAutoDraw(int displayId, AutoDraw autoDrawId);
static JavelinStaticAllocate<StenoStrokeCapture> container;
private:
static constexpr size_t MAXIMUM_STROKE_COUNT = 32;
size_t strokeCount = 0;
#if JAVELIN_SPLIT
AutoDraw autoDraw[2];
int lastWpm[2] = {-1, -1};
#else
AutoDraw autoDraw[1];
int lastWpm[1] = {-1};
#endif
StenoStroke strokes[MAXIMUM_STROKE_COUNT];
void DrawWpm(int displayId);
void DrawStrokes(int displayId);
void SetWpmTimer(bool enable);
// Override from TimerHandler
void Run(intptr_t id) final { WpmTimerHandler(); }
void WpmTimerHandler();
};
#endif
//---------------------------------------------------------------------------