OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
12 KiB

  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 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  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 ---
  17. diff -Naur src/art/hrm src/art/hrm
  18. --- ./src/art/hrm Thu Jan 1 01:00:00 1970
  19. +++ ./src/art/hrm Mon Jan 28 01:20:21 2002
  20. @@ -0,0 +1,3 @@
  21. +chtype ansi[1][80] = {
  22. +{ 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,},
  23. +};
  24. diff -Naur src/art/statusbar.h src/art/statusbar.h
  25. --- ./src/art/statusbar.h Wed Apr 18 20:40:32 2001
  26. +++ ./src/art/statusbar.h Mon Jan 28 04:11:56 2002
  27. @@ -1,13 +1,14 @@
  28. -chtype ansi_sb[11][80] = {
  29. +chtype ansi_sb[12][80] = {
  30. { 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,},
  31. { 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,},
  32. { 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,},
  33. { 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,},
  34. { 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,},
  35. -{ 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,},
  36. +{ 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*/
  37. { 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,},
  38. { 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,},
  39. { 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,},
  40. { 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,},
  41. { 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,},
  42. +{ 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*/
  43. };
  44. diff -Naur src/art/test src/art/test
  45. --- ./src/art/test Thu Jan 1 01:00:00 1970
  46. +++ ./src/art/test Mon Jan 28 01:14:37 2002
  47. @@ -0,0 +1,5 @@
  48. +file type (a) ansi (i) ascii (c) c header (t) th c header (b) binary
  49. +
  50. +
  51. +
  52. +
  53. \ No newline at end of file
  54. diff -Naur src/editor.h src/editor.h
  55. --- ./src/editor.h Wed Apr 18 20:40:32 2001
  56. +++ ./src/editor.h Tue Jan 29 07:01:29 2002
  57. @@ -118,6 +118,7 @@
  58. canvas *erase_display(canvas *);
  59. void erase_line(canvas *);
  60. +void r_erase_line(canvas *);
  61. void line_add(canvas *, int);
  62. void line_delete(canvas *, int);
  63. diff -Naur src/interface.c src/interface.c
  64. --- ./src/interface.c Wed Apr 18 20:40:32 2001
  65. +++ ./src/interface.c Tue Jan 29 20:31:58 2002
  66. @@ -1453,6 +1453,10 @@
  67. case 'B':
  68. return 4;
  69. break;
  70. + case 't':
  71. + case 'T':
  72. + return 5;
  73. + break;
  74. }
  75. }
  76. return 0;
  77. @@ -1489,6 +1493,65 @@
  78. }
  79. }
  80. return 0;
  81. +}
  82. +
  83. +int savei_defname(char *defname){
  84. + int x = 0;
  85. + character ch = 0;
  86. + int offset = 24;
  87. + int done = 0;
  88. + int i_offset = 0;
  89. +
  90. + if(options.sb_top) offset = 0;
  91. +
  92. + done = 0;
  93. + i_offset = 0;
  94. +
  95. + for(x = 0; x < 80; x++)
  96. + mvaddch(offset, x, ansi_sb[SB_THC_DEFNAME][x]);
  97. +
  98. + for(x = 0; x < 20; x++)
  99. + defname[x] = '\0';
  100. +
  101. + for(x = 0; x < 20; x++)
  102. + mvaddch(offset, 19 + x, ' ');
  103. +
  104. + mvaddstr(offset, 19, defname);
  105. +
  106. + refresh();
  107. +
  108. + while(!done) {
  109. + ch = n_getch();
  110. + ch=toupper(ch);
  111. + switch(ch) {
  112. + case KEY_BACKSPACE:
  113. + defname[i_offset] = '\0';
  114. + if(i_offset > 0) i_offset--;
  115. + defname[i_offset] = '\0';
  116. + break;
  117. + case 13:
  118. + done = 1;
  119. + break;
  120. + case '_':
  121. + case '-':
  122. + if(isprint(ch)) {
  123. + defname[i_offset] = ch;
  124. + if((i_offset+1) < 20) i_offset++;
  125. + }
  126. + break;
  127. + default:
  128. + if(isalnum(ch)) {
  129. + defname[i_offset] = ch;
  130. + if((i_offset+1) < 20) i_offset++;
  131. + }
  132. + break;
  133. + }
  134. + for(x = 0; x < 20; x++)
  135. + mvaddch(offset, 19 + x, ' ');
  136. + mvaddstr(offset, 19, defname);
  137. + refresh();
  138. + }
  139. + return 1;
  140. }
  141. /* this function gets the sauce information from the user */
  142. diff -Naur src/interface.h src/interface.h
  143. --- ./src/interface.h Wed Apr 18 20:40:32 2001
  144. +++ ./src/interface.h Tue Jan 29 07:12:04 2002
  145. @@ -12,6 +12,7 @@
  146. #define SB_SAUCE_AUTHOR 8
  147. #define SB_SAUCE_GROUP 9
  148. #define SB_SAUCE_TITLE 10
  149. +#define SB_THC_DEFNAME 11
  150. #define BLOCK_SELECT 0
  151. #define BLOCK_PASTE 1
  152. @@ -25,6 +26,7 @@
  153. void draw_editor(canvas *);
  154. void draw_statusbar(canvas *);
  155. void draw_page(canvas *);
  156. +void draw_tv_sbar(canvas *);
  157. void show_page(canvas *);
  158. void draw_block(canvas *, int, int, int, int);
  159. @@ -41,10 +43,12 @@
  160. } t_filerecord;
  161. char *file_select();
  162. +char *tv_file_select(int);
  163. int savei_filetype();
  164. int savei_clearscreen();
  165. int savei_sauce(char *, char *, char *);
  166. +int savei_defname(char* defname);
  167. int is_transparent(character );
  168. void multidraw_interface();
  169. diff -Naur src/keys.h src/keys.h
  170. --- ./src/keys.h Wed Apr 18 20:40:32 2001
  171. +++ ./src/keys.h Tue Jan 29 21:16:21 2002
  172. @@ -1,8 +1,31 @@
  173. #ifndef _KEYS_H
  174. #define _KEYS_H
  175. +#define NEW_KEYCODES
  176. +
  177. #define TD_KEY_REDRAW 12
  178. +#ifdef NEW_KEYCODES
  179. +#define TD_KEY_HOME KEY_HOME
  180. +#define TD_KEY_INSERT KEY_IC
  181. +#define TD_KEY_DEL KEY_DC
  182. +#define TD_KEY_END KEY_END
  183. +#define TD_KEY_PAGEUP KEY_PPAGE
  184. +#define TD_KEY_PAGEDOWN KEY_NPAGE
  185. +
  186. +#define TD_KEY_F1 KEY_F(1)
  187. +#define TD_KEY_F2 KEY_F(2)
  188. +#define TD_KEY_F3 KEY_F(3)
  189. +#define TD_KEY_F4 KEY_F(4)
  190. +#define TD_KEY_F5 KEY_F(5)
  191. +#define TD_KEY_F6 KEY_F(6)
  192. +#define TD_KEY_F7 KEY_F(7)
  193. +#define TD_KEY_F8 KEY_F(8)
  194. +#define TD_KEY_F9 KEY_F(9)
  195. +#define TD_KEY_F10 KEY_F(10)
  196. +#define TD_KEY_F11 KEY_F(11)
  197. +#define TD_KEY_F12 KEY_F(12)
  198. +#else
  199. #define TD_KEY_HOME 701
  200. #define TD_KEY_INSERT 702
  201. #define TD_KEY_DEL 703
  202. @@ -22,6 +45,7 @@
  203. #define TD_KEY_F10 716
  204. #define TD_KEY_F11 717
  205. #define TD_KEY_F12 718
  206. +#endif
  207. #define TD_KEY_BLOCK 719
  208. diff -Naur src/multidraw.c src/multidraw.c
  209. --- ./src/multidraw.c Wed Apr 18 20:40:32 2001
  210. +++ ./src/multidraw.c Tue Jan 29 06:58:45 2002
  211. @@ -19,7 +19,7 @@
  212. -
  213. +#define _GNU_SOURCE
  214. #include <stdio.h>
  215. #include <sys/types.h>
  216. #include <sys/socket.h>
  217. diff -Naur src/options_io.h src/options_io.h
  218. --- ./src/options_io.h Wed Apr 18 20:40:32 2001
  219. +++ ./src/options_io.h Tue Jan 29 07:15:51 2002
  220. @@ -1,5 +1,6 @@
  221. #ifndef __OPTIONS_IO
  222. #define __OPTIONS_IO
  223. +void load_options(void);
  224. void save_options(void);
  225. #endif
  226. diff -Naur src/save.c src/save.c
  227. --- ./src/save.c Wed Apr 18 20:40:32 2001
  228. +++ ./src/save.c Tue Jan 29 20:17:45 2002
  229. @@ -20,6 +20,7 @@
  230. #include <stdio.h>
  231. #include <ncurses.h>
  232. +#include <stdlib.h>
  233. #include "internal.h"
  234. #include "types.h"
  235. @@ -92,6 +93,8 @@
  236. save_c(page, fd);
  237. } else if (ftype == 4) {
  238. save_bin(page, fd);
  239. + } else if (ftype == 5) {
  240. + save_t(page, fd);
  241. }
  242. fclose(fd);
  243. page->modified = 0;
  244. @@ -247,6 +250,77 @@
  245. fprintf(fd, "%ld,", page->buffer[y][x]);
  246. fprintf(fd, "},\n");
  247. + }
  248. + fprintf(fd, "};\n");
  249. + return 0;
  250. +}
  251. +
  252. +int cycle_color(int color)
  253. +{
  254. + switch(color){
  255. + case 1:
  256. + color=4;
  257. + break;
  258. + case 4:
  259. + color=1;
  260. + break;
  261. + case 3:
  262. + color=6;
  263. + break;
  264. + case 6:
  265. + color=3;
  266. + break;
  267. + }
  268. + return(color);
  269. +}
  270. +
  271. +/* this function saves the file format as a C header in TheDraw format */
  272. +int save_t(canvas *page, FILE *fd) {
  273. + int y = 0;
  274. + int x = 0;
  275. + char *defname;
  276. + colour fg = COLOUR_WHITE;
  277. + colour bg = COLOUR_BLACK;
  278. +
  279. + flag bold = FALSE;
  280. +
  281. + flag blink = FALSE;
  282. +
  283. + unsigned int attr;
  284. +
  285. +
  286. + if(!page) return 1;
  287. +
  288. + if(!fd) return 1;
  289. +
  290. + defname = malloc(20);
  291. + savei_defname(defname);
  292. +
  293. + fprintf(fd, "/* TetraDraw C Screen Image. */\n");
  294. + fprintf(fd, "#define %s_WIDTH 80\n", defname);
  295. + fprintf(fd, "#define %s_DEPTH %d\n", defname, HY(page)+1);
  296. + fprintf(fd, "#define %s_LENGTH %d\n", defname, (HY(page)+1)*160);
  297. + fprintf(fd, "unsigned char %s[] = {\n", defname);
  298. + for(y = 0; y <= HY(page); y++) {
  299. + for(x = 0; x < 80; x++){
  300. + tear_attrib(page->buffer[y][x], &fg, &bg, &bold, &blink);
  301. + fg=cycle_color(fg);
  302. + bg=cycle_color(bg);
  303. + attr=bg << 4;
  304. + attr+=fg;
  305. + if(bold){
  306. + attr+=8;
  307. + }
  308. + if(blink){
  309. + attr+=128;
  310. + }
  311. + fprintf(fd, "'%c',", (char)page->buffer[y][x]);
  312. + fprintf(fd, "0x%.2X,", attr);
  313. + if((y*80+x+1)%6==0){
  314. + fprintf(fd, "\n");
  315. + }
  316. + }
  317. +
  318. }
  319. fprintf(fd, "};\n");
  320. return 0;
  321. diff -Naur src/save.h src/save.h
  322. --- ./src/save.h Wed Apr 18 20:40:32 2001
  323. +++ ./src/save.h Tue Jan 29 07:21:50 2002
  324. @@ -3,8 +3,10 @@
  325. int save_ansi(canvas *, FILE *);
  326. int save_c(canvas *, FILE *);
  327. +int save_t(canvas *, FILE *);
  328. int save_ascii(canvas *, FILE *);
  329. int save_bin(canvas *, FILE *);
  330. +int cycle_color(int);
  331. int save_cls(FILE *);
  332. void save_file(canvas *);
  333. diff -Naur src/tetraview.c src/tetraview.c
  334. --- ./src/tetraview.c Sun Jul 29 20:40:50 2001
  335. +++ ./src/tetraview.c Tue Jan 29 07:16:39 2002
  336. @@ -34,6 +34,10 @@
  337. #include "tetraview.h"
  338. #include "highascii.h"
  339. +#include "interface.h"
  340. +#include "network.h"
  341. +#include "options_io.h"
  342. +
  343. coordinate td_maxx = 0;
  344. coordinate td_maxy = 0;