2012-06-17 10:04:17 -07:00
|
|
|
#include "private.h"
|
|
|
|
|
2019-09-29 14:03:12 -07:00
|
|
|
|
2019-06-30 06:37:34 -07:00
|
|
|
#include <math.h>
|
2012-06-16 07:00:00 -07:00
|
|
|
#include <Elementary.h>
|
2018-01-10 14:26:40 -08:00
|
|
|
#include <assert.h>
|
2019-11-24 09:06:21 -08:00
|
|
|
#include "termpty.h"
|
|
|
|
#include "backlog.h"
|
2012-06-16 07:00:00 -07:00
|
|
|
#include "config.h"
|
|
|
|
#include "termio.h"
|
|
|
|
#include "options.h"
|
2012-06-17 02:26:01 -07:00
|
|
|
#include "options_behavior.h"
|
2012-06-16 07:00:00 -07:00
|
|
|
#include "main.h"
|
2020-06-23 03:48:27 -07:00
|
|
|
#include "theme.h"
|
2012-06-16 07:00:00 -07:00
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
typedef struct _Behavior_Ctx {
|
2020-06-14 15:34:57 -07:00
|
|
|
Config *config;
|
|
|
|
Evas_Object *term;
|
2018-01-10 14:26:40 -08:00
|
|
|
Evas_Object *op_w;
|
|
|
|
Evas_Object *op_h;
|
|
|
|
Evas_Object *op_wh_current;
|
2019-11-24 09:06:21 -08:00
|
|
|
Evas_Object *backlock_label;
|
|
|
|
char *backlog_msg;
|
2018-01-10 14:26:40 -08:00
|
|
|
} Behavior_Ctx;
|
|
|
|
|
2018-08-15 10:40:06 -07:00
|
|
|
extern Eina_Bool multisense_available;
|
2012-06-16 07:00:00 -07:00
|
|
|
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CB(Behavior_Ctx, jump_on_change, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, jump_on_keypress, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, disable_visual_bell, 1);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, bell_rings, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, flicker_on_key, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, urg_bell, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, multi_instance, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, xterm_256color, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, erase_is_del, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, login_shell, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, show_tabs, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, mv_always_show, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, ty_escapes, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, changedir_to_current, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, emoji_dbl_width, 0);
|
|
|
|
OPTIONS_CB(Behavior_Ctx, group_all, 0);
|
2012-08-05 02:38:58 -07:00
|
|
|
|
2014-08-10 09:06:28 -07:00
|
|
|
static unsigned int
|
|
|
|
sback_double_to_expo_int(double d)
|
|
|
|
{
|
|
|
|
if (d < 1.0)
|
|
|
|
return 0;
|
2014-09-13 05:16:41 -07:00
|
|
|
if (d >= 17.0)
|
|
|
|
d = 17.0;
|
2014-08-10 09:06:28 -07:00
|
|
|
return 1 << (unsigned char) d;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
sback_indicator_units_format(double d)
|
|
|
|
{
|
|
|
|
return (char*)eina_stringshare_printf("%'d", sback_double_to_expo_int(d));
|
|
|
|
}
|
|
|
|
static char *
|
|
|
|
sback_units_format(double d)
|
|
|
|
{
|
|
|
|
return (char*)eina_stringshare_printf(_("%'d lines"), sback_double_to_expo_int(d));
|
|
|
|
}
|
|
|
|
|
2019-11-24 09:06:21 -08:00
|
|
|
static void
|
|
|
|
_update_backlog_title(Behavior_Ctx *ctx)
|
|
|
|
{
|
|
|
|
char *factor = " KMG";
|
|
|
|
double amount = termpty_backlog_memory_get();
|
|
|
|
|
|
|
|
while (amount > 1024.0 && factor[1] != '\0')
|
|
|
|
{
|
|
|
|
amount /= 1024;
|
|
|
|
factor++;
|
|
|
|
}
|
|
|
|
eina_stringshare_del(ctx->backlog_msg);
|
|
|
|
ctx->backlog_msg = (char*) eina_stringshare_printf(
|
|
|
|
_("Scrollback (current memory usage: %'.2f%cB):"),
|
|
|
|
amount, factor[0]);
|
|
|
|
elm_object_text_set(ctx->backlock_label, ctx->backlog_msg);
|
|
|
|
}
|
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
static void
|
2016-10-05 13:00:22 -07:00
|
|
|
_cb_op_behavior_sback_chg(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *_event EINA_UNUSED)
|
2012-06-16 07:00:00 -07:00
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
2012-06-17 13:24:23 -07:00
|
|
|
|
2014-08-10 09:06:28 -07:00
|
|
|
config->scrollback = (double) sback_double_to_expo_int(elm_slider_value_get(obj));
|
2018-01-10 14:26:40 -08:00
|
|
|
termio_config_update(ctx->term);
|
2019-11-24 09:06:21 -08:00
|
|
|
_update_backlog_title(ctx);
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|
|
|
|
|
2013-05-03 04:50:58 -07:00
|
|
|
static void
|
2016-10-05 13:00:22 -07:00
|
|
|
_cb_op_behavior_tab_zoom_slider_chg(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *_event EINA_UNUSED)
|
2013-05-03 04:50:58 -07:00
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
2013-05-03 04:50:58 -07:00
|
|
|
|
|
|
|
config->tab_zoom = (double)(int)round(elm_slider_value_get(obj) * 10.0) / 10.0;
|
2018-01-10 14:26:40 -08:00
|
|
|
termio_config_update(ctx->term);
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2013-05-03 04:50:58 -07:00
|
|
|
}
|
|
|
|
|
2017-04-26 00:15:33 -07:00
|
|
|
static void
|
|
|
|
_cb_op_behavior_custom_geometry_current_set(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *_event EINA_UNUSED)
|
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
|
|
|
|
|
|
|
if (config->custom_geometry)
|
|
|
|
{
|
|
|
|
termio_size_get(ctx->term, &config->cg_width, &config->cg_height);
|
|
|
|
elm_spinner_value_set(ctx->op_w, config->cg_width);
|
|
|
|
elm_spinner_value_set(ctx->op_h, config->cg_height);
|
|
|
|
}
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2017-04-26 00:15:33 -07:00
|
|
|
}
|
|
|
|
|
2013-04-17 12:59:20 -07:00
|
|
|
static void
|
2016-10-05 13:00:22 -07:00
|
|
|
_cb_op_behavior_custom_geometry(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *_event EINA_UNUSED)
|
2013-04-17 12:59:20 -07:00
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
2013-04-17 12:59:20 -07:00
|
|
|
|
|
|
|
config->custom_geometry = elm_check_state_get(obj);
|
|
|
|
if (config->custom_geometry)
|
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
config->cg_width = (int) elm_spinner_value_get(ctx->op_w);
|
|
|
|
config->cg_height = (int) elm_spinner_value_get(ctx->op_h);
|
2013-04-17 12:59:20 -07:00
|
|
|
}
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2013-04-17 12:59:20 -07:00
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
elm_object_disabled_set(ctx->op_w, !config->custom_geometry);
|
|
|
|
elm_object_disabled_set(ctx->op_h, !config->custom_geometry);
|
|
|
|
elm_object_disabled_set(ctx->op_wh_current, !config->custom_geometry);
|
2013-04-17 12:59:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-10-05 13:00:22 -07:00
|
|
|
_cb_op_behavior_cg_width(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *_event EINA_UNUSED)
|
2013-04-17 12:59:20 -07:00
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
2013-04-17 12:59:20 -07:00
|
|
|
|
|
|
|
if (config->custom_geometry)
|
|
|
|
{
|
|
|
|
config->cg_width = (int) elm_spinner_value_get(obj);
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2013-04-17 12:59:20 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-10-05 13:00:22 -07:00
|
|
|
_cb_op_behavior_cg_height(void *data,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *_event EINA_UNUSED)
|
2013-04-17 12:59:20 -07:00
|
|
|
{
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
2013-04-17 12:59:20 -07:00
|
|
|
|
|
|
|
if (config->custom_geometry)
|
|
|
|
{
|
|
|
|
config->cg_height = (int) elm_spinner_value_get(obj);
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2013-04-17 12:59:20 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
static void
|
|
|
|
_parent_del_cb(void *data,
|
|
|
|
Evas *_e EINA_UNUSED,
|
|
|
|
Evas_Object *_obj EINA_UNUSED,
|
|
|
|
void *_event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
|
2019-11-24 09:06:21 -08:00
|
|
|
eina_stringshare_del(ctx->backlog_msg);
|
2018-01-10 14:26:40 -08:00
|
|
|
free(ctx);
|
|
|
|
}
|
|
|
|
|
2018-03-15 13:59:43 -07:00
|
|
|
static void
|
|
|
|
_cursors_changed_cb(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Behavior_Ctx *ctx = data;
|
|
|
|
Config *config = ctx->config;
|
|
|
|
int value = elm_radio_value_get(obj) - 1;
|
|
|
|
|
|
|
|
config->disable_cursor_blink = value % 2;
|
|
|
|
config->cursor_shape = value / 2;
|
|
|
|
|
|
|
|
termio_config_update(ctx->term);
|
|
|
|
windows_update();
|
2019-09-08 10:41:16 -07:00
|
|
|
config_save(config);
|
2018-03-15 13:59:43 -07:00
|
|
|
}
|
|
|
|
|
2019-06-30 06:37:34 -07:00
|
|
|
|
2018-03-15 13:59:43 -07:00
|
|
|
static void
|
|
|
|
_add_cursors_option(Evas_Object *bx,
|
|
|
|
Behavior_Ctx *ctx)
|
|
|
|
{
|
2019-05-26 13:41:26 -07:00
|
|
|
Evas_Object *lbl, *rd, *rdg, *layout;
|
2018-03-15 13:59:43 -07:00
|
|
|
|
|
|
|
lbl = elm_label_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(lbl, 0.0, 0.0);
|
|
|
|
elm_layout_text_set(lbl, NULL, _("Default cursor:"));
|
|
|
|
elm_box_pack_end(bx, lbl);
|
|
|
|
evas_object_show(lbl);
|
|
|
|
|
|
|
|
/* Blinking Block */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
rdg = rd;
|
|
|
|
elm_object_text_set(rd, _("Blinking Block"));
|
|
|
|
elm_radio_state_value_set(rd, 1);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
/* Steady Block */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
elm_object_text_set(rd, _("Steady Block"));
|
|
|
|
elm_radio_state_value_set(rd, 2);
|
|
|
|
elm_radio_group_add(rd, rdg);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in,noblink", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
/* Blinking Underline */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
elm_object_text_set(rd, _("Blinking Underline"));
|
|
|
|
elm_radio_state_value_set(rd, 3);
|
|
|
|
elm_radio_group_add(rd, rdg);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor_underline");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
/* Steady Underline */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
elm_object_text_set(rd, _("Steady Underline"));
|
|
|
|
elm_radio_state_value_set(rd, 4);
|
|
|
|
elm_radio_group_add(rd, rdg);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor_underline");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in,noblink", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
/* Blinking Bar */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
elm_object_text_set(rd, _("Blinking Bar"));
|
|
|
|
elm_radio_state_value_set(rd, 5);
|
|
|
|
elm_radio_group_add(rd, rdg);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor_bar");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
/* Steady Bar */
|
|
|
|
rd = elm_radio_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
|
|
|
|
elm_object_text_set(rd, _("Steady Bar"));
|
|
|
|
elm_radio_state_value_set(rd, 6);
|
|
|
|
elm_radio_group_add(rd, rdg);
|
|
|
|
layout = elm_layout_add(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
theme_apply_elm(layout, ctx->config, "terminology/cursor_bar");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_image_resizable_set(layout, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_object_part_content_set(rd, "icon", layout);
|
|
|
|
elm_box_pack_end(bx, rd);
|
|
|
|
evas_object_show(rd);
|
2019-05-26 10:25:44 -07:00
|
|
|
elm_layout_signal_emit(layout, "focus,out", "terminology");
|
|
|
|
elm_layout_signal_emit(layout, "focus,in,noblink", "terminology");
|
2018-03-15 13:59:43 -07:00
|
|
|
evas_object_smart_callback_add(rd, "changed", _cursors_changed_cb, ctx);
|
|
|
|
|
|
|
|
elm_radio_value_set(rdg,
|
|
|
|
1 + 2 * ctx->config->cursor_shape + (ctx->config->disable_cursor_blink ? 1 : 0));
|
|
|
|
}
|
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
void
|
|
|
|
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
|
|
|
{
|
2012-06-17 13:24:23 -07:00
|
|
|
Config *config = termio_config_get(term);
|
2019-01-21 13:11:22 -08:00
|
|
|
Evas_Object *o, *bx, *sc, *frame, *lbl;
|
2013-04-17 12:59:20 -07:00
|
|
|
int w, h;
|
2014-07-20 14:04:47 -07:00
|
|
|
const char *tooltip;
|
2018-01-10 14:26:40 -08:00
|
|
|
Behavior_Ctx *ctx;
|
2013-04-17 12:59:20 -07:00
|
|
|
|
|
|
|
termio_size_get(term, &w, &h);
|
2012-06-16 07:00:00 -07:00
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
ctx = calloc(1, sizeof(*ctx));
|
|
|
|
assert(ctx);
|
|
|
|
|
|
|
|
ctx->config = config;
|
|
|
|
ctx->term = term;
|
|
|
|
|
|
|
|
frame = o = elm_frame_add(opbox);
|
2012-09-02 07:10:31 -07:00
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2014-07-20 14:04:47 -07:00
|
|
|
elm_object_text_set(o, _("Behavior"));
|
2012-09-02 07:10:31 -07:00
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
|
|
|
|
_parent_del_cb, ctx);
|
|
|
|
|
2012-07-16 23:57:41 -07:00
|
|
|
sc = o = elm_scroller_add(opbox);
|
|
|
|
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
|
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2018-01-10 14:26:40 -08:00
|
|
|
elm_object_content_set(frame, o);
|
2012-07-16 23:57:41 -07:00
|
|
|
evas_object_show(o);
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2012-07-16 23:57:41 -07:00
|
|
|
bx = o = elm_box_add(opbox);
|
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
|
|
|
elm_object_content_set(sc, o);
|
|
|
|
evas_object_show(o);
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2020-06-14 15:34:57 -07:00
|
|
|
OPTIONS_CX(_("Show tabs"), show_tabs, 0);
|
|
|
|
OPTIONS_SEPARATOR;
|
|
|
|
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CX(_("Scroll to bottom on new content"), jump_on_change, 0);
|
|
|
|
OPTIONS_CX(_("Scroll to bottom when a key is pressed"), jump_on_keypress, 0);
|
|
|
|
|
|
|
|
OPTIONS_SEPARATOR;
|
2019-01-21 13:11:22 -08:00
|
|
|
|
2018-03-15 13:59:43 -07:00
|
|
|
_add_cursors_option(bx, ctx);
|
|
|
|
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CX(_("React to key presses"), flicker_on_key, 0);
|
2018-08-15 10:40:06 -07:00
|
|
|
if (!multisense_available)
|
|
|
|
{
|
|
|
|
lbl = elm_label_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(lbl, 0.0, 0.5);
|
|
|
|
elm_box_pack_before(bx, lbl, o);
|
|
|
|
elm_object_text_set(lbl, _("Audio Support for key presses <failure>DISABLED</failure>!"));
|
|
|
|
evas_object_show(lbl);
|
|
|
|
}
|
2020-06-14 15:34:57 -07:00
|
|
|
OPTIONS_SEPARATOR;
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CX(_("Visual Bell"), disable_visual_bell, 1);
|
|
|
|
OPTIONS_CX(_("Bell rings"), bell_rings, 0);
|
|
|
|
OPTIONS_CX(_("Urgent Bell"), urg_bell, 0);
|
2020-06-14 15:34:57 -07:00
|
|
|
OPTIONS_SEPARATOR;
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CX(_("Multiple instances, one process"), multi_instance, 0);
|
|
|
|
OPTIONS_CX(_("Set TERM to xterm-256color"), xterm_256color, 0);
|
|
|
|
OPTIONS_CX(_("BackArrow sends Del (instead of BackSpace)"), erase_is_del, 0);
|
|
|
|
OPTIONS_CX(_("Start as login shell"), login_shell, 0);
|
2020-06-14 15:34:57 -07:00
|
|
|
OPTIONS_CX(_("Open new terminals in current working directory"), changedir_to_current, 0);
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_CX(_("Always show miniview"), mv_always_show, 0);
|
|
|
|
OPTIONS_CX(_("Enable special Terminology escape codes"), ty_escapes, 0);
|
|
|
|
OPTIONS_CX(_("Treat Emojis as double-width characters"), emoji_dbl_width, 0);
|
|
|
|
OPTIONS_CX(_("When grouping input, do it on all terminals and not just the visible ones"), group_all, 0);
|
|
|
|
|
|
|
|
OPTIONS_SEPARATOR;
|
2014-12-02 15:42:29 -08:00
|
|
|
|
2013-09-11 23:00:08 -07:00
|
|
|
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);
|
2014-07-20 14:04:47 -07:00
|
|
|
elm_object_text_set(o, _("Always open at size:"));
|
2013-09-28 01:50:31 -07:00
|
|
|
elm_check_state_set(o, config->custom_geometry);
|
2013-09-11 23:00:08 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "changed",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_custom_geometry, ctx);
|
2013-09-11 23:00:08 -07:00
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
ctx->op_wh_current = o = elm_button_add(bx);
|
2017-04-26 00:15:33 -07:00
|
|
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
|
|
|
elm_object_text_set(o, _("Set Current:"));
|
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
elm_object_disabled_set(o, !config->custom_geometry);
|
|
|
|
evas_object_smart_callback_add(o, "clicked",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_custom_geometry_current_set,
|
|
|
|
ctx);
|
2017-04-26 00:15:33 -07:00
|
|
|
|
2013-04-17 12:59:20 -07:00
|
|
|
o = elm_label_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
2014-07-20 14:04:47 -07:00
|
|
|
elm_object_text_set(o, _("Width:"));
|
2013-04-17 12:59:20 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
ctx->op_w = o = elm_spinner_add(bx);
|
2014-03-14 21:04:31 -07:00
|
|
|
elm_spinner_editable_set(o, EINA_TRUE);
|
2013-05-10 08:04:29 -07:00
|
|
|
elm_spinner_min_max_set(o, 2.0, 350.0);
|
2013-04-17 12:59:20 -07:00
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
2018-01-10 14:26:40 -08:00
|
|
|
if (config->custom_geometry)
|
|
|
|
elm_spinner_value_set(o, config->cg_width);
|
|
|
|
else
|
|
|
|
elm_spinner_value_set(o, w);
|
2013-04-17 12:59:20 -07:00
|
|
|
elm_object_disabled_set(o, !config->custom_geometry);
|
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "changed",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_cg_width, ctx);
|
2013-04-17 12:59:20 -07:00
|
|
|
|
|
|
|
o = elm_label_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
2014-07-20 14:04:47 -07:00
|
|
|
elm_object_text_set(o, _("Height:"));
|
2013-04-17 12:59:20 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
2018-01-10 14:26:40 -08:00
|
|
|
ctx->op_h = o = elm_spinner_add(bx);
|
2014-03-14 21:04:31 -07:00
|
|
|
elm_spinner_editable_set(o, EINA_TRUE);
|
2013-05-10 08:04:29 -07:00
|
|
|
elm_spinner_min_max_set(o, 1.0, 150.0);
|
2013-04-17 12:59:20 -07:00
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
2018-01-10 14:26:40 -08:00
|
|
|
if (config->custom_geometry)
|
|
|
|
elm_spinner_value_set(o, config->cg_height);
|
|
|
|
else
|
|
|
|
elm_spinner_value_set(o, h);
|
2013-04-17 12:59:20 -07:00
|
|
|
elm_object_disabled_set(o, !config->custom_geometry);
|
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "changed",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_cg_height, ctx);
|
2013-04-17 12:59:20 -07:00
|
|
|
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_SEPARATOR;
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2012-07-16 23:57:41 -07:00
|
|
|
o = elm_label_add(bx);
|
2012-06-16 07:00:00 -07:00
|
|
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
2019-11-24 09:06:21 -08:00
|
|
|
ctx->backlock_label = o;
|
|
|
|
_update_backlog_title(ctx);
|
2012-07-16 23:57:41 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
2012-06-16 07:00:00 -07:00
|
|
|
evas_object_show(o);
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2013-05-01 00:59:04 -07:00
|
|
|
o = elm_slider_add(bx);
|
2014-08-10 09:06:28 -07:00
|
|
|
elm_slider_indicator_format_function_set(o,
|
|
|
|
sback_indicator_units_format,
|
|
|
|
(void(*)(char*))eina_stringshare_del);
|
2019-08-05 13:26:48 -07:00
|
|
|
elm_slider_units_format_function_set(o,
|
|
|
|
sback_units_format,
|
|
|
|
(void(*)(char*))eina_stringshare_del);
|
|
|
|
elm_slider_span_size_set(o, 40);
|
|
|
|
elm_slider_step_set(o, 1);
|
2014-08-10 09:06:28 -07:00
|
|
|
/* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogFloat */
|
|
|
|
union {
|
|
|
|
float v;
|
|
|
|
int c;
|
|
|
|
} u;
|
|
|
|
u.v = config->scrollback;
|
|
|
|
u.c = (u.c >> 23) - 127;
|
2014-09-13 05:16:41 -07:00
|
|
|
elm_slider_min_max_set(o, 0.0, 17.0);
|
2014-09-07 07:36:44 -07:00
|
|
|
elm_slider_value_set(o, u.c);
|
2019-08-05 13:26:48 -07:00
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
2012-07-16 23:57:41 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
2012-06-16 07:00:00 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "delay,changed",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_sback_chg, ctx);
|
2013-05-03 04:50:58 -07:00
|
|
|
|
2020-06-14 14:14:10 -07:00
|
|
|
OPTIONS_SEPARATOR;
|
2019-06-30 06:37:34 -07:00
|
|
|
|
2013-05-03 04:50:58 -07:00
|
|
|
o = elm_label_add(bx);
|
|
|
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
|
|
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
2014-07-20 14:04:47 -07:00
|
|
|
tooltip = _("Set the time of the animation that<br>"
|
2014-03-12 20:20:32 -07:00
|
|
|
"takes places on tab switches,<br>"
|
|
|
|
"be them by key binding, mouse<br>"
|
|
|
|
"wheel or tabs panel mouse move");
|
2014-07-20 14:04:47 -07:00
|
|
|
elm_object_tooltip_text_set(o, tooltip);
|
2020-06-14 14:14:10 -07:00
|
|
|
elm_object_text_set(o, _("Tab zoom/switch animation time:"));
|
2013-05-03 04:50:58 -07:00
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
o = elm_slider_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.0);
|
|
|
|
elm_slider_span_size_set(o, 40);
|
2014-08-10 09:09:23 -07:00
|
|
|
elm_slider_unit_format_set(o, _("%1.1f s"));
|
|
|
|
elm_slider_indicator_format_set(o, _("%1.1f s"));
|
2013-10-18 11:01:33 -07:00
|
|
|
elm_slider_min_max_set(o, 0.0, 1.0);
|
2013-05-03 04:50:58 -07:00
|
|
|
elm_slider_value_set(o, config->tab_zoom);
|
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "delay,changed",
|
2018-01-10 14:26:40 -08:00
|
|
|
_cb_op_behavior_tab_zoom_slider_chg, ctx);
|
2014-01-11 06:22:18 -08:00
|
|
|
|
2012-07-16 23:57:41 -07:00
|
|
|
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-06-16 07:00:00 -07:00
|
|
|
evas_object_show(o);
|
2019-06-30 06:37:34 -07:00
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|