SCL_DEBUG();
m_highlight_ui_object = NULL;
+ m_highlight_ui_object_alternate = NULL;
}
/**
evas_object_del(m_highlight_ui_object);
m_highlight_ui_object = NULL;
}
+ if (m_highlight_ui_object_alternate) {
+ evas_object_del(m_highlight_ui_object_alternate);
+ m_highlight_ui_object_alternate = NULL;
+ }
}
evas_object_raise(m_highlight_ui_object);
evas_object_show(m_highlight_ui_object);
+ sclboolean circular = FALSE;
+ if (state->desc.circular) {
+ if (m_highlight_ui_object_alternate == NULL) {
+ Evas_Object *window_object = static_cast<Evas_Object*>(windows->get_base_window());
+ Evas *evas = evas_object_evas_get(window_object);
+ m_highlight_ui_object_alternate = evas_object_image_add(evas);
+ sclchar composed_path[_POSIX_PATH_MAX] = {0,};
+ utils->get_composed_path(composed_path, IMG_PATH_PREFIX, SCL_HIGHLIGHT_UI_IMAGE);
+ evas_object_image_file_set(m_highlight_ui_object_alternate, composed_path, NULL);
+ }
+ SclWindowContext *winctx = windows->get_window_context(windows->get_base_window());
+ if (winctx) {
+ if (rect.x < 0) {
+ evas_object_move(m_highlight_ui_object_alternate,
+ winctx->geometry.width + rect.x, rect.y);
+ evas_object_image_fill_set(m_highlight_ui_object_alternate,
+ 0, 0, rect.width, rect.height);
+ evas_object_resize(m_highlight_ui_object_alternate,
+ rect.width, rect.height);
+ evas_object_raise(m_highlight_ui_object_alternate);
+ evas_object_show(m_highlight_ui_object_alternate);
+ circular = TRUE;
+ } else if (rect.x + rect.width > winctx->geometry.width) {
+ evas_object_move(m_highlight_ui_object_alternate,
+ -(winctx->geometry.width - rect.x), rect.y);
+ evas_object_image_fill_set(m_highlight_ui_object_alternate,
+ 0, 0, rect.width, rect.height);
+ evas_object_resize(m_highlight_ui_object_alternate,
+ rect.width, rect.height);
+ evas_object_raise(m_highlight_ui_object_alternate);
+ evas_object_show(m_highlight_ui_object_alternate);
+ circular = TRUE;
+ }
+ }
+ }
+ if (!circular) {
+ if (m_highlight_ui_object_alternate) {
+ evas_object_hide(m_highlight_ui_object_alternate);
+ }
+ } else {
+ if (m_highlight_ui_object_alternate) {
+ sclint window_layer = 29000;
+ if (!windows->is_base_window(state->desc.window_from) ||
+ !windows->is_base_window(state->desc.window_to)) {
+ window_layer = 29010;
+ }
+ evas_object_layer_set(m_highlight_ui_object_alternate, window_layer + 1);
+ }
+ }
+
sclint window_layer = 29000;
if (!windows->is_base_window(state->desc.window_from) ||
!windows->is_base_window(state->desc.window_to)) {
private:
Evas_Object *m_highlight_ui_object;
+ Evas_Object *m_highlight_ui_object_alternate;
};
} /* End of scl namespace */
#endif //__SCL_ANIMATOR_EFL_H__
SclRectangle rect_from;
SclRectangle rect_to;
+
+ sclboolean circular;
}SclAnimationDesc;
typedef struct {
protected :
CSCLAnimatorImpl* get_scl_animator_impl();
+ sclboolean animator_timer_highlight_ui(SclAnimationState *state);
private :
CSCLAnimatorImpl* m_impl;
}
sclboolean
+CSCLAnimator::animator_timer_highlight_ui(SclAnimationState *state)
+{
+ sclboolean ret = TRUE;
+
+ CSCLWindows *windows = CSCLWindows::get_instance();
+ if (state && windows) {
+ SclRectangle rect_from = state->desc.rect_from;
+ SclRectangle rect_to = state->desc.rect_to;
+
+ /* Convert popup window coordinates relative to base window */
+ if (!(windows->is_base_window(state->desc.window_from))) {
+ SclWindowContext *base_winctx = windows->get_window_context(windows->get_base_window());
+ SclWindowContext *prev_winctx = windows->get_window_context(state->desc.window_from);
+ if (base_winctx && prev_winctx) {
+ rect_from.x += (prev_winctx->geometry.x - base_winctx->geometry.x);
+ rect_from.y += (prev_winctx->geometry.y - base_winctx->geometry.y);
+ }
+ }
+ if (!(windows->is_base_window(state->desc.window_to))) {
+ SclWindowContext *base_winctx = windows->get_window_context(windows->get_base_window());
+ SclWindowContext *next_winctx = windows->get_window_context(state->desc.window_to);
+ if (base_winctx && next_winctx) {
+ rect_to.x += (next_winctx->geometry.x - base_winctx->geometry.x);
+ rect_to.y += (next_winctx->geometry.y - base_winctx->geometry.y);
+ }
+ }
+
+ sclint delta_x = 0; /* We will calculate the X considering circulation */
+ sclint delta_y = rect_to.y - rect_from.y;
+ sclint delta_width = rect_to.width - rect_from.width;
+ sclint delta_height = rect_to.height - rect_from.height;
+
+ state->rect_cur.y = rect_from.y +
+ ((delta_y) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
+ state->rect_cur.width = rect_from.width +
+ ((delta_width) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
+ state->rect_cur.height = rect_from.height +
+ ((delta_height) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
+
+ if (state->desc.circular) {
+ SclWindowContext *base_winctx = windows->get_window_context(windows->get_base_window());
+ if (base_winctx) {
+ if (rect_from.x > rect_to.x) {
+ delta_x = rect_to.x;
+ delta_x += (base_winctx->geometry.width - rect_from.x);
+ } else {
+ delta_x = -(rect_from.x);
+ delta_x -= (base_winctx->geometry.width - rect_to.x);
+ }
+
+ state->rect_cur.x = rect_from.x +
+ ((delta_x) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
+
+ if (state->rect_cur.x + state->rect_cur.width <= 0) {
+ /* Make the highlight UI come out from the right side of the window */
+ state->rect_cur.x += base_winctx->geometry.width;
+ } else if (state->rect_cur.x > base_winctx->geometry.width) {
+ state->rect_cur.x -= base_winctx->geometry.width;
+ }
+ }
+ } else {
+ delta_x = rect_to.x - rect_from.x;
+
+ state->rect_cur.x = rect_from.x +
+ ((delta_x) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
+ }
+ }
+
+ return ret;
+}
+sclboolean
CSCLAnimator::animator_timer()
{
sclboolean destroy_timer = TRUE;
if (SCL_ANIMATION_TIMER_INTERVAL * state->step >= state->desc.length) {
state->active = FALSE;
} else {
- SclRectangle rect_from = state->desc.rect_from;
- SclRectangle rect_to = state->desc.rect_to;
-
- /* Convert popup window coordinates relative to base window */
- if (!(windows->is_base_window(state->desc.window_from))) {
- SclWindowContext *base_winctx = windows->get_window_context(windows->get_base_window());
- SclWindowContext *prev_winctx = windows->get_window_context(state->desc.window_from);
- if (base_winctx && prev_winctx) {
- rect_from.x += (prev_winctx->geometry.x - base_winctx->geometry.x);
- rect_from.y += (prev_winctx->geometry.y - base_winctx->geometry.y);
- }
+ if (state->desc.type == ANIMATION_TYPE_HIGHLIGHT_UI) {
+ animator_timer_highlight_ui(state);
}
- if (!(windows->is_base_window(state->desc.window_to))) {
- SclWindowContext *base_winctx = windows->get_window_context(windows->get_base_window());
- SclWindowContext *next_winctx = windows->get_window_context(state->desc.window_to);
- if (base_winctx && next_winctx) {
- rect_to.x += (next_winctx->geometry.x - base_winctx->geometry.x);
- rect_to.y += (next_winctx->geometry.y - base_winctx->geometry.y);
- }
- }
-
- sclint delta_x = rect_to.x - rect_from.x;
- sclint delta_y = rect_to.y - rect_from.y;
- sclint delta_width = rect_to.width - rect_from.width;
- sclint delta_height = rect_to.height - rect_from.height;
- state->rect_cur.x = rect_from.x +
- ((delta_x) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
- state->rect_cur.y = rect_from.y +
- ((delta_y) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
- state->rect_cur.width = rect_from.width +
- ((delta_width) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
- state->rect_cur.height = rect_from.height +
- ((delta_height) * state->step * SCL_ANIMATION_TIMER_INTERVAL) / state->desc.length;
}
CSCLAnimatorImpl *impl = get_scl_animator_impl();
SclLayoutKeyCoordinatePointer next_coordinate =
sclres_layout_key_coordinate_pointer_frame[layout_to][desc.key_to];
+ /* Let's check if the navigation animation should be in circular movement */
+ sclboolean circular = FALSE;
+ /* If our 2 buttons overlap in Y axis */
+ if (calculate_distance(
+ prev_coordinate->y, prev_coordinate->y + prev_coordinate->height,
+ next_coordinate->y, next_coordinate->y + next_coordinate->height) < 0) {
+ /* And if those 2 buttons are side buttons, let's run the animation in circular mode */
+ if (prev_coordinate->is_side_button && next_coordinate->is_side_button) {
+ circular = TRUE;
+ }
+ }
+
sclint id = animator->find_animator_by_type(ANIMATION_TYPE_HIGHLIGHT_UI);
if (id == NOT_USED) {
SclAnimationDesc animdesc;
animdesc.window_from = desc.window_from;
animdesc.window_to = desc.window_to;
+ animdesc.circular = circular;
id = animator->create_animator(&animdesc);
animator->start_animator(id);
copy_rectangle( prev_coordinate, &(state->desc.rect_from) );
}
state->step = 0;
+ state->desc.circular = circular;
copy_rectangle( next_coordinate, &(state->desc.rect_to) );