home *** CD-ROM | disk | FTP | other *** search
- /* dectoch.e */
- /* by D.A.Bauman on Nov-27-1989 */
- /* Modified for Epsilon V5 on Aug-16-1990 */
-
- /* Usage: ALT(CTRL('Q')): insert graphics chars from decimal value
- 251 = √ , 135 = ç , 48 = 0 , etc */
-
- /* Usage: CTRL('U') ALT(CTRL('G')): insert graphics borders from numpad:
- ┌┬┐ 7 8 9
- ├┼┤ 4 5 6
- └┴┘ 1 2 3
- │─ 0 . */
- /* Usage: CTRL('U') ALT(CTRL('T')): insert double graphics border from numpad:
- ╔╦╗ 7 8 9
- ╠╬╣ 4 5 6
- ╚╩╝ 1 2 3
- ║═ 0 . */
-
- #include "eel.h"
-
- command dec_to_char() on reg_tab[ALT(CTRL('q'))]
- {char str[80];
- int i;
- get_string(str,"Enter decimal value to insert as a char: ");
- if (*str)
- {i=strtoi(str,10);
- if (i)
- {
- bprintf("%c",i);
- }
- }
- }
-
- command select_graphics_single() on reg_tab[ALT(CTRL('g'))]
- {
- select_graphics_char(1);
- }
-
- command select_graphics_double() on reg_tab[ALT(CTRL('t'))]
- {
- select_graphics_char(2);
- }
-
- int _sgc_first=1;
- short sp[11]= {0x5200,0x4f00,0x5000,0x5100,0x4b00,0x4c00,
- 0x4d00,0x4700,0x4800,0x4900,0x5300};
-
- int select_graphics_char(type) int type;
- {int c,i,j,k=0;
- char *ptr;
- char *ptr1="│└┴┘├┼┤┌┬┐─";
- char *ptr2="║╚╩╝╠╬╣╔╦╗═";
- if (iter>1) k=1;
- iter=1;
- if (type==1) ptr=ptr1; else ptr=ptr2;
- if (_sgc_first == 1) {_sgc_first=0; set_show_graphic();}
- refresh();
- say("Select cooresponding NUM Keypad representing outline graphics char: ");
- do
- {i=getkey();
- j=0;
- for(c=0; c<11; c++) if (sp[c]==key_code) {j=ptr[c]; break;}
- if (!j)
- {if ((i==8) || (i==127)) {backward_delete_character(); refresh();}
- else if ((i==10) || (i==13)) j=10;
- else if ((i>=' ') && (i<=254)) j=i;
- /* else if ((i>=292) && (i<=302)) j=ptr[i-292]; */ /* < EEL V5.0 */
- else if (!key_code && i==309) j=ptr[5];
- else k=0;
- }
- if (j) {bprintf("%c",j); refresh();}
- iter=1;
- }
- while(k);
- say("");
- }
-