}
}
part {
- name, "bg.list.border";
- type, RECT;
+ name, PART_CHANNELNUMBER_LIST;
+ type, SWALLOW;
scale, 1;
description {
state, "default" 0.0;
to, "padding.list";
relative, 1.0 1.0;
}
- color, COLOR_OPTION_BORDER;
min, 216 224;
align, 0.0 0.0;
- fixed, 1 1;
- }
- }
- part {
- name, "bg.list";
- type, RECT;
- scale, 1;
- description {
- state, "default" 0.0;
- rel1 {
- to, "bg.list.border";
- relative, 0.5 0.5;
- }
- rel2 {
- to, "bg.list.border";
- relative, 0.5 0.5;
- }
- color, COLOR_BG_NORMAL;
- min, 214 222;
- align, 0.5 0.5;
- fixed, 1 1;
- }
- }
- part {
- name, PART_CHANNELNUMBER_LIST;
- type, SWALLOW;
- scale, 1;
- description {
- state, "default" 0.0;
- rel1 {
- to, "bg.list";
- relative, 0.0 0.0;
- }
- rel2 {
- to, "bg.list";
- relative, 1.0 1.0;
- }
- align, 0.0 0.0;
- fixed, 1 1;
}
}
}
color, COLOR_TEXT_FOCUSED;
}
}
+ part {
+ name, "border.top";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "bg";
+ relative, 1.0 0.0;
+ }
+ color, COLOR_OPTION_BORDER;
+ min, 0 1;
+ align, 0.0 0.0;
+ visible, 0;
+ }
+ description {
+ state, "first" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "border.left";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "bg";
+ relative, 0.0 1.0;
+ }
+ color, COLOR_OPTION_BORDER;
+ min, 1 0;
+ align, 0.0 0.0;
+ }
+ }
+ part {
+ name, "border.bottom";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg";
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, "bg";
+ relative, 1.0 1.0;
+ }
+ color, COLOR_OPTION_BORDER;
+ min, 0 1;
+ align, 0.0 1.0;
+ visible, 0;
+ }
+ description {
+ state, "last" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "border.right";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "bg";
+ relative, 1.0 1.0;
+ }
+ color, COLOR_OPTION_BORDER;
+ min, 1 0;
+ align, 1.0 0.0;
+ }
+ }
}
programs {
program {
target, "bg";
target, PART_TEXT;
}
+ program {
+ name, "first";
+ signal, SIGNAL_FIRST;
+ source, "";
+ action, STATE_SET "first" 0.0;
+ target, "border.top";
+ }
+ program {
+ name, "last";
+ signal, SIGNAL_LAST;
+ source, "";
+ action, STATE_SET "last" 0.0;
+ target, "border.bottom";
+ }
}
}
int major;
int minor;
+ char number[NUMBER_MAX+1];
};
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
}
}
-static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Mouse_Move *ev)
-{
- viewmgr_update_view(VIEW_CHANNELNUMBER,
- UPDATE_TYPE_TIMER, 0);
-}
-
static input_handler key_handler = {
.key_down = _key_down_cb,
- .mouse_move = _mouse_move_cb,
};
-static Eina_Bool _hide_timer(void *data)
+static void _stop_hide_timer(struct _priv *priv)
+{
+ if (priv->hide_timer) {
+ ecore_timer_del(priv->hide_timer);
+ priv->hide_timer = NULL;
+ }
+}
+
+static Eina_Bool _done_input(void *data)
{
struct _priv *priv;
int r;
priv = data;
- priv->hide_timer = NULL;
-
r = tv_channel_direct_tune(priv->major, priv->minor);
if (r < 0)
_ERR("invalid channel");
viewmgr_hide_view(VIEW_CHANNELNUMBER);
+ viewmgr_show_view(VIEW_CHANNELINFO);
return ECORE_CALLBACK_CANCEL;
}
if (priv->hide_timer)
ecore_timer_reset(priv->hide_timer);
else
- priv->hide_timer = ecore_timer_add(HIDE_DUR, _hide_timer, priv);
-}
-
-static void _stop_hide_timer(struct _priv *priv)
-{
- if (priv->hide_timer) {
- ecore_timer_del(priv->hide_timer);
- priv->hide_timer = NULL;
- }
+ priv->hide_timer = ecore_timer_add(HIDE_DUR, _done_input, priv);
}
static void _tune_channel(void *data)
_tune_channel(data);
}
+static void _channel_focused_cb(int id, void *data,
+ Evas_Object *obj, Elm_Object_Item *it)
+{
+ viewmgr_update_view(VIEW_CHANNELNUMBER,
+ UPDATE_TYPE_TIMER, 0);
+}
+
static input_handler channel_handler = {
.key_down = _channel_key_down_cb,
.mouse_down = _channel_mouse_down_cb,
+ .focused = _channel_focused_cb,
};
static void _release_channel_handler(Evas_Object *obj)
_release_channel_handler(priv->list);
elm_box_clear(priv->list);
+ if (!channel_list) {
+ evas_object_hide(priv->list);
+ return;
+ }
+
+ evas_object_show(priv->list);
+
first = NULL;
ly = NULL;
EINA_LIST_FOREACH(channel_list, l, channel_info) {
if (!first) {
first = ly;
elm_object_focus_set(ly, EINA_TRUE);
+ elm_object_signal_emit(ly, SIGNAL_FIRST, "");
}
}
- if (first && ly)
+ if (first && ly) {
elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(ly, first, ELM_FOCUS_DOWN);
+ elm_object_signal_emit(ly, SIGNAL_LAST, "");
+ }
if (channel_list)
tv_channel_del_list(channel_list);
static void _update_number_info(struct _priv *priv)
{
- char buf[BUF_MAX];
-
- if (priv->major < 0) {
+ if (!priv->number) {
_ERR("Wrong channel number");
return;
}
- snprintf(buf, sizeof(buf), "%d", priv->major);
-
- elm_object_part_text_set(priv->base, PART_CHANNELNUMBER_NUMBER, buf);
+ elm_object_part_text_set(priv->base,
+ PART_CHANNELNUMBER_NUMBER, priv->number);
_update_channel_list(priv);
}
static void _number_reset(struct _priv *priv)
{
+ memset(priv->number, '\0', sizeof(char) * NUMBER_MAX + 1);
priv->major = -1;
- priv->minor = -1;
_release_channel_handler(priv->list);
elm_box_clear(priv->list);
static void _number_tuning(struct _priv *priv, const char *keyname)
{
- int num;
-
- if (!priv || !keyname) {
- _ERR("failed to get priv and keyname");
+ if (!keyname) {
+ _ERR("failed to get keyname");
return;
}
- num = _get_number(keyname);
- if (num < 0 || (num == 0 && priv->major <= 0))
- goto error;
-
- if (priv->major < 0) {
- priv->major = num;
- } else {
- priv->major *= 10;
- priv->major += num;
- }
-
- if (priv->major > MAJOR_MAX)
- goto error;
+ strncat(priv->number, keyname, 1);
+ priv->major = atoi(priv->number);
_update_number_info(priv);
- return;
-
-error:
- _number_reset(priv);
+ if (strlen(priv->number) == NUMBER_MAX)
+ _done_input(priv);
}
static Evas_Object *_create(Evas_Object *win, void *data)
goto error;
}
- elm_object_focus_allow_set(scroll, EINA_FALSE);
-
priv->list = util_add_box(scroll, false);
if (!priv->list) {
_ERR("failed to create box");
goto error;
}
-
elm_box_align_set(priv->list, 0.5, 0.0);
- elm_object_focus_allow_set(priv->list, EINA_TRUE);
- elm_object_focus_set(priv->list, EINA_TRUE);
-
viewmgr_set_view_data(VIEW_CHANNELNUMBER, priv);
inputmgr_add_callback(priv->base, 0, &key_handler, priv);
return;
}
+ viewmgr_show_view(VIEW_CHANNELNUMBER);
+
if (_get_number(ev->keyname) != -1)
_number_tuning(priv, ev->keyname);
-
- _start_hide_timer(priv);
} else if (type == UPDATE_TYPE_INPUT_KEY_UP) {
Evas_Event_Key_Up *ev = data;