/* ---------- PAINT Message ---------- */ static void PaintMsg(WINDOW wnd) { if (Selecting) return; if (wnd == inFocus) SendMessage(GetParent(wnd), ADDSTATUS, 0, 0); twputs(wnd, GetText(wnd), 0, 0); if (ActiveMenuBar->ActiveSelection != -1 && (wnd == inFocus || mwnd != NULL)) { ATTRCHR *sel, *cp; int offset, offset1; int i; int len; sel = DFmalloc(200 * sizeof(ATTRCHR)); offset=menu[ActiveMenuBar->ActiveSelection].x1; offset1=menu[ActiveMenuBar->ActiveSelection].x2; GetText(wnd)[offset1].ch = '\0'; for (i=0; i < 200; i++) { sel[i].ch = 0; } len = offset1 - offset; memcpy(sel, GetText(wnd) + offset, (len + 1) * sizeof(ATTRCHR)); for (i=0; i < len + 1; i++) { sel[i].attrib = clr((sel[i].attrib & 0xf), SelectBackground(wnd)); } twputs(wnd, sel, offset, 0); GetText(wnd)[offset1].ch = ' '; if (mwnd == NULL && wnd == inFocus) { char *st = ActiveMenu [ActiveMenuBar->ActiveSelection].StatusText; if (st != NULL) SendMessage(GetParent(wnd), ADDSTATUS, (PARAM)st, 0); } free(sel); } }
static void DisplayAsciitab(WINDOW wnd) { int x, y, i, ch; char content[80]; SetStandardColor(wnd); memset(content, ' ', 80); PutWindowLine(wnd, " + 0 1 2 3 4 5 6 7 8 9 A B C D E F ", 0, 0); ch = 0; for (y = 0; y < 16; y++) { i = 0; content[i++] = ' '; content[i++] = (y < 10) ? ('0' + y) : ('A' + (y-10)); content[i++] = '0'; content[i++] = ' '; for (x = 0; x < 16; x++) { if (ascii_highlight == ch) { content[i++] = CHANGECOLOR; /* next chars must be 8x 8x */ content[i++] = SelectForeground(wnd)+0x80; content[i++] = SelectBackground(wnd)+0x80; } /* SelectBackground(wnd)+0x80 thechar ' ' RESETCOLOR now... */ content[i++] = ch; /* see video.h wputs limitations! */ if ((!content[i-1]) #if 0 /* video.c treats this as non-escape char in THIS context */ || (content[i-1] == CHANGECOLOR) #endif || (content[i-1] == RESETCOLOR) #ifdef TAB_TOGGLING /* also used in editor.c and video.c */ || (content[i-1] == ('\t' | 0x80)) || (content[i-1] == ('\f' | 0x80)) #endif ) content[i-1] = '*'; if (ascii_highlight == ch) content[i++] = RESETCOLOR; content[i++] = ' '; ch++; } /* x loop */ #if ASCIIWIDTH > 40 content[i++] = (y < 10) ? ('0' + y) : ('A' + (y-10)); content[i++] = '0'; content[i++] = ' '; #endif content[i++] = 0; PutWindowLine(wnd, content, 0, y+1); } /* y loop */ content[0] = 0; i = ascii_highlight; if ((!i) #if 0 /* video.c treats this as non-escape char in THIS context */ || (i == CHANGECOLOR) #endif || (i == RESETCOLOR) #ifdef TAB_TOGGLING || (i == ('\t' | 0x80)) || (i == ('\f' | 0x80)) #endif ) i = '*'; sprintf(content," Character: Alt-%d (0x%02x) (\\%03o) '%c' ", ascii_highlight, ascii_highlight, ascii_highlight, (char)i); PutWindowLine(wnd, content, 0, 17); }