forked from enlightenment/terminology
add geometry as a config parameter
We can now save custom geometry for terminology to start.
This commit is contained in:
parent
f0d8b54057
commit
174368be27
|
@ -81,6 +81,12 @@ config_init(void)
|
||||||
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
|
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
(edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR);
|
(edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "custom_geometry", custom_geometry, EET_T_UCHAR);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "cg_width", cg_width, EET_T_INT);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "cg_height", cg_height, EET_T_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -159,6 +165,9 @@ config_sync(const Config *config_src, Config *config)
|
||||||
config->urg_bell = config_src->urg_bell;
|
config->urg_bell = config_src->urg_bell;
|
||||||
config->multi_instance = config_src->multi_instance;
|
config->multi_instance = config_src->multi_instance;
|
||||||
config->temporary = config_src->temporary;
|
config->temporary = config_src->temporary;
|
||||||
|
config->custom_geometry = config_src->custom_geometry;
|
||||||
|
config->cg_width = config_src->cg_width;
|
||||||
|
config->cg_height = config_src->cg_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config *
|
Config *
|
||||||
|
@ -180,7 +189,7 @@ config_load(const char *key)
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
config->font.orig_size = config->font.size;
|
config->font.orig_size = config->font.size;
|
||||||
if (config->font.name) config->font.orig_name = eina_stringshare_add(config->font.name);
|
if (config->font.name) config->font.orig_name = eina_stringshare_add(config->font.name);
|
||||||
config->font.orig_bitmap = config->font.bitmap;
|
config->font.orig_bitmap = config->font.bitmap;
|
||||||
if (config->version < CONF_VER)
|
if (config->version < CONF_VER)
|
||||||
|
@ -407,6 +416,9 @@ config_load(const char *key)
|
||||||
config->mute = EINA_FALSE;
|
config->mute = EINA_FALSE;
|
||||||
config->urg_bell = EINA_TRUE;
|
config->urg_bell = EINA_TRUE;
|
||||||
config->multi_instance = EINA_FALSE;
|
config->multi_instance = EINA_FALSE;
|
||||||
|
config->custom_geometry = EINA_FALSE;
|
||||||
|
config->cg_width = 80;
|
||||||
|
config->cg_height = 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,6 +463,9 @@ config_fork(Config *config)
|
||||||
CPY(mute);
|
CPY(mute);
|
||||||
CPY(urg_bell);
|
CPY(urg_bell);
|
||||||
CPY(multi_instance);
|
CPY(multi_instance);
|
||||||
|
CPY(custom_geometry);
|
||||||
|
CPY(cg_width);
|
||||||
|
CPY(cg_height);
|
||||||
|
|
||||||
CPY(temporary);
|
CPY(temporary);
|
||||||
SCPY(config_key);
|
SCPY(config_key);
|
||||||
|
|
|
@ -39,7 +39,10 @@ struct _Config
|
||||||
Eina_Bool mute;
|
Eina_Bool mute;
|
||||||
Eina_Bool urg_bell;
|
Eina_Bool urg_bell;
|
||||||
Eina_Bool multi_instance;
|
Eina_Bool multi_instance;
|
||||||
|
Eina_Bool custom_geometry;
|
||||||
|
int cg_width;
|
||||||
|
int cg_height;
|
||||||
|
|
||||||
Eina_Bool temporary; /* not in EET */
|
Eina_Bool temporary; /* not in EET */
|
||||||
const char *config_key; /* not in EET, the key that config was loaded */
|
const char *config_key; /* not in EET, the key that config was loaded */
|
||||||
};
|
};
|
||||||
|
|
|
@ -2732,11 +2732,18 @@ elm_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// later allow default size to be configured
|
|
||||||
if (!size_set)
|
if (!size_set)
|
||||||
{
|
{
|
||||||
size_w = 80;
|
if (config->custom_geometry)
|
||||||
size_h = 24;
|
{
|
||||||
|
size_w = config->cg_width;
|
||||||
|
size_h = config->cg_height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_w = 80;
|
||||||
|
size_h = 24;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for now if not set - dont do login shell - later from config
|
// for now if not set - dont do login shell - later from config
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "options_behavior.h"
|
#include "options_behavior.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
static Evas_Object *op_sbslider, *op_jumpcheck, *op_wordsep;
|
static Evas_Object *op_sbslider, *op_jumpcheck, *op_wordsep, *op_w, *op_h;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_behavior_jump_keypress_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
_cb_op_behavior_jump_keypress_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
||||||
|
@ -109,12 +109,59 @@ _cb_op_behavior_sback_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_op_behavior_custom_geometry(void *data, Evas_Object *obj, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
|
||||||
|
config->custom_geometry = elm_check_state_get(obj);
|
||||||
|
if (config->custom_geometry)
|
||||||
|
{
|
||||||
|
config->cg_width = (int) elm_spinner_value_get(op_w);
|
||||||
|
config->cg_height = (int) elm_spinner_value_get(op_h);
|
||||||
|
}
|
||||||
|
config_save(config, NULL);
|
||||||
|
|
||||||
|
elm_object_disabled_set(op_w, !config->custom_geometry);
|
||||||
|
elm_object_disabled_set(op_h, !config->custom_geometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_op_behavior_cg_width(void *data, Evas_Object *obj, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
|
||||||
|
if (config->custom_geometry)
|
||||||
|
{
|
||||||
|
config->cg_width = (int) elm_spinner_value_get(obj);
|
||||||
|
config_save(config, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_op_behavior_cg_height(void *data, Evas_Object *obj, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
|
||||||
|
if (config->custom_geometry)
|
||||||
|
{
|
||||||
|
config->cg_height = (int) elm_spinner_value_get(obj);
|
||||||
|
config_save(config, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
Evas_Object *o, *bx, *sc, *fr;
|
Evas_Object *o, *bx, *sc, *fr;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
termio_size_get(term, &w, &h);
|
||||||
|
|
||||||
fr = o = elm_frame_add(opbox);
|
fr = o = elm_frame_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
@ -206,6 +253,58 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_multi_instance_chg, term);
|
_cb_op_behavior_multi_instance_chg, term);
|
||||||
|
|
||||||
|
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, "Always open terminology in custom geometry (default is 80x24):");
|
||||||
|
elm_check_state_set(o, config->custom_geometry);
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_cb_op_behavior_custom_geometry, term);
|
||||||
|
|
||||||
|
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);
|
||||||
|
elm_object_text_set(o, "Width:");
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
op_w = o = elm_spinner_add(bx);
|
||||||
|
elm_spinner_min_max_set( o, 2.0, 350.0);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
if (config->custom_geometry)
|
||||||
|
elm_spinner_value_set(o, (double) config->cg_width);
|
||||||
|
else
|
||||||
|
elm_spinner_value_set(o, (double) w);
|
||||||
|
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",
|
||||||
|
_cb_op_behavior_cg_width, term);
|
||||||
|
|
||||||
|
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);
|
||||||
|
elm_object_text_set(o, "Height:");
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
op_h = o = elm_spinner_add(bx);
|
||||||
|
elm_spinner_min_max_set( o, 1.0, 150.0);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
if (config->custom_geometry)
|
||||||
|
elm_spinner_value_set(o, (double) config->cg_height);
|
||||||
|
else
|
||||||
|
elm_spinner_value_set(o, (double) h);
|
||||||
|
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",
|
||||||
|
_cb_op_behavior_cg_height, term);
|
||||||
|
|
||||||
o = elm_separator_add(bx);
|
o = elm_separator_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
|
Loading…
Reference in New Issue