forked from enlightenment/terminology
Merge branch 'grouped-input'
This commit is contained in:
commit
653173bd85
2
README
2
README
|
@ -63,6 +63,8 @@ Ctrl+Shift+c = copy current selection to clipboard
|
||||||
Ctrl+Shift+v = paste current clipboard selection
|
Ctrl+Shift+v = paste current clipboard selection
|
||||||
Alt+Home = Enter command mode (enter commands to control terminology itself)
|
Alt+Home = Enter command mode (enter commands to control terminology itself)
|
||||||
Alt+Return = Paste primary selection
|
Alt+Return = Paste primary selection
|
||||||
|
Alt+g = Group input: send input to all visible terminals in the window
|
||||||
|
Alt+Shift+g = Group input: send input to all terminals in the window
|
||||||
Alt+w = Copy selection to primary
|
Alt+w = Copy selection to primary
|
||||||
Alt+Up = Focus the terminal above
|
Alt+Up = Focus the terminal above
|
||||||
Alt+Down = Focus the terminal below
|
Alt+Down = Focus the terminal below
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" Manpage for Terminology
|
.\" Manpage for Terminology
|
||||||
.TH man 1 "02 Sep 2017" "1.1.1" "Terminology man page"
|
.TH man 1 "11 Feb 2018" "1.2.0" "Terminology man page"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Terminology \- Terminal Emulator written with EFL (Enlightenment Foundation Libraries).
|
Terminology \- Terminal Emulator written with EFL (Enlightenment Foundation Libraries).
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -288,6 +288,14 @@ Enter command mode (enter commands to control terminology itself).
|
||||||
Paste primary selection.
|
Paste primary selection.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
.B Alt+g
|
||||||
|
Group input: send input to all visible terminals in the window
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.B Alt+Shift+g
|
||||||
|
Group input: send input to all terminals in the window
|
||||||
|
.
|
||||||
|
.TP
|
||||||
.B Alt+w
|
.B Alt+w
|
||||||
Copy selection to primary.
|
Copy selection to primary.
|
||||||
.
|
.
|
||||||
|
|
332
src/bin/about.c
332
src/bin/about.c
|
@ -1,24 +1,28 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
|
||||||
static Evas_Object *ab_layout = NULL, *ab_over = NULL;
|
|
||||||
static Eina_Bool ab_out = EINA_FALSE;
|
typedef struct _about_ctx {
|
||||||
static Ecore_Timer *ab_del_timer = NULL;
|
Evas_Object *layout;
|
||||||
static Evas_Object *saved_win = NULL;
|
Evas_Object *over;
|
||||||
static Evas_Object *saved_bg = NULL;
|
Evas_Object *win;
|
||||||
static void (*ab_donecb) (void *data) = NULL;
|
Evas_Object *base;
|
||||||
static void *ab_donedata = NULL;
|
Evas_Object *term;
|
||||||
|
void (*donecb) (void *data);
|
||||||
|
void *donedata;
|
||||||
|
} About_Ctx;
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_ab_del_delay(void *_data EINA_UNUSED)
|
_cb_del_delay(void *data)
|
||||||
{
|
{
|
||||||
evas_object_del(ab_layout);
|
Evas_Object *layout = data;
|
||||||
ab_layout = NULL;
|
evas_object_del(layout);
|
||||||
ab_del_timer = NULL;
|
|
||||||
elm_cache_all_flush();
|
elm_cache_all_flush();
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -29,170 +33,166 @@ _cb_mouse_down(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_ev EINA_UNUSED)
|
void *_ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
about_toggle(saved_win, saved_bg, data, ab_donecb, ab_donedata);
|
About_Ctx *ctx = data;
|
||||||
|
|
||||||
|
if (ctx->over)
|
||||||
|
{
|
||||||
|
evas_object_del(ctx->over);
|
||||||
|
}
|
||||||
|
elm_object_focus_set(ctx->layout, EINA_FALSE);
|
||||||
|
edje_object_signal_emit(ctx->base, "about,hide", "terminology");
|
||||||
|
|
||||||
|
ecore_timer_add(10.0, _cb_del_delay, ctx->layout);
|
||||||
|
ctx->layout = NULL;
|
||||||
|
|
||||||
|
if (ctx->donecb)
|
||||||
|
ctx->donecb(ctx->donedata);
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
|
||||||
void (*donecb) (void *data), void *donedata)
|
void (*donecb) (void *data), void *donedata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
About_Ctx *ctx;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
const char *txt;
|
||||||
|
|
||||||
saved_win = win;
|
ctx = malloc(sizeof(*ctx));
|
||||||
saved_bg = bg;
|
assert(ctx);
|
||||||
if (!ab_layout)
|
|
||||||
{
|
|
||||||
Config *config = termio_config_get(term);
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
const char *txt;
|
|
||||||
|
|
||||||
ab_layout = o = elm_layout_add(win);
|
ctx->win = win;
|
||||||
if (elm_layout_file_set(o, config_theme_path_get(config),
|
ctx->base = base;
|
||||||
"terminology/about") == 0)
|
ctx->term = term;
|
||||||
{
|
ctx->donecb = donecb;
|
||||||
snprintf(buf, sizeof(buf), "%s/themes/default.edj",
|
ctx->donedata = donedata;
|
||||||
elm_app_data_dir_get());
|
|
||||||
elm_layout_file_set(o, buf, "terminology/about");
|
|
||||||
}
|
|
||||||
|
|
||||||
txt = eina_stringshare_printf(_(
|
ctx->layout = o = elm_layout_add(win);
|
||||||
"<b>Terminology %s</b><br>"
|
if (elm_layout_file_set(o, config_theme_path_get(config),
|
||||||
"Why should terminals be boring?<br>"
|
"terminology/about") == 0)
|
||||||
"<br>"
|
|
||||||
"This terminal was written for Enlightenment, to use EFL "
|
|
||||||
"and otherwise push the boundaries of what a modern terminal "
|
|
||||||
"emulator should be. We hope you enjoy it.<br>"
|
|
||||||
"<br>"
|
|
||||||
"Copyright © 2012-%d by:<br>"
|
|
||||||
"<br>"
|
|
||||||
"%s" // AUTHORS
|
|
||||||
"<br>"
|
|
||||||
"<br>"
|
|
||||||
"Distributed under the 2-clause BSD license detailed below:<br>"
|
|
||||||
"<br>"
|
|
||||||
"%s" // LICENSE
|
|
||||||
),
|
|
||||||
PACKAGE_VERSION, 2018,
|
|
||||||
"Boris Faure<br>"
|
|
||||||
"Carsten Haitzler<br>"
|
|
||||||
"Gustavo Sverzut Barbieri<br>"
|
|
||||||
"Cedric BAIL<br>"
|
|
||||||
"Sebastian Dransfeld<br>"
|
|
||||||
"Wonguk Jeong<br>"
|
|
||||||
"Christopher Michael<br>"
|
|
||||||
"Daniel Juyung Seo<br>"
|
|
||||||
"Panagiotis Galatsanos<br>"
|
|
||||||
"Mike Blumenkrantz<br>"
|
|
||||||
"Aleksandar Popadić<br>"
|
|
||||||
"Massimo Maiurana<br>"
|
|
||||||
"Stefan Schmidt<br>"
|
|
||||||
"Davide Andreoli<br>"
|
|
||||||
"Gustavo Lima Chaves<br>"
|
|
||||||
"Jean-Philippe ANDRÉ<br>"
|
|
||||||
"Tom Hacohen<br>"
|
|
||||||
"Alex-P. Natsios<br>"
|
|
||||||
"Lee Gwang-O<br>"
|
|
||||||
"Jean Guyomarc'h<br>"
|
|
||||||
"Jihoon Kim<br>"
|
|
||||||
"Kai Huuhko<br>"
|
|
||||||
"Mike McCormack<br>"
|
|
||||||
"Iván Briano<br>"
|
|
||||||
"Jerome Pinot<br>"
|
|
||||||
"José Roberto de Souza<br>"
|
|
||||||
"Leandro Pereira<br>"
|
|
||||||
"Leif Middelschulte<br>"
|
|
||||||
"Markus Törnqvist<br>"
|
|
||||||
"Thibaut Broggi<br>"
|
|
||||||
"Lucas De Marchi<br>"
|
|
||||||
"Marcel Hollerbach<br>"
|
|
||||||
"Anisse Astier<br>"
|
|
||||||
"Daniel Zaoui<br>"
|
|
||||||
"Doug Newgard<br>"
|
|
||||||
"Flavio Vinicius Alvares Ceolin<br>"
|
|
||||||
"Samuel F. Baggen<br>"
|
|
||||||
"Amitesh Singh<br>"
|
|
||||||
"Anthony F McInerney<br>"
|
|
||||||
"Aurélien Larcher<br>"
|
|
||||||
"Bruno Dilly<br>"
|
|
||||||
"Conrad Meyer<br>"
|
|
||||||
"Daniel Kolesa<br>"
|
|
||||||
"Eduardo Lima<br>"
|
|
||||||
"Flavio Ceolin<br>"
|
|
||||||
"Jason L. Cook<br>"
|
|
||||||
"Jérémy Anger<br>"
|
|
||||||
"Michael BOUCHAUD<br>"
|
|
||||||
"Michael Jennings<br>"
|
|
||||||
"Nicholas Hughart<br>"
|
|
||||||
"Rafael Antognolli<br>"
|
|
||||||
"Rui Seabra<br>"
|
|
||||||
"Sanjeev BA<br>"
|
|
||||||
"Theodor van Nahl<br>"
|
|
||||||
"Vincent Torri<br>"
|
|
||||||
"tantSinnister<br>",
|
|
||||||
"All rights reserved.<br>"
|
|
||||||
"<br>"
|
|
||||||
"Redistribution and use in source and binary forms, with or "
|
|
||||||
"without modification, are permitted provided that the "
|
|
||||||
"following conditions are met:<br>"
|
|
||||||
"<br>"
|
|
||||||
"1. Redistributions of source code must retain the above "
|
|
||||||
"copyright notice, this list of conditions and the following "
|
|
||||||
"disclaimer.<br>"
|
|
||||||
"2. Redistributions in binary form must reproduce the above "
|
|
||||||
"copyright notice, this list of conditions and the following "
|
|
||||||
"disclaimer in the documentation and/or other materials "
|
|
||||||
"provided with the distribution.<br>"
|
|
||||||
"<br>"
|
|
||||||
"<b>THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESS OR "
|
|
||||||
"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED "
|
|
||||||
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR "
|
|
||||||
"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER "
|
|
||||||
"OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, "
|
|
||||||
"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES "
|
|
||||||
"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE "
|
|
||||||
"GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS "
|
|
||||||
"INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, "
|
|
||||||
"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING "
|
|
||||||
"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF "
|
|
||||||
"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH "
|
|
||||||
"DAMAGE.</b>");
|
|
||||||
elm_object_part_text_set(o, "terminology.text", txt);
|
|
||||||
eina_stringshare_del(txt);
|
|
||||||
evas_object_show(o);
|
|
||||||
edje_object_part_swallow(bg, "terminology.about", ab_layout);
|
|
||||||
}
|
|
||||||
if (!ab_out)
|
|
||||||
{
|
{
|
||||||
ab_over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
snprintf(buf, sizeof(buf), "%s/themes/default.edj",
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
elm_app_data_dir_get());
|
||||||
edje_object_part_swallow(bg, "terminology.dismiss", o);
|
elm_layout_file_set(o, buf, "terminology/about");
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
||||||
_cb_mouse_down, term);
|
|
||||||
|
|
||||||
edje_object_signal_emit(bg, "about,show", "terminology");
|
|
||||||
elm_object_signal_emit(ab_layout, "begin" ,"terminology");
|
|
||||||
ab_out = EINA_TRUE;
|
|
||||||
ab_donecb = donecb;
|
|
||||||
ab_donedata = donedata;
|
|
||||||
elm_object_focus_set(ab_layout, EINA_TRUE);
|
|
||||||
if (ab_del_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(ab_del_timer);
|
|
||||||
ab_del_timer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_object_del(ab_over);
|
|
||||||
ab_over = NULL;
|
|
||||||
|
|
||||||
edje_object_signal_emit(bg, "about,hide", "terminology");
|
|
||||||
ab_out = EINA_FALSE;
|
|
||||||
elm_object_focus_set(ab_layout, EINA_FALSE);
|
|
||||||
if (ab_donecb) ab_donecb(ab_donedata);
|
|
||||||
// elm_object_focus_set(term, EINA_TRUE);
|
|
||||||
if (ab_del_timer) ecore_timer_del(ab_del_timer);
|
|
||||||
ab_del_timer = ecore_timer_add(10.0, _cb_ab_del_delay, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txt = eina_stringshare_printf(_(
|
||||||
|
"<b>Terminology %s</b><br>"
|
||||||
|
"Why should terminals be boring?<br>"
|
||||||
|
"<br>"
|
||||||
|
"This terminal was written for Enlightenment, to use EFL "
|
||||||
|
"and otherwise push the boundaries of what a modern terminal "
|
||||||
|
"emulator should be. We hope you enjoy it.<br>"
|
||||||
|
"<br>"
|
||||||
|
"Copyright © 2012-%d by:<br>"
|
||||||
|
"<br>"
|
||||||
|
"%s" // AUTHORS
|
||||||
|
"<br>"
|
||||||
|
"<br>"
|
||||||
|
"Distributed under the 2-clause BSD license detailed below:<br>"
|
||||||
|
"<br>"
|
||||||
|
"%s" // LICENSE
|
||||||
|
),
|
||||||
|
PACKAGE_VERSION, 2018,
|
||||||
|
"Boris Faure<br>"
|
||||||
|
"Carsten Haitzler<br>"
|
||||||
|
"Gustavo Sverzut Barbieri<br>"
|
||||||
|
"Cedric BAIL<br>"
|
||||||
|
"Sebastian Dransfeld<br>"
|
||||||
|
"Wonguk Jeong<br>"
|
||||||
|
"Christopher Michael<br>"
|
||||||
|
"Daniel Juyung Seo<br>"
|
||||||
|
"Panagiotis Galatsanos<br>"
|
||||||
|
"Mike Blumenkrantz<br>"
|
||||||
|
"Aleksandar Popadić<br>"
|
||||||
|
"Massimo Maiurana<br>"
|
||||||
|
"Stefan Schmidt<br>"
|
||||||
|
"Davide Andreoli<br>"
|
||||||
|
"Gustavo Lima Chaves<br>"
|
||||||
|
"Jean-Philippe ANDRÉ<br>"
|
||||||
|
"Tom Hacohen<br>"
|
||||||
|
"Alex-P. Natsios<br>"
|
||||||
|
"Lee Gwang-O<br>"
|
||||||
|
"Jean Guyomarc'h<br>"
|
||||||
|
"Jihoon Kim<br>"
|
||||||
|
"Kai Huuhko<br>"
|
||||||
|
"Mike McCormack<br>"
|
||||||
|
"Iván Briano<br>"
|
||||||
|
"Jerome Pinot<br>"
|
||||||
|
"José Roberto de Souza<br>"
|
||||||
|
"Leandro Pereira<br>"
|
||||||
|
"Leif Middelschulte<br>"
|
||||||
|
"Markus Törnqvist<br>"
|
||||||
|
"Thibaut Broggi<br>"
|
||||||
|
"Lucas De Marchi<br>"
|
||||||
|
"Marcel Hollerbach<br>"
|
||||||
|
"Anisse Astier<br>"
|
||||||
|
"Daniel Zaoui<br>"
|
||||||
|
"Doug Newgard<br>"
|
||||||
|
"Flavio Vinicius Alvares Ceolin<br>"
|
||||||
|
"Samuel F. Baggen<br>"
|
||||||
|
"Amitesh Singh<br>"
|
||||||
|
"Anthony F McInerney<br>"
|
||||||
|
"Aurélien Larcher<br>"
|
||||||
|
"Bruno Dilly<br>"
|
||||||
|
"Conrad Meyer<br>"
|
||||||
|
"Daniel Kolesa<br>"
|
||||||
|
"Eduardo Lima<br>"
|
||||||
|
"Flavio Ceolin<br>"
|
||||||
|
"Jason L. Cook<br>"
|
||||||
|
"Jérémy Anger<br>"
|
||||||
|
"Michael BOUCHAUD<br>"
|
||||||
|
"Michael Jennings<br>"
|
||||||
|
"Nicholas Hughart<br>"
|
||||||
|
"Rafael Antognolli<br>"
|
||||||
|
"Rui Seabra<br>"
|
||||||
|
"Sanjeev BA<br>"
|
||||||
|
"Theodor van Nahl<br>"
|
||||||
|
"Vincent Torri<br>"
|
||||||
|
"tantSinnister<br>",
|
||||||
|
"All rights reserved.<br>"
|
||||||
|
"<br>"
|
||||||
|
"Redistribution and use in source and binary forms, with or "
|
||||||
|
"without modification, are permitted provided that the "
|
||||||
|
"following conditions are met:<br>"
|
||||||
|
"<br>"
|
||||||
|
"1. Redistributions of source code must retain the above "
|
||||||
|
"copyright notice, this list of conditions and the following "
|
||||||
|
"disclaimer.<br>"
|
||||||
|
"2. Redistributions in binary form must reproduce the above "
|
||||||
|
"copyright notice, this list of conditions and the following "
|
||||||
|
"disclaimer in the documentation and/or other materials "
|
||||||
|
"provided with the distribution.<br>"
|
||||||
|
"<br>"
|
||||||
|
"<b>THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESS OR "
|
||||||
|
"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED "
|
||||||
|
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR "
|
||||||
|
"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER "
|
||||||
|
"OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, "
|
||||||
|
"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES "
|
||||||
|
"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE "
|
||||||
|
"GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS "
|
||||||
|
"INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, "
|
||||||
|
"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING "
|
||||||
|
"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF "
|
||||||
|
"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH "
|
||||||
|
"DAMAGE.</b>");
|
||||||
|
elm_object_part_text_set(o, "terminology.text", txt);
|
||||||
|
eina_stringshare_del(txt);
|
||||||
|
evas_object_show(o);
|
||||||
|
edje_object_part_swallow(base, "terminology.about", ctx->layout);
|
||||||
|
|
||||||
|
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_color_set(o, 0, 0, 0, 0);
|
||||||
|
edje_object_part_swallow(base, "terminology.dismiss", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
_cb_mouse_down, ctx);
|
||||||
|
|
||||||
|
edje_object_signal_emit(base, "about,show", "terminology");
|
||||||
|
elm_object_signal_emit(ctx->layout, "begin" ,"terminology");
|
||||||
|
elm_object_focus_set(ctx->layout, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _ABOUT_H__
|
#ifndef _ABOUT_H__
|
||||||
#define _ABOUT_H__ 1
|
#define _ABOUT_H__ 1
|
||||||
|
|
||||||
void about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
void about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
|
||||||
void (*donecb) (void *data), void *donedata);
|
void (*donecb) (void *data), void *donedata);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "col.h"
|
#include "col.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define CONF_VER 17
|
#define CONF_VER 18
|
||||||
|
|
||||||
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
||||||
|
|
||||||
|
@ -343,6 +343,7 @@ _add_default_keys(Config *config)
|
||||||
ADD_KB("Down", 0, 1, 0, 0, "term_down");
|
ADD_KB("Down", 0, 1, 0, 0, "term_down");
|
||||||
ADD_KB("Left", 0, 1, 0, 0, "term_left");
|
ADD_KB("Left", 0, 1, 0, 0, "term_left");
|
||||||
ADD_KB("Right", 0, 1, 0, 0, "term_right");
|
ADD_KB("Right", 0, 1, 0, 0, "term_right");
|
||||||
|
ADD_KB("g", 0, 1, 0, 0, "visible_group");
|
||||||
|
|
||||||
/* Ctrl-Shift- */
|
/* Ctrl-Shift- */
|
||||||
ADD_KB("Prior", 1, 0, 1, 0, "split_h");
|
ADD_KB("Prior", 1, 0, 1, 0, "split_h");
|
||||||
|
@ -377,6 +378,9 @@ _add_default_keys(Config *config)
|
||||||
ADD_KB("Right", 0, 0, 1, 0, "term_next");
|
ADD_KB("Right", 0, 0, 1, 0, "term_next");
|
||||||
ADD_KB("Home", 0, 0, 1, 0, "top_backlog");
|
ADD_KB("Home", 0, 0, 1, 0, "top_backlog");
|
||||||
ADD_KB("End", 0, 0, 1, 0, "reset_scroll");
|
ADD_KB("End", 0, 0, 1, 0, "reset_scroll");
|
||||||
|
|
||||||
|
/* Alt-Shift */
|
||||||
|
ADD_KB("g", 0, 1, 1, 0, "all_group");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -653,7 +657,12 @@ config_load(const char *key)
|
||||||
config->shine = 255;
|
config->shine = 255;
|
||||||
EINA_FALLTHROUGH;
|
EINA_FALLTHROUGH;
|
||||||
/*pass through*/
|
/*pass through*/
|
||||||
case CONF_VER: /* 17 */
|
case 17:
|
||||||
|
_add_key(config, "g", 0, 1, 0, 0, "visible_group");
|
||||||
|
_add_key(config, "g", 0, 1, 1, 0, "all_group");
|
||||||
|
EINA_FALLTHROUGH;
|
||||||
|
/*pass through*/
|
||||||
|
case CONF_VER: /* 18 */
|
||||||
config->version = CONF_VER;
|
config->version = CONF_VER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,224 +1,224 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
static Evas_Object *ct_frame = NULL, *ct_boxh = NULL, *ct_boxv = NULL;
|
static Eina_Hash *controls = NULL;
|
||||||
static Evas_Object *ct_box = NULL, *ct_box2 = NULL, *ct_box3 = NULL, *ct_over = NULL;
|
|
||||||
static Eina_Bool ct_out = EINA_FALSE;
|
typedef struct _Controls_Ctx {
|
||||||
static Ecore_Timer *ct_del_timer = NULL;
|
Evas_Object *frame;
|
||||||
static Evas_Object *ct_win = NULL, *ct_bg = NULL, *ct_term = NULL;
|
Evas_Object *over;
|
||||||
static void (*ct_donecb) (void *data) = NULL;
|
Evas_Object *win;
|
||||||
static void *ct_donedata = NULL;
|
Evas_Object *base;
|
||||||
|
Evas_Object *bg;
|
||||||
|
Evas_Object *term;
|
||||||
|
void (*donecb) (void *data);
|
||||||
|
void *donedata;
|
||||||
|
} Controls_Ctx;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_sel_on(void *_data EINA_UNUSED,
|
controls_hide(Controls_Ctx *ctx, Eina_Bool call_cb);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_sel_on(void *data,
|
||||||
Evas_Object *_term EINA_UNUSED,
|
Evas_Object *_term EINA_UNUSED,
|
||||||
void *_ev EINA_UNUSED)
|
void *_ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *bt_copy = evas_object_data_get(ct_frame, "bt_copy");
|
Controls_Ctx *ctx = data;
|
||||||
|
Evas_Object *bt_copy = evas_object_data_get(ctx->frame, "bt_copy");
|
||||||
if (bt_copy)
|
if (bt_copy)
|
||||||
elm_object_disabled_set(bt_copy, EINA_FALSE);
|
elm_object_disabled_set(bt_copy, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_sel_off(void *_data EINA_UNUSED,
|
_cb_sel_off(void *data,
|
||||||
Evas_Object *_term EINA_UNUSED,
|
Evas_Object *_term EINA_UNUSED,
|
||||||
void *_ev EINA_UNUSED)
|
void *_ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *bt_copy = evas_object_data_get(ct_frame, "bt_copy");
|
Controls_Ctx *ctx = data;
|
||||||
|
Evas_Object *bt_copy = evas_object_data_get(ctx->frame, "bt_copy");
|
||||||
if (bt_copy)
|
if (bt_copy)
|
||||||
elm_object_disabled_set(bt_copy, EINA_TRUE);
|
elm_object_disabled_set(bt_copy, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_ct_del_delay(void *_data EINA_UNUSED)
|
_cb_del_delay(void *data)
|
||||||
{
|
{
|
||||||
if (ct_over)
|
Evas_Object *frame = data;
|
||||||
{
|
evas_object_del(frame);
|
||||||
evas_object_del(ct_over);
|
|
||||||
ct_over = NULL;
|
|
||||||
}
|
|
||||||
if (ct_frame)
|
|
||||||
{
|
|
||||||
evas_object_del(ct_frame);
|
|
||||||
ct_frame = NULL;
|
|
||||||
}
|
|
||||||
ct_del_timer = NULL;
|
|
||||||
elm_cache_all_flush();
|
elm_cache_all_flush();
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_copy(void *_data EINA_UNUSED,
|
_cb_ct_copy(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
termio_take_selection(ct_term, ELM_SEL_TYPE_CLIPBOARD);
|
Controls_Ctx *ctx = data;
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
Evas_Object *term = ctx->term;
|
||||||
|
|
||||||
|
controls_hide(ctx, EINA_TRUE);
|
||||||
|
termio_take_selection(term, ELM_SEL_TYPE_CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_paste(void *_data EINA_UNUSED,
|
_cb_ct_paste(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
termio_paste_selection(ct_term, ELM_SEL_TYPE_CLIPBOARD);
|
Controls_Ctx *ctx = data;
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
Evas_Object *term = ctx->term;
|
||||||
|
|
||||||
|
controls_hide(ctx, EINA_TRUE);
|
||||||
|
termio_paste_selection(term, ELM_SEL_TYPE_CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_new(void *_data EINA_UNUSED,
|
_cb_ct_new(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
main_new(ct_win, ct_term);
|
Controls_Ctx *ctx = data;
|
||||||
|
main_new(ctx->win, ctx->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_split_v(void *_data EINA_UNUSED,
|
_cb_ct_split_v(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
split_vertically(ct_win, ct_term, NULL);
|
Controls_Ctx *ctx = data;
|
||||||
|
split_vertically(ctx->win, ctx->term, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_split_h(void *_data EINA_UNUSED,
|
_cb_ct_split_h(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
split_horizontally(ct_win, ct_term, NULL);
|
Controls_Ctx *ctx = data;
|
||||||
|
split_horizontally(ctx->win, ctx->term, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_miniview(void *_data EINA_UNUSED,
|
_cb_ct_miniview(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
term_miniview_toggle(termio_term_get(ct_term));
|
Controls_Ctx *ctx = data;
|
||||||
|
term_miniview_toggle(termio_term_get(ctx->term));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_set_title(void *_data EINA_UNUSED,
|
_cb_ct_set_title(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
term_set_title(termio_term_get(ct_term));
|
Controls_Ctx *ctx = data;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
|
controls_hide(ctx, EINA_TRUE);
|
||||||
|
term_set_title(termio_term_get(term));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_close(void *_data EINA_UNUSED,
|
_cb_ct_close(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
term_close(ct_win, ct_term, EINA_FALSE);
|
Controls_Ctx *ctx = data;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
|
Evas_Object *win = ctx->win;
|
||||||
|
|
||||||
|
controls_hide(ctx, EINA_TRUE);
|
||||||
|
term_close(win, term, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_options(void *_data EINA_UNUSED,
|
_on_sub_done(void *data)
|
||||||
|
{
|
||||||
|
Controls_Ctx *ctx = data;
|
||||||
|
|
||||||
|
ecore_timer_add(10.0, _cb_del_delay, ctx->frame);
|
||||||
|
ctx->frame = NULL;
|
||||||
|
|
||||||
|
if (ctx->donecb)
|
||||||
|
ctx->donecb(ctx->donedata);
|
||||||
|
|
||||||
|
eina_hash_del(controls, &ctx->win, ctx);
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_ct_options(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
Controls_Ctx *ctx = data;
|
||||||
options_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
|
||||||
|
options_show(ctx->win, ctx->base, ctx->bg, ctx->term, _on_sub_done, ctx);
|
||||||
|
controls_hide(ctx, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_ct_about(void *_data EINA_UNUSED,
|
_cb_ct_about(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
Controls_Ctx *ctx = data;
|
||||||
about_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
|
||||||
|
about_show(ctx->win, ctx->base, ctx->term, _on_sub_done, ctx);
|
||||||
|
controls_hide(ctx, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *_data EINA_UNUSED,
|
_cb_mouse_down(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_ev EINA_UNUSED)
|
void *_ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
Controls_Ctx *ctx = data;
|
||||||
|
|
||||||
|
controls_hide(ctx, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_frame_del(void *_data EINA_UNUSED,
|
_cb_saved_del(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
if (ct_win)
|
|
||||||
{
|
|
||||||
evas_object_smart_callback_del(ct_win, "selection,on", _cb_sel_on);
|
|
||||||
evas_object_smart_callback_del(ct_win, "selection,off", _cb_sel_off);
|
|
||||||
}
|
|
||||||
ct_frame = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_over_del(void *_data EINA_UNUSED,
|
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
ct_over = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_saved_del(void *_data EINA_UNUSED,
|
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_ev EINA_UNUSED)
|
void *_ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
if ((obj == ct_win) || (obj == ct_term))
|
Controls_Ctx *ctx = data;
|
||||||
{
|
|
||||||
if (obj == ct_term)
|
if (obj == ctx->win)
|
||||||
{
|
ctx->win = NULL;
|
||||||
if (ct_out)
|
else if (obj == ctx->term)
|
||||||
controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
|
ctx->term = NULL;
|
||||||
ct_term = NULL;
|
|
||||||
}
|
controls_hide(ctx, EINA_FALSE);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ct_frame)
|
|
||||||
{
|
|
||||||
evas_object_del(ct_frame);
|
|
||||||
ct_frame = NULL;
|
|
||||||
}
|
|
||||||
if (ct_del_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(ct_del_timer);
|
|
||||||
ct_del_timer = NULL;
|
|
||||||
}
|
|
||||||
if (ct_over)
|
|
||||||
{
|
|
||||||
evas_object_del(ct_over);
|
|
||||||
ct_over = NULL;
|
|
||||||
}
|
|
||||||
evas_object_event_callback_del(ct_win, EVAS_CALLBACK_DEL, _cb_saved_del);
|
|
||||||
ct_win = NULL;
|
|
||||||
}
|
|
||||||
evas_object_event_callback_del(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del);
|
|
||||||
ct_bg = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_button_add(Evas_Object *win, const char *label, const char *icon, Evas_Smart_Cb cb, void *cbdata)
|
_button_add(Evas_Object *win, const char *label, const char *icon, Evas_Smart_Cb cb, void *cbdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *bt;
|
Evas_Object *o, *bt;
|
||||||
|
|
||||||
bt = o = elm_button_add(win);
|
bt = o = elm_button_add(win);
|
||||||
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, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
if (label) elm_object_text_set(o, label);
|
if (label) elm_object_text_set(o, label);
|
||||||
evas_object_smart_callback_add(o, "clicked", cb, cbdata);
|
evas_object_smart_callback_add(o, "clicked", cb, cbdata);
|
||||||
|
|
||||||
if (icon)
|
if (icon)
|
||||||
{
|
{
|
||||||
o = elm_icon_add(win);
|
o = elm_icon_add(win);
|
||||||
|
@ -227,7 +227,7 @@ _button_add(Evas_Object *win, const char *label, const char *icon, Evas_Smart_Cb
|
||||||
elm_object_part_content_set(bt, "icon", o);
|
elm_object_part_content_set(bt, "icon", o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
return bt;
|
return bt;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ static Evas_Object *
|
||||||
_sep_add_v(Evas_Object *win)
|
_sep_add_v(Evas_Object *win)
|
||||||
{
|
{
|
||||||
Evas_Object *o = elm_separator_add(win);
|
Evas_Object *o = elm_separator_add(win);
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(o, 0.5, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, 0.5, EVAS_HINT_FILL);
|
||||||
elm_separator_horizontal_set(o, EINA_FALSE);
|
elm_separator_horizontal_set(o, EINA_FALSE);
|
||||||
|
@ -248,7 +248,7 @@ static Evas_Object *
|
||||||
_sep_add_h(Evas_Object *win)
|
_sep_add_h(Evas_Object *win)
|
||||||
{
|
{
|
||||||
Evas_Object *o = elm_separator_add(win);
|
Evas_Object *o = elm_separator_add(win);
|
||||||
|
|
||||||
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);
|
||||||
elm_separator_horizontal_set(o, EINA_TRUE);
|
elm_separator_horizontal_set(o, EINA_TRUE);
|
||||||
|
@ -256,167 +256,182 @@ _sep_add_h(Evas_Object *win)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
controls_hide(Controls_Ctx *ctx, Eina_Bool call_cb)
|
||||||
void (*donecb) (void *data), void *donedata)
|
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
if (ctx->win)
|
||||||
|
|
||||||
if (!ct_out)
|
|
||||||
{
|
{
|
||||||
if (options_active_get())
|
evas_object_event_callback_del(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del);
|
||||||
{
|
evas_object_smart_callback_del(ctx->win, "selection,on", _cb_sel_on);
|
||||||
options_toggle(win, bg, term, ct_donecb, ct_donedata);
|
evas_object_smart_callback_del(ctx->win, "selection,off", _cb_sel_off);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((win != ct_win) && (ct_frame))
|
if (ctx->term)
|
||||||
{
|
{
|
||||||
evas_object_del(ct_frame);
|
evas_object_event_callback_del(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del);
|
||||||
ct_frame = NULL;
|
edje_object_signal_emit(ctx->base, "controls,hide", "terminology");
|
||||||
ct_win = NULL;
|
|
||||||
ct_term = NULL;
|
|
||||||
}
|
}
|
||||||
if (!ct_frame)
|
|
||||||
|
if (ctx->over)
|
||||||
{
|
{
|
||||||
ct_frame = o = elm_frame_add(win);
|
evas_object_del(ctx->over);
|
||||||
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);
|
|
||||||
elm_object_text_set(o, _("Controls"));
|
|
||||||
|
|
||||||
ct_boxv = o = elm_box_add(win);
|
|
||||||
elm_box_horizontal_set(o, EINA_FALSE);
|
|
||||||
elm_object_content_set(ct_frame, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
ct_boxh = o = elm_box_add(win);
|
|
||||||
elm_box_pack_end(ct_boxv, o);
|
|
||||||
elm_box_horizontal_set(o, EINA_TRUE);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
ct_box = o = elm_box_add(win);
|
|
||||||
elm_box_pack_end(ct_boxh, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("New"), "window-new", _cb_ct_new, NULL);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Split V"), "object-flip-vertical", _cb_ct_split_v, NULL);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
o = _button_add(win, _("Split H"), "object-flip-horizontal", _cb_ct_split_h, NULL);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Miniview"), "view-restore", _cb_ct_miniview, NULL);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Set title"), "format-text-underline", _cb_ct_set_title, NULL);
|
|
||||||
elm_box_pack_end(ct_box, o);
|
|
||||||
|
|
||||||
o = _sep_add_v(win);
|
|
||||||
elm_box_pack_end(ct_boxh, o);
|
|
||||||
|
|
||||||
ct_box2 = o = elm_box_add(win);
|
|
||||||
elm_box_pack_end(ct_boxh, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Copy"), "edit-copy", _cb_ct_copy, NULL);
|
|
||||||
evas_object_data_set(ct_frame, "bt_copy", o);
|
|
||||||
if (!termio_selection_exists(term))
|
|
||||||
elm_object_disabled_set(o, EINA_TRUE);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Paste"), "edit-paste", _cb_ct_paste, NULL);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Settings"), "preferences-desktop", _cb_ct_options, NULL);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("About"), "help-about", _cb_ct_about, NULL);
|
|
||||||
elm_box_pack_end(ct_box2, o);
|
|
||||||
|
|
||||||
o = _sep_add_h(win);
|
|
||||||
elm_box_pack_end(ct_boxv, o);
|
|
||||||
|
|
||||||
ct_box3 = o = elm_box_add(win);
|
|
||||||
elm_box_pack_end(ct_boxv, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = _button_add(win, _("Close Terminal"), "window-close", _cb_ct_close, NULL);
|
|
||||||
elm_box_pack_end(ct_box3, o);
|
|
||||||
|
|
||||||
evas_object_event_callback_add(ct_frame, EVAS_CALLBACK_DEL,
|
|
||||||
_cb_frame_del, NULL);
|
|
||||||
|
|
||||||
evas_object_smart_callback_add(win, "selection,on", _cb_sel_on,
|
|
||||||
NULL);
|
|
||||||
evas_object_smart_callback_add(win, "selection,off", _cb_sel_off,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
if (!ct_out)
|
elm_object_focus_set(ctx->frame, EINA_FALSE);
|
||||||
{
|
|
||||||
edje_object_part_swallow(bg, "terminology.controls", ct_frame);
|
|
||||||
evas_object_show(ct_frame);
|
|
||||||
ct_over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
edje_object_part_swallow(bg, "terminology.dismiss", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
||||||
_cb_mouse_down, NULL);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
|
|
||||||
_cb_over_del, NULL);
|
|
||||||
|
|
||||||
ct_win = win;
|
if (call_cb)
|
||||||
ct_bg = bg;
|
|
||||||
ct_term = term;
|
|
||||||
ct_donecb = donecb;
|
|
||||||
ct_donedata = donedata;
|
|
||||||
edje_object_signal_emit(bg, "controls,show", "terminology");
|
|
||||||
ct_out = EINA_TRUE;
|
|
||||||
elm_object_focus_set(ct_frame, EINA_TRUE);
|
|
||||||
if (ct_del_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(ct_del_timer);
|
|
||||||
ct_del_timer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (ct_over)
|
ecore_timer_add(10.0, _cb_del_delay, ctx->frame);
|
||||||
{
|
ctx->frame = NULL;
|
||||||
evas_object_del(ct_over);
|
|
||||||
ct_over = NULL;
|
if (ctx->donecb)
|
||||||
}
|
ctx->donecb(ctx->donedata);
|
||||||
edje_object_signal_emit(ct_bg, "controls,hide", "terminology");
|
|
||||||
ct_out = EINA_FALSE;
|
eina_hash_del(controls, &ctx->win, ctx);
|
||||||
elm_object_focus_set(ct_frame, EINA_FALSE);
|
|
||||||
if (ct_donecb) ct_donecb(ct_donedata);
|
free(ctx);
|
||||||
// elm_object_focus_set(ct_term, EINA_TRUE);
|
|
||||||
if (ct_del_timer) ecore_timer_del(ct_del_timer);
|
|
||||||
ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
|
|
||||||
}
|
|
||||||
if (ct_win)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del(ct_win, EVAS_CALLBACK_DEL, _cb_saved_del);
|
|
||||||
evas_object_event_callback_del(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del);
|
|
||||||
}
|
|
||||||
if (ct_out)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_add(ct_win, EVAS_CALLBACK_DEL, _cb_saved_del, NULL);
|
|
||||||
evas_object_event_callback_add(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
|
Evas_Object *term, void (*donecb) (void *data), void *donedata)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
Evas_Object *ct_boxh, *ct_boxv, *ct_box, *ct_box2, *ct_box3;
|
||||||
|
Controls_Ctx *ctx;
|
||||||
|
|
||||||
|
if (eina_hash_find(controls, &win))
|
||||||
|
{
|
||||||
|
donecb(donedata);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ctx = malloc(sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
ctx->win = win;
|
||||||
|
ctx->base = base;
|
||||||
|
ctx->bg = bg;
|
||||||
|
ctx->term = term;
|
||||||
|
ctx->donecb = donecb;
|
||||||
|
ctx->donedata = donedata;
|
||||||
|
|
||||||
|
eina_hash_add(controls, &win, ctx);
|
||||||
|
|
||||||
|
ctx->frame = o = elm_frame_add(win);
|
||||||
|
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);
|
||||||
|
elm_object_text_set(o, _("Controls"));
|
||||||
|
|
||||||
|
ct_boxv = o = elm_box_add(win);
|
||||||
|
elm_box_horizontal_set(o, EINA_FALSE);
|
||||||
|
elm_object_content_set(ctx->frame, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
ct_boxh = o = elm_box_add(win);
|
||||||
|
elm_box_pack_end(ct_boxv, o);
|
||||||
|
elm_box_horizontal_set(o, EINA_TRUE);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
ct_box = o = elm_box_add(win);
|
||||||
|
elm_box_pack_end(ct_boxh, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("New"), "window-new",
|
||||||
|
_cb_ct_new, ctx);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Split V"), "object-flip-vertical",
|
||||||
|
_cb_ct_split_v, ctx);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
o = _button_add(win, _("Split H"), "object-flip-horizontal",
|
||||||
|
_cb_ct_split_h, ctx);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Miniview"), "view-restore",
|
||||||
|
_cb_ct_miniview, ctx);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Set title"), "format-text-underline",
|
||||||
|
_cb_ct_set_title, ctx);
|
||||||
|
elm_box_pack_end(ct_box, o);
|
||||||
|
|
||||||
|
o = _sep_add_v(win);
|
||||||
|
elm_box_pack_end(ct_boxh, o);
|
||||||
|
|
||||||
|
ct_box2 = o = elm_box_add(win);
|
||||||
|
elm_box_pack_end(ct_boxh, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Copy"), "edit-copy", _cb_ct_copy, ctx);
|
||||||
|
evas_object_data_set(ctx->frame, "bt_copy", o);
|
||||||
|
if (!termio_selection_exists(term))
|
||||||
|
elm_object_disabled_set(o, EINA_TRUE);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Paste"), "edit-paste", _cb_ct_paste, ctx);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Settings"), "preferences-desktop", _cb_ct_options, ctx);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("About"), "help-about", _cb_ct_about, ctx);
|
||||||
|
elm_box_pack_end(ct_box2, o);
|
||||||
|
|
||||||
|
o = _sep_add_h(win);
|
||||||
|
elm_box_pack_end(ct_boxv, o);
|
||||||
|
|
||||||
|
ct_box3 = o = elm_box_add(win);
|
||||||
|
elm_box_pack_end(ct_boxv, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = _button_add(win, _("Close Terminal"), "window-close", _cb_ct_close, NULL);
|
||||||
|
elm_box_pack_end(ct_box3, o);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(win, "selection,on", _cb_sel_on,
|
||||||
|
ctx);
|
||||||
|
evas_object_smart_callback_add(win, "selection,off", _cb_sel_off,
|
||||||
|
ctx);
|
||||||
|
|
||||||
|
edje_object_part_swallow(base, "terminology.controls", ctx->frame);
|
||||||
|
evas_object_show(ctx->frame);
|
||||||
|
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_color_set(o, 0, 0, 0, 0);
|
||||||
|
edje_object_part_swallow(base, "terminology.dismiss", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
_cb_mouse_down, ctx);
|
||||||
|
|
||||||
|
edje_object_signal_emit(base, "controls,show", "terminology");
|
||||||
|
elm_object_focus_set(ctx->frame, EINA_TRUE);
|
||||||
|
evas_object_event_callback_add(ctx->win, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
||||||
|
evas_object_event_callback_add(ctx->term, EVAS_CALLBACK_DEL, _cb_saved_del, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
controls_init(void)
|
||||||
|
{
|
||||||
|
controls = eina_hash_pointer_new(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
controls_shutdown(void)
|
||||||
|
{
|
||||||
|
eina_hash_free(controls);
|
||||||
|
controls = NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#ifndef _CONTROLS_H__
|
#ifndef _CONTROLS_H__
|
||||||
#define _CONTROLS_H__ 1
|
#define _CONTROLS_H__ 1
|
||||||
|
|
||||||
void controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
void controls_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
void (*donecb) (void *data), void *donedata);
|
Evas_Object *term,
|
||||||
|
void (*donecb) (void *data), void *donedata);
|
||||||
|
|
||||||
|
void controls_init(void);
|
||||||
|
void controls_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
172
src/bin/keyin.c
172
src/bin/keyin.c
|
@ -102,9 +102,9 @@ keyin_compose_seq_reset(Keys_Handler *khdl)
|
||||||
|
|
||||||
#include "tty_keys.h"
|
#include "tty_keys.h"
|
||||||
|
|
||||||
static void
|
void
|
||||||
_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
|
keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
|
||||||
int alt, int shift, int ctrl)
|
const int alt, const int shift, const int ctrl)
|
||||||
{
|
{
|
||||||
if (!ev->key)
|
if (!ev->key)
|
||||||
return;
|
return;
|
||||||
|
@ -228,92 +228,24 @@ key_binding_lookup(const char *keyname,
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
keyin_handle(Keys_Handler *khdl, Termpty *ty, const Evas_Event_Key_Down *ev,
|
keyin_handle_key_binding(Evas_Object *termio, const Evas_Event_Key_Down *ev,
|
||||||
Eina_Bool ctrl, Eina_Bool alt, Eina_Bool shift, Eina_Bool win,
|
Eina_Bool ctrl, Eina_Bool alt, Eina_Bool shift,
|
||||||
Eina_Bool meta, Eina_Bool hyper)
|
Eina_Bool win, Eina_Bool meta, Eina_Bool hyper)
|
||||||
{
|
{
|
||||||
|
|
||||||
Key_Binding *kb;
|
Key_Binding *kb;
|
||||||
kb = key_binding_lookup(ev->keyname, ctrl, alt, shift, win, meta, hyper);
|
kb = key_binding_lookup(ev->keyname, ctrl, alt, shift, win, meta, hyper);
|
||||||
if (kb)
|
if (kb)
|
||||||
{
|
{
|
||||||
if (kb->cb(ty->obj))
|
if (kb->cb(termio))
|
||||||
{
|
{
|
||||||
keyin_compose_seq_reset(khdl);
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* composing */
|
|
||||||
if (khdl->imf)
|
|
||||||
{
|
|
||||||
// EXCEPTION. Don't filter modifiers alt+shift -> breaks emacs
|
|
||||||
// and jed (alt+shift+5 for search/replace for example)
|
|
||||||
// Don't filter modifiers alt, is used by shells
|
|
||||||
if ((!alt) && (!ctrl))
|
|
||||||
{
|
|
||||||
Ecore_IMF_Event_Key_Down imf_ev;
|
|
||||||
|
|
||||||
ecore_imf_evas_event_key_down_wrap((Evas_Event_Key_Down*)ev, &imf_ev);
|
|
||||||
if (!khdl->composing)
|
|
||||||
{
|
|
||||||
if (ecore_imf_context_filter_event
|
|
||||||
(khdl->imf, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&imf_ev))
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if term app asked for kbd lock - dont handle here
|
|
||||||
if (ty->termstate.kbd_lock) return EINA_TRUE;
|
|
||||||
// if app asked us to not do autorepeat - ignore press if is it is the same
|
|
||||||
// timestamp as last one
|
|
||||||
if ((ty->termstate.no_autorepeat) &&
|
|
||||||
(ev->timestamp == khdl->last_keyup)) return EINA_TRUE;
|
|
||||||
if (!khdl->composing)
|
|
||||||
{
|
|
||||||
Ecore_Compose_State state;
|
|
||||||
char *compres = NULL;
|
|
||||||
|
|
||||||
keyin_compose_seq_reset(khdl);
|
|
||||||
khdl->seq = eina_list_append(khdl->seq, eina_stringshare_add(ev->key));
|
|
||||||
state = ecore_compose_get(khdl->seq, &compres);
|
|
||||||
if (state == ECORE_COMPOSE_MIDDLE) khdl->composing = EINA_TRUE;
|
|
||||||
else khdl->composing = EINA_FALSE;
|
|
||||||
if (!khdl->composing) keyin_compose_seq_reset(khdl);
|
|
||||||
else goto end;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Ecore_Compose_State state;
|
|
||||||
char *compres = NULL;
|
|
||||||
|
|
||||||
if (key_is_modifier(ev->key)) goto end;
|
|
||||||
khdl->seq = eina_list_append(khdl->seq, eina_stringshare_add(ev->key));
|
|
||||||
state = ecore_compose_get(khdl->seq, &compres);
|
|
||||||
if (state == ECORE_COMPOSE_NONE) keyin_compose_seq_reset(khdl);
|
|
||||||
else if (state == ECORE_COMPOSE_DONE)
|
|
||||||
{
|
|
||||||
keyin_compose_seq_reset(khdl);
|
|
||||||
if (compres)
|
|
||||||
{
|
|
||||||
termpty_write(ty, compres, strlen(compres));
|
|
||||||
free(compres);
|
|
||||||
compres = NULL;
|
|
||||||
}
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
else goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_handle_key_to_pty(ty, ev, alt, shift, ctrl);
|
|
||||||
|
|
||||||
|
|
||||||
end:
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
key_is_modifier(const char *key)
|
key_is_modifier(const char *key)
|
||||||
{
|
{
|
||||||
|
@ -343,18 +275,62 @@ keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev)
|
||||||
{
|
{
|
||||||
Ecore_IMF_Event_Key_Up imf_ev;
|
Ecore_IMF_Event_Key_Up imf_ev;
|
||||||
ecore_imf_evas_event_key_up_wrap(ev, &imf_ev);
|
ecore_imf_evas_event_key_up_wrap(ev, &imf_ev);
|
||||||
if (ecore_imf_context_filter_event
|
ecore_imf_context_filter_event
|
||||||
(khdl->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev))
|
(khdl->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
/* {{{ Callbacks */
|
/* {{{ Callbacks */
|
||||||
|
#define RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED \
|
||||||
|
Win *wn; \
|
||||||
|
Term *term = termio_term_get(termio_obj); \
|
||||||
|
if (!term) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
wn = term_win_get(term); \
|
||||||
|
if (!wn) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
if (win_is_group_action_handled(wn)) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
|
||||||
|
#define RETURN_FALSE_ON_GROUP_INPUT \
|
||||||
|
Win *wn; \
|
||||||
|
Term *term = termio_term_get(termio_obj); \
|
||||||
|
if (!term) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
wn = term_win_get(term); \
|
||||||
|
if (!wn) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
if (win_is_group_input(wn)) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
cb_all_group(Evas_Object *termio_obj)
|
||||||
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
|
|
||||||
|
win_toggle_all_group(wn);
|
||||||
|
|
||||||
|
ERR("ALL GROUP");
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
cb_visible_group(Evas_Object *termio_obj)
|
||||||
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
|
|
||||||
|
win_toggle_visible_group(wn);
|
||||||
|
|
||||||
|
ERR("VISIBLE GROUP");
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_prev(Evas_Object *termio_obj)
|
cb_term_prev(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
|
|
||||||
evas_object_smart_callback_call(termio_obj, "prev", NULL);
|
evas_object_smart_callback_call(termio_obj, "prev", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -362,6 +338,8 @@ cb_term_prev(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_next(Evas_Object *termio_obj)
|
cb_term_next(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
|
|
||||||
evas_object_smart_callback_call(termio_obj, "next", NULL);
|
evas_object_smart_callback_call(termio_obj, "next", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -369,9 +347,8 @@ cb_term_next(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_up(Evas_Object *termio_obj)
|
cb_term_up(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Term *term = termio_term_get(termio_obj);
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
if (!term)
|
|
||||||
return EINA_FALSE;
|
|
||||||
term_up(term);
|
term_up(term);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -379,9 +356,8 @@ cb_term_up(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_down(Evas_Object *termio_obj)
|
cb_term_down(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Term *term = termio_term_get(termio_obj);
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
if (!term)
|
|
||||||
return EINA_FALSE;
|
|
||||||
term_down(term);
|
term_down(term);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -389,9 +365,8 @@ cb_term_down(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_left(Evas_Object *termio_obj)
|
cb_term_left(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Term *term = termio_term_get(termio_obj);
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
if (!term)
|
|
||||||
return EINA_FALSE;
|
|
||||||
term_left(term);
|
term_left(term);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -399,9 +374,8 @@ cb_term_left(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_right(Evas_Object *termio_obj)
|
cb_term_right(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Term *term = termio_term_get(termio_obj);
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
if (!term)
|
|
||||||
return EINA_FALSE;
|
|
||||||
term_right(term);
|
term_right(term);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -409,6 +383,8 @@ cb_term_right(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_new(Evas_Object *termio_obj)
|
cb_term_new(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
|
|
||||||
char path[PATH_MAX], cwd[PATH_MAX], *cmd;
|
char path[PATH_MAX], cwd[PATH_MAX], *cmd;
|
||||||
const char *template = "%s -d %s";
|
const char *template = "%s -d %s";
|
||||||
int length;
|
int length;
|
||||||
|
@ -450,10 +426,8 @@ cb_tab_set_title(Evas_Object *termio_obj)
|
||||||
static Eina_Bool \
|
static Eina_Bool \
|
||||||
cb_tab_##N(Evas_Object *termio_obj) \
|
cb_tab_##N(Evas_Object *termio_obj) \
|
||||||
{ \
|
{ \
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT; \
|
||||||
int n = (N == 0) ? 9 : N - 1; \
|
int n = (N == 0) ? 9 : N - 1; \
|
||||||
Term *term = termio_term_get(termio_obj); \
|
|
||||||
if (!term) \
|
|
||||||
return EINA_FALSE; \
|
|
||||||
return term_tab_go(term, n); \
|
return term_tab_go(term, n); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,6 +446,7 @@ CB_TAB(9)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_cmd_box(Evas_Object *termio_obj)
|
cb_cmd_box(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
evas_object_smart_callback_call(termio_obj, "cmdbox", NULL);
|
evas_object_smart_callback_call(termio_obj, "cmdbox", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -479,6 +454,7 @@ cb_cmd_box(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_split_h(Evas_Object *termio_obj)
|
cb_split_h(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
evas_object_smart_callback_call(termio_obj, "split,h", NULL);
|
evas_object_smart_callback_call(termio_obj, "split,h", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -486,6 +462,7 @@ cb_split_h(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_split_v(Evas_Object *termio_obj)
|
cb_split_v(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
evas_object_smart_callback_call(termio_obj, "split,v", NULL);
|
evas_object_smart_callback_call(termio_obj, "split,v", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -493,6 +470,7 @@ cb_split_v(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_tab_new(Evas_Object *termio_obj)
|
cb_tab_new(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
evas_object_smart_callback_call(termio_obj, "new", NULL);
|
evas_object_smart_callback_call(termio_obj, "new", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -500,6 +478,7 @@ cb_tab_new(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_close(Evas_Object *termio_obj)
|
cb_close(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
evas_object_smart_callback_call(termio_obj, "close", NULL);
|
evas_object_smart_callback_call(termio_obj, "close", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -507,6 +486,7 @@ cb_close(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_tab_select(Evas_Object *termio_obj)
|
cb_tab_select(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_INPUT;
|
||||||
evas_object_smart_callback_call(termio_obj, "select", NULL);
|
evas_object_smart_callback_call(termio_obj, "select", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -557,6 +537,7 @@ cb_miniview(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_win_fullscreen(Evas_Object *termio_obj)
|
cb_win_fullscreen(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
Evas_Object *win = termio_win_get(termio_obj);
|
Evas_Object *win = termio_win_get(termio_obj);
|
||||||
Eina_Bool fullscreen;
|
Eina_Bool fullscreen;
|
||||||
|
|
||||||
|
@ -707,6 +688,9 @@ static Shortcut_Action _actions[] =
|
||||||
{"tab_9", gettext_noop("Switch to terminal tab 9"), cb_tab_9},
|
{"tab_9", gettext_noop("Switch to terminal tab 9"), cb_tab_9},
|
||||||
{"tab_10", gettext_noop("Switch to terminal tab 10"), cb_tab_0},
|
{"tab_10", gettext_noop("Switch to terminal tab 10"), cb_tab_0},
|
||||||
{"tab_title", gettext_noop("Change title"), cb_tab_set_title},
|
{"tab_title", gettext_noop("Change title"), cb_tab_set_title},
|
||||||
|
{"visible_group", gettext_noop("Toggle whether input goes to all visible terminals"), cb_visible_group},
|
||||||
|
{"all_group", gettext_noop("Toggle whether input goes to all visible terminals"), cb_all_group},
|
||||||
|
|
||||||
|
|
||||||
{"group", gettext_noop("Font size"), NULL},
|
{"group", gettext_noop("Font size"), NULL},
|
||||||
{"increase_font_size", gettext_noop("Font size up 1"), cb_increase_font_size},
|
{"increase_font_size", gettext_noop("Font size up 1"), cb_increase_font_size},
|
||||||
|
|
|
@ -11,12 +11,19 @@ struct _Keys_Handler
|
||||||
unsigned char composing : 1;
|
unsigned char composing : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
|
||||||
|
const int alt, const int shift, const int ctrl);
|
||||||
|
Eina_Bool
|
||||||
|
termpty_can_handle_key(const Termpty *ty,
|
||||||
|
const Keys_Handler *khdl,
|
||||||
|
const Evas_Event_Key_Down *ev);
|
||||||
void keyin_compose_seq_reset(Keys_Handler *khdl);
|
void keyin_compose_seq_reset(Keys_Handler *khdl);
|
||||||
Eina_Bool key_is_modifier(const char *key);
|
Eina_Bool key_is_modifier(const char *key);
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
keyin_handle(Keys_Handler *khdl, Termpty *ty, const Evas_Event_Key_Down *ev,
|
keyin_handle_key_binding(Evas_Object *termio, const Evas_Event_Key_Down *ev,
|
||||||
Eina_Bool ctrl, Eina_Bool alt, Eina_Bool shift, Eina_Bool win,
|
Eina_Bool ctrl, Eina_Bool alt, Eina_Bool shift,
|
||||||
Eina_Bool meta, Eina_Bool hyper);
|
Eina_Bool win, Eina_Bool meta, Eina_Bool hyper);
|
||||||
|
|
||||||
void keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev);
|
void keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev);
|
||||||
|
|
||||||
|
|
|
@ -978,6 +978,7 @@ remote:
|
||||||
ecore_con_init();
|
ecore_con_init();
|
||||||
ecore_con_url_init();
|
ecore_con_url_init();
|
||||||
|
|
||||||
|
controls_init();
|
||||||
terminology_starting_up = EINA_FALSE;
|
terminology_starting_up = EINA_FALSE;
|
||||||
|
|
||||||
elm_run();
|
elm_run();
|
||||||
|
@ -1008,9 +1009,11 @@ remote:
|
||||||
config_del(_main_config);
|
config_del(_main_config);
|
||||||
key_bindings_shutdown();
|
key_bindings_shutdown();
|
||||||
config_shutdown();
|
config_shutdown();
|
||||||
|
controls_shutdown();
|
||||||
eina_log_domain_unregister(_log_domain);
|
eina_log_domain_unregister(_log_domain);
|
||||||
_log_domain = -1;
|
_log_domain = -1;
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_GETTEXT && ENABLE_NLS
|
#if HAVE_GETTEXT && ENABLE_NLS
|
||||||
eina_stringshare_del(options.copyright);
|
eina_stringshare_del(options.copyright);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "options_font.h"
|
#include "options_font.h"
|
||||||
#include "options_theme.h"
|
#include "options_theme.h"
|
||||||
|
@ -14,17 +15,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
|
||||||
static Evas_Object *op_frame, *op_box = NULL, *op_toolbar = NULL,
|
|
||||||
*op_opbox = NULL, *op_tbox = NULL, *op_temp = NULL,
|
|
||||||
*op_over = NULL;
|
|
||||||
static Eina_Bool op_out = EINA_FALSE;
|
|
||||||
static Ecore_Timer *op_del_timer = NULL;
|
|
||||||
static Evas_Object *saved_win = NULL;
|
|
||||||
static Evas_Object *saved_bg = NULL;
|
|
||||||
static void (*op_donecb) (void *data) = NULL;
|
|
||||||
static void *op_donedata = NULL;
|
|
||||||
|
|
||||||
static enum option_mode {
|
enum option_mode {
|
||||||
OPTION_NONE = 0,
|
OPTION_NONE = 0,
|
||||||
OPTION_FONT,
|
OPTION_FONT,
|
||||||
OPTION_THEME,
|
OPTION_THEME,
|
||||||
|
@ -34,229 +26,249 @@ static enum option_mode {
|
||||||
OPTION_BEHAVIOR,
|
OPTION_BEHAVIOR,
|
||||||
OPTION_KEYS,
|
OPTION_KEYS,
|
||||||
OPTION_HELPERS,
|
OPTION_HELPERS,
|
||||||
OPTION_ELM
|
OPTION_ELM,
|
||||||
} _mode = 0;
|
|
||||||
|
OPTIONS_MODE_NB
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _Options_Ctx {
|
||||||
|
enum option_mode mode;
|
||||||
|
Evas_Object *frame;
|
||||||
|
Evas_Object *toolbar;
|
||||||
|
Evas_Object *opbox;
|
||||||
|
Evas_Object *over;
|
||||||
|
Evas_Object *win;
|
||||||
|
Evas_Object *base;
|
||||||
|
Evas_Object *bg;
|
||||||
|
Evas_Object *term;
|
||||||
|
Config *config;
|
||||||
|
void (*donecb) (void *data);
|
||||||
|
void *donedata;
|
||||||
|
struct _Options_Ctx *modes[OPTIONS_MODE_NB];
|
||||||
|
} Options_Ctx;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op(void *data,
|
_cb_op(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
enum option_mode mode = (intptr_t) data;
|
Options_Ctx **pctx = data;
|
||||||
|
Options_Ctx *ctx = *pctx;
|
||||||
|
enum option_mode mode = pctx - ctx->modes;
|
||||||
|
|
||||||
if (_mode == mode) return;
|
if (mode == ctx->mode)
|
||||||
_mode = mode;
|
return;
|
||||||
edje_object_signal_emit(saved_bg, "optdetails,hide", "terminology");
|
|
||||||
|
ctx->mode = mode;
|
||||||
|
|
||||||
|
edje_object_signal_emit(ctx->base, "optdetails,hide", "terminology");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_tmp_chg(void *data, Evas_Object *obj, void *_event EINA_UNUSED)
|
_cb_op_tmp_chg(void *data, Evas_Object *obj, void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Config *config = data;
|
Options_Ctx *ctx = data;
|
||||||
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->temporary = elm_check_state_get(obj);
|
config->temporary = elm_check_state_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_op_del_delay(void *_data EINA_UNUSED)
|
_cb_op_del_delay(void *data)
|
||||||
{
|
{
|
||||||
evas_object_del(op_opbox);
|
Options_Ctx *ctx = data;
|
||||||
evas_object_del(op_frame);
|
|
||||||
options_font_clear();
|
evas_object_del(ctx->opbox);
|
||||||
options_background_clear();
|
evas_object_del(ctx->frame);
|
||||||
options_theme_clear();
|
|
||||||
op_opbox = NULL;
|
free(ctx);
|
||||||
op_frame = NULL;
|
|
||||||
op_del_timer = NULL;
|
|
||||||
elm_cache_all_flush();
|
elm_cache_all_flush();
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_mouse_down(void *data,
|
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_ev EINA_UNUSED)
|
|
||||||
{
|
|
||||||
options_toggle(saved_win, saved_bg, data, op_donecb, op_donedata);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_opdt_hide_done(void *data,
|
_cb_opdt_hide_done(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
const char *_sig EINA_UNUSED,
|
const char *_sig EINA_UNUSED,
|
||||||
const char *_src EINA_UNUSED)
|
const char *_src EINA_UNUSED)
|
||||||
{
|
{
|
||||||
elm_box_clear(op_opbox);
|
Options_Ctx *ctx = data;
|
||||||
switch (_mode)
|
|
||||||
|
elm_box_clear(ctx->opbox);
|
||||||
|
switch (ctx->mode)
|
||||||
{
|
{
|
||||||
case OPTION_NONE: break;
|
case OPTION_NONE: break;
|
||||||
case OPTION_FONT: options_font(op_opbox, data); break;
|
case OPTION_FONT: options_font(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_THEME: options_theme(op_opbox, data); break;
|
case OPTION_THEME: options_theme(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_BACKGROUND: options_background(op_opbox, data); break;
|
case OPTION_BACKGROUND: options_background(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_COLORS: options_colors(op_opbox, data); break;
|
case OPTION_COLORS: options_colors(ctx->opbox, ctx->term, ctx->bg); break;
|
||||||
case OPTION_VIDEO: options_video(op_opbox, data); break;
|
case OPTION_VIDEO: options_video(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_BEHAVIOR: options_behavior(op_opbox, data); break;
|
case OPTION_BEHAVIOR: options_behavior(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_KEYS: options_keys(op_opbox, data); break;
|
case OPTION_KEYS: options_keys(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_HELPERS: options_helpers(op_opbox, data); break;
|
case OPTION_HELPERS: options_helpers(ctx->opbox, ctx->term); break;
|
||||||
case OPTION_ELM: options_elm(op_opbox, data); break;
|
case OPTION_ELM: options_elm(ctx->opbox, ctx->term); break;
|
||||||
|
case OPTIONS_MODE_NB: assert(0 && "should not occur");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(saved_bg, "optdetails,show", "terminology");
|
edje_object_signal_emit(ctx->base, "optdetails,show", "terminology");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_opdt_hide_done2(void *_data EINA_UNUSED,
|
_cb_opdt_hide_done2(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
const char *_sig EINA_UNUSED,
|
const char *_sig EINA_UNUSED,
|
||||||
const char *_src EINA_UNUSED)
|
const char *_src EINA_UNUSED)
|
||||||
{
|
{
|
||||||
if (op_del_timer)
|
Options_Ctx *ctx = data;
|
||||||
{
|
|
||||||
ecore_timer_del(op_del_timer);
|
edje_object_signal_callback_del(ctx->base, "optdetails,hide,done",
|
||||||
op_del_timer = NULL;
|
|
||||||
}
|
|
||||||
_cb_op_del_delay(NULL);
|
|
||||||
edje_object_signal_callback_del(saved_bg, "optdetails,hide,done",
|
|
||||||
"terminology",
|
"terminology",
|
||||||
_cb_opdt_hide_done2);
|
_cb_opdt_hide_done2);
|
||||||
|
ecore_timer_add(10.0, _cb_op_del_delay, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
options_hide(Options_Ctx *ctx)
|
||||||
|
{
|
||||||
|
edje_object_part_swallow(ctx->base, "terminology.optdetails", ctx->opbox);
|
||||||
|
edje_object_part_swallow(ctx->base, "terminology.options", ctx->frame);
|
||||||
|
edje_object_signal_emit(ctx->base, "optdetails,show", "terminology");
|
||||||
|
edje_object_signal_emit(ctx->base, "options,show", "terminology");
|
||||||
|
|
||||||
|
edje_object_signal_callback_del(ctx->base, "optdetails,hide,done",
|
||||||
|
"terminology",
|
||||||
|
_cb_opdt_hide_done);
|
||||||
|
edje_object_signal_callback_add(ctx->base, "optdetails,hide,done",
|
||||||
|
"terminology",
|
||||||
|
_cb_opdt_hide_done2, ctx);
|
||||||
|
elm_object_focus_set(ctx->frame, EINA_FALSE);
|
||||||
|
elm_object_focus_set(ctx->opbox, EINA_FALSE);
|
||||||
|
elm_object_focus_set(ctx->toolbar, EINA_FALSE);
|
||||||
|
|
||||||
|
evas_object_del(ctx->over);
|
||||||
|
ctx->over = NULL;
|
||||||
|
|
||||||
|
edje_object_signal_emit(ctx->base, "options,hide", "terminology");
|
||||||
|
edje_object_signal_emit(ctx->base, "optdetails,hide", "terminology");
|
||||||
|
|
||||||
|
if (ctx->donecb)
|
||||||
|
ctx->donecb(ctx->donedata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_mouse_down(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_ev EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Options_Ctx *ctx = data;
|
||||||
|
|
||||||
|
options_hide(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
options_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg, Evas_Object *term,
|
||||||
void (*donecb) (void *data), void *donedata)
|
void (*donecb) (void *data), void *donedata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o, *op_box, *op_tbox;
|
||||||
|
Options_Ctx *ctx;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
_mode = OPTION_NONE;
|
Elm_Object_Item *it_fn;
|
||||||
if (!op_frame)
|
Config *config = termio_config_get(term);
|
||||||
{
|
|
||||||
Elm_Object_Item *it_fn;
|
|
||||||
Config *config = termio_config_get(term);
|
|
||||||
|
|
||||||
if (!config) return;
|
|
||||||
saved_win = win;
|
|
||||||
saved_bg = bg;
|
|
||||||
|
|
||||||
op_opbox = o = elm_box_add(win);
|
|
||||||
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);
|
|
||||||
edje_object_part_swallow(bg, "terminology.optdetails", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
op_frame = o = elm_frame_add(win);
|
if (!config) return;
|
||||||
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);
|
|
||||||
elm_object_text_set(o, _("Options"));
|
|
||||||
|
|
||||||
op_box = o = elm_box_add(win);
|
ctx = malloc(sizeof(*ctx));
|
||||||
elm_box_horizontal_set(o, EINA_TRUE);
|
assert(ctx);
|
||||||
elm_object_content_set(op_frame, o);
|
ctx->mode = OPTION_NONE;
|
||||||
evas_object_show(o);
|
ctx->win = win;
|
||||||
|
ctx->base = base;
|
||||||
|
ctx->bg = bg;
|
||||||
|
ctx->term = term;
|
||||||
|
ctx->donecb = donecb;
|
||||||
|
ctx->donedata = donedata;
|
||||||
|
ctx->config = config;
|
||||||
|
|
||||||
op_tbox = o = elm_box_add(win);
|
for (i = 0; i < OPTIONS_MODE_NB; i++)
|
||||||
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
ctx->modes[i] = ctx;
|
||||||
evas_object_size_hint_align_set(o, 1.0, EVAS_HINT_FILL);
|
|
||||||
elm_box_pack_end(op_box, o);
|
ctx->opbox = o = elm_box_add(win);
|
||||||
evas_object_show(o);
|
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);
|
||||||
op_toolbar = o = elm_toolbar_add(win);
|
edje_object_part_swallow(ctx->base, "terminology.optdetails", o);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
evas_object_show(o);
|
||||||
evas_object_size_hint_align_set(o, 0.5, EVAS_HINT_FILL);
|
|
||||||
elm_toolbar_horizontal_set(o, EINA_FALSE);
|
ctx->frame = o = elm_frame_add(win);
|
||||||
elm_object_style_set(o, "item_horizontal");
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
elm_toolbar_icon_size_set(o, 16 * elm_config_scale_get());
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_toolbar_shrink_mode_set(o, ELM_TOOLBAR_SHRINK_SCROLL);
|
elm_object_text_set(o, _("Options"));
|
||||||
elm_toolbar_select_mode_set(o, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
|
||||||
elm_toolbar_menu_parent_set(o, win);
|
op_box = o = elm_box_add(win);
|
||||||
elm_toolbar_homogeneous_set(o, EINA_FALSE);
|
elm_box_horizontal_set(o, EINA_TRUE);
|
||||||
|
elm_object_content_set(ctx->frame, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
op_tbox = o = elm_box_add(win);
|
||||||
|
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, 1.0, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(op_box, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
ctx->toolbar = o = elm_toolbar_add(win);
|
||||||
|
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(o, 0.5, EVAS_HINT_FILL);
|
||||||
|
elm_toolbar_horizontal_set(o, EINA_FALSE);
|
||||||
|
elm_object_style_set(o, "item_horizontal");
|
||||||
|
elm_toolbar_icon_size_set(o, 16 * elm_config_scale_get());
|
||||||
|
elm_toolbar_shrink_mode_set(o, ELM_TOOLBAR_SHRINK_SCROLL);
|
||||||
|
elm_toolbar_select_mode_set(o, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
||||||
|
elm_toolbar_menu_parent_set(o, win);
|
||||||
|
elm_toolbar_homogeneous_set(o, EINA_FALSE);
|
||||||
|
|
||||||
#define ITEM_APPEND(_icon_name, _name, _option_mode) \
|
#define ITEM_APPEND(_icon_name, _name, _option_mode) \
|
||||||
elm_toolbar_item_append(o, _icon_name, _name, _cb_op, \
|
elm_toolbar_item_append(o, _icon_name, _name, _cb_op, \
|
||||||
(void*) OPTION_##_option_mode)
|
(void*) &ctx->modes[OPTION_##_option_mode])
|
||||||
|
|
||||||
it_fn =
|
it_fn =
|
||||||
ITEM_APPEND("preferences-desktop-font", _("Font"), FONT);
|
ITEM_APPEND("preferences-desktop-font", _("Font"), FONT);
|
||||||
ITEM_APPEND("preferences-desktop-theme", _("Theme"), THEME);
|
ITEM_APPEND("preferences-desktop-theme", _("Theme"), THEME);
|
||||||
ITEM_APPEND("preferences-desktop-background", _("Background"), BACKGROUND);
|
ITEM_APPEND("preferences-desktop-background", _("Background"), BACKGROUND);
|
||||||
ITEM_APPEND("preferences-desktop-theme", _("Colors"), COLORS);
|
ITEM_APPEND("preferences-desktop-theme", _("Colors"), COLORS);
|
||||||
ITEM_APPEND("video-display", _("Video"), VIDEO);
|
ITEM_APPEND("video-display", _("Video"), VIDEO);
|
||||||
ITEM_APPEND("preferences-system", _("Behavior"), BEHAVIOR);
|
ITEM_APPEND("preferences-system", _("Behavior"), BEHAVIOR);
|
||||||
ITEM_APPEND("preferences-desktop-keyboard-shortcuts", _("Keys"), KEYS);
|
ITEM_APPEND("preferences-desktop-keyboard-shortcuts", _("Keys"), KEYS);
|
||||||
ITEM_APPEND("system-run", _("Helpers"), HELPERS);
|
ITEM_APPEND("system-run", _("Helpers"), HELPERS);
|
||||||
ITEM_APPEND("preferences-color", _("Toolkit"), ELM);
|
ITEM_APPEND("preferences-color", _("Toolkit"), ELM);
|
||||||
#undef ITEM_APPEND
|
#undef ITEM_APPEND
|
||||||
|
|
||||||
elm_box_pack_end(op_tbox, o);
|
elm_box_pack_end(op_tbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
elm_toolbar_item_selected_set(it_fn, EINA_TRUE);
|
elm_toolbar_item_selected_set(it_fn, EINA_TRUE);
|
||||||
|
|
||||||
op_temp = o = elm_check_add(win);
|
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 1.0);
|
|
||||||
elm_object_text_set(o, _("Temporary"));
|
|
||||||
elm_check_state_set(o, config->temporary);
|
|
||||||
elm_box_pack_end(op_tbox, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_smart_callback_add(o, "changed", _cb_op_tmp_chg, config);
|
|
||||||
|
|
||||||
edje_object_part_swallow(bg, "terminology.options", op_frame);
|
o = elm_check_add(win);
|
||||||
evas_object_show(op_frame);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
}
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 1.0);
|
||||||
else if ((op_opbox) && (!op_out))
|
elm_object_text_set(o, _("Temporary"));
|
||||||
{
|
elm_check_state_set(o, config->temporary);
|
||||||
edje_object_part_swallow(bg, "terminology.optdetails", op_opbox);
|
elm_box_pack_end(op_tbox, o);
|
||||||
edje_object_part_swallow(bg, "terminology.options", op_frame);
|
evas_object_show(o);
|
||||||
edje_object_signal_emit(bg, "optdetails,show", "terminology");
|
evas_object_smart_callback_add(o, "changed", _cb_op_tmp_chg, ctx);
|
||||||
edje_object_signal_emit(bg, "options,show", "terminology");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!op_out)
|
|
||||||
{
|
|
||||||
edje_object_signal_callback_add(bg, "optdetails,hide,done",
|
|
||||||
"terminology",
|
|
||||||
_cb_opdt_hide_done, term);
|
|
||||||
op_over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
|
||||||
evas_object_color_set(o, 0, 0, 0, 0);
|
|
||||||
edje_object_part_swallow(bg, "terminology.dismiss", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
||||||
_cb_mouse_down, term);
|
|
||||||
|
|
||||||
edje_object_signal_emit(bg, "options,show", "terminology");
|
edje_object_part_swallow(base, "terminology.options", ctx->frame);
|
||||||
op_out = EINA_TRUE;
|
evas_object_show(ctx->frame);
|
||||||
op_donecb = donecb;
|
|
||||||
op_donedata = donedata;
|
edje_object_signal_callback_add(ctx->base, "optdetails,hide,done",
|
||||||
elm_object_focus_set(op_toolbar, EINA_TRUE);
|
"terminology",
|
||||||
if (op_del_timer)
|
_cb_opdt_hide_done, ctx);
|
||||||
{
|
ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
ecore_timer_del(op_del_timer);
|
evas_object_color_set(o, 0, 0, 0, 0);
|
||||||
op_del_timer = NULL;
|
edje_object_part_swallow(ctx->base, "terminology.dismiss", o);
|
||||||
}
|
evas_object_show(o);
|
||||||
}
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
else
|
_cb_mouse_down, ctx);
|
||||||
{
|
|
||||||
edje_object_signal_callback_del(bg, "optdetails,hide,done",
|
edje_object_signal_emit(ctx->base, "options,show", "terminology");
|
||||||
"terminology",
|
elm_object_focus_set(ctx->toolbar, EINA_TRUE);
|
||||||
_cb_opdt_hide_done);
|
|
||||||
edje_object_signal_callback_add(bg, "optdetails,hide,done",
|
|
||||||
"terminology",
|
|
||||||
_cb_opdt_hide_done2, term);
|
|
||||||
elm_object_focus_set(op_frame, EINA_FALSE);
|
|
||||||
elm_object_focus_set(op_opbox, EINA_FALSE);
|
|
||||||
elm_object_focus_set(op_toolbar, EINA_FALSE);
|
|
||||||
if (op_donecb) op_donecb(op_donedata);
|
|
||||||
evas_object_del(op_over);
|
|
||||||
op_over = NULL;
|
|
||||||
edje_object_signal_emit(bg, "options,hide", "terminology");
|
|
||||||
edje_object_signal_emit(bg, "optdetails,hide", "terminology");
|
|
||||||
op_out = EINA_FALSE;
|
|
||||||
if (op_del_timer) ecore_timer_del(op_del_timer);
|
|
||||||
op_del_timer = ecore_timer_add(10.0, _cb_op_del_delay, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
options_active_get(void)
|
|
||||||
{
|
|
||||||
return op_out;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#ifndef _TERMINOLOGY_OPTIONS_H__
|
#ifndef _TERMINOLOGY_OPTIONS_H__
|
||||||
#define _TERMINOLOGY_OPTIONS_H__ 1
|
#define _TERMINOLOGY_OPTIONS_H__ 1
|
||||||
|
|
||||||
void options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
|
void options_show(Evas_Object *win, Evas_Object *base, Evas_Object *bg,
|
||||||
void (*donecb) (void *data), void *donedata);
|
Evas_Object *term,
|
||||||
Eina_Bool options_active_get(void);
|
void (*donecb) (void *data), void *donedata);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "media.h"
|
#include "media.h"
|
||||||
|
@ -11,6 +12,24 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
typedef struct _Background_Ctx {
|
||||||
|
Config *config;
|
||||||
|
Evas_Object *frame;
|
||||||
|
Evas_Object *flip;
|
||||||
|
Evas_Object *bg_grid;
|
||||||
|
Evas_Object *term;
|
||||||
|
Evas_Object *entry;
|
||||||
|
Evas_Object *bubble;
|
||||||
|
Evas_Object *op_trans;
|
||||||
|
Evas_Object *op_opacity;
|
||||||
|
Evas_Object *op_shine_slider;
|
||||||
|
|
||||||
|
Eina_Stringshare *system_path;
|
||||||
|
Eina_Stringshare *user_path;
|
||||||
|
Eina_List *background_list;
|
||||||
|
Ecore_Timer *bubble_disappear;
|
||||||
|
} Background_Ctx;
|
||||||
|
|
||||||
typedef struct _Background_Item
|
typedef struct _Background_Item
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
|
@ -25,31 +44,14 @@ typedef struct _Insert_Gen_Grid_Item_Notify
|
||||||
} Insert_Gen_Grid_Item_Notify;
|
} Insert_Gen_Grid_Item_Notify;
|
||||||
|
|
||||||
|
|
||||||
static Eina_Stringshare *_system_path,
|
|
||||||
*_user_path;
|
|
||||||
|
|
||||||
static Evas_Object *_bg_grid = NULL,
|
|
||||||
*_term = NULL,
|
|
||||||
*_entry = NULL,
|
|
||||||
*_flip = NULL,
|
|
||||||
*_bubble = NULL;
|
|
||||||
|
|
||||||
static Eina_List *_backgroundlist = NULL;
|
|
||||||
|
|
||||||
static Ecore_Timer *_bubble_disappear;
|
|
||||||
|
|
||||||
static Ecore_Thread *_thread;
|
|
||||||
static Evas_Object *op_trans, *op_opacity;
|
|
||||||
static Evas_Object *op_shine_slider = NULL;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_shine_sel(void *data,
|
_cb_op_shine_sel(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *termio_obj = data;
|
Background_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(termio_obj);
|
Config *config = ctx->config;
|
||||||
Term *term = termio_term_get(termio_obj);
|
Term *term = termio_term_get(ctx->term);
|
||||||
Win *wn = term_win_get(term);
|
Win *wn = term_win_get(term);
|
||||||
int shine = elm_slider_value_get(obj);
|
int shine = elm_slider_value_get(obj);
|
||||||
Eina_List *l, *wn_list;
|
Eina_List *l, *wn_list;
|
||||||
|
@ -69,10 +71,11 @@ _cb_op_video_trans_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Background_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->translucent = elm_check_state_get(obj);
|
config->translucent = elm_check_state_get(obj);
|
||||||
elm_object_disabled_set(op_opacity, !config->translucent);
|
elm_object_disabled_set(ctx->op_opacity, !config->translucent);
|
||||||
main_trans_update(config);
|
main_trans_update(config);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
@ -82,64 +85,70 @@ _cb_op_video_opacity_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Background_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->opacity = elm_slider_value_get(obj);
|
config->opacity = elm_slider_value_get(obj);
|
||||||
if (!config->translucent) return;
|
if (!config->translucent)
|
||||||
|
return;
|
||||||
main_trans_update(config);
|
main_trans_update(config);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_fileselector(void *_data EINA_UNUSED,
|
_cb_fileselector(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *event)
|
void *event)
|
||||||
{
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
{
|
{
|
||||||
elm_object_text_set(_entry, elm_fileselector_path_get(obj));
|
elm_object_text_set(ctx->entry, elm_fileselector_path_get(obj));
|
||||||
elm_flip_go_to(_flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
elm_flip_go_to(_flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_timer_bubble_disappear(void *_data EINA_UNUSED)
|
_cb_timer_bubble_disappear(void *data)
|
||||||
{
|
{
|
||||||
evas_object_del(_bubble);
|
Background_Ctx *ctx = data;
|
||||||
_bubble_disappear = NULL;
|
evas_object_del(ctx->bubble);
|
||||||
|
ctx->bubble = NULL;
|
||||||
|
ctx->bubble_disappear = NULL;
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bubble_show(char *text)
|
_bubble_show(Background_Ctx *ctx, char *text)
|
||||||
{
|
{
|
||||||
Evas_Object *opbox = elm_object_top_widget_get(_bg_grid);
|
Evas_Object *opbox = elm_object_top_widget_get(ctx->bg_grid);
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
int x = 0, y = 0, w , h;
|
int x = 0, y = 0, w , h;
|
||||||
|
|
||||||
evas_object_geometry_get(_bg_grid, &x, &y, &w ,&h);
|
evas_object_geometry_get(ctx->bg_grid, &x, &y, &w ,&h);
|
||||||
if (_bubble_disappear)
|
if (ctx->bubble_disappear)
|
||||||
{
|
{
|
||||||
ecore_timer_del(_bubble_disappear);
|
ecore_timer_del(ctx->bubble_disappear);
|
||||||
_cb_timer_bubble_disappear(NULL);
|
_cb_timer_bubble_disappear(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
_bubble = elm_bubble_add(opbox);
|
ctx->bubble = elm_bubble_add(opbox);
|
||||||
elm_bubble_pos_set(_bubble, ELM_BUBBLE_POS_BOTTOM_RIGHT);
|
elm_bubble_pos_set(ctx->bubble, ELM_BUBBLE_POS_BOTTOM_RIGHT);
|
||||||
evas_object_resize(_bubble, 200, 50);
|
evas_object_resize(ctx->bubble, 200, 50);
|
||||||
evas_object_move(_bubble, (x + w - 200), (y + h - 50));
|
evas_object_move(ctx->bubble, (x + w - 200), (y + h - 50));
|
||||||
evas_object_show(_bubble);
|
evas_object_show(ctx->bubble);
|
||||||
|
|
||||||
o = elm_label_add(_bubble);
|
o = elm_label_add(ctx->bubble);
|
||||||
elm_object_text_set(o, text);
|
elm_object_text_set(o, text);
|
||||||
elm_object_content_set(_bubble, o);
|
elm_object_content_set(ctx->bubble, o);
|
||||||
|
|
||||||
_bubble_disappear = ecore_timer_add(2.0, _cb_timer_bubble_disappear, NULL);
|
ctx->bubble_disappear = ecore_timer_add(2.0,
|
||||||
|
_cb_timer_bubble_disappear, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -150,18 +159,22 @@ _grid_text_get(void *data,
|
||||||
Background_Item *item = data;
|
Background_Item *item = data;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (!item->path) return strdup(_("None"));
|
if (!item->path)
|
||||||
|
return strdup(_("None"));
|
||||||
s = ecore_file_file_get(item->path);
|
s = ecore_file_file_get(item->path);
|
||||||
if (s) return strdup(s);
|
if (s)
|
||||||
|
return strdup(s);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_grid_content_get(void *data, Evas_Object *obj, const char *part)
|
_grid_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
{
|
{
|
||||||
|
Background_Ctx *ctx = evas_object_data_get(obj, "ctx");
|
||||||
|
assert(ctx);
|
||||||
Background_Item *item = data;
|
Background_Item *item = data;
|
||||||
Evas_Object *o, *oe;
|
Evas_Object *o, *oe;
|
||||||
Config *config = termio_config_get(_term);
|
Config *config = ctx->config;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (!strcmp(part, "elm.swallow.icon"))
|
||||||
|
@ -181,7 +194,8 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!config->theme) return NULL;
|
if (!config->theme)
|
||||||
|
return NULL;
|
||||||
snprintf(path, PATH_MAX, "%s/themes/%s", elm_app_data_dir_get(),
|
snprintf(path, PATH_MAX, "%s/themes/%s", elm_app_data_dir_get(),
|
||||||
config->theme);
|
config->theme);
|
||||||
o = elm_layout_add(obj);
|
o = elm_layout_add(obj);
|
||||||
|
@ -200,11 +214,12 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_item_selected(void *data,
|
_item_selected(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Background_Ctx *ctx = evas_object_data_get(obj, "ctx");
|
||||||
Background_Item *item = data;
|
Background_Item *item = data;
|
||||||
Config *config = termio_config_get(_term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
if (!item->path)
|
if (!item->path)
|
||||||
|
@ -223,17 +238,18 @@ _item_selected(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_insert_gengrid_item(Insert_Gen_Grid_Item_Notify *msg_data)
|
_insert_gengrid_item(Background_Ctx *ctx,
|
||||||
|
Insert_Gen_Grid_Item_Notify *msg_data)
|
||||||
{
|
{
|
||||||
Insert_Gen_Grid_Item_Notify *insert_msg = msg_data;
|
Insert_Gen_Grid_Item_Notify *insert_msg = msg_data;
|
||||||
Config *config = termio_config_get(_term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
if (insert_msg && insert_msg->item && insert_msg->class && config)
|
if (insert_msg && insert_msg->item && insert_msg->class && config)
|
||||||
{
|
{
|
||||||
Background_Item *item = insert_msg->item;
|
Background_Item *item = insert_msg->item;
|
||||||
Elm_Gengrid_Item_Class *item_class = insert_msg->class;
|
Elm_Gengrid_Item_Class *item_class = insert_msg->class;
|
||||||
|
|
||||||
item->item = elm_gengrid_item_append(_bg_grid, item_class, item,
|
item->item = elm_gengrid_item_append(ctx->bg_grid, item_class, item,
|
||||||
_item_selected, item);
|
_item_selected, item);
|
||||||
if ((!item->path) && (!config->background))
|
if ((!item->path) && (!config->background))
|
||||||
{
|
{
|
||||||
|
@ -255,8 +271,8 @@ _insert_gengrid_item(Insert_Gen_Grid_Item_Notify *msg_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_List*
|
static Eina_List*
|
||||||
_rec_read_directorys(Eina_List *list, const char *root_path,
|
_rec_read_directorys(Background_Ctx *ctx, Eina_List *list,
|
||||||
Elm_Gengrid_Item_Class *class)
|
const char *root_path, Elm_Gengrid_Item_Class *class)
|
||||||
{
|
{
|
||||||
Eina_List *childs = ecore_file_ls(root_path);
|
Eina_List *childs = ecore_file_ls(root_path);
|
||||||
char *file_name, path[PATH_MAX];
|
char *file_name, path[PATH_MAX];
|
||||||
|
@ -296,7 +312,7 @@ _rec_read_directorys(Eina_List *list, const char *root_path,
|
||||||
notify->class = class;
|
notify->class = class;
|
||||||
notify->item = item;
|
notify->item = item;
|
||||||
//ecore_thread_feedback(th, notify);
|
//ecore_thread_feedback(th, notify);
|
||||||
_insert_gengrid_item(notify);
|
_insert_gengrid_item(ctx, notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -310,31 +326,30 @@ _rec_read_directorys(Eina_List *list, const char *root_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_refresh_directory(const char* data)
|
_refresh_directory(Background_Ctx *ctx, const char* data)
|
||||||
{
|
{
|
||||||
Background_Item *item;
|
Background_Item *item;
|
||||||
Elm_Gengrid_Item_Class *item_class;
|
Elm_Gengrid_Item_Class *item_class;
|
||||||
|
|
||||||
// This will run elm_gengrid_clear
|
elm_gengrid_clear(ctx->bg_grid);
|
||||||
elm_gengrid_clear(_bg_grid);
|
|
||||||
|
|
||||||
if (_backgroundlist)
|
if (ctx->background_list)
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(_backgroundlist, item)
|
EINA_LIST_FREE(ctx->background_list, item)
|
||||||
{
|
{
|
||||||
if (item->path)
|
if (item->path)
|
||||||
eina_stringshare_del(item->path);
|
eina_stringshare_del(item->path);
|
||||||
free(item);
|
free(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
_backgroundlist = NULL;
|
ctx->background_list = NULL;
|
||||||
}
|
}
|
||||||
item_class = elm_gengrid_item_class_new();
|
item_class = elm_gengrid_item_class_new();
|
||||||
item_class->func.text_get = _grid_text_get;
|
item_class->func.text_get = _grid_text_get;
|
||||||
item_class->func.content_get = _grid_content_get;
|
item_class->func.content_get = _grid_content_get;
|
||||||
|
|
||||||
item = calloc(1, sizeof(Background_Item));
|
item = calloc(1, sizeof(Background_Item));
|
||||||
_backgroundlist = eina_list_append(_backgroundlist, item);
|
ctx->background_list = eina_list_append(ctx->background_list, item);
|
||||||
|
|
||||||
//Insert None Item
|
//Insert None Item
|
||||||
Insert_Gen_Grid_Item_Notify *notify = calloc(1,
|
Insert_Gen_Grid_Item_Notify *notify = calloc(1,
|
||||||
|
@ -344,66 +359,93 @@ _refresh_directory(const char* data)
|
||||||
notify->class = item_class;
|
notify->class = item_class;
|
||||||
notify->item = item;
|
notify->item = item;
|
||||||
|
|
||||||
_insert_gengrid_item(notify);
|
_insert_gengrid_item(ctx, notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
_backgroundlist = _rec_read_directorys(_backgroundlist, data,
|
ctx->background_list = _rec_read_directorys(ctx, ctx->background_list, data,
|
||||||
item_class);
|
item_class);
|
||||||
|
|
||||||
elm_gengrid_item_class_free(item_class);
|
elm_gengrid_item_class_free(item_class);
|
||||||
_thread = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gengrid_refresh_samples(const char *path)
|
_gengrid_refresh_samples(Background_Ctx *ctx, const char *path)
|
||||||
{
|
{
|
||||||
if(!ecore_file_exists(path))
|
if(!ecore_file_exists(path))
|
||||||
return;
|
return;
|
||||||
_refresh_directory(path);
|
_refresh_directory(ctx, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_entry_changed(void *_data EINA_UNUSED,
|
_cb_entry_changed(void *data,
|
||||||
Evas_Object *parent,
|
Evas_Object *parent,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
const char *path = elm_object_text_get(parent);
|
const char *path = elm_object_text_get(parent);
|
||||||
_gengrid_refresh_samples(path);
|
_gengrid_refresh_samples(ctx, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_hoversel_select(void *data,
|
_cb_hoversel_select(Background_Ctx *ctx, const Eina_Stringshare *path)
|
||||||
Evas_Object *_hoversel EINA_UNUSED,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char *path = data;
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
elm_object_text_set(_entry, path);
|
elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
||||||
|
elm_object_text_set(ctx->entry, path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
o = elm_object_part_content_get(_flip, "back");
|
o = elm_object_part_content_get(ctx->flip, "back");
|
||||||
elm_fileselector_path_set(o, elm_object_text_get(_entry));
|
elm_fileselector_path_set(o, elm_object_text_get(ctx->entry));
|
||||||
elm_flip_go_to(_flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT);
|
elm_flip_go_to(ctx->flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_system_background_dir_init(void)
|
_cb_hoversel_select_system(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
|
|
||||||
|
_cb_hoversel_select(ctx, ctx->system_path);
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
_cb_hoversel_select_user(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
|
|
||||||
|
_cb_hoversel_select(ctx, ctx->user_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_hoversel_select_none(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
|
_cb_hoversel_select(ctx, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_system_background_dir_init(Background_Ctx *ctx)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get());
|
snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get());
|
||||||
if (_system_path)
|
if (ctx->system_path)
|
||||||
eina_stringshare_replace(&_system_path, path);
|
eina_stringshare_replace(&ctx->system_path, path);
|
||||||
else
|
else
|
||||||
_system_path = eina_stringshare_add(path);
|
ctx->system_path = eina_stringshare_add(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char*
|
static const char*
|
||||||
_user_background_dir_init(void){
|
_user_background_dir_init(Background_Ctx *ctx)
|
||||||
|
{
|
||||||
char path[PATH_MAX], *user;
|
char path[PATH_MAX], *user;
|
||||||
|
|
||||||
user = getenv("HOME");
|
user = getenv("HOME");
|
||||||
|
@ -412,52 +454,53 @@ _user_background_dir_init(void){
|
||||||
snprintf(path, PATH_MAX, "%s/.config/terminology/background/", user);
|
snprintf(path, PATH_MAX, "%s/.config/terminology/background/", user);
|
||||||
if (!ecore_file_exists(path))
|
if (!ecore_file_exists(path))
|
||||||
ecore_file_mkpath(path);
|
ecore_file_mkpath(path);
|
||||||
if (!_user_path)
|
if (!ctx->user_path)
|
||||||
_user_path = eina_stringshare_add(path);
|
ctx->user_path = eina_stringshare_add(path);
|
||||||
else
|
else
|
||||||
eina_stringshare_replace(&_user_path, path);
|
eina_stringshare_replace(&ctx->user_path, path);
|
||||||
return _user_path;
|
return ctx->user_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char*
|
static const char*
|
||||||
_import_background(const char* background)
|
_import_background(Background_Ctx *ctx, const char* background)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
const char *filename = ecore_file_file_get(background);
|
const char *filename = ecore_file_file_get(background);
|
||||||
|
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!_user_background_dir_init())
|
if (!_user_background_dir_init(ctx))
|
||||||
return NULL;
|
return NULL;
|
||||||
snprintf(path, PATH_MAX, "%s/%s", _user_path, filename);
|
snprintf(path, PATH_MAX, "%s/%s", ctx->user_path, filename);
|
||||||
if (!ecore_file_cp(background, path))
|
if (!ecore_file_cp(background, path))
|
||||||
return NULL;
|
return NULL;
|
||||||
return eina_stringshare_add(path);
|
return eina_stringshare_add(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_grid_doubleclick(void *_data EINA_UNUSED,
|
_cb_grid_doubleclick(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Config *config = termio_config_get(_term);
|
Background_Ctx *ctx = data;
|
||||||
|
Config *config = ctx->config;
|
||||||
char *config_background_dir = ecore_file_dir_get(config->background);
|
char *config_background_dir = ecore_file_dir_get(config->background);
|
||||||
|
|
||||||
if (!_user_path) {
|
if (!ctx->user_path) {
|
||||||
if (!_user_background_dir_init())
|
if (!_user_background_dir_init(ctx))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!config->background)
|
if (!config->background)
|
||||||
return;
|
return;
|
||||||
if (strncmp(config_background_dir, _user_path,
|
if (strncmp(config_background_dir, ctx->user_path,
|
||||||
strlen(config_background_dir)) == 0)
|
strlen(config_background_dir)) == 0)
|
||||||
{
|
{
|
||||||
_bubble_show(_("Source file is target file"));
|
_bubble_show(ctx, _("Source file is target file"));
|
||||||
free(config_background_dir);
|
free(config_background_dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *newfile = _import_background(config->background);
|
const char *newfile = _import_background(ctx, config->background);
|
||||||
|
|
||||||
if (newfile)
|
if (newfile)
|
||||||
{
|
{
|
||||||
|
@ -465,50 +508,74 @@ _cb_grid_doubleclick(void *_data EINA_UNUSED,
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
main_media_update(config);
|
main_media_update(config);
|
||||||
eina_stringshare_del(newfile);
|
eina_stringshare_del(newfile);
|
||||||
_bubble_show(_("Picture imported"));
|
_bubble_show(ctx, _("Picture imported"));
|
||||||
elm_object_text_set(_entry, config_background_dir);
|
elm_object_text_set(ctx->entry, config_background_dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_bubble_show(_("Failed"));
|
_bubble_show(ctx, _("Failed"));
|
||||||
}
|
}
|
||||||
free(config_background_dir);
|
free(config_background_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_parent_del_cb(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Background_Ctx *ctx = data;
|
||||||
|
Background_Item *item;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(ctx->background_list, item)
|
||||||
|
{
|
||||||
|
if (item->path)
|
||||||
|
eina_stringshare_del(item->path);
|
||||||
|
free(item);
|
||||||
|
}
|
||||||
|
ctx->background_list = NULL;
|
||||||
|
if (ctx->user_path)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(ctx->user_path);
|
||||||
|
ctx->user_path = NULL;
|
||||||
|
}
|
||||||
|
if (ctx->system_path)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(ctx->system_path);
|
||||||
|
ctx->system_path = NULL;
|
||||||
|
}
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
options_background(Evas_Object *opbox, Evas_Object *term)
|
options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
Evas_Object *frame, *o, *bx, *bx2;
|
Evas_Object *o, *bx, *bx_front;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
char path[PATH_MAX], *config_background_dir;
|
char path[PATH_MAX], *config_background_dir;
|
||||||
|
Background_Ctx *ctx;
|
||||||
|
|
||||||
_term = term;
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
frame = o = elm_frame_add(opbox);
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
|
||||||
|
ctx->frame = 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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(o, _("Background"));
|
elm_object_text_set(o, _("Background"));
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
|
|
||||||
_flip = o = elm_flip_add(opbox);
|
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_DEL,
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
_parent_del_cb, ctx);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
||||||
elm_object_content_set(frame, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = elm_fileselector_add(opbox);
|
bx = o = elm_box_add(ctx->frame);
|
||||||
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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_part_content_set(_flip, "back", o);
|
elm_object_content_set(ctx->frame, bx);
|
||||||
elm_fileselector_folder_only_set(o, EINA_TRUE);
|
|
||||||
evas_object_smart_callback_add(o, "done", _cb_fileselector, NULL);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
bx = o = elm_box_add(opbox);
|
|
||||||
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);
|
|
||||||
elm_object_part_content_set(_flip, "front", bx);
|
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
o = elm_label_add(opbox);
|
o = elm_label_add(opbox);
|
||||||
|
@ -518,7 +585,7 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
op_shine_slider = o = elm_slider_add(opbox);
|
ctx->op_shine_slider = o = elm_slider_add(opbox);
|
||||||
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);
|
||||||
elm_slider_span_size_set(o, 40);
|
elm_slider_span_size_set(o, 40);
|
||||||
|
@ -533,11 +600,11 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
evas_object_smart_callback_add(o, "delay,changed",
|
evas_object_smart_callback_add(o, "delay,changed",
|
||||||
_cb_op_shine_sel, term);
|
_cb_op_shine_sel, ctx);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
op_trans = o = elm_check_add(opbox);
|
ctx->op_trans = o = elm_check_add(opbox);
|
||||||
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);
|
||||||
elm_object_text_set(o, _("Translucent"));
|
elm_object_text_set(o, _("Translucent"));
|
||||||
|
@ -545,9 +612,9 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_video_trans_chg, term);
|
_cb_op_video_trans_chg, ctx);
|
||||||
|
|
||||||
op_opacity = o = elm_slider_add(opbox);
|
ctx->op_opacity = o = elm_slider_add(opbox);
|
||||||
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);
|
||||||
elm_slider_span_size_set(o, 40);
|
elm_slider_span_size_set(o, 40);
|
||||||
|
@ -559,7 +626,7 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_video_opacity_chg, term);
|
_cb_op_video_opacity_chg, ctx);
|
||||||
|
|
||||||
o = elm_separator_add(opbox);
|
o = elm_separator_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
@ -568,89 +635,85 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
bx2 = 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_box_horizontal_set(o, EINA_TRUE);
|
|
||||||
elm_box_pack_end(bx, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
|
|
||||||
_entry = 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.0);
|
|
||||||
elm_entry_single_line_set(o, EINA_TRUE);
|
|
||||||
elm_entry_scrollable_set(o, EINA_TRUE);
|
|
||||||
elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
|
||||||
evas_object_smart_callback_add(_entry, "changed", _cb_entry_changed, NULL);
|
|
||||||
elm_box_pack_start(bx2, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
o = elm_hoversel_add(opbox);
|
o = elm_hoversel_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_object_text_set(o, _("Select Path"));
|
elm_object_text_set(o, _("Select Path"));
|
||||||
elm_box_pack_end(bx2, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get());
|
snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get());
|
||||||
_system_background_dir_init();
|
_system_background_dir_init(ctx);
|
||||||
elm_hoversel_item_add(o, _("System"), NULL, ELM_ICON_NONE, _cb_hoversel_select ,
|
elm_hoversel_item_add(o, _("System"), NULL, ELM_ICON_NONE,
|
||||||
_system_path);
|
_cb_hoversel_select_system, ctx);
|
||||||
if (_user_background_dir_init())
|
if (_user_background_dir_init(ctx))
|
||||||
elm_hoversel_item_add(o, _("User"), NULL, ELM_ICON_NONE, _cb_hoversel_select ,
|
elm_hoversel_item_add(o, _("User"), NULL, ELM_ICON_NONE,
|
||||||
_user_path);
|
_cb_hoversel_select_user, ctx);
|
||||||
//In the other case it has failed, so dont show the user item
|
//In the other case it has failed, so dont show the user item
|
||||||
elm_hoversel_item_add(o, _("Other"), NULL, ELM_ICON_NONE, _cb_hoversel_select ,
|
elm_hoversel_item_add(o, _("Other"), NULL, ELM_ICON_NONE,
|
||||||
NULL);
|
_cb_hoversel_select_none, ctx);
|
||||||
|
|
||||||
_bg_grid = o = elm_gengrid_add(opbox);
|
ctx->flip = o = elm_flip_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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_smart_callback_add(o, "clicked,double", _cb_grid_doubleclick, NULL);
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
bx_front = 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_box_horizontal_set(o, EINA_FALSE);
|
||||||
|
elm_object_part_content_set(ctx->flip, "front", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
ctx->entry = 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.0);
|
||||||
|
elm_entry_single_line_set(o, EINA_TRUE);
|
||||||
|
elm_entry_scrollable_set(o, EINA_TRUE);
|
||||||
|
elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF,
|
||||||
|
ELM_SCROLLER_POLICY_OFF);
|
||||||
|
evas_object_smart_callback_add(ctx->entry, "changed",
|
||||||
|
_cb_entry_changed, ctx);
|
||||||
|
elm_box_pack_end(bx_front, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
ctx->bg_grid = o = elm_gengrid_add(opbox);
|
||||||
|
evas_object_data_set(ctx->bg_grid, "ctx", ctx);
|
||||||
|
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);
|
||||||
|
evas_object_smart_callback_add(o, "clicked,double",
|
||||||
|
_cb_grid_doubleclick, ctx);
|
||||||
elm_gengrid_item_size_set(o, elm_config_scale_get() * 100,
|
elm_gengrid_item_size_set(o, elm_config_scale_get() * 100,
|
||||||
elm_config_scale_get() * 80);
|
elm_config_scale_get() * 80);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx_front, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
o = elm_label_add(opbox);
|
o = elm_label_add(opbox);
|
||||||
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.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_object_text_set(o, _("Double click on a picture to import it"));
|
elm_object_text_set(o, _("Click on a picture to use it as background"));
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx_front, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
o = elm_fileselector_add(opbox);
|
||||||
|
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);
|
||||||
|
elm_object_part_content_set(ctx->flip, "back", o);
|
||||||
|
elm_fileselector_folder_only_set(o, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_add(o, "done", _cb_fileselector, ctx);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
if (config->background)
|
if (config->background)
|
||||||
{
|
{
|
||||||
config_background_dir = ecore_file_dir_get(config->background);
|
config_background_dir = ecore_file_dir_get(config->background);
|
||||||
elm_object_text_set(_entry, config_background_dir);
|
elm_object_text_set(ctx->entry, config_background_dir);
|
||||||
free(config_background_dir);
|
free(config_background_dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
elm_object_text_set(_entry, _system_path);
|
elm_object_text_set(ctx->entry, ctx->system_path);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
options_background_clear(void)
|
|
||||||
{
|
|
||||||
Background_Item *item;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(_backgroundlist, item)
|
|
||||||
{
|
|
||||||
if (item->path) eina_stringshare_del(item->path);
|
|
||||||
free(item);
|
|
||||||
}
|
|
||||||
_backgroundlist = NULL;
|
|
||||||
if (_user_path)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(_user_path);
|
|
||||||
_user_path = NULL;
|
|
||||||
}
|
|
||||||
if (_system_path)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(_system_path);
|
|
||||||
_system_path = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,34 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "options_behavior.h"
|
#include "options_behavior.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
static Evas_Object *op_w, *op_h, *op_wh_current;
|
typedef struct _Behavior_Ctx {
|
||||||
|
Evas_Object *op_w;
|
||||||
|
Evas_Object *op_h;
|
||||||
|
Evas_Object *op_wh_current;
|
||||||
|
Evas_Object *term;
|
||||||
|
Config *config;
|
||||||
|
} Behavior_Ctx;
|
||||||
|
|
||||||
|
|
||||||
#define CB(_cfg_name, _inv) \
|
#define CB(_cfg_name, _inv) \
|
||||||
static void \
|
static void \
|
||||||
_cb_op_behavior_##_cfg_name(void *data, Evas_Object *obj, \
|
_cb_op_behavior_##_cfg_name(void *data, Evas_Object *obj, \
|
||||||
void *_event EINA_UNUSED) \
|
void *_event EINA_UNUSED) \
|
||||||
{ \
|
{ \
|
||||||
Evas_Object *term = data; \
|
Behavior_Ctx *ctx = data; \
|
||||||
Config *config = termio_config_get(term); \
|
Config *config = ctx->config; \
|
||||||
if (_inv) \
|
if (_inv) \
|
||||||
config->_cfg_name = !elm_check_state_get(obj); \
|
config->_cfg_name = !elm_check_state_get(obj); \
|
||||||
else \
|
else \
|
||||||
config->_cfg_name = elm_check_state_get(obj); \
|
config->_cfg_name = elm_check_state_get(obj); \
|
||||||
termio_config_update(term); \
|
termio_config_update(ctx->term); \
|
||||||
windows_update(); \
|
windows_update(); \
|
||||||
config_save(config, NULL); \
|
config_save(config, NULL); \
|
||||||
}
|
}
|
||||||
|
@ -74,11 +82,11 @@ _cb_op_behavior_sback_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->scrollback = (double) sback_double_to_expo_int(elm_slider_value_get(obj));
|
config->scrollback = (double) sback_double_to_expo_int(elm_slider_value_get(obj));
|
||||||
termio_config_update(term);
|
termio_config_update(ctx->term);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +95,11 @@ _cb_op_behavior_tab_zoom_slider_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->tab_zoom = (double)(int)round(elm_slider_value_get(obj) * 10.0) / 10.0;
|
config->tab_zoom = (double)(int)round(elm_slider_value_get(obj) * 10.0) / 10.0;
|
||||||
termio_config_update(term);
|
termio_config_update(ctx->term);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,15 +108,16 @@ _cb_op_behavior_custom_geometry_current_set(void *data,
|
||||||
Evas_Object *obj EINA_UNUSED,
|
Evas_Object *obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
if (config->custom_geometry)
|
|
||||||
{
|
if (config->custom_geometry)
|
||||||
termio_size_get(term, &config->cg_width, &config->cg_height);
|
{
|
||||||
elm_spinner_value_set(op_w, config->cg_width);
|
termio_size_get(ctx->term, &config->cg_width, &config->cg_height);
|
||||||
elm_spinner_value_set(op_h, config->cg_height);
|
elm_spinner_value_set(ctx->op_w, config->cg_width);
|
||||||
}
|
elm_spinner_value_set(ctx->op_h, config->cg_height);
|
||||||
config_save(config, NULL);
|
}
|
||||||
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -116,20 +125,20 @@ _cb_op_behavior_custom_geometry(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->custom_geometry = elm_check_state_get(obj);
|
config->custom_geometry = elm_check_state_get(obj);
|
||||||
if (config->custom_geometry)
|
if (config->custom_geometry)
|
||||||
{
|
{
|
||||||
config->cg_width = (int) elm_spinner_value_get(op_w);
|
config->cg_width = (int) elm_spinner_value_get(ctx->op_w);
|
||||||
config->cg_height = (int) elm_spinner_value_get(op_h);
|
config->cg_height = (int) elm_spinner_value_get(ctx->op_h);
|
||||||
}
|
}
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
|
|
||||||
elm_object_disabled_set(op_w, !config->custom_geometry);
|
elm_object_disabled_set(ctx->op_w, !config->custom_geometry);
|
||||||
elm_object_disabled_set(op_h, !config->custom_geometry);
|
elm_object_disabled_set(ctx->op_h, !config->custom_geometry);
|
||||||
elm_object_disabled_set(op_wh_current, !config->custom_geometry);
|
elm_object_disabled_set(ctx->op_wh_current, !config->custom_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -137,8 +146,8 @@ _cb_op_behavior_cg_width(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
if (config->custom_geometry)
|
if (config->custom_geometry)
|
||||||
{
|
{
|
||||||
|
@ -152,8 +161,8 @@ _cb_op_behavior_cg_height(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Behavior_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
if (config->custom_geometry)
|
if (config->custom_geometry)
|
||||||
{
|
{
|
||||||
|
@ -162,28 +171,49 @@ _cb_op_behavior_cg_height(void *data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
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, *frame;
|
||||||
int w, h;
|
int w, h;
|
||||||
const char *tooltip;
|
const char *tooltip;
|
||||||
|
Behavior_Ctx *ctx;
|
||||||
|
|
||||||
termio_size_get(term, &w, &h);
|
termio_size_get(term, &w, &h);
|
||||||
|
|
||||||
fr = o = elm_frame_add(opbox);
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
|
||||||
|
frame = 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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(o, _("Behavior"));
|
elm_object_text_set(o, _("Behavior"));
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
|
||||||
sc = o = elm_scroller_add(opbox);
|
sc = o = elm_scroller_add(opbox);
|
||||||
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
|
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_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_content_set(fr, o);
|
elm_object_content_set(frame, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
bx = o = elm_box_add(opbox);
|
bx = o = elm_box_add(opbox);
|
||||||
|
@ -201,7 +231,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o); \
|
elm_box_pack_end(bx, o); \
|
||||||
evas_object_show(o); \
|
evas_object_show(o); \
|
||||||
evas_object_smart_callback_add(o, "changed", \
|
evas_object_smart_callback_add(o, "changed", \
|
||||||
_cb_op_behavior_##_cfg_name, term)
|
_cb_op_behavior_##_cfg_name, ctx)
|
||||||
|
|
||||||
CX(_("Scroll to bottom on new content"), jump_on_change, 0);
|
CX(_("Scroll to bottom on new content"), jump_on_change, 0);
|
||||||
CX(_("Scroll to bottom when a key is pressed"), jump_on_keypress, 0);
|
CX(_("Scroll to bottom when a key is pressed"), jump_on_keypress, 0);
|
||||||
|
@ -235,9 +265,9 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_custom_geometry, term);
|
_cb_op_behavior_custom_geometry, ctx);
|
||||||
|
|
||||||
op_wh_current = o = elm_button_add(bx);
|
ctx->op_wh_current = o = elm_button_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
||||||
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
||||||
elm_object_text_set(o, _("Set Current:"));
|
elm_object_text_set(o, _("Set Current:"));
|
||||||
|
@ -245,7 +275,8 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
elm_object_disabled_set(o, !config->custom_geometry);
|
elm_object_disabled_set(o, !config->custom_geometry);
|
||||||
evas_object_smart_callback_add(o, "clicked",
|
evas_object_smart_callback_add(o, "clicked",
|
||||||
_cb_op_behavior_custom_geometry_current_set, term);
|
_cb_op_behavior_custom_geometry_current_set,
|
||||||
|
ctx);
|
||||||
|
|
||||||
o = elm_label_add(bx);
|
o = elm_label_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
||||||
|
@ -254,18 +285,20 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
op_w = o = elm_spinner_add(bx);
|
ctx->op_w = o = elm_spinner_add(bx);
|
||||||
elm_spinner_editable_set(o, EINA_TRUE);
|
elm_spinner_editable_set(o, EINA_TRUE);
|
||||||
elm_spinner_min_max_set(o, 2.0, 350.0);
|
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_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);
|
||||||
if (config->custom_geometry) elm_spinner_value_set(o, config->cg_width);
|
if (config->custom_geometry)
|
||||||
else elm_spinner_value_set(o, w);
|
elm_spinner_value_set(o, config->cg_width);
|
||||||
|
else
|
||||||
|
elm_spinner_value_set(o, w);
|
||||||
elm_object_disabled_set(o, !config->custom_geometry);
|
elm_object_disabled_set(o, !config->custom_geometry);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_cg_width, term);
|
_cb_op_behavior_cg_width, ctx);
|
||||||
|
|
||||||
o = elm_label_add(bx);
|
o = elm_label_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
||||||
|
@ -274,18 +307,20 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
op_h = o = elm_spinner_add(bx);
|
ctx->op_h = o = elm_spinner_add(bx);
|
||||||
elm_spinner_editable_set(o, EINA_TRUE);
|
elm_spinner_editable_set(o, EINA_TRUE);
|
||||||
elm_spinner_min_max_set(o, 1.0, 150.0);
|
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_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);
|
||||||
if (config->custom_geometry) elm_spinner_value_set(o, config->cg_height);
|
if (config->custom_geometry)
|
||||||
else elm_spinner_value_set(o, h);
|
elm_spinner_value_set(o, config->cg_height);
|
||||||
|
else
|
||||||
|
elm_spinner_value_set(o, h);
|
||||||
elm_object_disabled_set(o, !config->custom_geometry);
|
elm_object_disabled_set(o, !config->custom_geometry);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_cg_height, term);
|
_cb_op_behavior_cg_height, ctx);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -326,7 +361,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "delay,changed",
|
evas_object_smart_callback_add(o, "delay,changed",
|
||||||
_cb_op_behavior_sback_chg, term);
|
_cb_op_behavior_sback_chg, ctx);
|
||||||
|
|
||||||
o = elm_label_add(bx);
|
o = elm_label_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
evas_object_size_hint_weight_set(o, 0.0, 0.0);
|
||||||
|
@ -352,7 +387,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "delay,changed",
|
evas_object_smart_callback_add(o, "delay,changed",
|
||||||
_cb_op_behavior_tab_zoom_slider_chg, term);
|
_cb_op_behavior_tab_zoom_slider_chg, ctx);
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
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);
|
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#include <Elementary.h>
|
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "options_colors.h"
|
#include "options_colors.h"
|
||||||
|
|
||||||
|
|
||||||
static const char mapping[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11 };
|
|
||||||
static const char *mapping_names[] =
|
static const char *mapping_names[] =
|
||||||
{
|
{
|
||||||
gettext_noop("Default"),
|
gettext_noop("Default"),
|
||||||
|
@ -19,53 +18,48 @@ static const char *mapping_names[] =
|
||||||
gettext_noop("Magenta"),
|
gettext_noop("Magenta"),
|
||||||
gettext_noop("Cyan"),
|
gettext_noop("Cyan"),
|
||||||
gettext_noop("White"),
|
gettext_noop("White"),
|
||||||
|
gettext_noop("Invisible"),
|
||||||
gettext_noop("Inverse"),
|
gettext_noop("Inverse"),
|
||||||
gettext_noop("Inverse Base")
|
gettext_noop("Inverse Background")
|
||||||
};
|
};
|
||||||
|
|
||||||
static Elm_Object_Item *colitem[4][11] = { { NULL } };
|
typedef struct _Colors_Ctx {
|
||||||
static Evas_Object *colorsel = NULL;
|
Elm_Object_Item *colitem[4][12];
|
||||||
static Elm_Object_Item *curitem = NULL;
|
Evas_Object *colorsel;
|
||||||
static Evas_Object *colpal[4] = { NULL };
|
Elm_Object_Item *curitem;
|
||||||
static Evas_Object *label = NULL, *reset = NULL;
|
Evas_Object *colpal[4];
|
||||||
|
Evas_Object *label;
|
||||||
|
Evas_Object *reset;
|
||||||
|
Config *config;
|
||||||
|
Evas_Object *term;
|
||||||
|
Evas_Object *bg;
|
||||||
|
} Colors_Ctx;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_use_custom_chg(void *data,
|
_cb_op_color_item_sel(void *data,
|
||||||
Evas_Object *obj,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Evas_Object *term = data;
|
|
||||||
Config *config = termio_config_get(term);
|
|
||||||
Eina_Bool state = EINA_FALSE;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
state = elm_check_state_get(obj);
|
|
||||||
elm_object_disabled_set(colorsel, !state);
|
|
||||||
for (i = 0; i < 4; i++) elm_object_disabled_set(colpal[i], !state);
|
|
||||||
elm_object_disabled_set(label, !state);
|
|
||||||
config->colors_use = state;
|
|
||||||
termio_config_update(term);
|
|
||||||
config_save(config, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cb_op_color_item_sel(void *_data EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *event)
|
void *event)
|
||||||
{
|
{
|
||||||
|
Colors_Ctx *ctx = data;
|
||||||
Elm_Object_Item *it = event;
|
Elm_Object_Item *it = event;
|
||||||
int r = 0, g = 0, b = 0, a = 0;
|
int r = 0, g = 0, b = 0, a = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
curitem = it;
|
if (ctx->curitem == it)
|
||||||
|
return;
|
||||||
|
if (ctx->curitem)
|
||||||
|
elm_colorselector_palette_item_selected_set(ctx->curitem, EINA_FALSE);
|
||||||
|
ctx->curitem = it;
|
||||||
elm_colorselector_palette_item_color_get(it, &r, &g, &b, &a);
|
elm_colorselector_palette_item_color_get(it, &r, &g, &b, &a);
|
||||||
elm_colorselector_color_set(colorsel, r, g, b, a);
|
elm_colorselector_color_set(ctx->colorsel, r, g, b, a);
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (colitem[j][i] == it)
|
if (i == COL_INVIS)
|
||||||
elm_object_text_set(label,
|
continue;
|
||||||
|
if (ctx->colitem[j][i] == it)
|
||||||
|
elm_object_text_set(ctx->label,
|
||||||
#if HAVE_GETTEXT && ENABLE_NLS
|
#if HAVE_GETTEXT && ENABLE_NLS
|
||||||
gettext(mapping_names[i])
|
gettext(mapping_names[i])
|
||||||
#else
|
#else
|
||||||
|
@ -81,29 +75,32 @@ _cb_op_color_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Colors_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
int r = 0, g = 0, b = 0, a = 0, rr = 0, gg = 0, bb = 0, aa = 0;
|
int r = 0, g = 0, b = 0, a = 0, rr = 0, gg = 0, bb = 0, aa = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
elm_colorselector_palette_item_color_get(curitem, &rr, &gg, &bb, &aa);
|
elm_colorselector_palette_item_color_get(ctx->curitem, &rr, &gg, &bb, &aa);
|
||||||
elm_colorselector_color_get(obj, &r, &g, &b, &a);
|
elm_colorselector_color_get(obj, &r, &g, &b, &a);
|
||||||
if ((r != rr) || (g != gg) || (b != bb) || (a != aa))
|
if ((r != rr) || (g != gg) || (b != bb) || (a != aa))
|
||||||
{
|
{
|
||||||
if (curitem)
|
if (ctx->curitem)
|
||||||
elm_colorselector_palette_item_color_set(curitem, r, g, b, a);
|
elm_colorselector_palette_item_color_set(ctx->curitem, r, g, b, a);
|
||||||
elm_object_disabled_set(reset, EINA_FALSE);
|
elm_object_disabled_set(ctx->reset, EINA_FALSE);
|
||||||
|
config->colors_use = EINA_TRUE;
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (colitem[j][i] == curitem)
|
if (i == COL_INVIS)
|
||||||
|
continue;
|
||||||
|
if (ctx->colitem[j][i] == ctx->curitem)
|
||||||
{
|
{
|
||||||
config->colors[(j * 12) + mapping[i]].r = r;
|
config->colors[(j * 12) + i].r = r * a / 256;
|
||||||
config->colors[(j * 12) + mapping[i]].g = g;
|
config->colors[(j * 12) + i].g = g * a / 256;
|
||||||
config->colors[(j * 12) + mapping[i]].b = b;
|
config->colors[(j * 12) + i].b = b * a / 256;
|
||||||
config->colors[(j * 12) + mapping[i]].a = a;
|
config->colors[(j * 12) + i].a = a;
|
||||||
termio_config_update(term);
|
termio_config_update(ctx->term);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -113,124 +110,203 @@ _cb_op_color_chg(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_reset(void *data,
|
_reset_config_colors(Colors_Ctx *ctx)
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
|
||||||
Config *config = termio_config_get(term);
|
|
||||||
int r = 0, g = 0, b = 0, a = 0;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
|
int r, g, b, a;
|
||||||
unsigned char rr = 0, gg = 0, bb = 0, aa = 0;
|
unsigned char rr = 0, gg = 0, bb = 0, aa = 0;
|
||||||
|
char buf[32];
|
||||||
colors_standard_get(j, i, &rr, &gg, &bb, &aa);
|
|
||||||
config->colors[(j * 12) + i].r = rr;
|
if (i == COL_INVIS)
|
||||||
config->colors[(j * 12) + i].g = gg;
|
continue;
|
||||||
config->colors[(j * 12) + i].b = bb;
|
|
||||||
config->colors[(j * 12) + i].a = aa;
|
snprintf(buf, sizeof(buf) - 1, "c%i", j * 12 + i);
|
||||||
}
|
if (!edje_object_color_class_get(ctx->bg, buf,
|
||||||
for (i = 0; i < 11; i++)
|
&r,
|
||||||
{
|
&g,
|
||||||
elm_colorselector_palette_item_color_set
|
&b,
|
||||||
(colitem[j][i],
|
&a,
|
||||||
config->colors[(j * 12) + mapping[i]].r,
|
NULL, NULL, NULL, NULL,
|
||||||
config->colors[(j * 12) + mapping[i]].g,
|
NULL, NULL, NULL, NULL))
|
||||||
config->colors[(j * 12) + mapping[i]].b,
|
{
|
||||||
config->colors[(j * 12) + mapping[i]].a);
|
colors_standard_get(j, i, &rr, &gg, &bb, &aa);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rr = r;
|
||||||
|
gg = g;
|
||||||
|
bb = b;
|
||||||
|
aa = a;
|
||||||
|
}
|
||||||
|
ctx->config->colors[(j * 12) + i].r = rr;
|
||||||
|
ctx->config->colors[(j * 12) + i].g = gg;
|
||||||
|
ctx->config->colors[(j * 12) + i].b = bb;
|
||||||
|
ctx->config->colors[(j * 12) + i].a = aa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elm_object_disabled_set(reset, EINA_TRUE);
|
}
|
||||||
elm_colorselector_palette_item_color_get(curitem, &r, &g, &b, &a);
|
|
||||||
elm_colorselector_color_set(colorsel, r, g, b, a);
|
|
||||||
|
static void
|
||||||
|
_cb_op_reset(void *data,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Colors_Ctx *ctx = data;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
|
Config *config = ctx->config;
|
||||||
|
int r = 0, g = 0, b = 0, a = 0;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
_reset_config_colors(ctx);
|
||||||
|
for (j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
for (i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
if (i == COL_INVIS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
elm_colorselector_palette_item_color_set
|
||||||
|
(ctx->colitem[j][i],
|
||||||
|
config->colors[(j * 12) + i].r,
|
||||||
|
config->colors[(j * 12) + i].g,
|
||||||
|
config->colors[(j * 12) + i].b,
|
||||||
|
config->colors[(j * 12) + i].a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elm_object_disabled_set(ctx->reset, EINA_TRUE);
|
||||||
|
config->colors_use = EINA_FALSE;
|
||||||
|
elm_colorselector_palette_item_color_get(ctx->curitem, &r, &g, &b, &a);
|
||||||
|
elm_colorselector_color_set(ctx->colorsel, r, g, b, a);
|
||||||
termio_config_update(term);
|
termio_config_update(term);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make color palettes wrap back. :) works with elm git. */
|
||||||
static void
|
static void
|
||||||
_cb_op_scroller_resize(void *_data EINA_UNUSED,
|
_cb_op_scroller_resize(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
// make color palettes wrap back. :) works with elm git.
|
Colors_Ctx *ctx = data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) evas_object_resize(colpal[i], 1, 1);
|
for (i = 0; i < 4; i++)
|
||||||
|
evas_object_resize(ctx->colpal[i], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_parent_del_cb(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Colors_Ctx *ctx = data;
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_colors(Evas_Object *opbox, Evas_Object *term)
|
options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg)
|
||||||
{
|
{
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
Evas_Object *o, *fr, *bx, *sc, *bx2, *bx3, *bx4;
|
Evas_Object *o, *fr, *bx, *sc, *bx2, *bx3, *bx4;
|
||||||
int i, j;
|
int i, j;
|
||||||
int r = 0, g = 0, b = 0, a = 0;
|
int r = 0, g = 0, b = 0, a = 0;
|
||||||
|
Colors_Ctx *ctx;
|
||||||
|
|
||||||
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
ctx->bg = bg;
|
||||||
|
|
||||||
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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(o, _("Colors"));
|
elm_object_text_set(o, _("Colors"));
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(fr, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
|
||||||
bx = o = elm_box_add(opbox);
|
bx = o = elm_box_add(opbox);
|
||||||
elm_box_horizontal_set(o, EINA_TRUE);
|
elm_box_horizontal_set(o, EINA_TRUE);
|
||||||
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.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_object_content_set(fr, o);
|
elm_object_content_set(fr, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
sc = o = elm_scroller_add(opbox);
|
sc = o = elm_scroller_add(opbox);
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE,
|
|
||||||
_cb_op_scroller_resize, NULL);
|
|
||||||
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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE,
|
||||||
|
_cb_op_scroller_resize, ctx);
|
||||||
|
|
||||||
bx3 = o = elm_box_add(opbox);
|
bx3 = o = elm_box_add(opbox);
|
||||||
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.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_object_content_set(sc, o);
|
elm_object_content_set(sc, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
if (!config->colors_use)
|
||||||
|
{
|
||||||
|
_reset_config_colors(ctx);
|
||||||
|
}
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
o = elm_label_add(opbox);
|
o = elm_label_add(opbox);
|
||||||
if (j == 0) elm_object_text_set(o, _("Normal"));
|
if (j == 0)
|
||||||
else if (j == 1) elm_object_text_set(o, _("Bright/Bold"));
|
elm_object_text_set(o, _("Normal"));
|
||||||
else if (j == 2) elm_object_text_set(o, _("Intense"));
|
else if (j == 1)
|
||||||
else if (j == 3) elm_object_text_set(o, _("Intense Bright/Bold"));
|
elm_object_text_set(o, _("Bright/Bold"));
|
||||||
|
else if (j == 2)
|
||||||
|
elm_object_text_set(o, _("Intense"));
|
||||||
|
else if (j == 3)
|
||||||
|
elm_object_text_set(o, _("Intense Bright/Bold"));
|
||||||
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);
|
||||||
elm_box_pack_end(bx3, o);
|
elm_box_pack_end(bx3, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
colpal[j] = o = elm_colorselector_add(opbox);
|
ctx->colpal[j] = o = elm_colorselector_add(opbox);
|
||||||
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);
|
||||||
elm_colorselector_mode_set(o, ELM_COLORSELECTOR_PALETTE);
|
elm_colorselector_mode_set(o, ELM_COLORSELECTOR_PALETTE);
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
Elm_Object_Item *it;
|
Elm_Object_Item *it;
|
||||||
|
|
||||||
|
if (i == COL_INVIS)
|
||||||
|
continue;
|
||||||
|
|
||||||
it = elm_colorselector_palette_color_add
|
it = elm_colorselector_palette_color_add
|
||||||
(o,
|
(o,
|
||||||
config->colors[(j * 12) + mapping[i]].r,
|
config->colors[(j * 12) + i].r,
|
||||||
config->colors[(j * 12) + mapping[i]].g,
|
config->colors[(j * 12) + i].g,
|
||||||
config->colors[(j * 12) + mapping[i]].b,
|
config->colors[(j * 12) + i].b,
|
||||||
config->colors[(j * 12) + mapping[i]].a);
|
config->colors[(j * 12) + i].a);
|
||||||
colitem[j][i] = it;
|
ctx->colitem[j][i] = it;
|
||||||
|
if (i == 0 && j == 0)
|
||||||
|
{
|
||||||
|
ctx->curitem = ctx->colitem[0][0];
|
||||||
|
elm_colorselector_palette_item_selected_set(ctx->curitem, EINA_TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
evas_object_smart_callback_add(o, "color,item,selected",
|
|
||||||
_cb_op_color_item_sel, term);
|
|
||||||
elm_box_pack_end(bx3, o);
|
elm_box_pack_end(bx3, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
evas_object_smart_callback_add(o, "color,item,selected",
|
||||||
|
_cb_op_color_item_sel, ctx);
|
||||||
if (j == 1)
|
if (j == 1)
|
||||||
{
|
{
|
||||||
o = elm_separator_add(opbox);
|
o = elm_separator_add(opbox);
|
||||||
|
@ -242,15 +318,13 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curitem = colitem[0][0];
|
|
||||||
|
|
||||||
bx2 = o = elm_box_add(opbox);
|
bx2 = o = elm_box_add(opbox);
|
||||||
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.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
label = o = elm_label_add(opbox);
|
ctx->label = o = elm_label_add(opbox);
|
||||||
elm_object_text_set(o,
|
elm_object_text_set(o,
|
||||||
#if HAVE_GETTEXT && ENABLE_NLS
|
#if HAVE_GETTEXT && ENABLE_NLS
|
||||||
gettext(mapping_names[0])
|
gettext(mapping_names[0])
|
||||||
|
@ -262,16 +336,16 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
elm_box_pack_end(bx2, o);
|
elm_box_pack_end(bx2, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
colorsel = o = elm_colorselector_add(opbox);
|
ctx->colorsel = o = elm_colorselector_add(opbox);
|
||||||
elm_colorselector_palette_item_color_get(colitem[0][0], &r, &g, &b, &a);
|
elm_colorselector_palette_item_color_get(ctx->curitem, &r, &g, &b, &a);
|
||||||
elm_colorselector_color_set(o, r, g, b, a);
|
elm_colorselector_color_set(o, r, g, b, a);
|
||||||
elm_colorselector_mode_set(o, ELM_COLORSELECTOR_COMPONENTS);
|
elm_colorselector_mode_set(o, ELM_COLORSELECTOR_COMPONENTS);
|
||||||
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);
|
||||||
elm_box_pack_end(bx2, o);
|
elm_box_pack_end(bx2, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed", _cb_op_color_chg, term);
|
evas_object_smart_callback_add(o, "changed", _cb_op_color_chg, ctx);
|
||||||
|
|
||||||
bx4 = o = elm_box_add(opbox);
|
bx4 = o = elm_box_add(opbox);
|
||||||
elm_box_horizontal_set(o, EINA_TRUE);
|
elm_box_horizontal_set(o, EINA_TRUE);
|
||||||
|
@ -279,22 +353,13 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
elm_box_pack_end(bx2, o);
|
elm_box_pack_end(bx2, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
o = elm_check_add(opbox);
|
|
||||||
evas_object_size_hint_weight_set(o, 1.0, 0.0);
|
|
||||||
evas_object_size_hint_align_set(o, 0.0, 0.5);
|
|
||||||
elm_object_text_set(o, _("Use"));
|
|
||||||
elm_check_state_set(o, config->colors_use);
|
|
||||||
elm_box_pack_end(bx4, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_smart_callback_add(o, "changed", _cb_op_use_custom_chg, term);
|
|
||||||
|
|
||||||
reset = o = elm_button_add(opbox);
|
ctx->reset = o = elm_button_add(opbox);
|
||||||
elm_object_disabled_set(o, EINA_TRUE);
|
elm_object_disabled_set(o, !config->colors_use);
|
||||||
evas_object_size_hint_weight_set(o, 1.0, 0.0);
|
evas_object_size_hint_weight_set(o, 1.0, 0.0);
|
||||||
evas_object_size_hint_align_set(o, 1.0, 0.5);
|
evas_object_size_hint_align_set(o, 1.0, 0.5);
|
||||||
elm_object_text_set(o, _("Reset"));
|
elm_object_text_set(o, _("Reset all the colors"));
|
||||||
elm_box_pack_end(bx4, o);
|
elm_box_pack_end(bx4, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "clicked", _cb_op_reset, term);
|
evas_object_smart_callback_add(o, "clicked", _cb_op_reset, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _OPTIONS_COLORS_H__
|
#ifndef _OPTIONS_COLORS_H__
|
||||||
#define _OPTIONS_COLORS_H__ 1
|
#define _OPTIONS_COLORS_H__ 1
|
||||||
|
|
||||||
void options_colors(Evas_Object *opbox, Evas_Object *term);
|
void options_colors(Evas_Object *opbox, Evas_Object *term, Evas_Object *bg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -12,37 +13,47 @@
|
||||||
#define FONT_MAX 45
|
#define FONT_MAX 45
|
||||||
#define FONT_STEP (1.0 / (FONT_MAX - FONT_MIN))
|
#define FONT_STEP (1.0 / (FONT_MAX - FONT_MIN))
|
||||||
|
|
||||||
static Evas_Object *op_fontslider, *op_fontlist, *op_fsml, *op_fbig;
|
|
||||||
|
|
||||||
typedef struct _Font Font;
|
typedef struct _Font_Ctx
|
||||||
|
{
|
||||||
|
Evas_Object *op_fontslider;
|
||||||
|
Evas_Object *op_fontlist;
|
||||||
|
Evas_Object *op_fsml;
|
||||||
|
Evas_Object *op_fbig;
|
||||||
|
Evas_Object *term;
|
||||||
|
Eina_List *fonts;
|
||||||
|
Eina_Hash *fonthash;
|
||||||
|
Config *config;
|
||||||
|
Evas_Coord tsize_w;
|
||||||
|
Evas_Coord tsize_h;
|
||||||
|
int expecting_resize;
|
||||||
|
} Font_Ctx;
|
||||||
|
|
||||||
struct _Font
|
typedef struct _Font
|
||||||
{
|
{
|
||||||
Elm_Object_Item *item;
|
Elm_Object_Item *item;
|
||||||
const char *pretty_name;
|
const char *pretty_name;
|
||||||
const char *full_name;
|
const char *full_name;
|
||||||
Evas_Object *term;
|
Font_Ctx *ctx;
|
||||||
unsigned char bitmap : 1;
|
unsigned char bitmap : 1;
|
||||||
};
|
} Font;
|
||||||
|
|
||||||
static Eina_List *fonts = NULL;
|
|
||||||
static Eina_Hash *fonthash = NULL;
|
|
||||||
static Evas_Coord tsize_w = 0, tsize_h = 0;
|
|
||||||
static int expecting_resize = 0;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_update_sizing(Evas_Object *term)
|
_update_sizing(Font_Ctx *ctx)
|
||||||
{
|
{
|
||||||
Evas_Coord mw = 1, mh = 1, w, h;
|
Evas_Coord mw = 1, mh = 1, w, h;
|
||||||
|
|
||||||
termio_config_update(term);
|
termio_config_update(ctx->term);
|
||||||
evas_object_size_hint_min_get(term, &mw, &mh);
|
evas_object_size_hint_min_get(ctx->term, &mw, &mh);
|
||||||
if (mw < 1) mw = 1;
|
if (mw < 1)
|
||||||
if (mh < 1) mh = 1;
|
mw = 1;
|
||||||
w = tsize_w / mw;
|
if (mh < 1)
|
||||||
h = tsize_h / mh;
|
mh = 1;
|
||||||
evas_object_size_hint_request_set(term, w * mw, h * mh);
|
w = ctx->tsize_w / mw;
|
||||||
expecting_resize = 1;
|
h = ctx->tsize_h / mh;
|
||||||
|
evas_object_size_hint_request_set(ctx->term, w * mw, h * mh);
|
||||||
|
ctx->expecting_resize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -133,18 +144,19 @@ _cb_op_font_sel(void *data,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Font *f = data;
|
Font *f = data;
|
||||||
Config *config = termio_config_get(f->term);
|
Font_Ctx *ctx = f->ctx;
|
||||||
Term *term = termio_term_get(f->term);
|
Config *config = ctx->config;
|
||||||
|
Term *term = termio_term_get(ctx->term);
|
||||||
|
|
||||||
if ((config->font.name) && (!strcmp(f->full_name, config->font.name)))
|
if ((config->font.name) && (!strcmp(f->full_name, config->font.name)))
|
||||||
return;
|
return;
|
||||||
if (config->font.name) eina_stringshare_del(config->font.name);
|
if (config->font.name) eina_stringshare_del(config->font.name);
|
||||||
config->font.name = eina_stringshare_add(f->full_name);
|
config->font.name = eina_stringshare_add(f->full_name);
|
||||||
config->font.bitmap = f->bitmap;
|
config->font.bitmap = f->bitmap;
|
||||||
_update_sizing(f->term);
|
_update_sizing(ctx);
|
||||||
elm_object_disabled_set(op_fsml, f->bitmap);
|
elm_object_disabled_set(ctx->op_fsml, f->bitmap);
|
||||||
elm_object_disabled_set(op_fontslider, f->bitmap);
|
elm_object_disabled_set(ctx->op_fontslider, f->bitmap);
|
||||||
elm_object_disabled_set(op_fbig, f->bitmap);
|
elm_object_disabled_set(ctx->op_fbig, f->bitmap);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
win_font_update(term);
|
win_font_update(term);
|
||||||
}
|
}
|
||||||
|
@ -154,15 +166,16 @@ _cb_op_fontsize_sel(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *termio_obj = data;
|
Font_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(termio_obj);
|
Config *config = ctx->config;
|
||||||
Term *term = termio_term_get(termio_obj);
|
Term *term = termio_term_get(ctx->term);
|
||||||
int size = elm_slider_value_get(obj) + 0.5;
|
int size = elm_slider_value_get(obj) + 0.5;
|
||||||
|
|
||||||
if (config->font.size == size) return;
|
if (config->font.size == size)
|
||||||
|
return;
|
||||||
config->font.size = size;
|
config->font.size = size;
|
||||||
_update_sizing(termio_obj);
|
_update_sizing(ctx);
|
||||||
elm_genlist_realized_items_update(op_fontlist);
|
elm_genlist_realized_items_update(ctx->op_fontlist);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
win_font_update(term);
|
win_font_update(term);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +194,7 @@ _cb_op_font_preview_del(void *_data EINA_UNUSED,
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Ecore_Timer *timer = evas_object_data_get(obj, "delay");
|
Ecore_Timer *timer = evas_object_data_get(obj, "delay");
|
||||||
|
|
||||||
if (timer)
|
if (timer)
|
||||||
{
|
{
|
||||||
ecore_timer_del(timer);
|
ecore_timer_del(timer);
|
||||||
|
@ -203,22 +216,27 @@ _cb_op_font_preview_delayed_eval(void *data)
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
|
Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
|
||||||
Config *config;
|
Config *config;
|
||||||
|
|
||||||
if (!evas_object_visible_get(obj)) goto done;
|
if (!evas_object_visible_get(obj))
|
||||||
if (edje_object_part_swallow_get(obj, "terminology.text.preview")) goto done;
|
goto done;
|
||||||
|
if (edje_object_part_swallow_get(obj, "terminology.text.preview"))
|
||||||
|
goto done;
|
||||||
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
||||||
if ((ow < 2) || (oh < 2)) goto done;
|
if ((ow < 2) || (oh < 2))
|
||||||
|
goto done;
|
||||||
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
||||||
f = evas_object_data_get(obj, "font");
|
f = evas_object_data_get(obj, "font");
|
||||||
if (!f) goto done;
|
if (!f)
|
||||||
config = termio_config_get(f->term);
|
goto done;
|
||||||
if (!config) goto done;
|
config = f->ctx->config;
|
||||||
|
if (!config)
|
||||||
|
goto done;
|
||||||
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
Evas *evas = evas_object_evas_get(obj);
|
Evas *evas = evas_object_evas_get(obj);
|
||||||
Evas_Object *textgrid = termio_textgrid_get(f->term);
|
Evas_Object *textgrid = termio_textgrid_get(f->ctx->term);
|
||||||
|
|
||||||
evas_object_textgrid_palette_get(textgrid, EVAS_TEXTGRID_PALETTE_STANDARD,
|
evas_object_textgrid_palette_get(textgrid, EVAS_TEXTGRID_PALETTE_STANDARD,
|
||||||
0, &r, &g, &b, &a);
|
0, &r, &g, &b, &a);
|
||||||
|
@ -252,11 +270,14 @@ _cb_op_font_preview_eval(void *data,
|
||||||
{
|
{
|
||||||
Font *f = data;
|
Font *f = data;
|
||||||
Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
|
Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
|
||||||
|
|
||||||
if (!evas_object_visible_get(obj)) return;
|
if (!evas_object_visible_get(obj))
|
||||||
if (edje_object_part_swallow_get(obj, "terminology.text.preview")) return;
|
return;
|
||||||
|
if (edje_object_part_swallow_get(obj, "terminology.text.preview"))
|
||||||
|
return;
|
||||||
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
||||||
if ((ow < 2) || (oh < 2)) return;
|
if ((ow < 2) || (oh < 2))
|
||||||
|
return;
|
||||||
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
||||||
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
||||||
{
|
{
|
||||||
|
@ -264,8 +285,10 @@ _cb_op_font_preview_eval(void *data,
|
||||||
double rnd = 0.2;
|
double rnd = 0.2;
|
||||||
|
|
||||||
timer = evas_object_data_get(obj, "delay");
|
timer = evas_object_data_get(obj, "delay");
|
||||||
if (timer) return;
|
if (timer)
|
||||||
else evas_object_data_set(obj, "font", f);
|
return;
|
||||||
|
else
|
||||||
|
evas_object_data_set(obj, "font", f);
|
||||||
rnd += (double)(rand() % 100) / 500.0;
|
rnd += (double)(rand() % 100) / 500.0;
|
||||||
timer = ecore_timer_add(rnd, _cb_op_font_preview_delayed_eval, obj);
|
timer = ecore_timer_add(rnd, _cb_op_font_preview_delayed_eval, obj);
|
||||||
evas_object_data_set(obj, "delay", timer);
|
evas_object_data_set(obj, "delay", timer);
|
||||||
|
@ -280,8 +303,8 @@ _cb_op_font_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (!strcmp(part, "elm.swallow.icon"))
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Config *config = termio_config_get(f->term);
|
Config *config = f->ctx->config;
|
||||||
|
|
||||||
o = edje_object_add(evas_object_evas_get(obj));
|
o = edje_object_add(evas_object_evas_get(obj));
|
||||||
theme_apply(o, config, "terminology/fontpreview");
|
theme_apply(o, config, "terminology/fontpreview");
|
||||||
theme_auto_reload_enable(o);
|
theme_auto_reload_enable(o);
|
||||||
|
@ -324,13 +347,14 @@ _cb_term_resize(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Font_Ctx *ctx = data;
|
||||||
if (expecting_resize)
|
|
||||||
|
if (ctx->expecting_resize)
|
||||||
{
|
{
|
||||||
expecting_resize = 0;
|
ctx->expecting_resize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
|
evas_object_geometry_get(ctx->term, NULL, NULL, &ctx->tsize_w, &ctx->tsize_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -339,32 +363,29 @@ _cb_font_del(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Font_Ctx *ctx = data;
|
||||||
evas_object_event_callback_del_full(term, EVAS_CALLBACK_RESIZE,
|
evas_object_event_callback_del_full(ctx->term, EVAS_CALLBACK_RESIZE,
|
||||||
_cb_term_resize, term);
|
_cb_term_resize, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
options_font_clear(void)
|
_parent_del_cb(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Font_Ctx *ctx = data;
|
||||||
Font *f;
|
Font *f;
|
||||||
|
|
||||||
op_fontslider = NULL;
|
EINA_LIST_FREE(ctx->fonts, f)
|
||||||
op_fontlist = NULL;
|
|
||||||
op_fsml = NULL;
|
|
||||||
op_fbig = NULL;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(fonts, f)
|
|
||||||
{
|
{
|
||||||
eina_stringshare_del(f->full_name);
|
eina_stringshare_del(f->full_name);
|
||||||
eina_stringshare_del(f->pretty_name);
|
eina_stringshare_del(f->pretty_name);
|
||||||
free(f);
|
free(f);
|
||||||
}
|
}
|
||||||
if (fonthash)
|
eina_hash_free(ctx->fonthash);
|
||||||
{
|
|
||||||
eina_hash_free(fonthash);
|
free(ctx);
|
||||||
fonthash = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -372,11 +393,11 @@ _cb_font_bolditalic(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Font_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
|
||||||
config->font.bolditalic = elm_check_state_get(obj);
|
config->font.bolditalic = elm_check_state_get(obj);
|
||||||
termio_config_update(term);
|
termio_config_update(ctx->term);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,33 +411,41 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
Elm_Object_Item *it, *sel_it = NULL, *sel_it2 = NULL, *grp_it = NULL;
|
Elm_Object_Item *it, *sel_it = NULL, *sel_it2 = NULL, *grp_it = NULL;
|
||||||
Elm_Genlist_Item_Class *it_class, *it_group;
|
Elm_Genlist_Item_Class *it_class, *it_group;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
|
Font_Ctx *ctx;
|
||||||
|
|
||||||
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
|
||||||
options_font_clear();
|
|
||||||
|
|
||||||
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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(o, _("Font"));
|
elm_object_text_set(o, _("Font"));
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(fr, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
|
||||||
bx0 = o = elm_box_add(opbox);
|
bx0 = o = elm_box_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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_content_set(fr, o);
|
elm_object_content_set(fr, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
bx = o = elm_box_add(opbox);
|
bx = o = elm_box_add(opbox);
|
||||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
|
||||||
elm_box_horizontal_set(o, EINA_TRUE);
|
elm_box_horizontal_set(o, EINA_TRUE);
|
||||||
|
|
||||||
op_fsml = o = elm_label_add(opbox);
|
ctx->op_fsml = o = elm_label_add(opbox);
|
||||||
elm_object_text_set(o, "<font_size=6>A</font_size>");
|
elm_object_text_set(o, "<font_size=6>A</font_size>");
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
op_fontslider = o = elm_slider_add(opbox);
|
ctx->op_fontslider = o = elm_slider_add(opbox);
|
||||||
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);
|
||||||
elm_slider_span_size_set(o, 40);
|
elm_slider_span_size_set(o, 40);
|
||||||
|
@ -429,28 +458,28 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_slider_value_set(o, config->font.size);
|
elm_slider_value_set(o, config->font.size);
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
evas_object_smart_callback_add(o, "delay,changed",
|
|
||||||
_cb_op_fontsize_sel, term);
|
|
||||||
|
|
||||||
op_fbig = o = elm_label_add(opbox);
|
evas_object_smart_callback_add(o, "delay,changed",
|
||||||
|
_cb_op_fontsize_sel, ctx);
|
||||||
|
|
||||||
|
ctx->op_fbig = o = elm_label_add(opbox);
|
||||||
elm_object_text_set(o, "<font_size=24>A</font_size>");
|
elm_object_text_set(o, "<font_size=24>A</font_size>");
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
elm_box_pack_end(bx0, bx);
|
elm_box_pack_end(bx0, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
it_class = elm_genlist_item_class_new();
|
it_class = elm_genlist_item_class_new();
|
||||||
it_class->item_style = "end_icon";
|
it_class->item_style = "end_icon";
|
||||||
it_class->func.text_get = _cb_op_font_text_get;
|
it_class->func.text_get = _cb_op_font_text_get;
|
||||||
it_class->func.content_get = _cb_op_font_content_get;
|
it_class->func.content_get = _cb_op_font_content_get;
|
||||||
|
|
||||||
it_group = elm_genlist_item_class_new();
|
it_group = elm_genlist_item_class_new();
|
||||||
it_group->item_style = "group_index";
|
it_group->item_style = "group_index";
|
||||||
it_group->func.text_get = _cb_op_font_group_text_get;
|
it_group->func.text_get = _cb_op_font_group_text_get;
|
||||||
|
|
||||||
op_fontlist = o = elm_genlist_add(opbox);
|
ctx->op_fontlist = o = elm_genlist_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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_genlist_mode_set(o, ELM_LIST_COMPRESS);
|
elm_genlist_mode_set(o, ELM_LIST_COMPRESS);
|
||||||
|
@ -476,9 +505,9 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
s = strchr(file, '.');
|
s = strchr(file, '.');
|
||||||
if (s != NULL) *s = '\0';
|
if (s != NULL) *s = '\0';
|
||||||
f->pretty_name = eina_stringshare_add(file);
|
f->pretty_name = eina_stringshare_add(file);
|
||||||
f->term = term;
|
f->ctx = ctx;
|
||||||
f->bitmap = EINA_TRUE;
|
f->bitmap = EINA_TRUE;
|
||||||
fonts = eina_list_append(fonts, f);
|
ctx->fonts = eina_list_append(ctx->fonts, f);
|
||||||
|
|
||||||
f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
|
f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
|
||||||
ELM_GENLIST_ITEM_NONE,
|
ELM_GENLIST_ITEM_NONE,
|
||||||
|
@ -488,9 +517,9 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
(!strcmp(config->font.name, file))))
|
(!strcmp(config->font.name, file))))
|
||||||
{
|
{
|
||||||
sel_it = it;
|
sel_it = it;
|
||||||
elm_object_disabled_set(op_fsml, EINA_TRUE);
|
elm_object_disabled_set(ctx->op_fsml, EINA_TRUE);
|
||||||
elm_object_disabled_set(op_fontslider, EINA_TRUE);
|
elm_object_disabled_set(ctx->op_fontslider, EINA_TRUE);
|
||||||
elm_object_disabled_set(op_fbig, EINA_TRUE);
|
elm_object_disabled_set(ctx->op_fbig, EINA_TRUE);
|
||||||
}
|
}
|
||||||
free(file);
|
free(file);
|
||||||
}
|
}
|
||||||
|
@ -499,8 +528,8 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
fontlist = evas_font_available_list(evas_object_evas_get(opbox));
|
fontlist = evas_font_available_list(evas_object_evas_get(opbox));
|
||||||
fontlist = eina_list_sort(fontlist, eina_list_count(fontlist),
|
fontlist = eina_list_sort(fontlist, eina_list_count(fontlist),
|
||||||
_cb_op_font_sort);
|
_cb_op_font_sort);
|
||||||
fonthash = eina_hash_string_superfast_new(NULL);
|
ctx->fonthash = eina_hash_string_superfast_new(NULL);
|
||||||
if (fonts)
|
if (ctx->fonts)
|
||||||
{
|
{
|
||||||
grp_it = elm_genlist_item_append(o, it_group, _("Standard"), NULL,
|
grp_it = elm_genlist_item_append(o, it_group, _("Standard"), NULL,
|
||||||
ELM_GENLIST_ITEM_GROUP,
|
ELM_GENLIST_ITEM_GROUP,
|
||||||
|
@ -510,19 +539,20 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
}
|
}
|
||||||
EINA_LIST_FOREACH(fontlist, l, fname)
|
EINA_LIST_FOREACH(fontlist, l, fname)
|
||||||
{
|
{
|
||||||
if (!eina_hash_find(fonthash, fname))
|
if (!eina_hash_find(ctx->fonthash, fname))
|
||||||
{
|
{
|
||||||
f = calloc(1, sizeof(Font));
|
f = calloc(1, sizeof(Font));
|
||||||
if (!f) break;
|
if (!f)
|
||||||
|
break;
|
||||||
if (_parse_font_name(fname, &f->full_name, &f->pretty_name) <0)
|
if (_parse_font_name(fname, &f->full_name, &f->pretty_name) <0)
|
||||||
{
|
{
|
||||||
free(f);
|
free(f);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
f->term = term;
|
f->ctx = ctx;
|
||||||
f->bitmap = EINA_FALSE;
|
f->bitmap = EINA_FALSE;
|
||||||
eina_hash_add(fonthash, eina_stringshare_add(fname), f);
|
eina_hash_add(ctx->fonthash, eina_stringshare_add(fname), f);
|
||||||
fonts = eina_list_append(fonts, f);
|
ctx->fonts = eina_list_append(ctx->fonts, f);
|
||||||
f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
|
f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
|
||||||
ELM_GENLIST_ITEM_NONE,
|
ELM_GENLIST_ITEM_NONE,
|
||||||
_cb_op_font_sel, f);
|
_cb_op_font_sel, f);
|
||||||
|
@ -568,12 +598,12 @@ options_font(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx0, o);
|
elm_box_pack_end(bx0, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_font_bolditalic, term);
|
_cb_font_bolditalic, ctx);
|
||||||
|
|
||||||
expecting_resize = 0;
|
ctx->expecting_resize = 0;
|
||||||
evas_object_geometry_get(term, NULL, NULL, &tsize_w, &tsize_h);
|
evas_object_geometry_get(term, NULL, NULL, &ctx->tsize_w, &ctx->tsize_h);
|
||||||
evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
|
evas_object_event_callback_add(term, EVAS_CALLBACK_RESIZE,
|
||||||
_cb_term_resize, term);
|
_cb_term_resize, ctx);
|
||||||
evas_object_event_callback_add(opbox, EVAS_CALLBACK_DEL,
|
evas_object_event_callback_add(opbox, EVAS_CALLBACK_DEL,
|
||||||
_cb_font_del, term);
|
_cb_font_del, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _OPTIONS_FONT_H__
|
#ifndef _OPTIONS_FONT_H__
|
||||||
#define _OPTIONS_FONT_H__ 1
|
#define _OPTIONS_FONT_H__ 1
|
||||||
|
|
||||||
void options_font_clear(void);
|
|
||||||
void options_font(Evas_Object *opbox, Evas_Object *term);
|
void options_font(Evas_Object *opbox, Evas_Object *term);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -8,12 +9,14 @@
|
||||||
#include "keyin.h"
|
#include "keyin.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/*XXX: can have only one widget at a time… */
|
typedef struct _Keys_Ctx {
|
||||||
static Config *_config;
|
Config *config;
|
||||||
static Evas_Object *_fr;
|
Evas_Object *frame;
|
||||||
static Evas_Object *_layout;
|
Evas_Object *gl;
|
||||||
|
Evas_Object *layout;
|
||||||
|
} Keys_Ctx;
|
||||||
|
|
||||||
static void _hover_del(Evas_Object *o);
|
static void _hover_del(Keys_Ctx *ctx);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_shortcut_delete(void *data,
|
_shortcut_delete(void *data,
|
||||||
|
@ -23,12 +26,17 @@ _shortcut_delete(void *data,
|
||||||
Evas_Object *hs, *bx;
|
Evas_Object *hs, *bx;
|
||||||
Config_Keys *cfg_key;
|
Config_Keys *cfg_key;
|
||||||
Evas_Coord w, min_w, min_h;
|
Evas_Coord w, min_w, min_h;
|
||||||
|
Keys_Ctx *ctx;
|
||||||
|
|
||||||
hs = data;
|
hs = data;
|
||||||
bx = evas_object_data_get(hs, "bx");
|
bx = evas_object_data_get(hs, "bx");
|
||||||
|
assert(bx);
|
||||||
cfg_key = evas_object_data_get(hs, "cfg");
|
cfg_key = evas_object_data_get(hs, "cfg");
|
||||||
|
assert(cfg_key);
|
||||||
|
ctx = evas_object_data_get(hs, "ctx");
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
_config->keys = eina_list_remove(_config->keys, cfg_key);
|
ctx->config->keys = eina_list_remove(ctx->config->keys, cfg_key);
|
||||||
evas_object_size_hint_min_get(hs, &w, NULL);
|
evas_object_size_hint_min_get(hs, &w, NULL);
|
||||||
evas_object_size_hint_min_get(bx, &min_w, &min_h);
|
evas_object_size_hint_min_get(bx, &min_w, &min_h);
|
||||||
min_w -= w;
|
min_w -= w;
|
||||||
|
@ -41,11 +49,13 @@ _shortcut_delete(void *data,
|
||||||
eina_stringshare_del(cfg_key->cb);
|
eina_stringshare_del(cfg_key->cb);
|
||||||
free(cfg_key);
|
free(cfg_key);
|
||||||
|
|
||||||
config_save(_config, NULL);
|
config_save(ctx->config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_shortcut_button_add(Evas_Object *bx, const Config_Keys *key)
|
_shortcut_button_add(Keys_Ctx *ctx,
|
||||||
|
Evas_Object *bx,
|
||||||
|
const Config_Keys *key)
|
||||||
{
|
{
|
||||||
const char *txt;
|
const char *txt;
|
||||||
Evas_Object *hs;
|
Evas_Object *hs;
|
||||||
|
@ -58,11 +68,13 @@ _shortcut_button_add(Evas_Object *bx, const Config_Keys *key)
|
||||||
key->meta ? _("Meta+") : "",
|
key->meta ? _("Meta+") : "",
|
||||||
key->hyper ? _("Hyper+") : "",
|
key->hyper ? _("Hyper+") : "",
|
||||||
key->keyname);
|
key->keyname);
|
||||||
hs = elm_hoversel_add(_fr);
|
hs = elm_hoversel_add(ctx->frame);
|
||||||
elm_hoversel_hover_parent_set(hs, _fr);
|
elm_hoversel_hover_parent_set(hs, ctx->frame);
|
||||||
|
|
||||||
evas_object_data_set(hs, "bx", bx);
|
evas_object_data_set(hs, "bx", bx);
|
||||||
evas_object_data_set(hs, "cfg", key);
|
evas_object_data_set(hs, "cfg", key);
|
||||||
|
evas_object_data_set(hs, "ctx", ctx);
|
||||||
|
|
||||||
elm_layout_text_set(hs, NULL, txt);
|
elm_layout_text_set(hs, NULL, txt);
|
||||||
|
|
||||||
elm_hoversel_item_add(hs, _("Delete"), "delete", ELM_ICON_STANDARD,
|
elm_hoversel_item_add(hs, _("Delete"), "delete", ELM_ICON_STANDARD,
|
||||||
|
@ -75,17 +87,22 @@ _shortcut_button_add(Evas_Object *bx, const Config_Keys *key)
|
||||||
static void
|
static void
|
||||||
_cb_key_up(void *data,
|
_cb_key_up(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *obj, void *event)
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event)
|
||||||
{
|
{
|
||||||
Evas_Event_Key_Up *ev = event;
|
Evas_Event_Key_Up *ev = event;
|
||||||
int ctrl, alt, shift, win, meta, hyper, res;
|
int ctrl, alt, shift, win, meta, hyper, res;
|
||||||
Config_Keys *cfg_key;
|
Config_Keys *cfg_key;
|
||||||
Shortcut_Action *action;
|
Shortcut_Action *action;
|
||||||
Evas_Object *bx = data;
|
Evas_Object *bx = data;
|
||||||
|
Keys_Ctx *ctx;
|
||||||
|
|
||||||
if (key_is_modifier(ev->keyname))
|
if (key_is_modifier(ev->keyname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ctx = evas_object_data_get(bx, "ctx");
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
||||||
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
|
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
|
||||||
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
||||||
|
@ -95,7 +112,7 @@ _cb_key_up(void *data,
|
||||||
evas_key_modifier_is_set(ev->modifiers, "ISO_Level3_Shift");
|
evas_key_modifier_is_set(ev->modifiers, "ISO_Level3_Shift");
|
||||||
hyper = evas_key_modifier_is_set(ev->modifiers, "Hyper");
|
hyper = evas_key_modifier_is_set(ev->modifiers, "Hyper");
|
||||||
|
|
||||||
_hover_del(obj);
|
_hover_del(ctx);
|
||||||
|
|
||||||
action = evas_object_data_get(bx, "action");
|
action = evas_object_data_get(bx, "action");
|
||||||
if (!action)
|
if (!action)
|
||||||
|
@ -123,8 +140,8 @@ _cb_key_up(void *data,
|
||||||
Evas_Coord w, h, min_w, min_h;
|
Evas_Coord w, h, min_w, min_h;
|
||||||
|
|
||||||
last = evas_object_data_get(bx, "last");
|
last = evas_object_data_get(bx, "last");
|
||||||
_config->keys = eina_list_append(_config->keys, cfg_key);
|
ctx->config->keys = eina_list_append(ctx->config->keys, cfg_key);
|
||||||
bt = _shortcut_button_add(bx, cfg_key);
|
bt = _shortcut_button_add(ctx, bx, cfg_key);
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
evas_object_size_hint_min_get(bt, &w, &h);
|
evas_object_size_hint_min_get(bt, &w, &h);
|
||||||
evas_object_size_hint_min_get(bx, &min_w, &min_h);
|
evas_object_size_hint_min_get(bx, &min_w, &min_h);
|
||||||
|
@ -133,7 +150,7 @@ _cb_key_up(void *data,
|
||||||
evas_object_size_hint_min_set(bx, min_w, min_h);
|
evas_object_size_hint_min_set(bx, min_w, min_h);
|
||||||
elm_box_pack_before(bx, bt, last);
|
elm_box_pack_before(bx, bt, last);
|
||||||
|
|
||||||
config_save(_config, NULL);
|
config_save(ctx->config, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -144,44 +161,49 @@ _cb_key_up(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_mouse_down(void *_data EINA_UNUSED,
|
_cb_mouse_down(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_hover_del(obj);
|
Keys_Ctx *ctx = data;
|
||||||
|
|
||||||
|
_hover_del(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_hover_sizing_eval(void)
|
_hover_sizing_eval(Keys_Ctx *ctx)
|
||||||
{
|
{
|
||||||
Evas_Coord x = 0, y = 0, w = 0, h = 0;
|
Evas_Coord x = 0, y = 0, w = 0, h = 0;
|
||||||
evas_object_geometry_get(_fr, &x, &y, &w, &h);
|
|
||||||
|
evas_object_geometry_get(ctx->frame, &x, &y, &w, &h);
|
||||||
#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
|
#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
|
||||||
evas_object_geometry_set(_layout, x, y, w, h);
|
evas_object_geometry_set(ctx->layout, x, y, w, h);
|
||||||
#else
|
#else
|
||||||
evas_object_move(_layout, x, y);
|
evas_object_move(ctx->layout, x, y);
|
||||||
evas_object_resize(_layout, w, h);
|
evas_object_resize(ctx->layout, w, h);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_parent_move_cb(void *_data EINA_UNUSED,
|
_parent_move_cb(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_hover_sizing_eval();
|
Keys_Ctx *ctx = data;
|
||||||
|
_hover_sizing_eval(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_parent_resize_cb(void *_data EINA_UNUSED,
|
_parent_resize_cb(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_hover_sizing_eval();
|
Keys_Ctx *ctx = data;
|
||||||
|
_hover_sizing_eval(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -190,88 +212,74 @@ _parent_hide_cb(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_hover_del(data);
|
Keys_Ctx *ctx = data;
|
||||||
|
_hover_del(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_parent_del_cb(void *data,
|
_parent_del_cb(void *data,
|
||||||
Evas *_e EINA_UNUSED,
|
Evas *_e EINA_UNUSED,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_hover_del(data);
|
Keys_Ctx *ctx = data;
|
||||||
}
|
_hover_del(ctx);
|
||||||
|
|
||||||
static void
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_DEL,
|
||||||
_hover_del(Evas_Object *o)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del(o, EVAS_CALLBACK_KEY_UP,
|
|
||||||
_cb_key_up);
|
|
||||||
evas_object_event_callback_del(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
||||||
_cb_mouse_down);
|
|
||||||
evas_object_event_callback_del(_fr, EVAS_CALLBACK_MOVE,
|
|
||||||
_parent_move_cb);
|
|
||||||
evas_object_event_callback_del(_fr, EVAS_CALLBACK_RESIZE,
|
|
||||||
_parent_resize_cb);
|
|
||||||
evas_object_event_callback_del(_fr, EVAS_CALLBACK_HIDE,
|
|
||||||
_parent_hide_cb);
|
|
||||||
evas_object_event_callback_del(_fr, EVAS_CALLBACK_DEL,
|
|
||||||
_parent_del_cb);
|
_parent_del_cb);
|
||||||
evas_object_del(o);
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_HIDE,
|
||||||
_layout = NULL;
|
_parent_hide_cb);
|
||||||
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_focused(void *_data EINA_UNUSED,
|
_hover_del(Keys_Ctx *ctx)
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
DBG("focused");
|
if (ctx->layout)
|
||||||
}
|
{
|
||||||
static void
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_KEY_UP,
|
||||||
_cb_unfocused(void *_data EINA_UNUSED,
|
_cb_key_up);
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
void *_event EINA_UNUSED)
|
_cb_mouse_down);
|
||||||
{
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_MOVE,
|
||||||
DBG("unfocused");
|
_parent_move_cb);
|
||||||
if (_layout)
|
evas_object_event_callback_del(ctx->frame, EVAS_CALLBACK_RESIZE,
|
||||||
elm_object_focus_set(_layout, EINA_TRUE);
|
_parent_resize_cb);
|
||||||
|
evas_object_del(ctx->layout);
|
||||||
|
}
|
||||||
|
ctx->layout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_shortcut_add(void *data,
|
_on_shortcut_add(void *data,
|
||||||
Evas_Object *bt,
|
Evas_Object *bt,
|
||||||
void *_event_info EINA_UNUSED)
|
void *_event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *oe;
|
Evas_Object *o, *oe;
|
||||||
Evas_Object *bx = data;
|
Evas_Object *bx = data;
|
||||||
|
Keys_Ctx *ctx;
|
||||||
|
|
||||||
_layout = o = elm_layout_add(bt);
|
ctx = evas_object_data_get(bx, "ctx");
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
assert(ctx->layout == NULL);
|
||||||
|
ctx->layout = o = elm_layout_add(bt);
|
||||||
|
evas_object_data_set(ctx->layout, "ctx", ctx);
|
||||||
oe = elm_layout_edje_get(o);
|
oe = elm_layout_edje_get(o);
|
||||||
theme_apply(oe, _config, "terminology/keybinding");
|
theme_apply(oe, ctx->config, "terminology/keybinding");
|
||||||
theme_auto_reload_enable(oe);
|
theme_auto_reload_enable(oe);
|
||||||
elm_layout_text_set(o, "label", _("Please press key sequence"));
|
elm_layout_text_set(o, "label", _("Please press key sequence"));
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
elm_object_focus_allow_set(o, EINA_TRUE);
|
|
||||||
evas_object_smart_callback_add(o, "focused",
|
|
||||||
_cb_focused, NULL);
|
|
||||||
evas_object_smart_callback_add(o, "unfocused",
|
|
||||||
_cb_unfocused, NULL);
|
|
||||||
elm_object_focus_set(o, EINA_TRUE);
|
|
||||||
|
|
||||||
_hover_sizing_eval();
|
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_KEY_UP,
|
||||||
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_UP,
|
|
||||||
_cb_key_up, bx);
|
_cb_key_up, bx);
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_cb_mouse_down, o);
|
_cb_mouse_down, ctx);
|
||||||
evas_object_event_callback_add(_fr, EVAS_CALLBACK_MOVE,
|
elm_object_focus_set(ctx->frame, EINA_TRUE);
|
||||||
_parent_move_cb, o);
|
elm_object_focus_allow_set(ctx->frame, EINA_TRUE);
|
||||||
evas_object_event_callback_add(_fr, EVAS_CALLBACK_RESIZE,
|
|
||||||
_parent_resize_cb, o);
|
_hover_sizing_eval(ctx);
|
||||||
evas_object_event_callback_add(_fr, EVAS_CALLBACK_HIDE,
|
|
||||||
_parent_hide_cb, o);
|
|
||||||
evas_object_event_callback_add(_fr, EVAS_CALLBACK_DEL,
|
|
||||||
_parent_del_cb, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -282,11 +290,16 @@ gl_content_get(void *data, Evas_Object *obj, const char *_part EINA_UNUSED)
|
||||||
Evas_Object *bx, *bt, *lbl, *sep;
|
Evas_Object *bx, *bt, *lbl, *sep;
|
||||||
Config_Keys *key;
|
Config_Keys *key;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
Keys_Ctx *ctx;
|
||||||
|
|
||||||
|
ctx = evas_object_data_get(obj, "ctx");
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
bx = elm_box_add(obj);
|
bx = elm_box_add(obj);
|
||||||
elm_box_horizontal_set(bx, EINA_TRUE);
|
elm_box_horizontal_set(bx, EINA_TRUE);
|
||||||
elm_box_homogeneous_set(bx, EINA_FALSE);
|
elm_box_homogeneous_set(bx, EINA_FALSE);
|
||||||
evas_object_size_hint_align_set(bx, 0, 0);
|
evas_object_size_hint_align_set(bx, 0, 0);
|
||||||
|
evas_object_data_set(bx, "ctx", ctx);
|
||||||
|
|
||||||
lbl = elm_label_add(obj);
|
lbl = elm_label_add(obj);
|
||||||
elm_layout_text_set(lbl, NULL, action->description);
|
elm_layout_text_set(lbl, NULL, action->description);
|
||||||
|
@ -304,11 +317,11 @@ gl_content_get(void *data, Evas_Object *obj, const char *_part EINA_UNUSED)
|
||||||
if (h > min_h) min_h = h;
|
if (h > min_h) min_h = h;
|
||||||
|
|
||||||
// TODO: have a better data structure
|
// TODO: have a better data structure
|
||||||
EINA_LIST_FOREACH(_config->keys, l, key)
|
EINA_LIST_FOREACH(ctx->config->keys, l, key)
|
||||||
{
|
{
|
||||||
if (!strcmp(key->cb, action->action))
|
if (!strcmp(key->cb, action->action))
|
||||||
{
|
{
|
||||||
bt = _shortcut_button_add(bx, key);
|
bt = _shortcut_button_add(ctx, bx, key);
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
evas_object_size_hint_min_get(bt, &w, &h);
|
evas_object_size_hint_min_get(bt, &w, &h);
|
||||||
min_w += w;
|
min_w += w;
|
||||||
|
@ -318,7 +331,7 @@ gl_content_get(void *data, Evas_Object *obj, const char *_part EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
bt = elm_button_add(obj);
|
bt = elm_button_add(obj);
|
||||||
evas_object_smart_callback_add(bt, "clicked", on_shortcut_add, bx);
|
evas_object_smart_callback_add(bt, "clicked", _on_shortcut_add, bx);
|
||||||
elm_layout_text_set(bt, NULL, "+");
|
elm_layout_text_set(bt, NULL, "+");
|
||||||
evas_object_size_hint_min_get(bt, &w, &h);
|
evas_object_size_hint_min_get(bt, &w, &h);
|
||||||
min_w += w;
|
min_w += w;
|
||||||
|
@ -350,10 +363,10 @@ _cb_reset_keys(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *gl = data;
|
Keys_Ctx *ctx = data;
|
||||||
|
|
||||||
config_reset_keys(_config);
|
config_reset_keys(ctx->config);
|
||||||
elm_genlist_realized_items_update(gl);
|
elm_genlist_realized_items_update(ctx->gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -363,23 +376,33 @@ options_keys(Evas_Object *opbox, Evas_Object *term)
|
||||||
const Shortcut_Action *action;
|
const Shortcut_Action *action;
|
||||||
Elm_Genlist_Item_Class *itc, *itc_group;
|
Elm_Genlist_Item_Class *itc, *itc_group;
|
||||||
Elm_Object_Item *git = NULL;
|
Elm_Object_Item *git = NULL;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
Keys_Ctx *ctx;
|
||||||
|
|
||||||
_config = termio_config_get(term);
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
_fr = o = elm_frame_add(opbox);
|
ctx->config = config;
|
||||||
|
|
||||||
|
ctx->frame = 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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(o, _("Key Bindings"));
|
elm_object_text_set(o, _("Key Bindings"));
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_HIDE,
|
||||||
|
_parent_hide_cb, ctx);
|
||||||
|
|
||||||
bx = elm_box_add(opbox);
|
bx = elm_box_add(opbox);
|
||||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(bx, 0.0, 0.0);
|
evas_object_size_hint_align_set(bx, 0.0, 0.0);
|
||||||
elm_object_content_set(_fr, bx);
|
elm_object_content_set(ctx->frame, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
gl = elm_genlist_add(opbox);
|
ctx->gl = gl = elm_genlist_add(opbox);
|
||||||
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_scroller_policy_set(gl, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
|
elm_scroller_policy_set(gl, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
|
||||||
|
@ -387,6 +410,7 @@ options_keys(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_genlist_homogeneous_set(gl, EINA_FALSE);
|
elm_genlist_homogeneous_set(gl, EINA_FALSE);
|
||||||
elm_box_pack_end(bx, gl);
|
elm_box_pack_end(bx, gl);
|
||||||
evas_object_show(gl);
|
evas_object_show(gl);
|
||||||
|
evas_object_data_set(gl, "ctx", ctx);
|
||||||
|
|
||||||
itc = elm_genlist_item_class_new();
|
itc = elm_genlist_item_class_new();
|
||||||
itc->item_style = "one_icon";
|
itc->item_style = "one_icon";
|
||||||
|
@ -434,5 +458,5 @@ options_keys(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_object_text_set(o, _("Reset bindings"));
|
elm_object_text_set(o, _("Reset bindings"));
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "clicked", _cb_reset_keys, gl);
|
evas_object_smart_callback_add(o, "clicked", _cb_reset_keys, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include <Efreet.h>
|
#include <Efreet.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -10,18 +11,23 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
typedef struct _Theme_Ctx
|
||||||
|
{
|
||||||
|
Evas_Object *term;
|
||||||
|
Config *config;
|
||||||
|
Evas_Object *op_themelist;
|
||||||
|
Eina_List *themes;
|
||||||
|
Ecore_Timer *seltimer;
|
||||||
|
} Theme_Ctx;
|
||||||
|
|
||||||
typedef struct _Theme Theme;
|
typedef struct _Theme Theme;
|
||||||
struct _Theme
|
struct _Theme
|
||||||
{
|
{
|
||||||
Elm_Object_Item *item;
|
Elm_Object_Item *item;
|
||||||
const char *name;
|
const char *name;
|
||||||
Evas_Object *term;
|
Theme_Ctx *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evas_Object *op_themelist;
|
|
||||||
static Eina_List *themes = NULL;
|
|
||||||
static Ecore_Timer *seltimer = NULL;
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_cb_op_theme_text_get(void *data,
|
_cb_op_theme_text_get(void *data,
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
@ -32,7 +38,8 @@ _cb_op_theme_text_get(void *data,
|
||||||
|
|
||||||
eina_strlcpy(buf, t->name, sizeof(buf));
|
eina_strlcpy(buf, t->name, sizeof(buf));
|
||||||
p = strrchr(buf, '.');
|
p = strrchr(buf, '.');
|
||||||
if (p) *p = 0;
|
if (p)
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +52,7 @@ _cb_op_theme_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (!strcmp(part, "elm.swallow.icon"))
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Config *config = termio_config_get(t->term);
|
Config *config = t->ctx->config;
|
||||||
|
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
|
@ -66,14 +73,14 @@ _cb_op_theme_sel(void *data,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Theme *t = data;
|
Theme *t = data;
|
||||||
Config *config = termio_config_get(t->term);
|
Config *config = t->ctx->config;
|
||||||
|
|
||||||
if ((config->theme) && (!strcmp(t->name, config->theme)))
|
if ((config->theme) && (!strcmp(t->name, config->theme)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
eina_stringshare_replace(&(config->theme), t->name);
|
eina_stringshare_replace(&(config->theme), t->name);
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
change_theme(termio_win_get(t->term), config);
|
change_theme(termio_win_get(t->ctx->term), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -92,10 +99,35 @@ _cb_sel_item(void *data)
|
||||||
elm_gengrid_item_selected_set(t->item, EINA_TRUE);
|
elm_gengrid_item_selected_set(t->item, EINA_TRUE);
|
||||||
elm_gengrid_item_bring_in(t->item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
|
elm_gengrid_item_bring_in(t->item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
|
||||||
}
|
}
|
||||||
seltimer = NULL;
|
t->ctx->seltimer = NULL;
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_parent_del_cb(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Theme_Ctx *ctx = data;
|
||||||
|
Theme *t;
|
||||||
|
|
||||||
|
ctx->op_themelist = NULL;
|
||||||
|
|
||||||
|
if (ctx->seltimer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(ctx->seltimer);
|
||||||
|
ctx->seltimer = NULL;
|
||||||
|
}
|
||||||
|
EINA_LIST_FREE(ctx->themes, t)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(t->name);
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_theme(Evas_Object *opbox, Evas_Object *term)
|
options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
|
@ -108,8 +140,13 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
Eina_Bool to_skip = EINA_FALSE;
|
Eina_Bool to_skip = EINA_FALSE;
|
||||||
double scale = elm_config_scale_get();
|
double scale = elm_config_scale_get();
|
||||||
|
Theme_Ctx *ctx;
|
||||||
|
|
||||||
options_theme_clear();
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -118,6 +155,9 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(fr, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
|
||||||
box = o = elm_box_add(opbox);
|
box = o = elm_box_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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
@ -130,7 +170,7 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
it_class->func.text_get = _cb_op_theme_text_get;
|
it_class->func.text_get = _cb_op_theme_text_get;
|
||||||
it_class->func.content_get = _cb_op_theme_content_get;
|
it_class->func.content_get = _cb_op_theme_content_get;
|
||||||
|
|
||||||
op_themelist = o = elm_gengrid_add(opbox);
|
ctx->op_themelist = o = elm_gengrid_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);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_gengrid_item_size_set(o, scale * 160, scale * 180);
|
elm_gengrid_item_size_set(o, scale * 160, scale * 180);
|
||||||
|
@ -152,10 +192,10 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
else if (userfiles)
|
else if (userfiles)
|
||||||
files = userfiles;
|
files = userfiles;
|
||||||
|
|
||||||
if (seltimer)
|
if (ctx->seltimer)
|
||||||
{
|
{
|
||||||
ecore_timer_del(seltimer);
|
ecore_timer_del(ctx->seltimer);
|
||||||
seltimer = NULL;
|
ctx->seltimer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH_SAFE(files, l, l_next, file)
|
EINA_LIST_FOREACH_SAFE(files, l, l_next, file)
|
||||||
|
@ -185,19 +225,21 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
}
|
}
|
||||||
|
|
||||||
t = calloc(1, sizeof(Theme));
|
t = calloc(1, sizeof(Theme));
|
||||||
if (!t) break;
|
if (!t)
|
||||||
|
break;
|
||||||
t->name = eina_stringshare_add(file);
|
t->name = eina_stringshare_add(file);
|
||||||
t->term = term;
|
t->ctx = ctx;
|
||||||
t->item = elm_gengrid_item_append(o, it_class, t,
|
t->item = elm_gengrid_item_append(o, it_class, t,
|
||||||
_cb_op_theme_sel, t);
|
_cb_op_theme_sel, t);
|
||||||
if (t->item)
|
if (t->item)
|
||||||
{
|
{
|
||||||
themes = eina_list_append(themes, t);
|
ctx->themes = eina_list_append(ctx->themes, t);
|
||||||
if ((config) && (config->theme) &&
|
if ((config) && (config->theme) &&
|
||||||
(!strcmp(config->theme, t->name)))
|
(!strcmp(config->theme, t->name)))
|
||||||
{
|
{
|
||||||
if (seltimer) ecore_timer_del(seltimer);
|
if (ctx->seltimer)
|
||||||
seltimer = ecore_timer_add(0.2, _cb_sel_item, t);
|
ecore_timer_del(ctx->seltimer);
|
||||||
|
ctx->seltimer = ecore_timer_add(0.2, _cb_sel_item, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -217,22 +259,3 @@ options_theme(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
options_theme_clear(void)
|
|
||||||
{
|
|
||||||
Theme *t;
|
|
||||||
|
|
||||||
op_themelist = NULL;
|
|
||||||
|
|
||||||
if (seltimer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(seltimer);
|
|
||||||
seltimer = NULL;
|
|
||||||
}
|
|
||||||
EINA_LIST_FREE(themes, t)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(t->name);
|
|
||||||
free(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _OPTIONS_THEME_H__
|
#ifndef _OPTIONS_THEME_H__
|
||||||
#define _OPTIONS_THEME_H__ 1
|
#define _OPTIONS_THEME_H__ 1
|
||||||
|
|
||||||
void options_theme_clear(void);
|
|
||||||
void options_theme(Evas_Object *opbox, Evas_Object *term);
|
void options_theme(Evas_Object *opbox, Evas_Object *term);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
static Evas_Object *op_vidmod;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_video_mute_chg(void *data,
|
_cb_op_video_mute_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
|
@ -51,7 +49,7 @@ _cb_op_video_vidmod_chg(void *data,
|
||||||
void
|
void
|
||||||
options_video(Evas_Object *opbox, Evas_Object *term)
|
options_video(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *fr, *bx0;
|
Evas_Object *o, *fr, *bx0, *op_vidmod;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
|
|
||||||
fr = o = elm_frame_add(opbox);
|
fr = o = elm_frame_add(opbox);
|
||||||
|
|
|
@ -60,6 +60,7 @@ struct _Term_Container {
|
||||||
void (*bell)(Term_Container *tc, Term_Container *child);
|
void (*bell)(Term_Container *tc, Term_Container *child);
|
||||||
void (*close)(Term_Container *container, Term_Container *child);
|
void (*close)(Term_Container *container, Term_Container *child);
|
||||||
void (*update)(Term_Container *tc);
|
void (*update)(Term_Container *tc);
|
||||||
|
Eina_Bool (*is_visible)(Term_Container *tc, Term_Container *child);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
291
src/bin/termio.c
291
src/bin/termio.c
|
@ -86,12 +86,10 @@ struct _Termio
|
||||||
Evas_Object *win, *theme, *glayer;
|
Evas_Object *win, *theme, *glayer;
|
||||||
Config *config;
|
Config *config;
|
||||||
const char *sel_str;
|
const char *sel_str;
|
||||||
const char *preedit_str;
|
|
||||||
Eina_List *cur_chids;
|
Eina_List *cur_chids;
|
||||||
Ecore_Job *sel_reset_job;
|
Ecore_Job *sel_reset_job;
|
||||||
double set_sel_at;
|
double set_sel_at;
|
||||||
Elm_Sel_Type sel_type;
|
Elm_Sel_Type sel_type;
|
||||||
Keys_Handler khdl;
|
|
||||||
unsigned char jump_on_change : 1;
|
unsigned char jump_on_change : 1;
|
||||||
unsigned char jump_on_keypress : 1;
|
unsigned char jump_on_keypress : 1;
|
||||||
unsigned char have_sel : 1;
|
unsigned char have_sel : 1;
|
||||||
|
@ -101,6 +99,7 @@ struct _Termio
|
||||||
unsigned char bottom_right : 1;
|
unsigned char bottom_right : 1;
|
||||||
unsigned char top_left : 1;
|
unsigned char top_left : 1;
|
||||||
unsigned char reset_sel : 1;
|
unsigned char reset_sel : 1;
|
||||||
|
unsigned char cb_added : 1;
|
||||||
double gesture_zoom_start_size;
|
double gesture_zoom_start_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1982,70 +1981,6 @@ _block_obj_del(Termblock *blk)
|
||||||
blk->obj = NULL;
|
blk->obj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
|
||||||
/* {{{ Keys */
|
|
||||||
|
|
||||||
static void
|
|
||||||
_smart_cb_key_up(void *data,
|
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *event)
|
|
||||||
{
|
|
||||||
Evas_Event_Key_Up *ev = event;
|
|
||||||
Termio *sd = evas_object_smart_data_get(data);
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
|
||||||
|
|
||||||
keyin_handle_up(&sd->khdl, ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_smart_cb_key_down(void *data,
|
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *event)
|
|
||||||
{
|
|
||||||
const Evas_Event_Key_Down *ev = event;
|
|
||||||
Termio *sd = evas_object_smart_data_get(data);
|
|
||||||
int ctrl, alt, shift, win, meta, hyper;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(ev->key);
|
|
||||||
|
|
||||||
if (miniview_handle_key(term_miniview_get(sd->term), ev))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (term_has_popmedia(sd->term) && !strcmp(ev->key, "Escape"))
|
|
||||||
{
|
|
||||||
term_popmedia_close(sd->term);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
|
||||||
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
|
|
||||||
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
|
||||||
win = evas_key_modifier_is_set(ev->modifiers, "Super");
|
|
||||||
meta = evas_key_modifier_is_set(ev->modifiers, "Meta") ||
|
|
||||||
evas_key_modifier_is_set(ev->modifiers, "AltGr") ||
|
|
||||||
evas_key_modifier_is_set(ev->modifiers, "ISO_Level3_Shift");
|
|
||||||
hyper = evas_key_modifier_is_set(ev->modifiers, "Hyper");
|
|
||||||
|
|
||||||
if (keyin_handle(&sd->khdl, sd->pty, ev, ctrl, alt, shift, win, meta, hyper))
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
if (sd->jump_on_keypress)
|
|
||||||
{
|
|
||||||
if (!key_is_modifier(ev->key))
|
|
||||||
{
|
|
||||||
sd->scroll = 0;
|
|
||||||
_smart_update_queue(data, sd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
if (sd->config->flicker_on_key)
|
|
||||||
edje_object_signal_emit(sd->cursor.obj, "key,down", "terminology");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
/* {{{ Selection */
|
/* {{{ Selection */
|
||||||
|
|
||||||
|
@ -3493,28 +3428,25 @@ termio_event_feed_mouse_in(Evas_Object *obj)
|
||||||
evas_event_feed_mouse_in(e, 0, NULL);
|
evas_event_feed_mouse_in(e, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
_imf_cursor_set(Termio *sd)
|
termio_imf_cursor_set(Evas_Object *obj, Ecore_IMF_Context *imf)
|
||||||
{
|
{
|
||||||
/* TODO */
|
Termio *sd = evas_object_smart_data_get(obj);
|
||||||
Evas_Coord cx, cy, cw, ch;
|
Evas_Coord cx, cy, cw, ch;
|
||||||
|
|
||||||
|
if (!imf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
evas_object_geometry_get(sd->cursor.obj, &cx, &cy, &cw, &ch);
|
evas_object_geometry_get(sd->cursor.obj, &cx, &cy, &cw, &ch);
|
||||||
if (sd->khdl.imf)
|
ecore_imf_context_cursor_location_set(imf, cx, cy, cw, ch);
|
||||||
ecore_imf_context_cursor_location_set(sd->khdl.imf, cx, cy, cw, ch);
|
ecore_imf_context_cursor_position_set(imf, (sd->cursor.y * sd->grid.w) + sd->cursor.x);
|
||||||
if (sd->khdl.imf) ecore_imf_context_cursor_position_set
|
|
||||||
(sd->khdl.imf, (sd->cursor.y * sd->grid.w) + sd->cursor.x);
|
|
||||||
/*
|
|
||||||
ecore_imf_context_cursor_position_set(sd->imf, 0); // how to get it?
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
_smart_cb_focus_in(void *data,
|
termio_focus_in(Evas_Object *termio)
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *_obj EINA_UNUSED,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
Termio *sd = evas_object_smart_data_get(data);
|
Termio *sd = evas_object_smart_data_get(termio);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
if (sd->config->disable_cursor_blink)
|
if (sd->config->disable_cursor_blink)
|
||||||
|
@ -3522,39 +3454,20 @@ _smart_cb_focus_in(void *data,
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(sd->cursor.obj, "focus,in", "terminology");
|
edje_object_signal_emit(sd->cursor.obj, "focus,in", "terminology");
|
||||||
if (!sd->win) return;
|
if (!sd->win) return;
|
||||||
elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_TERMINAL);
|
|
||||||
if (sd->khdl.imf)
|
|
||||||
{
|
|
||||||
ecore_imf_context_input_panel_show(sd->khdl.imf);
|
|
||||||
ecore_imf_context_reset(sd->khdl.imf);
|
|
||||||
ecore_imf_context_focus_in(sd->khdl.imf);
|
|
||||||
_imf_cursor_set(sd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
_smart_cb_focus_out(void *data,
|
termio_focus_out(Evas_Object *termio)
|
||||||
Evas *_e EINA_UNUSED,
|
|
||||||
Evas_Object *obj,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
Termio *sd = evas_object_smart_data_get(data);
|
Termio *sd = evas_object_smart_data_get(termio);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
if (!sd->config->disable_focus_visuals)
|
if (!sd->config->disable_focus_visuals)
|
||||||
edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology");
|
edje_object_signal_emit(sd->cursor.obj, "focus,out", "terminology");
|
||||||
if (!sd->win) return;
|
if (!sd->win) return;
|
||||||
sd->pty->selection.last_click = 0;
|
sd->pty->selection.last_click = 0;
|
||||||
elm_win_keyboard_mode_set(sd->win, ELM_WIN_KEYBOARD_OFF);
|
|
||||||
if (sd->khdl.imf)
|
|
||||||
{
|
|
||||||
ecore_imf_context_reset(sd->khdl.imf);
|
|
||||||
_imf_cursor_set(sd);
|
|
||||||
ecore_imf_context_focus_out(sd->khdl.imf);
|
|
||||||
ecore_imf_context_input_panel_hide(sd->khdl.imf);
|
|
||||||
}
|
|
||||||
if (!sd->ctxpopup)
|
if (!sd->ctxpopup)
|
||||||
_remove_links(sd, obj);
|
_remove_links(sd, termio);
|
||||||
term_unfocus(sd->term);
|
term_unfocus(sd->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4810,6 +4723,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
Eina_List *l, *ln;
|
Eina_List *l, *ln;
|
||||||
Termblock *blk;
|
Termblock *blk;
|
||||||
int x, y, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0;
|
int x, y, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0;
|
||||||
|
const char *preedit_str;
|
||||||
ssize_t w;
|
ssize_t w;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
@ -4996,7 +4910,9 @@ _smart_apply(Evas_Object *obj)
|
||||||
evas_object_textgrid_update_add(sd->grid.obj, ch1, y,
|
evas_object_textgrid_update_add(sd->grid.obj, ch1, y,
|
||||||
ch2 - ch1 + 1, 1);
|
ch2 - ch1 + 1, 1);
|
||||||
}
|
}
|
||||||
if (sd->preedit_str && sd->preedit_str[0])
|
|
||||||
|
preedit_str = term_preedit_str_get(sd->term);
|
||||||
|
if (preedit_str && preedit_str[0])
|
||||||
{
|
{
|
||||||
Eina_Unicode *uni, g;
|
Eina_Unicode *uni, g;
|
||||||
int len = 0, i, jump, xx, backx;
|
int len = 0, i, jump, xx, backx;
|
||||||
|
@ -5004,7 +4920,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
Evas_Textgrid_Cell *tc;
|
Evas_Textgrid_Cell *tc;
|
||||||
x = sd->cursor.x, y = sd->cursor.y;
|
x = sd->cursor.x, y = sd->cursor.y;
|
||||||
|
|
||||||
uni = eina_unicode_utf8_to_unicode(sd->preedit_str, &len);
|
uni = eina_unicode_utf8_to_unicode(preedit_str, &len);
|
||||||
if (uni)
|
if (uni)
|
||||||
{
|
{
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
|
@ -5253,53 +5169,12 @@ _cursor_cb_move(void *data,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Termio *sd = evas_object_smart_data_get(data);
|
Termio *sd = evas_object_smart_data_get(data);
|
||||||
|
Ecore_IMF_Context *imf;
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
_imf_cursor_set(sd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
imf = term_imf_context_get(sd->term);
|
||||||
_imf_event_commit_cb(void *data,
|
if (imf)
|
||||||
Ecore_IMF_Context *_ctx EINA_UNUSED,
|
termio_imf_cursor_set(sd->self, imf);
|
||||||
void *event)
|
|
||||||
{
|
|
||||||
Termio *sd = data;
|
|
||||||
char *str = event;
|
|
||||||
DBG("IMF committed '%s'", str);
|
|
||||||
if (!str) return;
|
|
||||||
termpty_write(sd->pty, str, strlen(str));
|
|
||||||
if (sd->preedit_str)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(sd->preedit_str);
|
|
||||||
sd->preedit_str = NULL;
|
|
||||||
}
|
|
||||||
_smart_update_queue(sd->self, sd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_imf_event_delete_surrounding_cb(void *data,
|
|
||||||
Ecore_IMF_Context *_ctx EINA_UNUSED,
|
|
||||||
void *event)
|
|
||||||
{
|
|
||||||
Termio *sd = data;
|
|
||||||
Ecore_IMF_Event_Delete_Surrounding *ev = event;
|
|
||||||
DBG("IMF del surrounding %p %i %i", sd, ev->offset, ev->n_chars);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_imf_event_preedit_changed_cb(void *data,
|
|
||||||
Ecore_IMF_Context *ctx,
|
|
||||||
void *_event EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Termio *sd = data;
|
|
||||||
char *preedit_string;
|
|
||||||
int cursor_pos;
|
|
||||||
ecore_imf_context_preedit_string_get(ctx, &preedit_string, &cursor_pos);
|
|
||||||
if (!preedit_string) return;
|
|
||||||
DBG("IMF preedit str '%s'", preedit_string);
|
|
||||||
if (sd->preedit_str) eina_stringshare_del(sd->preedit_str);
|
|
||||||
sd->preedit_str = eina_stringshare_add(preedit_string);
|
|
||||||
_smart_update_queue(sd->self, sd);
|
|
||||||
free(preedit_string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5371,68 +5246,8 @@ _smart_add(Evas_Object *obj)
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
_smart_cb_mouse_wheel, obj);
|
_smart_cb_mouse_wheel, obj);
|
||||||
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
|
|
||||||
_smart_cb_key_down, obj);
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP,
|
|
||||||
_smart_cb_key_up, obj);
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN,
|
|
||||||
_smart_cb_focus_in, obj);
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT,
|
|
||||||
_smart_cb_focus_out, obj);
|
|
||||||
|
|
||||||
sd->link.suspend = 1;
|
sd->link.suspend = 1;
|
||||||
|
|
||||||
if (ecore_imf_init())
|
|
||||||
{
|
|
||||||
const char *imf_id = ecore_imf_context_default_id_get();
|
|
||||||
Evas *e;
|
|
||||||
|
|
||||||
if (!imf_id) sd->khdl.imf = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const Ecore_IMF_Context_Info *imf_info;
|
|
||||||
|
|
||||||
imf_info = ecore_imf_context_info_by_id_get(imf_id);
|
|
||||||
if ((!imf_info->canvas_type) ||
|
|
||||||
(strcmp(imf_info->canvas_type, "evas") == 0))
|
|
||||||
sd->khdl.imf = ecore_imf_context_add(imf_id);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
imf_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
|
|
||||||
if (imf_id) sd->khdl.imf = ecore_imf_context_add(imf_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sd->khdl.imf) goto imf_done;
|
|
||||||
|
|
||||||
e = evas_object_evas_get(o);
|
|
||||||
ecore_imf_context_client_window_set
|
|
||||||
(sd->khdl.imf, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(e)));
|
|
||||||
ecore_imf_context_client_canvas_set(sd->khdl.imf, e);
|
|
||||||
|
|
||||||
ecore_imf_context_event_callback_add
|
|
||||||
(sd->khdl.imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, sd);
|
|
||||||
ecore_imf_context_event_callback_add
|
|
||||||
(sd->khdl.imf, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _imf_event_delete_surrounding_cb, sd);
|
|
||||||
ecore_imf_context_event_callback_add
|
|
||||||
(sd->khdl.imf, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _imf_event_preedit_changed_cb, sd);
|
|
||||||
/* make IMF usable by a terminal - no preedit, prediction... */
|
|
||||||
ecore_imf_context_prediction_allow_set
|
|
||||||
(sd->khdl.imf, EINA_FALSE);
|
|
||||||
ecore_imf_context_autocapital_type_set
|
|
||||||
(sd->khdl.imf, ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
|
|
||||||
ecore_imf_context_input_panel_layout_set
|
|
||||||
(sd->khdl.imf, ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL);
|
|
||||||
ecore_imf_context_input_mode_set
|
|
||||||
(sd->khdl.imf, ECORE_IMF_INPUT_MODE_FULL);
|
|
||||||
ecore_imf_context_input_panel_language_set
|
|
||||||
(sd->khdl.imf, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
|
|
||||||
ecore_imf_context_input_panel_return_key_type_set
|
|
||||||
(sd->khdl.imf, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
|
|
||||||
imf_done:
|
|
||||||
if (sd->khdl.imf) DBG("Ecore IMF Setup");
|
|
||||||
else WRN(_("Ecore IMF failed"));
|
|
||||||
}
|
|
||||||
terms = eina_list_append(terms, obj);
|
terms = eina_list_append(terms, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5445,12 +5260,6 @@ _smart_del(Evas_Object *obj)
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
terms = eina_list_remove(terms, obj);
|
terms = eina_list_remove(terms, obj);
|
||||||
if (sd->khdl.imf)
|
|
||||||
{
|
|
||||||
ecore_imf_context_event_callback_del
|
|
||||||
(sd->khdl.imf, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb);
|
|
||||||
ecore_imf_context_del(sd->khdl.imf);
|
|
||||||
}
|
|
||||||
if (sd->cursor.obj) evas_object_del(sd->cursor.obj);
|
if (sd->cursor.obj) evas_object_del(sd->cursor.obj);
|
||||||
if (sd->event)
|
if (sd->event)
|
||||||
{
|
{
|
||||||
|
@ -5470,17 +5279,6 @@ _smart_del(Evas_Object *obj)
|
||||||
evas_object_del(sd->event);
|
evas_object_del(sd->event);
|
||||||
sd->event = NULL;
|
sd->event = NULL;
|
||||||
}
|
}
|
||||||
if (sd->self)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_DOWN,
|
|
||||||
_smart_cb_key_down);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_UP,
|
|
||||||
_smart_cb_key_up);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_IN,
|
|
||||||
_smart_cb_focus_in);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_OUT,
|
|
||||||
_smart_cb_focus_out);
|
|
||||||
}
|
|
||||||
if (sd->sel.top) evas_object_del(sd->sel.top);
|
if (sd->sel.top) evas_object_del(sd->sel.top);
|
||||||
if (sd->sel.bottom) evas_object_del(sd->sel.bottom);
|
if (sd->sel.bottom) evas_object_del(sd->sel.bottom);
|
||||||
if (sd->sel.theme) evas_object_del(sd->sel.theme);
|
if (sd->sel.theme) evas_object_del(sd->sel.theme);
|
||||||
|
@ -5517,13 +5315,10 @@ _smart_del(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
sd->sendfile.active = EINA_FALSE;
|
sd->sendfile.active = EINA_FALSE;
|
||||||
}
|
}
|
||||||
keyin_compose_seq_reset(&sd->khdl);
|
|
||||||
if (sd->sel_str) eina_stringshare_del(sd->sel_str);
|
if (sd->sel_str) eina_stringshare_del(sd->sel_str);
|
||||||
if (sd->preedit_str) eina_stringshare_del(sd->preedit_str);
|
|
||||||
if (sd->sel_reset_job) ecore_job_del(sd->sel_reset_job);
|
if (sd->sel_reset_job) ecore_job_del(sd->sel_reset_job);
|
||||||
EINA_LIST_FREE(sd->cur_chids, chid) eina_stringshare_del(chid);
|
EINA_LIST_FREE(sd->cur_chids, chid) eina_stringshare_del(chid);
|
||||||
sd->sel_str = NULL;
|
sd->sel_str = NULL;
|
||||||
sd->preedit_str = NULL;
|
|
||||||
sd->sel_reset_job = NULL;
|
sd->sel_reset_job = NULL;
|
||||||
sd->link.down.dndobj = NULL;
|
sd->link.down.dndobj = NULL;
|
||||||
sd->cursor.obj = NULL;
|
sd->cursor.obj = NULL;
|
||||||
|
@ -5535,10 +5330,8 @@ _smart_del(Evas_Object *obj)
|
||||||
sd->delayed_size_timer = NULL;
|
sd->delayed_size_timer = NULL;
|
||||||
sd->font.name = NULL;
|
sd->font.name = NULL;
|
||||||
sd->pty = NULL;
|
sd->pty = NULL;
|
||||||
sd->khdl.imf = NULL;
|
|
||||||
sd->win = NULL;
|
sd->win = NULL;
|
||||||
sd->glayer = NULL;
|
sd->glayer = NULL;
|
||||||
ecore_imf_shutdown();
|
|
||||||
|
|
||||||
_parent_sc.del(obj);
|
_parent_sc.del(obj);
|
||||||
}
|
}
|
||||||
|
@ -5682,17 +5475,6 @@ _smart_pty_exited(void *data)
|
||||||
evas_object_del(sd->event);
|
evas_object_del(sd->event);
|
||||||
sd->event = NULL;
|
sd->event = NULL;
|
||||||
}
|
}
|
||||||
if (sd->self)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_DOWN,
|
|
||||||
_smart_cb_key_down);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_UP,
|
|
||||||
_smart_cb_key_up);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_IN,
|
|
||||||
_smart_cb_focus_in);
|
|
||||||
evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_OUT,
|
|
||||||
_smart_cb_focus_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
term_close(sd->win, sd->self, EINA_TRUE);
|
term_close(sd->win, sd->self, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -6305,3 +6087,22 @@ termio_add(Evas_Object *win, Config *config,
|
||||||
_smart_size(obj, w, h, EINA_FALSE);
|
_smart_size(obj, w, h, EINA_FALSE);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
termio_key_down(Evas_Object *termio,
|
||||||
|
const Evas_Event_Key_Down *ev)
|
||||||
|
{
|
||||||
|
Termio *sd = evas_object_smart_data_get(termio);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
if (sd->jump_on_keypress)
|
||||||
|
{
|
||||||
|
if (!key_is_modifier(ev->key))
|
||||||
|
{
|
||||||
|
sd->scroll = 0;
|
||||||
|
_smart_update_queue(termio, sd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sd->config->flicker_on_key)
|
||||||
|
edje_object_signal_emit(sd->cursor.obj, "key,down", "terminology");
|
||||||
|
}
|
||||||
|
|
|
@ -49,8 +49,15 @@ Eina_Bool termio_file_send_ok(const Evas_Object *obj, const char *file);
|
||||||
void termio_file_send_cancel(const Evas_Object *obj);
|
void termio_file_send_cancel(const Evas_Object *obj);
|
||||||
double termio_file_send_progress_get(const Evas_Object *obj);
|
double termio_file_send_progress_get(const Evas_Object *obj);
|
||||||
|
|
||||||
|
void
|
||||||
|
termio_imf_cursor_set(Evas_Object *obj, Ecore_IMF_Context *imf);
|
||||||
|
|
||||||
Termpty *termio_pty_get(const Evas_Object *obj);
|
Termpty *termio_pty_get(const Evas_Object *obj);
|
||||||
Evas_Object * termio_miniview_get(const Evas_Object *obj);
|
Evas_Object * termio_miniview_get(const Evas_Object *obj);
|
||||||
Term* termio_term_get(const Evas_Object *obj);
|
Term* termio_term_get(const Evas_Object *obj);
|
||||||
|
|
||||||
|
void termio_key_down(Evas_Object *termio, const Evas_Event_Key_Down *ev);
|
||||||
|
void termio_focus_in(Evas_Object *termio);
|
||||||
|
void termio_focus_out(Evas_Object *termio);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <Ecore_Input.h>
|
||||||
|
#include <Ecore_IMF.h>
|
||||||
|
#include <Ecore_IMF_Evas.h>
|
||||||
#include "termpty.h"
|
#include "termpty.h"
|
||||||
#include "termptyesc.h"
|
#include "termptyesc.h"
|
||||||
#include "termptyops.h"
|
#include "termptyops.h"
|
||||||
#include "termptysave.h"
|
#include "termptysave.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
#include "keyin.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -54,6 +58,26 @@ termpty_shutdown(void)
|
||||||
_termpty_log_dom = -1;
|
_termpty_log_dom = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
termpty_can_handle_key(const Termpty *ty,
|
||||||
|
const Keys_Handler *khdl,
|
||||||
|
const Evas_Event_Key_Down *ev)
|
||||||
|
{
|
||||||
|
// if term app asked for kbd lock - dont handle here
|
||||||
|
if (ty->termstate.kbd_lock)
|
||||||
|
return EINA_FALSE;
|
||||||
|
// if app asked us to not do autorepeat - ignore press if is it is the same
|
||||||
|
// timestamp as last one
|
||||||
|
if ((ty->termstate.no_autorepeat) &&
|
||||||
|
(ev->timestamp == khdl->last_keyup))
|
||||||
|
return EINA_FALSE;
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
||||||
{
|
{
|
||||||
|
|
869
src/bin/win.c
869
src/bin/win.c
File diff suppressed because it is too large
Load Diff
|
@ -47,6 +47,11 @@ Config *win_config_get(const Win *wn);
|
||||||
void win_term_swallow(Win *wn, Term *term);
|
void win_term_swallow(Win *wn, Term *term);
|
||||||
void win_add_split(Win *wn, Term *term);
|
void win_add_split(Win *wn, Term *term);
|
||||||
void win_sizing_handle(Win *wn);
|
void win_sizing_handle(Win *wn);
|
||||||
|
void win_toggle_visible_group(Win *wn);
|
||||||
|
void win_toggle_all_group(Win *wn);
|
||||||
|
Eina_Bool win_is_group_action_handled(Win *wn);
|
||||||
|
Eina_Bool win_is_group_input(Win *wn);
|
||||||
|
|
||||||
|
|
||||||
void term_ref(Term *term);
|
void term_ref(Term *term);
|
||||||
void term_unref(Term *term);
|
void term_unref(Term *term);
|
||||||
|
@ -61,6 +66,13 @@ void term_down(Term *term);
|
||||||
void term_left(Term *term);
|
void term_left(Term *term);
|
||||||
void term_right(Term *term);
|
void term_right(Term *term);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
term_preedit_str_get(Term *term);
|
||||||
|
Ecore_IMF_Context *
|
||||||
|
term_imf_context_get(Term *term);
|
||||||
|
|
||||||
|
Eina_Bool term_is_visible(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);
|
void win_font_update(Term *term);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue