RTL 15/103115/1 submit/tizen_3.0/20161207.102010
authorYoungHun Cho <hoon.cho@samsung.com>
Wed, 7 Dec 2016 08:28:32 +0000 (17:28 +0900)
committerYoungHun Cho <hoon.cho@samsung.com>
Wed, 7 Dec 2016 08:34:08 +0000 (17:34 +0900)
Change-Id: I080c9586a5bb2ed3999feb8f15925a2f81fb50b1
Signed-off-by: YoungHun Cho <hoon.cho@samsung.com>
.rds_delta
inc/conf.h
inc/page_indicator.h
res/edje/add_widget_viewer.edc
src/cluster_view.c
src/conf.c
src/homescreen-efl.c
src/page_indicator.c

index f62f08f..6201ce4 100644 (file)
@@ -3,7 +3,4 @@
 #modify
 author-signature.xml
 signature1.xml
-bin/homescreen-efl
-res/edje/app_icon.edj
-res/edje/cluster_page.edj
-res/edje/widget.edj
+res/edje/add_widget_viewer.edj
index 08b14a4..84ab1b9 100755 (executable)
@@ -42,6 +42,9 @@ extern double __conf_get_resolution_scale_w();
 extern double __conf_get_resolution_scale_area();
 extern int __conf_get_window_h();
 extern int __conf_get_window_w();
+extern int __conf_get_mirroring_x(int x, int width);
+
+#define MIRRORING_X(x, w) (__conf_get_mirroring_x((x), (w)))
 
 #define INDICATOR_H ((45) * (__conf_get_resolution_scale_h()))
 
index 70a09ce..862828a 100755 (executable)
 #define PAGE_INDICATOR_MAX_PAGE_COUNT 7
 #define PAGE_INDICATOR_CENTER_PAGE_INDEX 3
 
-
 typedef struct {
        Evas_Object *scroller;
        Evas_Object *box;
        Evas_Object *unit[PAGE_INDICATOR_MAX_PAGE_COUNT];
+       double unit_angle[PAGE_INDICATOR_MAX_PAGE_COUNT];
 
        int page_count;
        int x;
index 0a52873..4b92511 100755 (executable)
@@ -24,7 +24,7 @@ images {
 styles {
        style {
                name: "leaf,font";
-               base: "font=Tizen text_class=T024 font_size=38 align=left color=#808080FF color_class=T024 ellipsis=1.0";
+               base: "font=Tizen text_class=T024 font_size=38 color=#808080FF color_class=T024 ellipsis=1.0";
        }
 }
 
index 40c80ec..fc1e322 100755 (executable)
@@ -761,6 +761,7 @@ static void __cluster_view_create_all_page(void)
 
        evas_object_size_hint_align_set(cluster_view_s.allpage, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(cluster_view_s.allpage, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_resize(cluster_view_s.allpage, WINDOW_W, WINDOW_H);
        evas_object_move(cluster_view_s.allpage, 0, 0);
        evas_object_show(cluster_view_s.allpage);
 
@@ -784,7 +785,7 @@ static void __cluster_view_create_all_page(void)
        cluster_page_t *page_item = NULL;
        elm_box_unpack_all(cluster_view_s.box);
        EINA_LIST_FOREACH(cluster_view_s.page_list, find_list, page_item) {
-               evas_object_move(page_item->page_layout, -720, 0);
+               evas_object_move(page_item->page_layout, -WINDOW_W, -WINDOW_H);
                if (page_item->page_layout) {
                        page_item->thumbnail_ly = elm_layout_add(page_item->page_layout);
                        elm_layout_file_set(page_item->thumbnail_ly, util_get_res_file_path(EDJE_DIR"/cluster_allpage_thumbnail.edj"), GROUP_CLUSTER_ALLPAGE_THUMBNAIL_LY);
@@ -878,8 +879,8 @@ static int __cluster_view_allpage_get_page_index(int x, int y)
        for (idx = 0; idx < cluster_view_s.page_count; idx++) {
                int row = idx / 2;
                int col = idx % 2;
-               int ny = sy + (row * h);
-               int nx = sx + (col * w);
+               int ny = sy + (row * h) + (CLUSTER_ALL_PAGE_H / 2);
+               int nx = sx + (col * w) + (CLUSTER_ALL_PAGE_W / 2);
 
                int d = (ny - y) * (ny - y) + (nx - x) * (nx - x);
                if (d < CLUSTER_VIEW_ALLPAGE_MOVE_GAP) {
@@ -1196,7 +1197,7 @@ static void __cluster_view_allpage_drag_page(void *data)
                int move_y = cluster_mouse_info.move_y - cluster_mouse_info.offset_y;
                int new_index = INIT_VALUE;
                evas_object_move(cluster_view_s.picked_page->thumbnail_ly, move_x, move_y);
-               new_index = __cluster_view_allpage_get_page_index(move_x, move_y);
+               new_index = __cluster_view_allpage_get_page_index(MIRRORING_X(move_x + CLUSTER_ALL_PAGE_W / 2, WINDOW_W), move_y + CLUSTER_ALL_PAGE_H / 2);
 
                int move = 0;
                int start, end;
@@ -1243,10 +1244,17 @@ static void __cluster_view_allpage_pick_up_page(void *data)
        elm_object_signal_emit(cluster_view_s.picked_page->thumbnail_ly, SIGNAL_ALLPAGE_DELETE_BUTTON_HIDE, SIGNAL_SOURCE);
        elm_object_signal_emit(cluster_view_s.picked_page->thumbnail_ly, SIGNAL_ALLPAGE_DRAG_BG_SHOW, SIGNAL_SOURCE);
 
-       int x, y;
-       __cluster_view_allpage_get_page_pos(cluster_view_s.picked_page->page_index, &x, &y);
-       cluster_mouse_info.offset_x = cluster_mouse_info.down_x - x;
-       cluster_mouse_info.offset_y = cluster_mouse_info.down_y - y;
+       int cx = -1, cy = -1;
+       int gx = -1, gy = -1, gw = 0, gh = 0;
+       Evas *e = NULL;
+
+       Evas_Object *page = cluster_view_s.picked_page->thumbnail_ly;
+       e = evas_object_evas_get(page);
+       evas_pointer_canvas_xy_get(e, &cx, &cy);
+       evas_object_geometry_get(page, &gx, &gy, &gw, &gh);
+
+       cluster_mouse_info.offset_x = cx - gx;
+       cluster_mouse_info.offset_y = cy - gy;
 }
 
 static void __cluster_view_allpage_drop_page(void *data)
index de6542b..128b4b8 100755 (executable)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include <Elementary.h>
+
 #include "conf.h"
 #include "util.h"
 
@@ -48,6 +50,14 @@ double __conf_get_resolution_scale_area()
        return resolution_scale_area;
 }
 
+int __conf_get_mirroring_x(int x, int width)
+{
+       if (elm_config_mirrored_get())
+               return width - x;
+
+       return x;
+}
+
 void conf_set_resolution_scale(int win_width, int win_height)
 {
        window_h = win_height;
index 7ab0b93..a29f315 100755 (executable)
@@ -75,7 +75,6 @@ static Eina_Bool __homescreen_efl_init_view(void *data);
 
 static void __homescreen_efl_lang_changed_cb(app_event_info_h event_info, void *user_data)
 {
-       LOGD("called");
        menu_hide();
        cluster_view_lang_changed(main_info.view_type);
        apps_view_lang_changed(main_info.view_type);
index d4b8d9d..6c5685d 100755 (executable)
@@ -27,7 +27,7 @@ static void __page_indicator_unit_rotate(Evas_Object *unit, double angle, double
 static void __page_indicator_unit_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
 static int __page_indicator_get_indicator_unit(int page_count, int cur_page);
 
-page_indicator_t * page_indictor_create(Evas_Object *scroller)
+page_indicator_t *page_indictor_create(Evas_Object *scroller)
 {
        int i;
        char edj_path[PATH_MAX] = {0, };
@@ -73,6 +73,7 @@ page_indicator_t * page_indictor_create(Evas_Object *scroller)
                evas_object_resize(rect, PAGE_INDICATOR_UNIT, PAGE_INDICATOR_UNIT);
                evas_object_show(rect);
                elm_object_part_content_set(page_indicator->unit[i], SIZE_SETTER, rect);
+               page_indicator->unit_angle[i] = 0.0;
        }
 
        return page_indicator;
@@ -181,51 +182,51 @@ static int __page_indicator_get_indicator_unit(int page_count, int page)
 
 static void __page_indicator_scroll_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       int i = 0;
-       int x = 0;
-       int max_unit_count = 0;
-       double cur_unit_angle = 0.0;
-       double next_unit_angle = 0.0;
-       int cur_indicator_unit = -1;
-       int next_indicator_unit = -1;
-       int cur_page = 0, next_page = 0;
-       int cur_x = 0, next_x = 0;
-
        page_indicator_t *page_indicator = (page_indicator_t*) data;
        if (!page_indicator) {
                LOGE("Invalid page_indicator");
                return;
        }
 
-       elm_scroller_region_get(obj, &x, NULL, NULL, NULL);
+       int cur_x = 0;
+       int page_size = 0;
+       elm_scroller_region_get(obj, &cur_x, NULL, &page_size, NULL);
+
+       int scroller_width = page_size * page_indicator->page_count;
+       int cur_page_x = page_indicator->current_page * page_size;
 
-       cur_page = x / page_indicator->w;
-       next_page = (cur_page + 1) % page_indicator->page_count;
+       cur_x = MIRRORING_X(cur_x + page_size / 2, scroller_width) - page_size / 2;
 
-       cur_indicator_unit = __page_indicator_get_indicator_unit(page_indicator->page_count, cur_page);
-       next_indicator_unit = __page_indicator_get_indicator_unit(page_indicator->page_count, next_page);
+       int delta_x = cur_x - cur_page_x;
+       if (delta_x < -page_size)
+               delta_x = delta_x + scroller_width;
+       else if (delta_x > page_size)
+               delta_x = delta_x - scroller_width;
+
+       int cur_page = page_indicator->current_page;
+       int next_page = (cur_page + 1) % page_indicator->page_count;
+       if (delta_x < 0) {
+               delta_x = (delta_x - scroller_width) % scroller_width;
+               next_page = ((cur_page - 1) + page_indicator->page_count) % page_indicator->page_count;
+       }
 
-       cur_x = x;
-       next_x = (cur_x + page_indicator->w) % (page_indicator->w * page_indicator->page_count);
+       int cur_indicator_unit = __page_indicator_get_indicator_unit(page_indicator->page_count, cur_page);
+       int next_indicator_unit = __page_indicator_get_indicator_unit(page_indicator->page_count, next_page);
 
-       next_unit_angle = (double)(next_x - next_page * page_indicator->w) / page_indicator->w * 90.0;
-       cur_unit_angle = (next_unit_angle + 90) - 180;
+       double angle_delta = (double)delta_x / page_size * 90.0;
 
-       max_unit_count = page_indicator->page_count < PAGE_INDICATOR_MAX_PAGE_COUNT ? page_indicator->page_count : PAGE_INDICATOR_MAX_PAGE_COUNT;
+       int i = 0;
+       int max_unit_count = page_indicator->page_count < PAGE_INDICATOR_MAX_PAGE_COUNT ? page_indicator->page_count : PAGE_INDICATOR_MAX_PAGE_COUNT;
        for (i = 0; i < max_unit_count; i++)
        {
                double angle = 0.0;
-               double color = 0.0;
-
-               if (i == cur_indicator_unit) {
-                       angle = cur_unit_angle;
-               } else if (i == next_indicator_unit) {
-                       angle = next_unit_angle;
-               } else {
-                       angle = 0.0;
+               if (i == cur_indicator_unit || i == next_indicator_unit) {
+                       angle = page_indicator->unit_angle[i] + angle_delta;
+                       if (angle > 90.0)
+                               angle -= 180.0;
                }
 
-               color = fabs(angle) * 2 + 75.0;
+               double color = fabs(angle) * 2 + 75.0;
                __page_indicator_unit_rotate(page_indicator->unit[i], angle, color);
        }
 }
@@ -264,9 +265,11 @@ static void __page_indicator_set_current_page(page_indicator_t *page_indicator)
 
                if (i == cur_indicator_unit) {
                        edje_object_signal_emit(edje, SIGNAL_PAGE_INDICATOR_CURRENT, SIGNAL_SOURCE);
+                       page_indicator->unit_angle[i] = 90.0;
                }
                else {
                        edje_object_signal_emit(edje, SIGNAL_PAGE_INDICATOR_DEFAULT, SIGNAL_SOURCE);
+                       page_indicator->unit_angle[i] = 0.0;
                }
 
                if (page_indicator->page_count > PAGE_INDICATOR_MAX_PAGE_COUNT && i == PAGE_INDICATOR_CENTER_PAGE_INDEX) {