20 #if defined(__linux__) 21 static const char* te[] = {
"┌",
"┐",
"└",
"┘",
"─",
"│",
"├",
"┤",
"┼",
"┬",
"┴" };
28 #if defined(__linux__) 42 #if defined(__linux__) 51 #if defined(__linux__) 63 for(
int i=0; i<m_R; i++) {
67 for(
unsigned j=0; j<nCount; j++) {
76 cell_draw(c.
x, c.
y, WC, HC);
87 for(
unsigned i=0; i<nCount; i++) {
104 #if defined(__linux__) 106 row_t& last_row = rows.at(rows.size()-1);
108 new_row.
num = last_row.
num+1;
109 for(
int j=0; j<m_C; j++) {
118 cell_draw(c.
x, c.
y, WC, HC);
120 new_row.
c.push_back(c);
125 rows.push_back(new_row);
130 return rows.size()-1;
137 #if defined(__linux__) 138 cell_t& c = get_cell(nRow, nColumn);
141 va_start(argptr, fmt);
143 vsprintf(msg, fmt, argptr);
164 #if defined(__linux__) 175 #if defined(__linux__) 186 #if defined(__linux__) 197 #if defined(__linux__) 206 #if defined(__linux__) 215 #if defined(__linux__) 224 #if defined(__linux__) 234 #if defined(__linux__) 241 #if defined(__linux__) 243 cell_t& TableEngineConsole::get_cell(
int row,
int col)
245 return rows.at(row).c.at(col);
250 void TableEngineConsole::cell_draw(
int x,
int y,
int w,
int h)
285 void TableEngineConsole::cell_draw_fix()
287 for(
int col=0; col<m_C+1; col++) {
289 for(
int row=0; row<m_R+1; row++) {
296 if((row==0) && (col != 0) && (col != m_C))
298 if((row==m_R) && (col != 0) && (col != m_C))
300 if((col && row) && (col != m_C) && (row != m_R))
302 if((col==0) & (row != 0) && (row != m_R))
304 if((col==m_C) & (row != 0) && (row != m_R))
314 int TableEngineConsole::get_pos(
int *X,
int *Y)
318 char cmd[]=
"\033[6n";
319 struct termios save,raw;
320 setvbuf(stdout, NULL, _IONBF, 0);
322 cfmakeraw(&raw); tcsetattr(0,TCSANOW,&raw);
323 if (isatty(fileno(stdin)))
326 write(1,cmd,
sizeof(cmd));
327 res = read (0 ,buf ,
sizeof(buf));
330 Y[0] = atoi(&buf[2]);
332 X[0] = atoi(&buf[5]);
334 X[0] = atoi(&buf[4]);
339 tcsetattr(0,TCSANOW,&save);
345 int TableEngineConsole::get_screen(
int *W,
int *H)
347 struct winsize ws = { 0, 0, 0, 0 };
348 if(ioctl(fileno(stdout), TIOCGWINSZ, &ws) == -1) {
void SetConsolePos(int X, int Y)
void GetConsolePos(int &X, int &Y)
int CreateTable(const char *pColumnName[], unsigned nCount, unsigned isTStudio)
int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)