summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-10-17 00:11:13 +0200
committerBoris Faure <billiob@gmail.com>2019-10-17 00:11:13 +0200
commit688a45dc150e295a084b86d17d59dcd30ca54205 (patch)
tree92e91ea63b4ed5bbf49ea08287efa72d8ebfe89c
parent951b415cd99838066a45ebd44c5cfa28828294e2 (diff)
parentfd2212afd8d98c39ff8ad25d86c55557209a2a5f (diff)
Merge branch 'terminology-1.5'
Conflicts: src/bin/options_font.c
-rw-r--r--src/bin/options_font.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index d90e7e9..3945f6e 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -16,10 +16,13 @@
16 16
17typedef struct _Font_Ctx 17typedef struct _Font_Ctx
18{ 18{
19 Evas_Object *fr;
20 Evas_Object *opbox;
19 Evas_Object *op_fontslider; 21 Evas_Object *op_fontslider;
20 Evas_Object *op_fontlist; 22 Evas_Object *op_fontlist;
21 Evas_Object *op_fsml; 23 Evas_Object *op_fsml;
22 Evas_Object *op_fbig; 24 Evas_Object *op_fbig;
25 Evas_Object *cx;
23 Evas_Object *term; 26 Evas_Object *term;
24 Eina_List *fonts; 27 Eina_List *fonts;
25 Eina_Hash *fonthash; 28 Eina_Hash *fonthash;
@@ -358,14 +361,16 @@ _cb_term_resize(void *data,
358} 361}
359 362
360static void 363static void
361_cb_font_del(void *data, 364_cb_font_bolditalic(void *data,
362 Evas *_e EINA_UNUSED, 365 Evas_Object *obj,
363 Evas_Object *_obj EINA_UNUSED, 366 void *_event EINA_UNUSED)
364 void *_event EINA_UNUSED)
365{ 367{
366 Font_Ctx *ctx = data; 368 Font_Ctx *ctx = data;
367 evas_object_event_callback_del_full(ctx->term, EVAS_CALLBACK_RESIZE, 369 Config *config = ctx->config;
368 _cb_term_resize, ctx); 370
371 config->font.bolditalic = elm_check_state_get(obj);
372 termio_config_update(ctx->term);
373 config_save(config);
369} 374}
370 375
371static void 376static void
@@ -385,26 +390,20 @@ _parent_del_cb(void *data,
385 } 390 }
386 eina_hash_free(ctx->fonthash); 391 eina_hash_free(ctx->fonthash);
387 392
388 free(ctx); 393 evas_object_event_callback_del_full(ctx->term, EVAS_CALLBACK_RESIZE,
389} 394 _cb_term_resize, ctx);
390 395 evas_object_smart_callback_del_full(ctx->cx, "changed",
391static void 396 _cb_font_bolditalic, ctx);
392_cb_font_bolditalic(void *data, 397 evas_object_smart_callback_del_full(ctx->op_fontslider, "delay,changed",
393 Evas_Object *obj, 398 _cb_op_fontsize_sel, ctx);
394 void *_event EINA_UNUSED)
395{
396 Font_Ctx *ctx = data;
397 Config *config = ctx->config;
398 399
399 config->font.bolditalic = elm_check_state_get(obj); 400 free(ctx);
400 termio_config_update(ctx->term);
401 config_save(config);
402} 401}
403 402
404void 403void
405options_font(Evas_Object *opbox, Evas_Object *term) 404options_font(Evas_Object *opbox, Evas_Object *term)
406{ 405{
407 Evas_Object *o, *bx, *fr, *bx0; 406 Evas_Object *o, *bx, *bx0;
408 char buf[4096], *file, *fname; 407 char buf[4096], *file, *fname;
409 Eina_List *files, *fontlist, *l; 408 Eina_List *files, *fontlist, *l;
410 Font *f; 409 Font *f;
@@ -418,21 +417,22 @@ options_font(Evas_Object *opbox, Evas_Object *term)
418 417
419 ctx->config = config; 418 ctx->config = config;
420 ctx->term = term; 419 ctx->term = term;
420 ctx->opbox = opbox;
421 421
422 fr = o = elm_frame_add(opbox); 422 ctx->fr = o = elm_frame_add(opbox);
423 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 423 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
424 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 424 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
425 elm_object_text_set(o, _("Font")); 425 elm_object_text_set(o, _("Font"));
426 elm_box_pack_end(opbox, o); 426 elm_box_pack_end(opbox, o);
427 evas_object_show(o); 427 evas_object_show(o);
428 428
429 evas_object_event_callback_add(fr, EVAS_CALLBACK_DEL, 429 evas_object_event_callback_add(ctx->fr, EVAS_CALLBACK_DEL,
430 _parent_del_cb, ctx); 430 _parent_del_cb, ctx);
431 431
432 bx0 = o = elm_box_add(opbox); 432 bx0 = o = elm_box_add(opbox);
433 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 433 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
434 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 434 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
435 elm_object_content_set(fr, o); 435 elm_object_content_set(ctx->fr, o);
436 evas_object_show(o); 436 evas_object_show(o);
437 437
438 bx = o = elm_box_add(opbox); 438 bx = o = elm_box_add(opbox);
@@ -588,7 +588,7 @@ options_font(Evas_Object *opbox, Evas_Object *term)
588 evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 588 evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
589 evas_object_show(o); 589 evas_object_show(o);
590 590
591 o = elm_check_add(bx0); 591 ctx->cx = o = elm_check_add(bx0);
592 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 592 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
593 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); 593 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
594 elm_object_text_set(o, _("Display bold and italic in the terminal")); 594 elm_object_text_set(o, _("Display bold and italic in the terminal"));
@@ -602,6 +602,4 @@ options_font(Evas_Object *opbox, Evas_Object *term)
602 evas_object_geometry_get(term, NULL, NULL, &ctx->tsize_w, &ctx->tsize_h); 602 evas_object_geometry_get(term, NULL, NULL, &ctx->tsize_w, &ctx->tsize_h);
603 evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE, 603 evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
604 _cb_term_resize, ctx); 604 _cb_term_resize, ctx);
605 evas_object_event_callback_add(opbox, EVAS_CALLBACK_DEL,
606 _cb_font_del, ctx);
607} 605}