forked from enlightenment/terminology
parent
b12b4da7e9
commit
a36cce4ef6
|
@ -1,34 +1,66 @@
|
|||
#include "col.h"
|
||||
|
||||
const Color colors[2][12] =
|
||||
const Color colors[2][2][12] =
|
||||
{
|
||||
{ // normal
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_DEF
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
|
||||
{ 0xcc, 0x33, 0x33, 0xff }, // COL_RED
|
||||
{ 0x33, 0xcc, 0x33, 0xff }, // COL_GREEN
|
||||
{ 0xcc, 0x88, 0x33, 0xff }, // COL_YELLOW
|
||||
{ 0x33, 0x33, 0xcc, 0xff }, // COL_BLUE
|
||||
{ 0xcc, 0x33, 0xcc, 0xff }, // COL_MAGENTA
|
||||
{ 0x33, 0xcc, 0xcc, 0xff }, // COL_CYAN
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x22, 0x22, 0x22, 0xff }, // COL_INVERSE
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_INVERSEBG
|
||||
{ // normal
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_DEF
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
|
||||
{ 0xcc, 0x33, 0x33, 0xff }, // COL_RED
|
||||
{ 0x33, 0xcc, 0x33, 0xff }, // COL_GREEN
|
||||
{ 0xcc, 0x88, 0x33, 0xff }, // COL_YELLOW
|
||||
{ 0x33, 0x33, 0xcc, 0xff }, // COL_BLUE
|
||||
{ 0xcc, 0x33, 0xcc, 0xff }, // COL_MAGENTA
|
||||
{ 0x33, 0xcc, 0xcc, 0xff }, // COL_CYAN
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x22, 0x22, 0x22, 0xff }, // COL_INVERSE
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
{ // bright/bold
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_DEF
|
||||
{ 0x66, 0x66, 0x66, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0x66, 0x66, 0xff }, // COL_RED
|
||||
{ 0x66, 0xff, 0x66, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0x66, 0xff }, // COL_YELLOW
|
||||
{ 0x66, 0x66, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0x66, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0x66, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
},
|
||||
{ // bright/bold
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_DEF
|
||||
{ 0x66, 0x66, 0x66, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0x66, 0x66, 0xff }, // COL_RED
|
||||
{ 0x66, 0xff, 0x66, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0x66, 0xff }, // COL_YELLOW
|
||||
{ 0x66, 0x66, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0x66, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0x66, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_INVERSEBG
|
||||
{ // intense
|
||||
{ // normal
|
||||
{ 0xdd, 0xdd, 0xdd, 0xff }, // COL_DEF
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
|
||||
{ 0xcc, 0x88, 0x88, 0xff }, // COL_RED
|
||||
{ 0x88, 0xcc, 0x88, 0xff }, // COL_GREEN
|
||||
{ 0xcc, 0xaa, 0x88, 0xff }, // COL_YELLOW
|
||||
{ 0x88, 0x88, 0xcc, 0xff }, // COL_BLUE
|
||||
{ 0xcc, 0x88, 0xcc, 0xff }, // COL_MAGENTA
|
||||
{ 0x88, 0xcc, 0xcc, 0xff }, // COL_CYAN
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
{ // bright/bold
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_DEF
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0xcc, 0xcc, 0xff }, // COL_RED
|
||||
{ 0xcc, 0xff, 0xcc, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0xcc, 0xff }, // COL_YELLOW
|
||||
{ 0xcc, 0xcc, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0xcc, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0xcc, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_INVERSE
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_INVERSEBG
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ struct _Color
|
|||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
extern const Color colors[2][12];
|
||||
extern const Color colors[2][2][12];
|
||||
extern const Color colors256[256];
|
||||
|
|
|
@ -126,10 +126,15 @@ _smart_apply(Evas_Object *obj)
|
|||
|
||||
if (cells[j].att.inverse)
|
||||
{
|
||||
int t;
|
||||
|
||||
fgext = 0;
|
||||
bgext = 0;
|
||||
fg = COL_INVERSE;
|
||||
bg = COL_INVERSEBG;
|
||||
fg = cells[j].att.fg;
|
||||
bg = cells[j].att.bg;
|
||||
if (fg == COL_DEF) fg = COL_INVERSEBG;
|
||||
if (bg == COL_DEF) bg = COL_INVERSE;
|
||||
t = bg; bg = fg; fg = t;
|
||||
if (bold)
|
||||
{
|
||||
fg += 12;
|
||||
|
@ -140,6 +145,8 @@ _smart_apply(Evas_Object *obj)
|
|||
fg += 24;
|
||||
bg += 24;
|
||||
}
|
||||
if (cells[j].att.fgintense) fg += 48;
|
||||
if (cells[j].att.bgintense) bg += 48;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,6 +166,8 @@ _smart_apply(Evas_Object *obj)
|
|||
if (!fgext) fg += 24;
|
||||
if (!bgext) bg += 24;
|
||||
}
|
||||
if (cells[j].att.fgintense) fg += 48;
|
||||
if (cells[j].att.bgintense) bg += 48;
|
||||
if ((glyph == ' ') || (glyph == 0))
|
||||
fg = COL_INVIS;
|
||||
}
|
||||
|
@ -749,7 +758,7 @@ _smart_add(Evas_Object *obj)
|
|||
Termio *sd;
|
||||
Evas_Object_Smart_Clipped_Data *cd;
|
||||
Evas_Object *o;
|
||||
int i, j, k, n;
|
||||
int i, j, k, l, n;
|
||||
|
||||
_parent_sc.add(obj);
|
||||
cd = evas_object_smart_data_get(obj);
|
||||
|
@ -767,15 +776,20 @@ _smart_add(Evas_Object *obj)
|
|||
evas_object_show(o);
|
||||
sd->grid.obj = o;
|
||||
|
||||
for (n = 0, k = 0; k < 2; k++)
|
||||
for (n = 0, l = 0; l < 2; l++) // normal/intense
|
||||
{
|
||||
for (j = 0; j < 2; j++)
|
||||
for (k = 0; k < 2; k++) // normal/faint
|
||||
{
|
||||
for (i = 0; i < 12; i++, n++)
|
||||
evas_object_textgrid_palette_set
|
||||
(o, EVAS_TEXTGRID_PALETTE_STANDARD, n,
|
||||
colors[j][i].r / (k + 1), colors[j][i].g / (k + 1),
|
||||
colors[j][i].b / (k + 1), colors[j][i].a / (k + 1));
|
||||
for (j = 0; j < 2; j++) // normal/bright
|
||||
{
|
||||
for (i = 0; i < 12; i++, n++) //colors
|
||||
evas_object_textgrid_palette_set
|
||||
(o, EVAS_TEXTGRID_PALETTE_STANDARD, n,
|
||||
colors[l][j][i].r / (k + 1),
|
||||
colors[l][j][i].g / (k + 1),
|
||||
colors[l][j][i].b / (k + 1),
|
||||
colors[l][j][i].a / (k + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (n = 0; n < 256; n++)
|
||||
|
|
|
@ -270,6 +270,8 @@ _reset_att(Termatt *att)
|
|||
att->strike = 0;
|
||||
att->fg256 = 0;
|
||||
att->bg256 = 0;
|
||||
att->fgintense = 0;
|
||||
att->bgintense = 0;
|
||||
att->autowrapped = 0;
|
||||
att->newline = 0;
|
||||
att->tab = 0;
|
||||
|
@ -433,6 +435,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
|
|||
case 37:
|
||||
ty->state.att.fg256 = 0;
|
||||
ty->state.att.fg = (arg - 30) + COL_BLACK;
|
||||
ty->state.att.fgintense = 0;
|
||||
break;
|
||||
case 38: // xterm 256 fg color ???
|
||||
// now check if next arg is 5
|
||||
|
@ -449,10 +452,12 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
|
|||
ty->state.att.fg = arg;
|
||||
}
|
||||
}
|
||||
ty->state.att.fgintense = 0;
|
||||
break;
|
||||
case 39: // default fg color
|
||||
ty->state.att.fg256 = 0;
|
||||
ty->state.att.fg = COL_DEF;
|
||||
ty->state.att.fgintense = 0;
|
||||
break;
|
||||
case 40: // bg
|
||||
case 41:
|
||||
|
@ -464,6 +469,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
|
|||
case 47:
|
||||
ty->state.att.bg256 = 0;
|
||||
ty->state.att.bg = (arg - 40) + COL_BLACK;
|
||||
ty->state.att.bgintense = 0;
|
||||
break;
|
||||
case 48: // xterm 256 bg color ???
|
||||
// now check if next arg is 5
|
||||
|
@ -480,10 +486,80 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
|
|||
ty->state.att.bg = arg;
|
||||
}
|
||||
}
|
||||
ty->state.att.bgintense = 0;
|
||||
break;
|
||||
case 49: // default bg color
|
||||
ty->state.att.bg256 = 0;
|
||||
ty->state.att.bg = COL_DEF;
|
||||
ty->state.att.bgintense = 0;
|
||||
break;
|
||||
case 90: // fg
|
||||
case 91:
|
||||
case 92:
|
||||
case 93:
|
||||
case 94:
|
||||
case 95:
|
||||
case 96:
|
||||
case 97:
|
||||
ty->state.att.fg256 = 0;
|
||||
ty->state.att.fg = (arg - 90) + COL_BLACK;
|
||||
ty->state.att.fgintense = 1;
|
||||
break;
|
||||
case 98: // xterm 256 fg color ???
|
||||
// now check if next arg is 5
|
||||
arg = _csi_arg_get(&b);
|
||||
if (arg != 5) ERR("Failed xterm 256 color fg esc 5\n");
|
||||
else
|
||||
{
|
||||
// then get next arg - should be color index 0-255
|
||||
arg = _csi_arg_get(&b);
|
||||
if (!b) ERR("Failed xterm 256 color fg esc val\n");
|
||||
else
|
||||
{
|
||||
ty->state.att.fg256 = 1;
|
||||
ty->state.att.fg = arg;
|
||||
}
|
||||
}
|
||||
ty->state.att.fgintense = 1;
|
||||
break;
|
||||
case 99: // default fg color
|
||||
ty->state.att.fg256 = 0;
|
||||
ty->state.att.fg = COL_DEF;
|
||||
ty->state.att.fgintense = 1;
|
||||
break;
|
||||
case 100: // bg
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
case 106:
|
||||
case 107:
|
||||
ty->state.att.bg256 = 0;
|
||||
ty->state.att.bg = (arg - 100) + COL_BLACK;
|
||||
ty->state.att.bgintense = 1;
|
||||
break;
|
||||
case 108: // xterm 256 bg color ???
|
||||
// now check if next arg is 5
|
||||
arg = _csi_arg_get(&b);
|
||||
if (arg != 5) ERR("Failed xterm 256 color bg esc 5\n");
|
||||
else
|
||||
{
|
||||
// then get next arg - should be color index 0-255
|
||||
arg = _csi_arg_get(&b);
|
||||
if (!b) ERR("Failed xterm 256 color bg esc val\n");
|
||||
else
|
||||
{
|
||||
ty->state.att.bg256 = 1;
|
||||
ty->state.att.bg = arg;
|
||||
}
|
||||
}
|
||||
ty->state.att.bgintense = 1;
|
||||
break;
|
||||
case 109: // default bg color
|
||||
ty->state.att.bg256 = 0;
|
||||
ty->state.att.bg = COL_DEF;
|
||||
ty->state.att.bgintense = 1;
|
||||
break;
|
||||
default: // not handled???
|
||||
ERR(" color cmd [%i] not handled\n", arg);
|
||||
|
|
|
@ -32,11 +32,12 @@ struct _Termatt
|
|||
unsigned short strike : 1;
|
||||
unsigned short fg256 : 1;
|
||||
unsigned short bg256 : 1;
|
||||
unsigned short fgintense : 1;
|
||||
unsigned short bgintense : 1;
|
||||
// below used for working out text from selections
|
||||
unsigned short autowrapped : 1;
|
||||
unsigned short newline : 1;
|
||||
unsigned short tab : 1;
|
||||
// 2 bits left
|
||||
};
|
||||
|
||||
struct _Termstate
|
||||
|
|
Loading…
Reference in New Issue