-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcapcli.h
More file actions
105 lines (81 loc) · 2.23 KB
/
capcli.h
File metadata and controls
105 lines (81 loc) · 2.23 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// Created by mteg on 5/6/18.
//
#ifndef CAPOC2_CAPCLI_H
#define CAPOC2_CAPCLI_H
class capCli;
class capCliThread;
#include "cli.h"
#include "capserver.h"
#include "capengine.h"
#include "capaffine.h"
struct capKeymap
{
struct capKeymap *next;
char *name;
char *description;
char *actions[3][256];
#define CA_PRESS 0
#define CA_HOLD 1
#define CA_RELEASE 2
char dragActions[5][2];
float dragFactors[5][2];
#define CAB_LEFT 1
#define CAB_RIGHT 2
#define CAB_SHIFT 2
#define CAD_AXIS_X 0
#define CAD_AXIS_Y 1
#define CAD_NONE 0
#define CAD_CAM_PITCH 1
#define CAD_CAM_YAW 2
#define CAD_CAM_PANZ 3
#define CAD_CAM_PANX 4
#define CAD_CAM_PANY 5
#define CAD_MARKER_X 6
#define CAD_MARKER_Y 7
#define CAD_MARK_POINTS 8
#define CAD_MEASURE 9
#define CAD_NVM_PANX 10
#define CAD_NVM_PANY 11
#define CAD_MARKER_SET 12
#define CAD_RANGE_ADJUST 13
};
class capCli {
public:
explicit capCli(const char *clidata, capEngine *engine);
struct capKeymap *keymaps;
struct capKeymap *currentKeymap;
struct capKeymap *rootKeymap;
capServer *server;
capEngine *engine;
const char *capCliData;
void bindkey(const char *keyMap, const char *keyName, int actionType, const char *action);
capKeymap *findmap(const char *keyMap);
void setKeymap(const char *string);
};
class capCliBuffer {
public:
unsigned int size = 0, pos = 0;
char *mem = NULL;
};
class capCliThread : public cli {
private:
void printAffine(capAffineMatrix *af);
public:
explicit capCliThread(capCli *cliController, struct tcpConn *conn);
explicit capCliThread(capCli *cliController);
capCli *cliController;
struct tcpConn *conn;
capCliBuffer commandResult;
void exec() final;
void write(const char *buf, size_t) final;
int complete(clitok_id, char*, int) final;
void axisAction(int button, int axis, float step, float x1, float y1, float x2, float y2);
void keyAction(unsigned char key, int type);
bool fetchColor(capColor *c, bool resetAlpha);
bool fetchColor(capColor *c);
float floatToken(clitok_id token, float defval);
void axisAction(int action, float step, float x1, float y1, float x2, float y2);
void printf(const char *fmt, ...) final;
};
#endif //CAPOC2_CAPCLI_H