Applied patches from Alexey and Pavel
This commit is contained in:
@@ -369,6 +369,7 @@ void vputws (int row, int col, vatch* buf, uint len);
|
||||
void vputc (int row, int col, int atr, vchar chr);
|
||||
void vputvs (int row, int col, int atr, const vchar* str);
|
||||
void vputs (int row, int col, int atr, const char* str);
|
||||
void vputs_box (int row, int col, int atr, const char* str);
|
||||
void vputns (int row, int col, int atr, const char* str, uint len);
|
||||
void vputx (int row, int col, int atr, vchar chr, uint len);
|
||||
void vputy (int row, int col, int atr, vchar chr, uint len);
|
||||
|
@@ -79,6 +79,7 @@
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
static bool __vcurhidden = false;
|
||||
static unsigned long gvid_boxcvtc(char);
|
||||
|
||||
#if !defined(__USE_NCURSES__)
|
||||
|
||||
@@ -779,6 +780,20 @@ void vputvs(int row, int col, int atr, const vchar* str) {
|
||||
// ------------------------------------------------------------------
|
||||
// Print string with attribute at specfied location
|
||||
|
||||
void vputs_box(int row, int col, int atr, const char* str) {
|
||||
#if defined(__USE_NCURSES__)
|
||||
uint counter;
|
||||
int len = strlen(str);
|
||||
int attr = gvid_attrcalc(atr);
|
||||
move(row, col);
|
||||
for(counter = 0; counter < len; counter++)
|
||||
addch(gvid_tcpr(gvid_boxcvtc(str[counter])) | attr);
|
||||
refresh();
|
||||
#else
|
||||
vputs(row, col, atr, str);
|
||||
#endif
|
||||
}
|
||||
|
||||
void vputs(int row, int col, int atr, const char* str) {
|
||||
|
||||
#if defined(__USE_NCURSES__)
|
||||
@@ -2069,25 +2084,52 @@ chtype _box_table(int type, int c) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#if defined(__UNIX__) && !defined(__USE_NCURSES__)
|
||||
#if defined(__UNIX__)
|
||||
void gvid_boxcvt(char* s) {
|
||||
while(*s)
|
||||
*s++ = (char)gvid_boxcvtc(*s);
|
||||
}
|
||||
|
||||
while(*s) {
|
||||
switch(*s) {
|
||||
case '<EFBFBD>': *s = _box_table(8, 0); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 1); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 2); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 4); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 5); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 7); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 8); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 9); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 10); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 11); break;
|
||||
case '<EFBFBD>': *s = _box_table(8, 12); break;
|
||||
static unsigned long gvid_boxcvtc(char c) {
|
||||
switch(c) {
|
||||
#if 0
|
||||
case '<27>': return _box_table(8, 0);
|
||||
case '<27>': return _box_table(8, 1);
|
||||
case '<27>': return _box_table(8, 2);
|
||||
case '<27>': return _box_table(8, 4);
|
||||
case '<27>': return _box_table(8, 5);
|
||||
case '<27>': return _box_table(8, 7);
|
||||
case '<27>': return _box_table(8, 8);
|
||||
case '<27>': return _box_table(8, 9);
|
||||
case '<27>': return _box_table(8, 10);
|
||||
case '<27>': return _box_table(8, 11);
|
||||
case '<27>': return _box_table(8, 12);
|
||||
#else
|
||||
case '<EFBFBD>': return _box_table(0, 0);
|
||||
case '<EFBFBD>': return _box_table(0, 1);
|
||||
case '<EFBFBD>': return _box_table(0, 2);
|
||||
case '<EFBFBD>': return _box_table(0, 4);
|
||||
case '<EFBFBD>': return _box_table(0, 5);
|
||||
case '<EFBFBD>': return _box_table(0, 7);
|
||||
case '<EFBFBD>': return _box_table(0, 8);
|
||||
case '<EFBFBD>': return _box_table(0, 9);
|
||||
case '<EFBFBD>': return _box_table(0, 10);
|
||||
case '<EFBFBD>': return _box_table(0, 11);
|
||||
case '<EFBFBD>': return _box_table(0, 12);
|
||||
case '<EFBFBD>': return _box_table(1, 0);
|
||||
case '<EFBFBD>': return _box_table(1, 1);
|
||||
case '<EFBFBD>': return _box_table(1, 2);
|
||||
case '<EFBFBD>': return _box_table(1, 4);
|
||||
case '<EFBFBD>': return _box_table(1, 5);
|
||||
case '<EFBFBD>': return _box_table(1, 7);
|
||||
case '<EFBFBD>': return _box_table(1, 8);
|
||||
case '<EFBFBD>': return _box_table(1, 9);
|
||||
case '<EFBFBD>': return _box_table(1, 10);
|
||||
case '<EFBFBD>': return _box_table(1, 11);
|
||||
case '<EFBFBD>': return _box_table(1, 12);
|
||||
#endif
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -376,6 +376,7 @@ int wprintf (const char* format, ...) __attribute__ ((format (printf,
|
||||
int wprintaf (int attr, const char* format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int wprintfs (int wrow, int wcol, int attr, const char* format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
int wprints (int wrow, int wcol, int attr, const char* str);
|
||||
int wprints_box (int wrow, int wcol, int attr, const char* str);
|
||||
int wprintvs (int wrow, int wcol, int attr, const vchar* str);
|
||||
int wprintns (int wrow, int wcol, int attr, const char* str, uint len, vchar fill=' ', int fill_attr=-1);
|
||||
int wprintsf (int wrow, int wcol, int attr, const char* format, const char* str);
|
||||
|
@@ -886,6 +886,23 @@ int wprints(int wrow, int wcol, int attr, const char* str) {
|
||||
return gwin.werrno=W_NOERROR;
|
||||
}
|
||||
|
||||
int wprints_box(int wrow, int wcol, int attr, const char* str) {
|
||||
|
||||
// check for active window
|
||||
if(!gwin.total)
|
||||
return gwin.werrno=W_NOACTIVE;
|
||||
|
||||
// check for valid coordinates
|
||||
#ifdef GOLD_WCHK
|
||||
if(wchkcoord(wrow,wcol))
|
||||
return gwin.werrno=W_INVCOORD;
|
||||
#endif
|
||||
|
||||
const int &border = gwin.active->border;
|
||||
vputs_box(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,str);
|
||||
return gwin.werrno=W_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Displays a string inside active window
|
||||
|
Reference in New Issue
Block a user