2012-06-17 10:04:17 -07:00
|
|
|
#include "private.h"
|
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#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"
|
|
|
|
|
2012-06-17 02:26:01 -07:00
|
|
|
static Evas_Object *op_sbslider, *op_jumpcheck, *op_wordsep;
|
2012-06-16 07:00:00 -07:00
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_op_behavior_jump_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
2012-06-16 07:00:00 -07:00
|
|
|
{
|
2012-06-17 13:24:23 -07:00
|
|
|
Evas_Object *term = data;
|
|
|
|
Config *config = termio_config_get(term);
|
2012-06-16 07:00:00 -07:00
|
|
|
config->jump_on_change = elm_check_state_get(obj);
|
2012-06-17 13:24:23 -07:00
|
|
|
termio_config_update(term);
|
|
|
|
config_save(config, NULL);
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
2012-06-16 07:00:00 -07:00
|
|
|
{
|
2012-06-17 13:24:23 -07:00
|
|
|
Evas_Object *term = data;
|
|
|
|
Config *config = termio_config_get(term);
|
2012-06-16 10:31:54 -07:00
|
|
|
char *txt;
|
2012-06-17 13:24:23 -07:00
|
|
|
|
2012-06-16 10:31:54 -07:00
|
|
|
if (config->wordsep)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(config->wordsep);
|
|
|
|
config->wordsep = NULL;
|
|
|
|
}
|
|
|
|
txt = elm_entry_markup_to_utf8(elm_object_text_get(obj));
|
|
|
|
if (txt)
|
|
|
|
{
|
|
|
|
config->wordsep = eina_stringshare_add(txt);
|
|
|
|
free(txt);
|
|
|
|
}
|
2012-06-17 13:24:23 -07:00
|
|
|
termio_config_update(term);
|
|
|
|
config_save(config, NULL);
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_op_behavior_sback_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
2012-06-16 07:00:00 -07:00
|
|
|
{
|
2012-06-17 13:24:23 -07:00
|
|
|
Evas_Object *term = data;
|
|
|
|
Config *config = termio_config_get(term);
|
|
|
|
|
2012-06-16 10:31:54 -07:00
|
|
|
config->scrollback = elm_slider_value_get(obj) + 0.5;
|
2012-06-17 13:24:23 -07:00
|
|
|
termio_config_update(term);
|
|
|
|
config_save(config, NULL);
|
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);
|
2012-06-16 07:00:00 -07:00
|
|
|
Evas_Object *o;
|
|
|
|
char *txt;
|
|
|
|
|
|
|
|
op_jumpcheck = o = elm_check_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.5);
|
|
|
|
elm_object_text_set(o, "Jump to bottom on change");
|
|
|
|
elm_check_state_set(o, config->jump_on_change);
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "changed",
|
|
|
|
_cb_op_behavior_jump_chg, term);
|
|
|
|
|
2012-06-17 02:26:01 -07:00
|
|
|
o = elm_separator_add(opbox);
|
2012-06-16 07:00:00 -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);
|
2012-06-17 02:26:01 -07:00
|
|
|
elm_separator_horizontal_set(o, EINA_TRUE);
|
2012-06-16 07:00:00 -07:00
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
2012-06-17 02:26:01 -07:00
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
o = elm_label_add(opbox);
|
|
|
|
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, "Word separators:");
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
op_wordsep = o = elm_entry_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.5);
|
|
|
|
elm_entry_single_line_set(o, EINA_TRUE);
|
2012-06-16 11:21:48 -07:00
|
|
|
elm_entry_scrollable_set(o, EINA_TRUE);
|
|
|
|
elm_entry_scrollbar_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2012-06-16 07:00:00 -07:00
|
|
|
txt = elm_entry_utf8_to_markup(config->wordsep);
|
|
|
|
if (txt)
|
|
|
|
{
|
|
|
|
elm_object_text_set(o, txt);
|
|
|
|
free(txt);
|
|
|
|
}
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "changed",
|
|
|
|
_cb_op_behavior_wsep_chg, term);
|
|
|
|
|
2012-06-17 02:26:01 -07:00
|
|
|
o = elm_separator_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.5);
|
|
|
|
elm_separator_horizontal_set(o, EINA_TRUE);
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
o = elm_label_add(opbox);
|
|
|
|
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, "Scrollback lines:");
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
op_sbslider = o = elm_slider_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_slider_span_size_set(o, 160);
|
|
|
|
elm_slider_unit_format_set(o, "%1.0f");
|
|
|
|
elm_slider_indicator_format_set(o, "%1.0f");
|
|
|
|
elm_slider_min_max_set(o, 0, 10000);
|
|
|
|
elm_slider_value_set(o, config->scrollback);
|
|
|
|
elm_box_pack_end(opbox, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "delay,changed",
|
|
|
|
_cb_op_behavior_sback_chg, term);
|
|
|
|
|
2012-06-16 10:31:54 -07:00
|
|
|
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, 0.0);
|
2012-06-16 07:00:00 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
}
|