summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-01-13 21:26:17 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-13 21:42:34 +0900
commit37fd08acb6aed168f26eff64c62071a6c36ba731 (patch)
tree725ca9eb175a909237b08640357e59a60a6750ff
parent433a30e2df1ae6186b2d030970524d1001b82b4a (diff)
fix emotion
that box thing was just breaking the ui
-rw-r--r--examples/gradient_simple.cfgbin770 -> 443 bytes
-rw-r--r--main.c101
2 files changed, 50 insertions, 51 deletions
diff --git a/examples/gradient_simple.cfg b/examples/gradient_simple.cfg
index c5cd64f..548d9d1 100644
--- a/examples/gradient_simple.cfg
+++ b/examples/gradient_simple.cfg
Binary files differ
diff --git a/main.c b/main.c
index a630eb7..275d71e 100644
--- a/main.c
+++ b/main.c
@@ -27,7 +27,7 @@ const char *home = NULL;
27 27
28#define HAS_FILTER_CHAIN 28#define HAS_FILTER_CHAIN
29#define HAS_FILTER_CHAIN_TXT 29#define HAS_FILTER_CHAIN_TXT
30#define HAS_FILTER_CHAIN_IMG 30#undef HAS_FILTER_CHAIN_IMG
31#undef HAS_FILTER_CHAIN_TB 31#undef HAS_FILTER_CHAIN_TB
32#define TEXTVIEW_PROXY 32#define TEXTVIEW_PROXY
33 33
@@ -46,7 +46,6 @@ Eo *proxies[IMAGE_COUNT] = { NULL };
46Eo *proxyimages[IMAGE_COUNT] = { NULL }; 46Eo *proxyimages[IMAGE_COUNT] = { NULL };
47Eo *proxypreviews[IMAGE_COUNT+1] = { NULL }; 47Eo *proxypreviews[IMAGE_COUNT+1] = { NULL };
48Eo *emotion_video = NULL; 48Eo *emotion_video = NULL;
49Eo *emotion_proxy = NULL;
50Eo *emotion_frame = NULL; 49Eo *emotion_frame = NULL;
51Eo *fsbuttons[IMAGE_COUNT+1] = { NULL }; 50Eo *fsbuttons[IMAGE_COUNT+1] = { NULL };
52Eo *textblockview = NULL; 51Eo *textblockview = NULL;
@@ -110,16 +109,10 @@ _image_set(int k, const char *path)
110 source = NULL; 109 source = NULL;
111 } 110 }
112 111
113#ifdef HAS_FILTER_CHAIN
114 char buf[32]; 112 char buf[32];
115 sprintf(buf, "image%d", k + 1); 113 sprintf(buf, "image%d", k + 1);
116#ifdef HAS_FILTER_CHAIN_TXT
117 eo_do(textview, efl_gfx_filter_source_set(buf, source)); 114 eo_do(textview, efl_gfx_filter_source_set(buf, source));
118#endif
119#ifdef HAS_FILTER_CHAIN_IMG
120 eo_do(imageview, efl_gfx_filter_source_set(buf, source)); 115 eo_do(imageview, efl_gfx_filter_source_set(buf, source));
121#endif
122#endif
123 116
124 _textblock_proxies_bind(); 117 _textblock_proxies_bind();
125} 118}
@@ -132,7 +125,15 @@ _emotion_started_cb(void *data EINA_UNUSED,
132 int w, h; 125 int w, h;
133 Evas_Object *emotion = elm_video_emotion_get(emotion_video); 126 Evas_Object *emotion = elm_video_emotion_get(emotion_video);
134 emotion_object_size_get(emotion, &w, &h); 127 emotion_object_size_get(emotion, &w, &h);
135 evas_object_resize(emotion_proxy, w, h); 128 evas_object_resize(emotion_video, w, h);
129
130 // booh
131 eo_do(textview,
132 efl_gfx_filter_source_set("emotion", NULL),
133 efl_gfx_filter_source_set("emotion", emotion_video));
134 eo_do(imageview,
135 efl_gfx_filter_source_set("emotion", NULL),
136 efl_gfx_filter_source_set("emotion", emotion_video));
136} 137}
137 138
138static void 139static void
@@ -156,7 +157,7 @@ _video_set(const char *path)
156 evas_object_show(proxypreviews[VIDEO_PROXY_ID]); 157 evas_object_show(proxypreviews[VIDEO_PROXY_ID]);
157 evas_object_hide(fsbuttons[VIDEO_PROXY_ID]); 158 evas_object_hide(fsbuttons[VIDEO_PROXY_ID]);
158 159
159 elm_video_audio_mute_set(emotion_video, EINA_TRUE); 160 elm_video_audio_mute_set(emotion_video, EINA_FALSE);
160 Evas_Object *emotion = elm_video_emotion_get(emotion_video); 161 Evas_Object *emotion = elm_video_emotion_get(emotion_video);
161 emotion_object_keep_aspect_set(emotion, EINA_FALSE); 162 emotion_object_keep_aspect_set(emotion, EINA_FALSE);
162 evas_object_smart_callback_add(emotion, "playback_started", 163 evas_object_smart_callback_add(emotion, "playback_started",
@@ -165,7 +166,7 @@ _video_set(const char *path)
165 _emotion_finished_cb, NULL); 166 _emotion_finished_cb, NULL);
166 elm_video_play(emotion_video); 167 elm_video_play(emotion_video);
167 168
168 source = emotion_proxy; 169 source = emotion_video;
169 } 170 }
170 else 171 else
171 { 172 {
@@ -173,16 +174,11 @@ _video_set(const char *path)
173 evas_object_show(fsbuttons[VIDEO_PROXY_ID]); 174 evas_object_show(fsbuttons[VIDEO_PROXY_ID]);
174 } 175 }
175 176
176#ifdef HAS_FILTER_CHAIN
177#ifdef HAS_FILTER_CHAIN_TXT
178 eo_do(textview, efl_gfx_filter_source_set("emotion", source)); 177 eo_do(textview, efl_gfx_filter_source_set("emotion", source));
179#endif
180#ifdef HAS_FILTER_CHAIN_IMG
181 eo_do(imageview, efl_gfx_filter_source_set("emotion", source)); 178 eo_do(imageview, efl_gfx_filter_source_set("emotion", source));
182#endif
183#endif
184} 179}
185 180
181#ifdef HAS_FILTER_CHAIN_TB
186static char * 182static char *
187_duplicate_br_newline(const char *str) 183_duplicate_br_newline(const char *str)
188{ 184{
@@ -206,6 +202,7 @@ _duplicate_br_newline(const char *str)
206 eina_strbuf_free(sb); 202 eina_strbuf_free(sb);
207 return br; 203 return br;
208} 204}
205#endif
209 206
210static char *_real_path_get(const char *path) 207static char *_real_path_get(const char *path)
211{ 208{
@@ -224,8 +221,8 @@ static void
224_config_reload(const char *path) 221_config_reload(const char *path)
225{ 222{
226 Eet_File *ef; 223 Eet_File *ef;
227 Eina_Bool b = EINA_TRUE; 224 //Eina_Bool b = EINA_TRUE;
228 void *data; 225 //void *data;
229 int size = 0; 226 int size = 0;
230 char *utf8; 227 char *utf8;
231 int *fontsize; 228 int *fontsize;
@@ -298,7 +295,7 @@ _config_reload(const char *path)
298 if (utf8) 295 if (utf8)
299 { 296 {
300 char *markup = elm_entry_utf8_to_markup(utf8); 297 char *markup = elm_entry_utf8_to_markup(utf8);
301 elm_object_text_set(textblockeditor, markup); 298 if (textblockeditor) elm_object_text_set(textblockeditor, markup);
302 free(markup); 299 free(markup);
303 free(utf8); 300 free(utf8);
304 } 301 }
@@ -341,7 +338,7 @@ _config_save(const char *path)
341 Eet_File *ef; 338 Eet_File *ef;
342 Eina_Bool ok = EINA_TRUE; 339 Eina_Bool ok = EINA_TRUE;
343 char *utf8; 340 char *utf8;
344 Eina_Bool b; 341 //Eina_Bool b;
345 int fontsize; 342 int fontsize;
346 343
347 ef = eet_open(path, EET_FILE_MODE_WRITE); 344 ef = eet_open(path, EET_FILE_MODE_WRITE);
@@ -491,7 +488,7 @@ _padding_update(void)
491 evas_object_text_style_pad_get(textview, &l, &r, &t, &b); 488 evas_object_text_style_pad_get(textview, &l, &r, &t, &b);
492 snprintf(padding, sizeof(padding), "%s L=%dpx, R=%dpx, T=%dpx, B=%dpx", 489 snprintf(padding, sizeof(padding), "%s L=%dpx, R=%dpx, T=%dpx, B=%dpx",
493 _("Padding:"), l, r, t, b); 490 _("Padding:"), l, r, t, b);
494 elm_object_text_set(paddinglbl, padding); 491 if (paddinglbl) elm_object_text_set(paddinglbl, padding);
495} 492}
496 493
497static void 494static void
@@ -514,6 +511,7 @@ _entry_update_cb(void *data EINA_UNUSED,
514 _entry_update(); 511 _entry_update();
515} 512}
516 513
514#ifdef HAS_FILTER_CHAIN_TB
517static void 515static void
518_textblock_update_cb(void *data EINA_UNUSED, 516_textblock_update_cb(void *data EINA_UNUSED,
519 Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED) 517 Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
@@ -524,29 +522,26 @@ _textblock_update_cb(void *data EINA_UNUSED,
524 str = elm_object_text_get(textblockview); 522 str = elm_object_text_get(textblockview);
525 br = _duplicate_br_newline(str); 523 br = _duplicate_br_newline(str);
526 markup = elm_entry_utf8_to_markup(br); 524 markup = elm_entry_utf8_to_markup(br);
527 elm_object_text_set(textblockeditor, markup); 525 if (textblockeditor) elm_object_text_set(textblockeditor, markup);
528 free(markup); 526 free(markup);
529 free(br); 527 free(br);
530} 528}
529#endif
531 530
532static void 531static void
533_markup_update(void) 532_markup_update(void)
534{ 533{
534#ifdef HAS_FILTER_CHAIN_TB
535 const char *str; 535 const char *str;
536 char *utf8; 536 char *utf8;
537 537
538 if (!textblockeditor) return;
538 str = elm_object_text_get(textblockeditor); 539 str = elm_object_text_get(textblockeditor);
539 utf8 = elm_entry_markup_to_utf8(str); 540 utf8 = elm_entry_markup_to_utf8(str);
540 if (!utf8) return; 541 if (!utf8) return;
541 elm_object_text_set(textblockview, utf8); 542 elm_object_text_set(textblockview, utf8);
542 free(utf8); 543 free(utf8);
543} 544#endif
544
545static void
546_markup_update_cb(void *data EINA_UNUSED,
547 Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
548{
549 _markup_update();
550} 545}
551 546
552static void 547static void
@@ -572,6 +567,13 @@ _style_apply(void)
572 567
573 stylestr = elm_object_text_get(styleentry); 568 stylestr = elm_object_text_get(styleentry);
574 stylestr_utf8 = elm_entry_markup_to_utf8(stylestr); 569 stylestr_utf8 = elm_entry_markup_to_utf8(stylestr);
570 if (stylestr && !*stylestr)
571 stylestr = NULL;
572 if (stylestr_utf8 && !*stylestr_utf8)
573 {
574 free(stylestr_utf8);
575 stylestr_utf8 = NULL;
576 }
575 577
576 // Evas Text and Image 578 // Evas Text and Image
577#ifdef HAS_FILTER_CHAIN_TXT 579#ifdef HAS_FILTER_CHAIN_TXT
@@ -777,6 +779,7 @@ _home_dir_get(void)
777 return dir; 779 return dir;
778} 780}
779 781
782#ifdef TEXTVIEW_PROXY
780static void 783static void
781_textview_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, 784_textview_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
782 void *event_info EINA_UNUSED) 785 void *event_info EINA_UNUSED)
@@ -786,7 +789,7 @@ _textview_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
786 evas_object_geometry_get(obj, &x, &y, &w, &h); 789 evas_object_geometry_get(obj, &x, &y, &w, &h);
787 evas_object_geometry_set(img, x, y, w, h); 790 evas_object_geometry_set(img, x, y, w, h);
788} 791}
789 792#endif
790 793
791EAPI_MAIN int 794EAPI_MAIN int
792elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) 795elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
@@ -809,9 +812,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
809 win = elm_win_util_standard_add("text-styles", title); 812 win = elm_win_util_standard_add("text-styles", title);
810 evas_object_smart_callback_add(win, "delete,request", _quit_click_cb, NULL); 813 evas_object_smart_callback_add(win, "delete,request", _quit_click_cb, NULL);
811 814
812 evas_object_resize(win, WIDTH, HEIGHT);
813 evas_object_show(win);
814
815 evas = evas_object_evas_get(win); 815 evas = evas_object_evas_get(win);
816 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); 816 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO);
817 817
@@ -882,7 +882,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
882 evas_object_image_source_set(o, textview); 882 evas_object_image_source_set(o, textview);
883 //evas_object_image_source_clip_set(o, 1); 883 //evas_object_image_source_clip_set(o, 1);
884 evas_object_clip_set(o, evas_object_clip_get(textview)); 884 evas_object_clip_set(o, evas_object_clip_get(textview));
885 evas_object_image_source_visible_set(o, 1); 885 evas_object_image_source_visible_set(o, 0);
886 evas_object_event_callback_add(textview, EVAS_CALLBACK_RESIZE, _textview_update, o); 886 evas_object_event_callback_add(textview, EVAS_CALLBACK_RESIZE, _textview_update, o);
887 evas_object_event_callback_add(textview, EVAS_CALLBACK_MOVE, _textview_update, o); 887 evas_object_event_callback_add(textview, EVAS_CALLBACK_MOVE, _textview_update, o);
888 evas_object_show(o); 888 evas_object_show(o);
@@ -1062,6 +1062,11 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1062 // First item will be an emotion. Gifs are still too broken for proper tests 1062 // First item will be an emotion. Gifs are still too broken for proper tests
1063 if (WITH_EMOTION) 1063 if (WITH_EMOTION)
1064 { 1064 {
1065 // Video
1066 o = elm_video_add(win);
1067 evas_object_show(o);
1068 emotion_video = o;
1069
1065 // Frame 1070 // Frame
1066 Eo *fr = elm_frame_add(vb); 1071 Eo *fr = elm_frame_add(vb);
1067 evas_object_show(fr); 1072 evas_object_show(fr);
@@ -1072,20 +1077,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1072 elm_object_text_set(fr, "emotion"); 1077 elm_object_text_set(fr, "emotion");
1073 emotion_frame = fr; 1078 emotion_frame = fr;
1074 1079
1075 o = elm_box_add(win);
1076 evas_object_resize(o, 640, 480);
1077 //evas_object_move(o, -9999, -9999);
1078 evas_object_show(o);
1079 emotion_proxy = o;
1080
1081 o = elm_video_add(win);
1082 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1083 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1084 evas_object_show(o);
1085 elm_box_pack_end(emotion_proxy, o);
1086 emotion_video = o;
1087
1088 // Video
1089 Eo *tbl = elm_table_add(fr); 1080 Eo *tbl = elm_table_add(fr);
1090 evas_object_show(tbl); 1081 evas_object_show(tbl);
1091 evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1082 evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1096,8 +1087,10 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1096 o = evas_object_image_filled_add(evas); 1087 o = evas_object_image_filled_add(evas);
1097 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1088 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1098 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1089 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1099 evas_object_image_source_set(o, emotion_proxy); 1090 evas_object_image_source_set(o, emotion_video);
1100 evas_object_image_source_visible_set(o, EINA_FALSE); 1091 evas_object_image_source_visible_set(o, EINA_FALSE);
1092 evas_object_image_source_clip_set(o, 0);
1093 //eo_do(o, evas_obj_no_render_set(1));
1101 elm_table_pack(tbl, o, 0, 0, 1, 1); 1094 elm_table_pack(tbl, o, 0, 0, 1, 1);
1102 evas_object_show(o); 1095 evas_object_show(o);
1103 proxypreviews[VIDEO_PROXY_ID] = o; 1096 proxypreviews[VIDEO_PROXY_ID] = o;
@@ -1175,7 +1168,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1175 proxies[k] = o; 1168 proxies[k] = o;
1176 1169
1177 //o = evas_object_image_filled_add(evas); 1170 //o = evas_object_image_filled_add(evas);
1178 o = elm_image_add(evas); 1171 o = elm_image_add(win);
1179 elm_image_aspect_fixed_set(o, EINA_FALSE); 1172 elm_image_aspect_fixed_set(o, EINA_FALSE);
1180 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1173 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1181 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1174 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -1246,6 +1239,9 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1246 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1239 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1247 evas_object_smart_callback_add(o, "clicked", _snap_click_cb, textproxy); 1240 evas_object_smart_callback_add(o, "clicked", _snap_click_cb, textproxy);
1248 elm_table_pack(tbl, o, 0, 0, 2, 1); 1241 elm_table_pack(tbl, o, 0, 0, 2, 1);
1242#ifndef TEXTVIEW_PROXY
1243 elm_object_disabled_set(o, EINA_TRUE);
1244#endif
1249 1245
1250 // Reset button 1246 // Reset button
1251 o = elm_button_add(tbl); 1247 o = elm_button_add(tbl);
@@ -1293,6 +1289,9 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1293 // Apply default style 1289 // Apply default style
1294 _style_apply(); 1290 _style_apply();
1295 1291
1292 //elm_win_alpha_set(win, 1);
1293 evas_object_resize(win, WIDTH, HEIGHT);
1294 evas_object_show(win);
1296 elm_run(); 1295 elm_run();
1297 1296
1298 // Save config 1297 // Save config