summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-09-24 15:17:57 +0100
committerTom Hacohen <tom@stosb.com>2014-09-24 15:17:57 +0100
commit8235f7a7205ecd7dfa8ef4ee2d8e37d37f094e9d (patch)
tree18e5b4f73df7f06bce0e97bf72c44f2e6bb65035
parent9eef07be3256af64cd89f71bb6f0b6672712c241 (diff)
Add support for prev, next and cur slides in theme.
This will be needed for transitions and is needed for slide preview.
-rw-r--r--data/default.edc22
-rw-r--r--src/bin/main.c34
2 files changed, 44 insertions, 12 deletions
diff --git a/data/default.edc b/data/default.edc
index 31d2ed8..f8d6741 100644
--- a/data/default.edc
+++ b/data/default.edc
@@ -11,6 +11,19 @@ collections {
11 desc { 11 desc {
12 } 12 }
13 } 13 }
14 /* Ignored. */
15 part { name: "slide_prev";
16 type: SWALLOW;
17 desc {
18 visible: 0;
19 }
20 }
21 part { name: "slide_next";
22 type: SWALLOW;
23 desc {
24 visible: 0;
25 }
26 }
14 } 27 }
15 } 28 }
16 group { name: "preview_win"; 29 group { name: "preview_win";
@@ -33,7 +46,7 @@ collections {
33 rel1.to_x: "slide_cur"; 46 rel1.to_x: "slide_cur";
34 rel1.relative: 1.0 0.0; 47 rel1.relative: 1.0 0.0;
35 } 48 }
36 part { name: "slide_prev"; 49 part { name: "slide_next";
37 type: SWALLOW; 50 type: SWALLOW;
38 desc { 51 desc {
39 } 52 }
@@ -62,6 +75,13 @@ collections {
62 color: 255 0 0 255; 75 color: 255 0 0 255;
63 } 76 }
64 } 77 }
78 /* Ignored. */
79 part { name: "slide_prev";
80 type: SWALLOW;
81 desc {
82 visible: 0;
83 }
84 }
65 } 85 }
66 } 86 }
67} 87}
diff --git a/src/bin/main.c b/src/bin/main.c
index 8584228..454e6aa 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -17,7 +17,7 @@ int _gifter_log_dom = -1;
17typedef struct _Gifter_Win { 17typedef struct _Gifter_Win {
18 Elm_Win *win; 18 Elm_Win *win;
19 Elm_Layout *layout; 19 Elm_Layout *layout;
20 Elm_Image *pdf; 20 Elm_Image *pdf[3]; /* Prev, next and cur */
21} Gifter_Win; 21} Gifter_Win;
22 22
23typedef struct _Gifter_Context { 23typedef struct _Gifter_Context {
@@ -50,8 +50,14 @@ _pdf_page_set(int page)
50static void 50static void
51_pdf_page_set_all(int page) 51_pdf_page_set_all(int page)
52{ 52{
53 eo_do(ctx.main.pdf, _pdf_page_set(page)); 53 unsigned int i = 0;
54 eo_do(ctx.preview.pdf, _pdf_page_set(page)); 54 for (i = 0 ; i < EINA_C_ARRAY_LENGTH(ctx.main.pdf) ; i++)
55 {
56 int cur_page = page + i - 1;
57 eo_do(ctx.main.pdf[i], _pdf_page_set(cur_page));
58 eo_do(ctx.preview.pdf[i], _pdf_page_set(cur_page));
59 }
60
55 DBG("Set page: %s:%d", ctx.filename, page); 61 DBG("Set page: %s:%d", ctx.filename, page);
56} 62}
57 63
@@ -92,6 +98,7 @@ _create_win(Gifter_Win *win, const char *group_name)
92 Evas_Coord w = 600, h = 600; 98 Evas_Coord w = 600, h = 600;
93 Evas_Object *bg, *dummy_key; 99 Evas_Object *bg, *dummy_key;
94 char theme_filename[PATH_MAX]; 100 char theme_filename[PATH_MAX];
101 unsigned int i = 0;
95 102
96 snprintf(theme_filename, sizeof(theme_filename), "%s/themes/default.edj", elm_app_data_dir_get()); 103 snprintf(theme_filename, sizeof(theme_filename), "%s/themes/default.edj", elm_app_data_dir_get());
97 104
@@ -118,17 +125,20 @@ _create_win(Gifter_Win *win, const char *group_name)
118 elm_win_resize_object_add(win->win, win->layout); 125 elm_win_resize_object_add(win->win, win->layout);
119 eo_unref(win->layout); 126 eo_unref(win->layout);
120 127
121 win->pdf = eo_add(ELM_IMAGE_CLASS, win->layout, 128 for (i = 0 ; i < EINA_C_ARRAY_LENGTH(win->pdf) ; i++)
122 elm_obj_image_smooth_set(EINA_TRUE), 129 {
123 elm_obj_image_aspect_fixed_set(EINA_TRUE), 130 win->pdf[i] = eo_add(ELM_IMAGE_CLASS, win->layout,
124 _pdf_page_set(ctx.page), 131 elm_obj_image_smooth_set(EINA_TRUE),
125 evas_obj_visibility_set(EINA_TRUE)); 132 elm_obj_image_aspect_fixed_set(EINA_TRUE),
126 eo_unref(win->pdf); 133 _pdf_page_set(ctx.page + i - 1),
134 evas_obj_visibility_set(EINA_TRUE));
135 eo_unref(win->pdf[i]);
136 }
127 137
128 { 138 {
129 /* Update w/h according to aspect ratio. */ 139 /* Update w/h according to aspect ratio. */
130 int tw = 0, th = 0; 140 int tw = 0, th = 0;
131 eo_do(win->pdf, elm_obj_image_object_size_get(&tw, &th)); 141 eo_do(win->pdf[1], elm_obj_image_object_size_get(&tw, &th));
132 142
133 if (tw && th) 143 if (tw && th)
134 { 144 {
@@ -139,7 +149,9 @@ _create_win(Gifter_Win *win, const char *group_name)
139 evas_object_resize(win->win, w, h); 149 evas_object_resize(win->win, w, h);
140 } 150 }
141 151
142 eo_do(win->layout, elm_obj_container_content_set("slide_cur", win->pdf)); 152 eo_do(win->layout, elm_obj_container_content_set("slide_prev", win->pdf[0]));
153 eo_do(win->layout, elm_obj_container_content_set("slide_cur", win->pdf[1]));
154 eo_do(win->layout, elm_obj_container_content_set("slide_next", win->pdf[2]));
143 155
144 evas_object_smart_callback_add(win->win, "delete,request", my_win_del, NULL); 156 evas_object_smart_callback_add(win->win, "delete,request", my_win_del, NULL);
145 evas_object_show(win->win); 157 evas_object_show(win->win);