font: update all terms to this window when changing font (size)

Closes T5012
Closes T5445
devs/iscaro/meson
Boris Faure 5 years ago
parent 70c4ba6fdb
commit e7b3265662
  1. 11
      src/bin/options_font.c
  2. 20
      src/bin/termio.c
  3. 1
      src/bin/termio.h
  4. 15
      src/bin/win.c
  5. 4
      src/bin/win.h

@ -134,6 +134,8 @@ _cb_op_font_sel(void *data,
{
Font *f = data;
Config *config = termio_config_get(f->term);
Term *term = termio_term_get(f->term);
if ((config->font.name) && (!strcmp(f->full_name, config->font.name)))
return;
if (config->font.name) eina_stringshare_del(config->font.name);
@ -144,6 +146,7 @@ _cb_op_font_sel(void *data,
elm_object_disabled_set(op_fontslider, f->bitmap);
elm_object_disabled_set(op_fbig, f->bitmap);
config_save(config, NULL);
win_font_update(term);
}
static void
@ -151,15 +154,17 @@ _cb_op_fontsize_sel(void *data,
Evas_Object *obj,
void *_event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
Evas_Object *termio_obj = data;
Config *config = termio_config_get(termio_obj);
Term *term = termio_term_get(termio_obj);
int size = elm_slider_value_get(obj) + 0.5;
if (config->font.size == size) return;
config->font.size = size;
_update_sizing(term);
_update_sizing(termio_obj);
elm_genlist_realized_items_update(op_fontlist);
config_save(config, NULL);
win_font_update(term);
}
static int

@ -465,7 +465,7 @@ _font_size_set(Evas_Object *obj, int size)
if (size < 5) size = 5;
else if (size > 100) size = 100;
if (config && config->font.size != size)
if (config)
{
config->temporary = EINA_TRUE;
config->font.size = size;
@ -476,6 +476,24 @@ _font_size_set(Evas_Object *obj, int size)
}
}
void
termio_font_update(Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
Config *config;
EINA_SAFETY_ON_NULL_RETURN(sd);
config = sd->config;
if (config)
{
sd->noreqsize = 1;
termio_config_update(obj);
sd->noreqsize = 0;
evas_object_data_del(obj, "sizedone");
}
}
void
termio_font_size_set(Evas_Object *obj, int size)
{

@ -21,6 +21,7 @@ void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y);
void termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int n);
void termio_config_update(Evas_Object *obj);
void termio_font_update(Evas_Object *obj);
Config *termio_config_get(const Evas_Object *obj);
Eina_Bool termio_take_selection(Evas_Object *obj, Elm_Sel_Type);
void termio_paste_selection(Evas_Object *obj, Elm_Sel_Type);

@ -4616,6 +4616,21 @@ win_font_size_set(Win *wn, int new_size)
for_each_term_do(wn, &_font_size_set, (void*)(intptr_t)new_size);
}
static Eina_Bool
_font_update(Term *term, void *_data EINA_UNUSED)
{
termio_font_update(term->termio);
return ECORE_CALLBACK_PASS_ON;
}
void
win_font_update(Term *term)
{
Win *wn = term->wn;
for_each_term_do(wn, &_font_update, NULL);
}
void
windows_free(void)
{

@ -59,8 +59,8 @@ void term_down(Term *term);
void term_left(Term *term);
void term_right(Term *term);
void
win_font_size_set(Win *wn, int new_size);
void win_font_size_set(Win *wn, int new_size);
void win_font_update(Term *term);
Eina_Bool
term_has_popmedia(const Term *term);

Loading…
Cancel
Save