add option to enable bold/italic (on by default)
This commit is contained in:
parent
a0b7fae2dd
commit
d9276909a4
|
@ -7,7 +7,7 @@
|
||||||
#include "col.h"
|
#include "col.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define CONF_VER 10
|
#define CONF_VER 11
|
||||||
|
|
||||||
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@ config_init(void)
|
||||||
(edd_base, Config, "font.size", font.size, EET_T_INT);
|
(edd_base, Config, "font.size", font.size, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
(edd_base, Config, "font.bitmap", font.bitmap, EET_T_UCHAR);
|
(edd_base, Config, "font.bitmap", font.bitmap, EET_T_UCHAR);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "font.bolditalic", font.bitmap, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
(edd_base, Config, "helper.email", helper.email, EET_T_STRING);
|
(edd_base, Config, "helper.email", helper.email, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
@ -229,6 +231,7 @@ config_sync(const Config *config_src, Config *config)
|
||||||
config->font.size = config_src->font.size;
|
config->font.size = config_src->font.size;
|
||||||
eina_stringshare_replace(&(config->font.name), config_src->font.name);
|
eina_stringshare_replace(&(config->font.name), config_src->font.name);
|
||||||
config->font.bitmap = config_src->font.bitmap;
|
config->font.bitmap = config_src->font.bitmap;
|
||||||
|
config->font.bolditalic = config_src->font.bolditalic;
|
||||||
config->helper.inline_please = config_src->helper.inline_please;
|
config->helper.inline_please = config_src->helper.inline_please;
|
||||||
eina_stringshare_replace(&(config->helper.email), config_src->helper.email);
|
eina_stringshare_replace(&(config->helper.email), config_src->helper.email);
|
||||||
eina_stringshare_replace(&(config->helper.url.general), config_src->helper.url.general);
|
eina_stringshare_replace(&(config->helper.url.general), config_src->helper.url.general);
|
||||||
|
@ -448,6 +451,7 @@ config_default_font_set(Config *config, Evas *evas)
|
||||||
{
|
{
|
||||||
config->font.bitmap = EINA_FALSE;
|
config->font.bitmap = EINA_FALSE;
|
||||||
config->font.size = 12;
|
config->font.size = 12;
|
||||||
|
config->font.bolditalic = EINA_TRUE;
|
||||||
eina_stringshare_del(fname);
|
eina_stringshare_del(fname);
|
||||||
}
|
}
|
||||||
#undef FONT_DEJAVU
|
#undef FONT_DEJAVU
|
||||||
|
@ -469,6 +473,7 @@ config_new(void)
|
||||||
config->font.bitmap = EINA_TRUE;
|
config->font.bitmap = EINA_TRUE;
|
||||||
config->font.name = eina_stringshare_add("nexus.pcf");
|
config->font.name = eina_stringshare_add("nexus.pcf");
|
||||||
config->font.size = 10;
|
config->font.size = 10;
|
||||||
|
config->font.bolditalic = EINA_TRUE;
|
||||||
config->helper.email = eina_stringshare_add("xdg-email");;
|
config->helper.email = eina_stringshare_add("xdg-email");;
|
||||||
config->helper.url.general = eina_stringshare_add("xdg-open");
|
config->helper.url.general = eina_stringshare_add("xdg-open");
|
||||||
config->helper.url.video = eina_stringshare_add("xdg-open");
|
config->helper.url.video = eina_stringshare_add("xdg-open");
|
||||||
|
@ -589,7 +594,10 @@ config_load(const char *key)
|
||||||
case 9:
|
case 9:
|
||||||
/* actually do nothing */
|
/* actually do nothing */
|
||||||
/*pass through*/
|
/*pass through*/
|
||||||
case CONF_VER: /* 10 */
|
case 10:
|
||||||
|
config->font.bolditalic = EINA_TRUE;
|
||||||
|
/*pass through*/
|
||||||
|
case CONF_VER: /* 11 */
|
||||||
config->version = CONF_VER;
|
config->version = CONF_VER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -643,6 +651,7 @@ config_fork(Config *config)
|
||||||
SCPY(font.orig_name);
|
SCPY(font.orig_name);
|
||||||
CPY(font.orig_size);
|
CPY(font.orig_size);
|
||||||
CPY(font.orig_bitmap);
|
CPY(font.orig_bitmap);
|
||||||
|
CPY(font.bolditalic);
|
||||||
SCPY(helper.email);
|
SCPY(helper.email);
|
||||||
SCPY(helper.url.general);
|
SCPY(helper.url.general);
|
||||||
SCPY(helper.url.video);
|
SCPY(helper.url.video);
|
||||||
|
|
|
@ -36,6 +36,7 @@ struct _Config
|
||||||
int orig_size; /* not in EET */
|
int orig_size; /* not in EET */
|
||||||
unsigned char bitmap;
|
unsigned char bitmap;
|
||||||
unsigned char orig_bitmap; /* not in EET */
|
unsigned char orig_bitmap; /* not in EET */
|
||||||
|
unsigned char bolditalic;
|
||||||
} font;
|
} font;
|
||||||
struct {
|
struct {
|
||||||
const char *email;
|
const char *email;
|
||||||
|
|
|
@ -5,34 +5,5 @@ void options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
||||||
void (*donecb) (void *data), void *donedata);
|
void (*donecb) (void *data), void *donedata);
|
||||||
Eina_Bool options_active_get(void);
|
Eina_Bool options_active_get(void);
|
||||||
|
|
||||||
#define OPTIONS_CB(_cfg_name, _inv) \
|
|
||||||
static void \
|
|
||||||
_cb_op_behavior_##_cfg_name(void *data, Evas_Object *obj, \
|
|
||||||
void *event EINA_UNUSED) \
|
|
||||||
{ \
|
|
||||||
Evas_Object *term = data; \
|
|
||||||
Config *config = termio_config_get(term); \
|
|
||||||
if (_inv) \
|
|
||||||
config->_cfg_name = !elm_check_state_get(obj); \
|
|
||||||
else \
|
|
||||||
config->_cfg_name = elm_check_state_get(obj); \
|
|
||||||
termio_config_update(term); \
|
|
||||||
windows_update(); \
|
|
||||||
config_save(config, NULL); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define OPTIONS_CX(_bx, _lbl, _cfg_name, _inv) \
|
|
||||||
do { \
|
|
||||||
o = elm_check_add(_bx); \
|
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); \
|
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); \
|
|
||||||
elm_object_text_set(o, _lbl); \
|
|
||||||
elm_check_state_set(o, _inv ? !config->_cfg_name : config->_cfg_name); \
|
|
||||||
elm_box_pack_end(_bx, o); \
|
|
||||||
evas_object_show(o); \
|
|
||||||
evas_object_smart_callback_add(o, "changed", \
|
|
||||||
_cb_op_behavior_##_cfg_name, term) \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -342,6 +342,18 @@ options_font_clear(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_font_bolditalic(void *data, Evas_Object *obj,
|
||||||
|
void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
|
||||||
|
config->font.bolditalic = elm_check_state_get(obj);
|
||||||
|
termio_config_update(term);
|
||||||
|
config_save(config, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_font(Evas_Object *opbox, Evas_Object *term)
|
options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
|
@ -522,6 +534,16 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = elm_check_add(bx0);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
elm_object_text_set(o, _("Display bold and italic in the terminal"));
|
||||||
|
elm_check_state_set(o, config->font.bolditalic);
|
||||||
|
elm_box_pack_end(bx0, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_cb_font_bolditalic, term);
|
||||||
|
|
||||||
expecting_resize = 0;
|
expecting_resize = 0;
|
||||||
evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
|
evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
|
||||||
evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
|
evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
|
||||||
|
|
|
@ -4778,7 +4778,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int fg, bg, fgext, bgext, codepoint;
|
int fg, bg, fgext, bgext, codepoint, bold, italic;
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
fg = cells[x].att.fg;
|
fg = cells[x].att.fg;
|
||||||
|
@ -4786,6 +4786,16 @@ _smart_apply(Evas_Object *obj)
|
||||||
fgext = cells[x].att.fg256;
|
fgext = cells[x].att.fg256;
|
||||||
bgext = cells[x].att.bg256;
|
bgext = cells[x].att.bg256;
|
||||||
codepoint = cells[x].codepoint;
|
codepoint = cells[x].codepoint;
|
||||||
|
if (sd->config->font.bolditalic)
|
||||||
|
{
|
||||||
|
bold = cells[x].att.bold;
|
||||||
|
italic = cells[x].att.italic;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bold = 0;
|
||||||
|
italic = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((fg == COL_DEF) && (cells[x].att.inverse ^ inv))
|
if ((fg == COL_DEF) && (cells[x].att.inverse ^ inv))
|
||||||
fg = COL_INVERSEBG;
|
fg = COL_INVERSEBG;
|
||||||
|
@ -4807,6 +4817,8 @@ _smart_apply(Evas_Object *obj)
|
||||||
if ((cells[x].att.bold) && (!fgext)) fg += 12;
|
if ((cells[x].att.bold) && (!fgext)) fg += 12;
|
||||||
if ((cells[x].att.faint) && (!fgext)) fg += 24;
|
if ((cells[x].att.faint) && (!fgext)) fg += 24;
|
||||||
if ((tc[x].codepoint != codepoint) ||
|
if ((tc[x].codepoint != codepoint) ||
|
||||||
|
(tc[x].bold != bold) ||
|
||||||
|
(tc[x].italic != italic) ||
|
||||||
(tc[x].fg != fg) ||
|
(tc[x].fg != fg) ||
|
||||||
(tc[x].bg != bg) ||
|
(tc[x].bg != bg) ||
|
||||||
(tc[x].fg_extended != fgext) ||
|
(tc[x].fg_extended != fgext) ||
|
||||||
|
@ -4821,8 +4833,16 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[x].bg_extended = bgext;
|
tc[x].bg_extended = bgext;
|
||||||
tc[x].underline = cells[x].att.underline;
|
tc[x].underline = cells[x].att.underline;
|
||||||
tc[x].strikethrough = cells[x].att.strike;
|
tc[x].strikethrough = cells[x].att.strike;
|
||||||
tc[x].bold = cells[x].att.bold;
|
if (sd->config->font.bolditalic)
|
||||||
tc[x].italic = cells[x].att.italic;
|
{
|
||||||
|
tc[x].bold = cells[x].att.bold;
|
||||||
|
tc[x].italic = cells[x].att.italic;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tc[x].bold = 0;
|
||||||
|
tc[x].italic = 0;
|
||||||
|
}
|
||||||
tc[x].double_width = cells[x].att.dblwidth;
|
tc[x].double_width = cells[x].att.dblwidth;
|
||||||
tc[x].fg = fg;
|
tc[x].fg = fg;
|
||||||
tc[x].bg = bg;
|
tc[x].bg = bg;
|
||||||
|
|
Loading…
Reference in New Issue