-
Notifications
You must be signed in to change notification settings - Fork 3
/
wtpen.h
191 lines (168 loc) · 5.83 KB
/
wtpen.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#ifndef __WTPEN_HEAD_H
#define __WTPEN_HEAD_H
#include <gtk/gtk.h>
typedef struct { // for the buttons/entries on the preference-tab (keys)
GtkWidget *button;
GtkWidget *entry;
int key; // keycode
gchar *label; // label
} DefKeys;
// used to store configuration settings
typedef struct {
int key; // the key to bind
unsigned short mode; // the recognition mode attached to that key
} HotKey;
typedef struct {
int x, y; // window position
int lx, ly; // lookup window position
int dx, dy; // loopup window size
double opacity; // opacity of the main window
gchar *font; // font to be used for the 9 other choices
short speed; // recognition speed (1..10)
long lijnkleur; // de kleur van de lijn
long rasterkleur; // de kleur van het raster
gboolean raster; // show raster
int paste[2]; // paste key-sequence
int backspace[2]; // backspace key-sequence
gchar *device; // input device
HotKey keymode[7]; // key/mode settings for each mode
DefKeys defkey[13]; // 13 predefined labels for keycodes
gboolean tips; // enable tooltips
gboolean speech; // enable speech
int voice; // voice number to be used (0=male, 1=female, 2=teacher)
} KeySettings;
typedef struct {
int state; // keystate (pressed or released)
int key; // the key number
} KeyState;
typedef struct {
GtkWidget *check; // checkbutton
GtkWidget *button; // button
unsigned short bit; // recognition bit set
unsigned short mask; // recognition bit unset
} ModeBits;
#define GET_DEF_KEY 1
#define GET_HOT_KEY 2
// bits for recognition setting (see WTSetRange)
#define GB1 0x0001 // GB ordered by pinyin
#define GB2 0x0002 // GB ordered by radicals
#define BIG5 0x0004 // traditional characters
#define DIGITS 0x0020 // the digits 0..9 and the minus sign
#define LOWERCASE 0x0040 // lowercase alphabeth
#define UPPERCASE 0x0080 // uppercase alphabeth
#define PUNC 0x0100 // punctuation symbols
#define DEFAULT 0x1000 // default
#define KEY_PRESS 2
#define KEY_RELEASE 3
#define PRESS TRUE
#define RELEASE FALSE
#define NUMKEYS 120 // the maximum number of keys on a keyboard
// key (scan) codes that might not be the same on other keyboards
// that is why there is an additional page in the preferences to define other labels
#define CTRL_L 37
#define SHIFT_L 50
#define ALT_L 64
#define CTRL_R 105
#define SHIFT_R 62
#define ALT_R 108
#define ESC 9
#define CAPS 66
#define NUMS 77
#define SCROLLS 78
#define PAUSE 127
//#include <X11/keysymdef.h>
/*
* Variable type definition
*/
typedef short WTError;
typedef long WT_int32; /*Defines four byte variables*/
/*
* Define Macros
*/
//#define WTPEN_abs(value) (((value)<0)?(-(value)):(value))
// define to use a thread for the focus detection loop (else it is an on-iddle routine)
//#define WITH_THREADS
/*
* Declaration of functioins
*/
#ifdef __cplusplus
extern "C" {
#endif
WTError WTRecognizeInit(char *RamAddress,WT_int32 RamSize,char *LibStartAddress);
/*
* function: Initialization. Call this function once to start the recognition system
* Parameter:
* RamAddress:
* Memory to use, at least 2K
* RamSize:
* RamAddress Aims spatial size
* LibStartAddress:
* start of library in the memory
* Returns value:
* 0- success
* other values- error
*/
WTError WTRecognize(unsigned char * PointBuf, short PointsNumber, unsigned short *CandidateResult);
/*
* function: Recognitize. carries on recognition based on the input path, finally places in CandidateResult
* Parameter:
* PointBuf:
* input: (X1,Y1,X2,Y2,...0xff,0x00,Xn,Yn,Xn+1,Yn+1,
* ...0xff,0x00,0xff,0xff),In which spot is right (0xff,0x00) Expressed that a stroke ended
* To (0xff,0xff) expressed that this character finished
* In the recognition process this part of memory's content will be rewritten.
* PointsNumber:
* Altogether path points, also separately calculated a spot including the stroke and the character end mark.
* CandidateResult:
* The depositing recognition result, opens by the main tuning function, should have a 2*10=20 byte at least
* Returns value:
* 0--Expresses successfully
* Other values--The expression makes a mistake
* CandidateResult If the value is the character which 0xffff is resists to know.
*/
WTError WTRecognizeEnd();
/*
* Function: Essential other work. This function when withdrawal recognition system transfers one time then
* parameter:none
* Returns value:
* 0--Expresses successfully
* Other values--The expression makes a mistake
*/
WTError WTSetRange(short Range);
/*
* Function: When the establishment recognition scope, the function parameter's corresponding position establishment is 1,
* the recognition scope will include the corresponding character repertoire,
* When the establishment is 0, the corresponding character repertoire will not distinguish in the scope.
* Moreover, whether establishes to have an effect is also decided by the time
* Whether other storehouse does support the corresponding character repertoire.
* parameters:
* Range:
* bit0 GB level 1 (3755)
* bit1 GB level 2 (6763)
* bit2 Traditional character
* bit5 Arabic numeral (digits)
* bit6 Lowercase letter
* bit7 Uppercase letter
* bit8 Punctuation mark
* bit14 Laboratory stipulation function symbol
* bit15 USER Specific
* Other retentions
* Returns value:
* 0--Expresses successfully
* Other values--The expression makes a mistake
*/
WTError WTSetSpeed(short Speed);
/*
* Function: Establishment recognition speed (Limited function)
* parameter:
* Speed:
* 0-10, 0 slowest, 10 quickest, a speed quicker recognition rate is lower
* If does not transfer this function, the default value is 6
* return value:
* 0--success
* Other values--The expression makes a mistake
*/
#ifdef __cplusplus
}
#endif
#endif