1 //
2 // "$Id: Fl_ILM216.cxx,v 1.8 2003/02/26 01:59:31 easysw Exp $"
3 //
4 // ILM-216 LCD emulator widget code for flcdsim.
5 //
6 // Copyright 2003 by Michael Sweet.
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // Contents:
19 //
20 // Fl_ILM216::Fl_ILM216() - Create a new ILM-216 widget.
21 // Fl_ILM216::~Fl_ILM216() - Delete an ILM-216 widget.
22 // Fl_ILM216::draw() - Draw the widget.
23 // Fl_LCD216::load_char() - Load a single character in the font.
24 // Fl_LCD216::load_font() - Load the standard ILM-216 font.
25 // Fl_LCD216::process() - Process data like an ILM-216.
26 //
27
28 //modified by Daniel Noethen
29
30 //
31 // Include necessary headers...
32 //
33
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <unistd.h>
38 #include <ctype.h>
39 #include <FL/fl_draw.H>
40
41 #include "butt.h"
42 #include "flgui.h"
43
44 #include "../xpm/rec.xpm" //rec_xpm
45 #include "../xpm/rec_dark.xpm" //rec_xpm
46 #include "../xpm/rec_armed.xpm" //rec_xpm
47 #include "../xpm/conn.xpm" //conn_xpm
48 #include "../xpm/conn_dark.xpm" //conn_xpm
49
50
51 //
52 // Font data for the LCD-216...
53 //
54 //
55 //
56
57 static const uchar standard_font[224][8] = {
58 // 0x20 to 0x2f
59 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
60 { 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04, 0x00 },
61 { 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00 },
62 { 0x0a, 0x0a, 0x1f, 0x0a, 0x1f, 0x0a, 0x0a, 0x00 },
63 { 0x04, 0x0f, 0x14, 0x0e, 0x05, 0x1e, 0x04, 0x00 },
64 { 0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03, 0x00 },
65 { 0x0c, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0d, 0x00 },
66 { 0x0c, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
67 { 0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02, 0x00 },
68 { 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00 },
69 { 0x00, 0x04, 0x15, 0x0e, 0x15, 0x04, 0x00, 0x00 },
70 { 0x00, 0x04, 0x04, 0x1f, 0x04, 0x04, 0x00, 0x00 },
71 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x08 },
72 { 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00 },
73 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00 },
74 { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00 },
75
76 // 0x30 to 0x3f
77 { 0x0e, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0e, 0x00 },
78 { 0x04, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x1f, 0x00 },
79 { 0x0e, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1f, 0x00 },
80 { 0x1f, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0e, 0x00 },
81 { 0x02, 0x06, 0x0a, 0x12, 0x1f, 0x02, 0x02, 0x00 },
82 { 0x1f, 0x10, 0x1e, 0x01, 0x01, 0x11, 0x0e, 0x00 },
83 { 0x06, 0x08, 0x10, 0x1e, 0x11, 0x11, 0x0e, 0x00 },
84 { 0x1f, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08, 0x00 },
85 { 0x0e, 0x11, 0x11, 0x0e, 0x11, 0x11, 0x0e, 0x00 },
86 { 0x0e, 0x11, 0x11, 0x0f, 0x01, 0x02, 0x0c, 0x00 },
87 { 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x00, 0x00 },
88 { 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x04, 0x08, 0x00 },
89 { 0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02, 0x00 },
90 { 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00 },
91 { 0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x00 },
92 { 0x0e, 0x11, 0x01, 0x02, 0x04, 0x00, 0x04, 0x00 },
93
94 // 0x40 to 0x4f
95 { 0x0e, 0x11, 0x01, 0x0d, 0x15, 0x15, 0x0e, 0x00 },
96 { 0x0e, 0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x00 },
97 { 0x1e, 0x11, 0x11, 0x1e, 0x11, 0x11, 0x1e, 0x00 },
98 { 0x0e, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0e, 0x00 },
99 { 0x1c, 0x12, 0x11, 0x11, 0x11, 0x12, 0x1c, 0x00 },
100 { 0x1f, 0x10, 0x10, 0x1e, 0x10, 0x10, 0x1f, 0x00 },
101 { 0x1f, 0x10, 0x10, 0x1e, 0x10, 0x10, 0x10, 0x00 },
102 { 0x0e, 0x11, 0x10, 0x17, 0x11, 0x11, 0x0f, 0x00 },
103 { 0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11, 0x00 },
104 { 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1f, 0x00 },
105 { 0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0c, 0x00 },
106 { 0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11, 0x00 },
107 { 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x00 },
108 { 0x11, 0x1b, 0x15, 0x15, 0x11, 0x11, 0x11, 0x00 },
109 { 0x11, 0x11, 0x19, 0x15, 0x13, 0x11, 0x11, 0x00 },
110 { 0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e, 0x00 },
111
112 // 0x50 to 0x5f
113 { 0x1e, 0x11, 0x11, 0x1e, 0x10, 0x10, 0x10, 0x00 },
114 { 0x0e, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0d, 0x00 },
115 { 0x1e, 0x11, 0x11, 0x1e, 0x14, 0x12, 0x11, 0x00 },
116 { 0x0f, 0x10, 0x10, 0x0e, 0x01, 0x01, 0x1e, 0x00 },
117 { 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 },
118 { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e, 0x00 },
119 { 0x11, 0x11, 0x11, 0x11, 0x11, 0x0a, 0x04, 0x00 },
120 { 0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0a, 0x00 },
121 { 0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11, 0x00 },
122 { 0x11, 0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x00 },
123 { 0x1f, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1f, 0x00 },
124 { 0x0e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x00 },
125 { 0x11, 0x0a, 0x1f, 0x04, 0x1f, 0x04, 0x04, 0x00 },
126 { 0x0e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0e, 0x00 },
127 { 0x04, 0x0a, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00 },
128 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f },
129
130 // 0x60 to 0x6f
131 { 0x08, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
132 { 0x00, 0x00, 0x0e, 0x01, 0x0f, 0x11, 0x0f, 0x00 },
133 { 0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1e, 0x00 },
134 { 0x00, 0x00, 0x0e, 0x10, 0x10, 0x11, 0x0e, 0x00 },
135 { 0x01, 0x01, 0x0d, 0x13, 0x11, 0x11, 0x0f, 0x00 },
136 { 0x00, 0x00, 0x0e, 0x11, 0x1f, 0x10, 0x0e, 0x00 },
137 { 0x06, 0x09, 0x08, 0x1c, 0x08, 0x08, 0x08, 0x00 },
138 { 0x00, 0x0f, 0x11, 0x11, 0x0f, 0x01, 0x0e, 0x00 },
139 { 0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x11, 0x00 },
140 { 0x04, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x0e, 0x00 },
141 { 0x02, 0x00, 0x02, 0x02, 0x02, 0x12, 0x0c, 0x00 },
142 { 0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12, 0x00 },
143 { 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0e, 0x00 },
144 { 0x00, 0x00, 0x1a, 0x15, 0x15, 0x11, 0x11, 0x00 },
145 { 0x00, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11, 0x00 },
146 { 0x00, 0x00, 0x0e, 0x11, 0x11, 0x11, 0x0e, 0x00 },
147
148 // 0x70 to 0x7f
149 { 0x00, 0x1e, 0x11, 0x11, 0x1e, 0x10, 0x10, 0x00 },
150 { 0x00, 0x0d, 0x13, 0x11, 0x0f, 0x01, 0x01, 0x00 },
151 { 0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10, 0x00 },
152 { 0x00, 0x00, 0x0e, 0x10, 0x0e, 0x01, 0x1e, 0x00 },
153 { 0x08, 0x08, 0x1c, 0x08, 0x08, 0x09, 0x06, 0x00 },
154 { 0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0d, 0x00 },
155 { 0x00, 0x00, 0x11, 0x11, 0x11, 0x0a, 0x04, 0x00 },
156 { 0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0a, 0x00 },
157 { 0x00, 0x00, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x00 },
158 { 0x00, 0x11, 0x11, 0x11, 0x0f, 0x01, 0x0e, 0x00 },
159 { 0x00, 0x00, 0x1f, 0x02, 0x04, 0x08, 0x1f, 0x00 },
160 { 0x02, 0x04, 0x04, 0x08, 0x04, 0x04, 0x02, 0x00 },
161 { 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 },
162 { 0x08, 0x04, 0x04, 0x02, 0x04, 0x04, 0x08, 0x00 },
163 { 0x00, 0x04, 0x02, 0x1f, 0x02, 0x04, 0x00, 0x00 },
164 { 0x00, 0x04, 0x08, 0x1f, 0x08, 0x04, 0x00, 0x00 },
165
166 // 0x80 to 0x8f
167 { 0x1c, 0x10, 0x18, 0x10, 0x12, 0x02, 0x02, 0x02 },
168 { 0x1c, 0x10, 0x18, 0x16, 0x11, 0x02, 0x04, 0x07 },
169 { 0x1c, 0x10, 0x18, 0x16, 0x11, 0x02, 0x01, 0x06 },
170 { 0x1c, 0x10, 0x18, 0x15, 0x15, 0x07, 0x01, 0x01 },
171 { 0x08, 0x14, 0x14, 0x08, 0x05, 0x06, 0x05, 0x05 },
172 { 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
173 { 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f },
174 { 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f },
175 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
176 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
177 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
178 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
179 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
180 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
181 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
182 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
183
184 // 0x90 to 0x9f
185 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
186 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
187 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
188 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
189 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
190 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
191 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
192 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
193 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
194 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
195 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
196 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
197 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
198 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
199 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
200 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
201
202 // 0xa0 to 0xaf
203 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
204 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x14, 0x1c },
205 { 0x07, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00 },
206 { 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x1c },
207 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x04 },
208 { 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00 },
209 { 0x00, 0x1f, 0x01, 0x1f, 0x01, 0x02, 0x04, 0x00 },
210 { 0x00, 0x00, 0x00, 0x1f, 0x01, 0x06, 0x04, 0x08 },
211 { 0x00, 0x00, 0x00, 0x02, 0x04, 0x0c, 0x14, 0x04 },
212 { 0x00, 0x00, 0x00, 0x04, 0x1f, 0x11, 0x01, 0x06 },
213 { 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x04, 0x1f },
214 { 0x00, 0x00, 0x00, 0x02, 0x1f, 0x06, 0x0a, 0x12 },
215 { 0x00, 0x00, 0x00, 0x08, 0x1f, 0x09, 0x0a, 0x08 },
216 { 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x02, 0x1f },
217 { 0x00, 0x00, 0x00, 0x1e, 0x02, 0x1e, 0x02, 0x1e },
218 { 0x00, 0x00, 0x00, 0x00, 0x15, 0x15, 0x01, 0x06 },
219
220 // 0xb0 to 0xbf
221 { 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00 },
222 { 0x1f, 0x01, 0x05, 0x06, 0x04, 0x04, 0x08, 0x00 },
223 { 0x01, 0x02, 0x04, 0x0c, 0x14, 0x04, 0x04, 0x00 },
224 { 0x04, 0x1f, 0x11, 0x11, 0x01, 0x02, 0x04, 0x00 },
225 { 0x00, 0x1f, 0x04, 0x04, 0x04, 0x04, 0x1f, 0x00 },
226 { 0x02, 0x1f, 0x02, 0x06, 0x0a, 0x12, 0x02, 0x00 },
227 { 0x08, 0x1f, 0x09, 0x09, 0x09, 0x09, 0x12, 0x00 },
228 { 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x04, 0x04, 0x00 },
229 { 0x00, 0x0f, 0x09, 0x11, 0x01, 0x02, 0x0c, 0x00 },
230 { 0x08, 0x0f, 0x12, 0x02, 0x02, 0x02, 0x04, 0x00 },
231 { 0x00, 0x1f, 0x01, 0x01, 0x01, 0x01, 0x1f, 0x00 },
232 { 0x0a, 0x1f, 0x0a, 0x0a, 0x02, 0x04, 0x08, 0x00 },
233 { 0x00, 0x18, 0x01, 0x19, 0x01, 0x02, 0x1c, 0x00 },
234 { 0x00, 0x1f, 0x01, 0x02, 0x04, 0x0a, 0x11, 0x00 },
235 { 0x08, 0x1f, 0x09, 0x0a, 0x08, 0x08, 0x07, 0x00 },
236 { 0x00, 0x11, 0x11, 0x09, 0x01, 0x02, 0x0c, 0x00 },
237
238 // 0xc0 to 0xcf
239 { 0x00, 0x0f, 0x09, 0x15, 0x03, 0x02, 0x0c, 0x00 },
240 { 0x02, 0x1c, 0x04, 0x1f, 0x04, 0x04, 0x08, 0x00 },
241 { 0x00, 0x15, 0x15, 0x15, 0x01, 0x02, 0x04, 0x00 },
242 { 0x0e, 0x00, 0x1f, 0x04, 0x04, 0x04, 0x08, 0x00 },
243 { 0x08, 0x08, 0x08, 0x0c, 0x0a, 0x08, 0x08, 0x00 },
244 { 0x04, 0x04, 0x1f, 0x04, 0x04, 0x08, 0x10, 0x00 },
245 { 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00 },
246 { 0x00, 0x1f, 0x01, 0x0a, 0x04, 0x0a, 0x10, 0x00 },
247 { 0x04, 0x1f, 0x02, 0x04, 0x0e, 0x15, 0x04, 0x00 },
248 { 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00 },
249 { 0x00, 0x04, 0x02, 0x11, 0x11, 0x11, 0x11, 0x00 },
250 { 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x0f, 0x00 },
251 { 0x00, 0x1f, 0x01, 0x01, 0x01, 0x02, 0x04, 0x00 },
252 { 0x00, 0x08, 0x14, 0x02, 0x01, 0x01, 0x00, 0x00 },
253 { 0x04, 0x1f, 0x04, 0x04, 0x15, 0x15, 0x04, 0x00 },
254 { 0x00, 0x1f, 0x01, 0x01, 0x0a, 0x04, 0x02, 0x00 },
255
256 // 0xd0 to 0xdf
257 { 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x01, 0x00 },
258 { 0x00, 0x04, 0x08, 0x10, 0x11, 0x1f, 0x01, 0x00 },
259 { 0x00, 0x01, 0x01, 0x0a, 0x04, 0x0a, 0x10, 0x00 },
260 { 0x00, 0x1f, 0x08, 0x1f, 0x08, 0x08, 0x07, 0x00 },
261 { 0x08, 0x08, 0x1f, 0x09, 0x0a, 0x08, 0x08, 0x00 },
262 { 0x00, 0x0e, 0x02, 0x02, 0x02, 0x02, 0x1f, 0x00 },
263 { 0x00, 0x1f, 0x01, 0x1f, 0x01, 0x01, 0x1f, 0x00 },
264 { 0x0e, 0x00, 0x1f, 0x01, 0x01, 0x02, 0x04, 0x00 },
265 { 0x12, 0x12, 0x12, 0x12, 0x02, 0x04, 0x08, 0x00 },
266 { 0x00, 0x04, 0x14, 0x14, 0x15, 0x15, 0x16, 0x00 },
267 { 0x00, 0x10, 0x10, 0x11, 0x12, 0x14, 0x18, 0x00 },
268 { 0x00, 0x1f, 0x11, 0x11, 0x11, 0x11, 0x1f, 0x00 },
269 { 0x00, 0x1f, 0x11, 0x11, 0x01, 0x02, 0x04, 0x00 },
270 { 0x00, 0x18, 0x00, 0x01, 0x01, 0x02, 0x1c, 0x00 },
271 { 0x04, 0x12, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
272 { 0x1c, 0x14, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00 },
273
274 // 0xe0 to 0xef
275 { 0x00, 0x00, 0x09, 0x15, 0x12, 0x12, 0x0d, 0x00 },
276 { 0x0a, 0x00, 0x0e, 0x01, 0x0f, 0x11, 0x0f, 0x00 },
277 { 0x00, 0x00, 0x0e, 0x11, 0x1e, 0x11, 0x1e, 0x00 },
278 { 0x00, 0x00, 0x0e, 0x10, 0x0c, 0x11, 0x0e, 0x00 },
279 { 0x00, 0x00, 0x11, 0x11, 0x13, 0x1d, 0x10, 0x00 },
280 { 0x00, 0x00, 0x0f, 0x14, 0x12, 0x11, 0x0e, 0x00 },
281 { 0x00, 0x00, 0x06, 0x19, 0x11, 0x19, 0x16, 0x00 },
282 { 0x00, 0x00, 0x0f, 0x11, 0x11, 0x13, 0x0d, 0x00 },
283 { 0x00, 0x00, 0x07, 0x04, 0x04, 0x14, 0x08, 0x00 },
284 { 0x00, 0x02, 0x1a, 0x02, 0x00, 0x00, 0x00, 0x00 },
285 { 0x02, 0x00, 0x06, 0x02, 0x02, 0x02, 0x02, 0x00 },
286 { 0x00, 0x14, 0x08, 0x14, 0x00, 0x00, 0x00, 0x00 },
287 { 0x00, 0x04, 0x0e, 0x14, 0x15, 0x0e, 0x04, 0x00 },
288 { 0x08, 0x08, 0x1c, 0x08, 0x1c, 0x08, 0x0f, 0x00 },
289 { 0x0e, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11, 0x00 },
290 { 0x0a, 0x00, 0x0e, 0x11, 0x11, 0x11, 0x0e, 0x00 },
291
292 // 0xf0 to 0xff
293 { 0x00, 0x00, 0x16, 0x19, 0x11, 0x19, 0x16, 0x00 },
294 { 0x00, 0x00, 0x0d, 0x13, 0x11, 0x13, 0x0d, 0x00 },
295 { 0x00, 0x0e, 0x11, 0x1f, 0x11, 0x11, 0x0e, 0x00 },
296 { 0x00, 0x00, 0x00, 0x0b, 0x11, 0x1a, 0x00, 0x00 },
297 { 0x00, 0x00, 0x0e, 0x11, 0x11, 0x0a, 0x1b, 0x00 },
298 { 0x0a, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0d, 0x00 },
299 { 0x1f, 0x80, 0x04, 0x02, 0x04, 0x08, 0x1f, 0x00 },
300 { 0x00, 0x00, 0x1f, 0x0a, 0x0a, 0x0a, 0x13, 0x00 },
301 { 0x1f, 0x00, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x00 },
302 { 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x0f, 0x00 },
303 { 0x00, 0x01, 0x1e, 0x04, 0x1f, 0x04, 0x04, 0x00 },
304 { 0x00, 0x00, 0x1f, 0x08, 0x0f, 0x09, 0x11, 0x00 },
305 { 0x00, 0x00, 0x1f, 0x15, 0x1f, 0x11, 0x11, 0x00 },
306 { 0x00, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x04, 0x00 },
307 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
308 { 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f }
309 };
310
311
312 //
313 // 'Fl_ILM216::Fl_ILM216()' - Create a new ILM-216 widget.
314 //
315
Fl_ILM216(int X,int Y,int W,int H,const char * L)316 Fl_ILM216::Fl_ILM216(int X, // I - X position
317 int Y, // I - Y position
318 int W, // I - Width
319 int H, // I - Height
320 const char *L) // I - Label string
321 : Fl_Widget(X, Y, W, H, L)
322 {
323
324 // Initialize defaults...
325 backlight_ = 0;
326
327 rec_ = new Fl_Pixmap(rec_xpm);
328 rec_dark_ = new Fl_Pixmap(rec_dark_xpm);
329 rec_armed_ = new Fl_Pixmap(rec_armed_xpm);
330 conn_ = new Fl_Pixmap(conn_xpm);
331 conn_dark_ = new Fl_Pixmap(conn_dark_xpm);
332
333 // Load the standard font...
334 load_font();
335
336 }
337
338
339 //
340 // 'Fl_ILM216::~Fl_ILM216()' - Delete an ILM-216 widget.
341 //
342
~Fl_ILM216(void)343 Fl_ILM216::~Fl_ILM216(void)
344 {
345 // Unload the font data...
346 for (int i = 0; i < 256; i ++)
347 {
348 if (font_[i])
349 delete font_[i];
350
351 if (outline_[i])
352 delete outline_[i];
353 }
354 delete rec_;
355 delete rec_dark_;
356 delete rec_armed_;
357 delete conn_;
358 delete conn_dark_;
359 }
360
handle(int event)361 int Fl_ILM216::handle(int event)
362 {
363 if(event == FL_RELEASE)
364 do_callback();
365
366 return 1;
367 }
368
369
370 // 'Fl_ILM216::draw()' - Draw the widget.
371 //
372
draw(void)373 void Fl_ILM216::draw(void)
374 {
375 int i; // Looping var
376 int X = x() + (w() - 16 * 24) / 2; // X base position
377 int Y = y() + (h() - 2 * 40) / 2; // Y base position
378 Fl_Color oc; // Outline color
379
380 // Draw the background...
381 if (backlight_)
382 {
383 draw_box(box(), x(), y(), w(), h(), fl_lighter((Fl_Color)cfg.main.bg_color));
384 oc = fl_color_average((Fl_Color)cfg.main.txt_color, fl_lighter((Fl_Color)cfg.main.bg_color), 0.5f);
385 }
386 else
387 {
388 draw_box(box(), x(), y(), w(), h(), (Fl_Color)cfg.main.bg_color);
389 oc = fl_color_average((Fl_Color)cfg.main.txt_color, (Fl_Color)cfg.main.bg_color, 0.5f);
390 }
391
392 //draw the right line
393 fl_color((Fl_Color)cfg.main.txt_color);
394
395 fl_line_style(FL_SOLID, 1, NULL);
396 fl_line(X + 15*25-15, Y, X + 15*25-15, Y+40*2);
397 fl_line_style(0);
398
399 //draw the status symbols
400 if(connected)
401 conn_->draw(X + 15*25 -5, Y+8);
402 else
403 conn_dark_->draw(X + 15*25 -5, Y+8);
404
405
406 if(recording)
407 rec_->draw(X + 15*25 -7, Y+8+50);
408 else if (cfg.rec.start_rec)
409 rec_armed_->draw(X + 15*25 -7, Y+8+50);
410 else
411 rec_dark_->draw(X + 15*25 -7, Y+8+50);
412
413 // Draw the LCD contents...
414 for (i = 0; i < 16; i ++)
415 {
416 fl_color((Fl_Color)cfg.main.txt_color);
417
418 if (font_[chars_[i + 0]])
419 font_[chars_[i + 0]]->draw(X + i * 24, Y);
420 if (font_[chars_[i + 16]])
421 font_[chars_[i + 16]]->draw(X + i * 24, Y + 40);
422
423 fl_color(oc);
424
425 if (outline_[chars_[i + 0]])
426 outline_[chars_[i + 0]]->draw(X + i * 24, Y);
427 if (outline_[chars_[i + 16]])
428 outline_[chars_[i + 16]]->draw(X + i * 24, Y + 40);
429 }
430 }
431
432
433 //
434 // 'Fl_LCD216::load_char()' - Load a single character in the font.
435 //
436
load_char(uchar ch,const uchar * data)437 void Fl_ILM216::load_char(uchar ch, // I - Character
438 const uchar *data) // I - 5x8 bitmap data
439 {
440 int i; // Looping var
441 uchar *fdata; // Pointer to font data
442 uchar *odata; // Pointer to outline data
443
444 // Delete the existing character, if any...
445 if (font_[ch])
446 {
447 delete font_[ch];
448 font_[ch] = 0;
449 }
450
451 if (outline_[ch])
452 {
453 //delete outline_[ch];
454 outline_[ch] = 0;
455 }
456
457 // Don't need to define blank chars...
458 if (data[0] == 0 && !memcmp(data, data + 1, 7))
459 return;
460
461 // Create a 20x32 bitmap from the 5x8 data, so that it looks like the
462 // LCD display.
463 fdata = fdata_[ch - ' '];
464 odata = odata_[ch - ' '];
465
466 memset(fdata, 0, 96);
467 memset(odata, 0, 96);
468
469 for (i = 0; i < 8; i ++, fdata += 12, odata += 12, data ++)
470 {
471 // Each bit in the source byte is mapped to a 3x3 "pixel" and a 4x4
472 // "outline" in the LCD bitmap.
473 if (*data & 0x10)
474 {
475 fdata[0] |= 0x07;
476 fdata[3] |= 0x07;
477 fdata[6] |= 0x07;
478
479 odata[0] |= 0x08;
480 odata[3] |= 0x08;
481 odata[6] |= 0x08;
482 odata[9] |= 0x0f;
483 }
484
485 if (*data & 0x08)
486 {
487 fdata[0] |= 0x70;
488 fdata[3] |= 0x70;
489 fdata[6] |= 0x70;
490
491 odata[0] |= 0x80;
492 odata[3] |= 0x80;
493 odata[6] |= 0x80;
494 odata[9] |= 0xf0;
495 }
496
497 if (*data & 0x04)
498 {
499 fdata[1] |= 0x07;
500 fdata[4] |= 0x07;
501 fdata[7] |= 0x07;
502
503 odata[1] |= 0x08;
504 odata[4] |= 0x08;
505 odata[7] |= 0x08;
506 odata[10] |= 0x0f;
507 }
508
509 if (*data & 0x02)
510 {
511 fdata[1] |= 0x70;
512 fdata[4] |= 0x70;
513 fdata[7] |= 0x70;
514
515 odata[1] |= 0x80;
516 odata[4] |= 0x80;
517 odata[7] |= 0x80;
518 odata[10] |= 0xf0;
519 }
520
521 if (*data & 0x01)
522 {
523 fdata[2] |= 0x07;
524 fdata[5] |= 0x07;
525 fdata[8] |= 0x07;
526
527 odata[2] |= 0x08;
528 odata[5] |= 0x08;
529 odata[8] |= 0x08;
530 odata[11] |= 0x0f;
531 }
532 }
533
534 // Create the bitmap image for this char...
535 font_[ch] = new Fl_Bitmap(fdata_[ch - ' '], 20, 32);
536 outline_[ch] = new Fl_Bitmap(odata_[ch - ' '], 20, 32);
537 }
538
539
540 //
541 // 'Fl_LCD216::load_font()' - Load the standard ILM-216 font.
542 //
543
load_font(void)544 void Fl_ILM216::load_font(void)
545 {
546 // Clear the font list...
547 memset(font_, 0, sizeof(font_));
548 memset(outline_, 0, sizeof(outline_));
549
550 // Load standard font data for 224 chars...
551 for (int i = 0; i < 224; i ++)
552 load_char(i + ' ', standard_font[i]);
553 }
554
555 //
556 // 'Fl_LCD216::process()' - Process data like an ILM-216.
557 //
558
print(const uchar * in,int inbytes)559 int Fl_ILM216::print(const uchar *in, int inbytes)
560 {
561
562 int nbytes;
563
564 // Loop through the input bytes...
565 nbytes = 0;
566
567 for (; inbytes > 0; inbytes --, in ++)
568 {
569 chars_[cursor_pos_++] = *in;
570
571 if(*in == '\n')
572 cursor_pos_ = 16;
573 }
574
575 redraw();
576
577 // Return the number of bytes of output...
578 return (nbytes);
579 }
580
581 //
582 // End of "$Id: Fl_ILM216.cxx,v 1.8 2003/02/26 01:59:31 easysw Exp $".
583 //
584