parent
548e12472e
commit
a7eb68799c
|
@ -1,6 +1,16 @@
|
||||||
|
#include "private.h"
|
||||||
#include "col.h"
|
#include "col.h"
|
||||||
|
#include <Edje.h>
|
||||||
|
|
||||||
const Color colors[2][2][12] =
|
typedef struct _Color Color;
|
||||||
|
|
||||||
|
struct _Color
|
||||||
|
{
|
||||||
|
unsigned char r, g, b, a;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const Color colors[2][2][12] =
|
||||||
{
|
{
|
||||||
{ // normal
|
{ // normal
|
||||||
{ // normal
|
{ // normal
|
||||||
|
@ -64,7 +74,7 @@ const Color colors[2][2][12] =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const Color colors256[256] =
|
static const Color colors256[256] =
|
||||||
{
|
{
|
||||||
// basic 16 repeated
|
// basic 16 repeated
|
||||||
/*
|
/*
|
||||||
|
@ -383,3 +393,62 @@ const Color colors256[256] =
|
||||||
{ 0xe4, 0xe4, 0xe4, 0xff },
|
{ 0xe4, 0xe4, 0xe4, 0xff },
|
||||||
{ 0xee, 0xee, 0xee, 0xff },
|
{ 0xee, 0xee, 0xee, 0xff },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void colors_term_init(Evas_Object *textgrid, Evas_Object *bg)
|
||||||
|
{
|
||||||
|
int c, n, l, k, j, i;
|
||||||
|
int r, g, b, a;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
for (c = 0; c < 4 * 12; c++)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf) - 1, "color-%d", c);
|
||||||
|
|
||||||
|
n = c + 24 * ( c / 24);
|
||||||
|
|
||||||
|
if (edje_object_color_class_get(bg, buf,
|
||||||
|
&r, &g, &b, &a,
|
||||||
|
NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL))
|
||||||
|
{
|
||||||
|
evas_object_textgrid_palette_set(
|
||||||
|
textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, c,
|
||||||
|
r, g, b, a);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Color color = colors[c/24][(c%24)/12][c%12];
|
||||||
|
|
||||||
|
/* normal */
|
||||||
|
evas_object_textgrid_palette_set(
|
||||||
|
textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, n,
|
||||||
|
color.r, color.g, color.b, color.a);
|
||||||
|
/* faint */
|
||||||
|
evas_object_textgrid_palette_set(
|
||||||
|
textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, n + 24,
|
||||||
|
r/2, g/2, b/2, a/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (c = 0; c < 256; c++)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf) - 1, "256color-%d", c);
|
||||||
|
|
||||||
|
if (edje_object_color_class_get(bg, buf,
|
||||||
|
&r, &g, &b, &a,
|
||||||
|
NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL))
|
||||||
|
{
|
||||||
|
evas_object_textgrid_palette_set(
|
||||||
|
textgrid, EVAS_TEXTGRID_PALETTE_EXTENDED, c,
|
||||||
|
r, g, b, a);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Color color = colors256[c];
|
||||||
|
|
||||||
|
evas_object_textgrid_palette_set(
|
||||||
|
textgrid, EVAS_TEXTGRID_PALETTE_EXTENDED, c,
|
||||||
|
color.r, color.g, color.b, color.a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
typedef struct _Color Color;
|
#ifndef _COL_H__
|
||||||
|
#define _COL_H__ 1
|
||||||
|
|
||||||
struct _Color
|
#include <Evas.h>
|
||||||
{
|
|
||||||
unsigned char r, g, b, a;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const Color colors[2][2][12];
|
void colors_term_init(Evas_Object *textgrid, Evas_Object *bg);
|
||||||
extern const Color colors256[256];
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -697,6 +697,8 @@ main_term_new(Win *wn, Config *config, const char *cmd,
|
||||||
|
|
||||||
term->term = o = termio_add(wn->win, config, cmd, login_shell, cd,
|
term->term = o = termio_add(wn->win, config, cmd, login_shell, cd,
|
||||||
size_w, size_h);
|
size_w, size_h);
|
||||||
|
colors_term_init(termio_textgrid_get(term->term), term->bg);
|
||||||
|
|
||||||
termio_win_set(o, wn->win);
|
termio_win_set(o, wn->win);
|
||||||
termio_theme_set(o, term->bg);
|
termio_theme_set(o, term->bg);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
|
|
@ -69,6 +69,7 @@ _cb_op_theme_sel(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
if (!theme_apply(edje, config, "terminology/background"))
|
if (!theme_apply(edje, config, "terminology/background"))
|
||||||
ERR("Couldn't find terminology theme!");
|
ERR("Couldn't find terminology theme!");
|
||||||
|
colors_term_init(termio_textgrid_get(t->term), edje);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -2167,30 +2167,6 @@ _smart_add(Evas_Object *obj)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
sd->grid.obj = o;
|
sd->grid.obj = o;
|
||||||
|
|
||||||
for (n = 0, l = 0; l < 2; l++) // normal/intense
|
|
||||||
{
|
|
||||||
for (k = 0; k < 2; k++) // normal/faint
|
|
||||||
{
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
evas_object_textgrid_palette_set
|
|
||||||
(o, EVAS_TEXTGRID_PALETTE_EXTENDED, n,
|
|
||||||
colors256[n].r, colors256[n].g,
|
|
||||||
colors256[n].b, colors256[n].a);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup cursor */
|
/* Setup cursor */
|
||||||
o = edje_object_add(evas_object_evas_get(obj));
|
o = edje_object_add(evas_object_evas_get(obj));
|
||||||
evas_object_pass_events_set(o, EINA_TRUE);
|
evas_object_pass_events_set(o, EINA_TRUE);
|
||||||
|
@ -2873,3 +2849,12 @@ termio_cwd_get(const Evas_Object *obj, char *buf, size_t size)
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
termio_textgrid_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Termio *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL;
|
||||||
|
|
||||||
|
return sd->grid.obj;
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _TERMIO_H__ 1
|
#define _TERMIO_H__ 1
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "col.h"
|
||||||
|
|
||||||
Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h);
|
Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h);
|
||||||
void termio_win_set(Evas_Object *obj, Evas_Object *win);
|
void termio_win_set(Evas_Object *obj, Evas_Object *win);
|
||||||
|
@ -20,5 +21,6 @@ void termio_font_size_set(Evas_Object *obj, int size);
|
||||||
void termio_grid_size_set(Evas_Object *obj, int w, int h);
|
void termio_grid_size_set(Evas_Object *obj, int w, int h);
|
||||||
pid_t termio_pid_get(const Evas_Object *obj);
|
pid_t termio_pid_get(const Evas_Object *obj);
|
||||||
Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size);
|
Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size);
|
||||||
|
Evas_Object *termio_textgrid_get(Evas_Object *obj);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue