* updated kmbox (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / graphic / tetradraw / thc.patch
blob403e46b74390e80f590bad14d6d68aee3811dd34
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../tetradraw/thc.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This patch file is dual-licensed. It is available under the license the
11 # patched project is licensed under, as long as it is an OpenSource license
12 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
13 # of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 diff -Naur src/art/hrm src/art/hrm
19 --- ./src/art/hrm Thu Jan 1 01:00:00 1970
20 +++ ./src/art/hrm Mon Jan 28 01:20:21 2002
21 @@ -0,0 +1,3 @@
22 +chtype ansi[1][80] = {
23 +{ 2097766,617,620,613,32,2097780,633,624,613,32,1576,609,1577,32,2097761,622,627,617,32,1576,617,1577,32,609,627,611,2097769,617,32,1576,611,1577,32,2097763,32,616,613,609,612,613,626,32,1576,628,1577,32,2097780,616,32,611,32,616,613,609,612,613,626,32,1576,610,1577,32,2097762,617,622,609,626,633,32,32,32,32,32,32,32,32,32,32,32,32,},
24 +};
25 diff -Naur src/art/statusbar.h src/art/statusbar.h
26 --- ./src/art/statusbar.h Wed Apr 18 20:40:32 2001
27 +++ ./src/art/statusbar.h Mon Jan 28 04:11:56 2002
28 @@ -1,13 +1,14 @@
29 -chtype ansi_sb[11][80] = {
30 +chtype ansi_sb[12][80] = {
31 { 808,800,800,812,800,800,800,800,809,800,800,2099049,859,800,800,800,861,800,99,76,82,32,2099043,2099059,859,800,800,861,1568,817,2099005,32,818,2099005,32,819,2099005,32,820,2099005,32,821,2099005,32,822,2099005,32,823,2099005,32,824,2099005,32,825,2099005,32,816,2099005,32,32,32,2099035,800,800,800,800,800,800,800,800,800,2099037,800,808,800,812,800,809,32,32,},
32 { 2097762,620,623,611,619,544,1576,611,1577,544,2097763,623,624,633,544,1576,621,1577,544,2097773,623,630,613,544,1576,613,1577,544,2097765,626,609,627,613,544,1576,614,1577,544,2097766,617,620,620,544,1576,626,1577,544,2097778,613,624,620,609,611,613,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
33 { 2097762,620,623,611,619,2097696,2097776,609,627,628,613,32,1576,627,1577,1568,2097779,628,609,621,624,1568,1576,632,1577,1568,614,620,617,624,544,2097784,1568,1576,633,1577,1568,614,620,617,624,544,2097785,1568,1576,626,1577,1568,2097778,609,617,627,613,544,1576,620,1577,544,2097772,623,631,613,626,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
34 { 2097762,620,623,611,619,544,2097766,617,620,620,544,1576,614,1577,1568,2097766,623,626,613,615,626,623,629,622,612,544,1576,610,1577,544,2097762,609,611,619,615,626,623,629,622,612,544,1576,611,1577,544,2097763,616,609,626,609,611,628,613,626,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
35 { 2097762,620,623,611,619,544,2097778,613,624,620,609,611,613,544,1576,614,1577,544,2097766,623,626,613,615,626,623,629,622,612,544,1576,610,1577,544,2097762,609,611,619,615,626,623,629,622,612,544,1576,611,1577,544,2097763,616,609,626,609,611,628,613,626,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
36 -{ 2097766,617,620,613,544,2097780,633,624,613,544,1576,609,1577,544,2097761,622,627,617,544,1576,617,1577,544,609,627,611,2097769,617,544,1576,611,1577,544,2097763,544,616,613,609,612,613,626,32,1576,610,1577,32,2097762,617,622,609,626,633,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
37 +{ 2097766,617,620,613,32,2097780,633,624,613,32,1576,609,1577,32,2097761,622,627,617,32,1576,617,1577,32,609,627,611,2097769,617,32,1576,611,1577,32,2097763,32,616,613,609,612,613,626,32,1576,628,1577,32,2097780,616,32,611,32,616,613,609,612,613,626,32,1576,610,1577,32,2097762,617,622,609,626,633,32,32,32,32,32,32,32,32,32,32,32,32,},/*the save line*/
38 { 2097763,620,613,609,626,544,2097779,611,626,613,613,622,544,1576,633,1577,544,2097785,613,627,544,1576,622,1577,544,2097774,623,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
39 { 2097779,609,630,613,544,2097779,609,629,611,613,544,1576,633,1577,544,2097785,613,627,544,1576,622,1577,544,2097774,623,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
40 { 2097779,609,629,611,613,544,2097761,629,628,616,623,626,1577,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
41 { 2097779,609,629,611,613,544,2097767,626,623,629,624,1577,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
42 { 2097779,609,629,611,613,544,2097780,617,628,620,613,1577,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},
43 +{ 2097764,613,614,617,622,617,628,617,623,622,544,2097774,609,621,613,1577,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,}, /*th c format something*/
45 diff -Naur src/art/test src/art/test
46 --- ./src/art/test Thu Jan 1 01:00:00 1970
47 +++ ./src/art/test Mon Jan 28 01:14:37 2002
48 @@ -0,0 +1,5 @@
49 +\e[0m\e[1;32mf\e[0;32mile\e[37m \e[1;32mt\e[0;32mype\e[37m \e[36m(\e[32ma\e[36m)\e[37m \e[1;32ma\e[0;32mnsi\e[37m \e[36m(\e[32mi\e[36m)\e[37m \e[32masc\e[1mi\e[0;32mi\e[37m \e[36m(\e[32mc\e[36m)\e[37m \e[1;32mc\e[0;37m \e[32mheader\e[37m \e[36m(\e[32mt\e[36m)\e[37m \e[1;32mt\e[0;32mh\e[37m \e[32mc\e[37m \e[32mheader\e[37m \e[36m(\e[32mb\e[36m)\e[37m \e[1;32mb\e[0;32minary\e[37m
50 +\e[A\e[79C
52 +\e[A\e[79C
53 +\e[0m\x1a
54 \ No newline at end of file
55 diff -Naur src/editor.h src/editor.h
56 --- ./src/editor.h Wed Apr 18 20:40:32 2001
57 +++ ./src/editor.h Tue Jan 29 07:01:29 2002
58 @@ -118,6 +118,7 @@
60 canvas *erase_display(canvas *);
61 void erase_line(canvas *);
62 +void r_erase_line(canvas *);
64 void line_add(canvas *, int);
65 void line_delete(canvas *, int);
66 diff -Naur src/interface.c src/interface.c
67 --- ./src/interface.c Wed Apr 18 20:40:32 2001
68 +++ ./src/interface.c Tue Jan 29 20:31:58 2002
69 @@ -1453,6 +1453,10 @@
70 case 'B':
71 return 4;
72 break;
73 + case 't':
74 + case 'T':
75 + return 5;
76 + break;
79 return 0;
80 @@ -1489,6 +1493,65 @@
83 return 0;
86 +int savei_defname(char *defname){
87 + int x = 0;
88 + character ch = 0;
89 + int offset = 24;
90 + int done = 0;
91 + int i_offset = 0;
93 + if(options.sb_top) offset = 0;
95 + done = 0;
96 + i_offset = 0;
98 + for(x = 0; x < 80; x++)
99 + mvaddch(offset, x, ansi_sb[SB_THC_DEFNAME][x]);
101 + for(x = 0; x < 20; x++)
102 + defname[x] = '\0';
104 + for(x = 0; x < 20; x++)
105 + mvaddch(offset, 19 + x, ' ');
107 + mvaddstr(offset, 19, defname);
109 + refresh();
111 + while(!done) {
112 + ch = n_getch();
113 + ch=toupper(ch);
114 + switch(ch) {
115 + case KEY_BACKSPACE:
116 + defname[i_offset] = '\0';
117 + if(i_offset > 0) i_offset--;
118 + defname[i_offset] = '\0';
119 + break;
120 + case 13:
121 + done = 1;
122 + break;
123 + case '_':
124 + case '-':
125 + if(isprint(ch)) {
126 + defname[i_offset] = ch;
127 + if((i_offset+1) < 20) i_offset++;
129 + break;
130 + default:
131 + if(isalnum(ch)) {
132 + defname[i_offset] = ch;
133 + if((i_offset+1) < 20) i_offset++;
135 + break;
137 + for(x = 0; x < 20; x++)
138 + mvaddch(offset, 19 + x, ' ');
139 + mvaddstr(offset, 19, defname);
140 + refresh();
142 + return 1;
145 /* this function gets the sauce information from the user */
146 diff -Naur src/interface.h src/interface.h
147 --- ./src/interface.h Wed Apr 18 20:40:32 2001
148 +++ ./src/interface.h Tue Jan 29 07:12:04 2002
149 @@ -12,6 +12,7 @@
150 #define SB_SAUCE_AUTHOR 8
151 #define SB_SAUCE_GROUP 9
152 #define SB_SAUCE_TITLE 10
153 +#define SB_THC_DEFNAME 11
155 #define BLOCK_SELECT 0
156 #define BLOCK_PASTE 1
157 @@ -25,6 +26,7 @@
158 void draw_editor(canvas *);
159 void draw_statusbar(canvas *);
160 void draw_page(canvas *);
161 +void draw_tv_sbar(canvas *);
162 void show_page(canvas *);
164 void draw_block(canvas *, int, int, int, int);
165 @@ -41,10 +43,12 @@
166 } t_filerecord;
168 char *file_select();
169 +char *tv_file_select(int);
171 int savei_filetype();
172 int savei_clearscreen();
173 int savei_sauce(char *, char *, char *);
174 +int savei_defname(char* defname);
175 int is_transparent(character );
177 void multidraw_interface();
178 diff -Naur src/keys.h src/keys.h
179 --- ./src/keys.h Wed Apr 18 20:40:32 2001
180 +++ ./src/keys.h Tue Jan 29 21:16:21 2002
181 @@ -1,8 +1,31 @@
182 #ifndef _KEYS_H
183 #define _KEYS_H
185 +#define NEW_KEYCODES
187 #define TD_KEY_REDRAW 12
189 +#ifdef NEW_KEYCODES
190 +#define TD_KEY_HOME KEY_HOME
191 +#define TD_KEY_INSERT KEY_IC
192 +#define TD_KEY_DEL KEY_DC
193 +#define TD_KEY_END KEY_END
194 +#define TD_KEY_PAGEUP KEY_PPAGE
195 +#define TD_KEY_PAGEDOWN KEY_NPAGE
197 +#define TD_KEY_F1 KEY_F(1)
198 +#define TD_KEY_F2 KEY_F(2)
199 +#define TD_KEY_F3 KEY_F(3)
200 +#define TD_KEY_F4 KEY_F(4)
201 +#define TD_KEY_F5 KEY_F(5)
202 +#define TD_KEY_F6 KEY_F(6)
203 +#define TD_KEY_F7 KEY_F(7)
204 +#define TD_KEY_F8 KEY_F(8)
205 +#define TD_KEY_F9 KEY_F(9)
206 +#define TD_KEY_F10 KEY_F(10)
207 +#define TD_KEY_F11 KEY_F(11)
208 +#define TD_KEY_F12 KEY_F(12)
209 +#else
210 #define TD_KEY_HOME 701
211 #define TD_KEY_INSERT 702
212 #define TD_KEY_DEL 703
213 @@ -22,6 +45,7 @@
214 #define TD_KEY_F10 716
215 #define TD_KEY_F11 717
216 #define TD_KEY_F12 718
217 +#endif
219 #define TD_KEY_BLOCK 719
221 diff -Naur src/multidraw.c src/multidraw.c
222 --- ./src/multidraw.c Wed Apr 18 20:40:32 2001
223 +++ ./src/multidraw.c Tue Jan 29 06:58:45 2002
224 @@ -19,7 +19,7 @@
229 +#define _GNU_SOURCE
230 #include <stdio.h>
231 #include <sys/types.h>
232 #include <sys/socket.h>
233 diff -Naur src/options_io.h src/options_io.h
234 --- ./src/options_io.h Wed Apr 18 20:40:32 2001
235 +++ ./src/options_io.h Tue Jan 29 07:15:51 2002
236 @@ -1,5 +1,6 @@
237 #ifndef __OPTIONS_IO
238 #define __OPTIONS_IO
240 +void load_options(void);
241 void save_options(void);
242 #endif
243 diff -Naur src/save.c src/save.c
244 --- ./src/save.c Wed Apr 18 20:40:32 2001
245 +++ ./src/save.c Tue Jan 29 20:17:45 2002
246 @@ -20,6 +20,7 @@
248 #include <stdio.h>
249 #include <ncurses.h>
250 +#include <stdlib.h>
252 #include "internal.h"
253 #include "types.h"
254 @@ -92,6 +93,8 @@
255 save_c(page, fd);
256 } else if (ftype == 4) {
257 save_bin(page, fd);
258 + } else if (ftype == 5) {
259 + save_t(page, fd);
261 fclose(fd);
262 page->modified = 0;
263 @@ -247,6 +250,77 @@
264 fprintf(fd, "%ld,", page->buffer[y][x]);
266 fprintf(fd, "},\n");
268 + fprintf(fd, "};\n");
269 + return 0;
272 +int cycle_color(int color)
274 + switch(color){
275 + case 1:
276 + color=4;
277 + break;
278 + case 4:
279 + color=1;
280 + break;
281 + case 3:
282 + color=6;
283 + break;
284 + case 6:
285 + color=3;
286 + break;
288 + return(color);
291 +/* this function saves the file format as a C header in TheDraw format */
292 +int save_t(canvas *page, FILE *fd) {
293 + int y = 0;
294 + int x = 0;
295 + char *defname;
296 + colour fg = COLOUR_WHITE;
297 + colour bg = COLOUR_BLACK;
299 + flag bold = FALSE;
301 + flag blink = FALSE;
303 + unsigned int attr;
306 + if(!page) return 1;
308 + if(!fd) return 1;
310 + defname = malloc(20);
311 + savei_defname(defname);
313 + fprintf(fd, "/* TetraDraw C Screen Image. */\n");
314 + fprintf(fd, "#define %s_WIDTH 80\n", defname);
315 + fprintf(fd, "#define %s_DEPTH %d\n", defname, HY(page)+1);
316 + fprintf(fd, "#define %s_LENGTH %d\n", defname, (HY(page)+1)*160);
317 + fprintf(fd, "unsigned char %s[] = {\n", defname);
318 + for(y = 0; y <= HY(page); y++) {
319 + for(x = 0; x < 80; x++){
320 + tear_attrib(page->buffer[y][x], &fg, &bg, &bold, &blink);
321 + fg=cycle_color(fg);
322 + bg=cycle_color(bg);
323 + attr=bg << 4;
324 + attr+=fg;
325 + if(bold){
326 + attr+=8;
328 + if(blink){
329 + attr+=128;
331 + fprintf(fd, "'%c',", (char)page->buffer[y][x]);
332 + fprintf(fd, "0x%.2X,", attr);
333 + if((y*80+x+1)%6==0){
334 + fprintf(fd, "\n");
339 fprintf(fd, "};\n");
340 return 0;
341 diff -Naur src/save.h src/save.h
342 --- ./src/save.h Wed Apr 18 20:40:32 2001
343 +++ ./src/save.h Tue Jan 29 07:21:50 2002
344 @@ -3,8 +3,10 @@
346 int save_ansi(canvas *, FILE *);
347 int save_c(canvas *, FILE *);
348 +int save_t(canvas *, FILE *);
349 int save_ascii(canvas *, FILE *);
350 int save_bin(canvas *, FILE *);
351 +int cycle_color(int);
352 int save_cls(FILE *);
353 void save_file(canvas *);
355 diff -Naur src/tetraview.c src/tetraview.c
356 --- ./src/tetraview.c Sun Jul 29 20:40:50 2001
357 +++ ./src/tetraview.c Tue Jan 29 07:16:39 2002
358 @@ -34,6 +34,10 @@
359 #include "tetraview.h"
360 #include "highascii.h"
362 +#include "interface.h"
363 +#include "network.h"
364 +#include "options_io.h"
366 coordinate td_maxx = 0;
367 coordinate td_maxy = 0;