summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-08-18 15:15:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-08-18 15:15:37 +0900
commit433a30e2df1ae6186b2d030970524d1001b82b4a (patch)
treeed46936525d156252cf15faad1fc7f976aade9ae
parentbed4799c8b96aa64ae34f87dd44184fc5067c7f9 (diff)
bla bla bla add some #define
-rw-r--r--main.c652
1 files changed, 282 insertions, 370 deletions
diff --git a/main.c b/main.c
index 972e6cc..a630eb7 100644
--- a/main.c
+++ b/main.c
@@ -26,8 +26,10 @@ const char *home = NULL;
26#endif 26#endif
27 27
28#define HAS_FILTER_CHAIN 28#define HAS_FILTER_CHAIN
29#define HAS_FILTER_CHAIN_TXT
29#define HAS_FILTER_CHAIN_IMG 30#define HAS_FILTER_CHAIN_IMG
30#undef HAS_FILTER_CHAIN_TB 31#undef HAS_FILTER_CHAIN_TB
32#define TEXTVIEW_PROXY
31 33
32#define IMAGE_COUNT 2 34#define IMAGE_COUNT 2
33#define FIXED_SIZED_SOURCE 1 35#define FIXED_SIZED_SOURCE 1
@@ -50,7 +52,6 @@ Eo *fsbuttons[IMAGE_COUNT+1] = { NULL };
50Eo *textblockview = NULL; 52Eo *textblockview = NULL;
51Eo *textblockeditor = NULL; 53Eo *textblockeditor = NULL;
52Eo *size_spinner = NULL; 54Eo *size_spinner = NULL;
53Eo *frameflip = NULL;
54Eo *imageview = NULL; 55Eo *imageview = NULL;
55Ecore_Timer *timer = NULL; 56Ecore_Timer *timer = NULL;
56 57
@@ -112,7 +113,9 @@ _image_set(int k, const char *path)
112#ifdef HAS_FILTER_CHAIN 113#ifdef HAS_FILTER_CHAIN
113 char buf[32]; 114 char buf[32];
114 sprintf(buf, "image%d", k + 1); 115 sprintf(buf, "image%d", k + 1);
116#ifdef HAS_FILTER_CHAIN_TXT
115 eo_do(textview, efl_gfx_filter_source_set(buf, source)); 117 eo_do(textview, efl_gfx_filter_source_set(buf, source));
118#endif
116#ifdef HAS_FILTER_CHAIN_IMG 119#ifdef HAS_FILTER_CHAIN_IMG
117 eo_do(imageview, efl_gfx_filter_source_set(buf, source)); 120 eo_do(imageview, efl_gfx_filter_source_set(buf, source));
118#endif 121#endif
@@ -171,7 +174,9 @@ _video_set(const char *path)
171 } 174 }
172 175
173#ifdef HAS_FILTER_CHAIN 176#ifdef HAS_FILTER_CHAIN
177#ifdef HAS_FILTER_CHAIN_TXT
174 eo_do(textview, efl_gfx_filter_source_set("emotion", source)); 178 eo_do(textview, efl_gfx_filter_source_set("emotion", source));
179#endif
175#ifdef HAS_FILTER_CHAIN_IMG 180#ifdef HAS_FILTER_CHAIN_IMG
176 eo_do(imageview, efl_gfx_filter_source_set("emotion", source)); 181 eo_do(imageview, efl_gfx_filter_source_set("emotion", source));
177#endif 182#endif
@@ -259,15 +264,6 @@ _config_reload(const char *path)
259 free(path); 264 free(path);
260 } 265 }
261 266
262 // Flip side
263 data = eet_read(ef, "flipside", &size);
264 if (data)
265 {
266 b = *((Eina_Bool *) data);
267 elm_flip_go_to(frameflip, !b, ELM_FLIP_CUBE_RIGHT); // ugly
268 free(data);
269 }
270
271 // Text string 267 // Text string
272 utf8 = eet_read(ef, "textentry", &size); 268 utf8 = eet_read(ef, "textentry", &size);
273 if (utf8) 269 if (utf8)
@@ -409,10 +405,6 @@ _config_save(const char *path)
409 free(utf8); 405 free(utf8);
410 } 406 }
411 407
412 // Current page
413 b = !elm_flip_front_visible_get(frameflip);
414 ok &= eet_write(ef, "flipside", &b, sizeof(b), 0);
415
416 eet_close(ef); 408 eet_close(ef);
417 return ok; 409 return ok;
418} 410}
@@ -582,7 +574,9 @@ _style_apply(void)
582 stylestr_utf8 = elm_entry_markup_to_utf8(stylestr); 574 stylestr_utf8 = elm_entry_markup_to_utf8(stylestr);
583 575
584 // Evas Text and Image 576 // Evas Text and Image
577#ifdef HAS_FILTER_CHAIN_TXT
585 eo_do(textview, efl_gfx_filter_program_set(stylestr_utf8, "textview")); 578 eo_do(textview, efl_gfx_filter_program_set(stylestr_utf8, "textview"));
579#endif
586#ifdef HAS_FILTER_CHAIN_IMG 580#ifdef HAS_FILTER_CHAIN_IMG
587 eo_do(imageview, efl_gfx_filter_program_set(stylestr_utf8, "imageview")); 581 eo_do(imageview, efl_gfx_filter_program_set(stylestr_utf8, "imageview"));
588#endif 582#endif
@@ -593,7 +587,9 @@ _style_apply(void)
593 587
594 sprintf(buf, "image%d", k + 1); 588 sprintf(buf, "image%d", k + 1);
595 elm_image_file_get(proxyimages[k], &path, NULL); 589 elm_image_file_get(proxyimages[k], &path, NULL);
590#ifdef HAS_FILTER_CHAIN_TXT
596 eo_do(textview, efl_gfx_filter_source_set(buf, (path && *path) ? proxies[k] : NULL)); 591 eo_do(textview, efl_gfx_filter_source_set(buf, (path && *path) ? proxies[k] : NULL));
592#endif
597#ifdef HAS_FILTER_CHAIN_IMG 593#ifdef HAS_FILTER_CHAIN_IMG
598 eo_do(imageview, efl_gfx_filter_source_set(buf, (path && *path) ? proxies[k] : NULL)); 594 eo_do(imageview, efl_gfx_filter_source_set(buf, (path && *path) ? proxies[k] : NULL));
599#endif 595#endif
@@ -691,14 +687,6 @@ _reset_click_cb(void *data EINA_UNUSED,
691} 687}
692 688
693static void 689static void
694_flip_click_cb(void *data EINA_UNUSED,
695 Evas_Object *obj EINA_UNUSED,
696 void *event_info EINA_UNUSED)
697{
698 elm_flip_go(frameflip, ELM_FLIP_CUBE_LEFT);
699}
700
701static void
702_load_file_chosen_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 690_load_file_chosen_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
703 void *event_info EINA_UNUSED) 691 void *event_info EINA_UNUSED)
704{ 692{
@@ -803,7 +791,7 @@ _textview_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
803EAPI_MAIN int 791EAPI_MAIN int
804elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) 792elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
805{ 793{
806 Eo *win, *panes, *panes2, *panes3, *vbox, *o, *vb, *flip; 794 Eo *win, *panes, *panes2, *panes3, *vbox, *o, *vb, *fr, *tbl;
807 const char *title, *elm_engine; 795 const char *title, *elm_engine;
808 Eina_Bool ok; 796 Eina_Bool ok;
809 Evas *evas; 797 Evas *evas;
@@ -845,283 +833,223 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
845 evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL); 833 evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL);
846 elm_panes_content_left_size_set(panes, (double) PANE_H_LEFT / 100.0); 834 elm_panes_content_left_size_set(panes, (double) PANE_H_LEFT / 100.0);
847 835
848 // Left pane: Frame 836 // Frame with title
849 flip = elm_flip_add(panes); 837 fr = elm_frame_add(panes);
850 evas_object_show(flip); 838 evas_object_show(fr);
851 evas_object_size_hint_weight_set(flip, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 839 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
852 evas_object_size_hint_align_set(flip, EVAS_HINT_FILL, EVAS_HINT_FILL); 840 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
853 elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_CUBE); 841 elm_object_style_set(fr, "default");
854 elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, -1.0); 842 elm_object_text_set(fr, "Evas_Object_Text");
855 elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, -1.0); 843 elm_object_part_content_set(panes, "left", fr);
856 elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE); 844
857 elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE); 845 // Split
858 elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 0.05); 846 panes2 = elm_panes_add(fr);
859 elm_object_part_content_set(panes, "left", flip); 847 elm_panes_horizontal_set(panes2, EINA_TRUE);
860 frameflip = flip; 848 elm_panes_fixed_set(panes2, EINA_FALSE);
861 849 evas_object_size_hint_weight_set(panes2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
862 // Cube front: Evas_Object_Text + String entry + Style entry 850 evas_object_size_hint_align_set(panes2, EVAS_HINT_FILL, EVAS_HINT_FILL);
863 { 851 elm_panes_content_left_size_set(panes2, (double) PANE_V_TOP / 100.);
864 // Frame with title 852 elm_object_part_content_set(fr, "default", panes2);
865 Eo *fr = elm_frame_add(flip); 853
866 evas_object_show(fr); 854 // Split AGAIN between text and image
867 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 855 panes3 = elm_panes_add(panes2);
868 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); 856 elm_panes_horizontal_set(panes3, EINA_FALSE);
869 elm_object_style_set(fr, "default"); 857 elm_panes_fixed_set(panes3, EINA_FALSE);
870 elm_object_text_set(fr, "Evas_Object_Text"); 858 evas_object_size_hint_weight_set(panes3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
871 elm_object_part_content_set(flip, "front", fr); 859 evas_object_size_hint_align_set(panes3, EVAS_HINT_FILL, EVAS_HINT_FILL);
872 860 elm_panes_content_left_size_set(panes3, 0.8);
873 // Split 861
874 panes2 = elm_panes_add(fr); 862 // Evas_Object_Text
875 elm_panes_horizontal_set(panes2, EINA_TRUE); 863 vbox = elm_box_add(fr);
876 elm_panes_fixed_set(panes2, EINA_FALSE); 864 elm_box_horizontal_set(vbox, EINA_FALSE);
877 evas_object_size_hint_weight_set(panes2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 865 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
878 evas_object_size_hint_align_set(panes2, EVAS_HINT_FILL, EVAS_HINT_FILL); 866 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
879 elm_panes_content_left_size_set(panes2, (double) PANE_V_TOP / 100.); 867 evas_object_show(vbox);
880 elm_object_part_content_set(fr, "default", panes2); 868 elm_object_part_content_set(panes3, "left", vbox);
881 869
882 // Split AGAIN between text and image 870 o = evas_object_text_add(fr);
883 panes3 = elm_panes_add(panes2); 871 evas_object_show(o);
884 elm_panes_horizontal_set(panes3, EINA_FALSE); 872 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
885 elm_panes_fixed_set(panes3, EINA_FALSE); 873 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
886 evas_object_size_hint_weight_set(panes3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 874 evas_object_text_font_set(o, FONT_NAME, FONT_SIZE);
887 evas_object_size_hint_align_set(panes3, EVAS_HINT_FILL, EVAS_HINT_FILL); 875 evas_object_size_hint_align_set(o, 0.0, 0.0);
888 elm_panes_content_left_size_set(panes3, 0.8); 876 elm_box_pack_start(vbox, o);
889 877 textview = o;
890 // Evas_Object_Text 878
891 vbox = elm_box_add(fr); 879#ifdef TEXTVIEW_PROXY
892 elm_box_horizontal_set(vbox, EINA_FALSE); 880#warning HIJACKING TEXT BY A PROXY IN FRONT
893 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 881 o = evas_object_image_filled_add(evas);
894 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 882 evas_object_image_source_set(o, textview);
895 evas_object_show(vbox); 883 //evas_object_image_source_clip_set(o, 1);
896 elm_object_part_content_set(panes3, "left", vbox); 884 evas_object_clip_set(o, evas_object_clip_get(textview));
897 885 evas_object_image_source_visible_set(o, 1);
898 o = evas_object_text_add(fr); 886 evas_object_event_callback_add(textview, EVAS_CALLBACK_RESIZE, _textview_update, o);
899 evas_object_show(o); 887 evas_object_event_callback_add(textview, EVAS_CALLBACK_MOVE, _textview_update, o);
900 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 888 evas_object_show(o);
901 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 889 textproxy = o;
902 evas_object_text_font_set(o, FONT_NAME, FONT_SIZE); 890#endif
903 evas_object_size_hint_align_set(o, 0.0, 0.0); 891
904 elm_box_pack_start(vbox, o); 892 // Evas_Object_Image
905 textview = o; 893 //o = evas_object_image_filled_add(evas);
906 894 vbox = elm_box_add(fr);
907 // WARNING: HIJACKING TEXT BY A PROXY IN FRONT 895 elm_box_horizontal_set(vbox, 1);
908 o = evas_object_image_filled_add(evas); 896 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
909 evas_object_image_source_set(o, textview); 897 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
910 evas_object_image_source_visible_set(o, EINA_FALSE); 898 elm_object_part_content_set(panes3, "right", vbox);
911 evas_object_event_callback_add(textview, EVAS_CALLBACK_RESIZE, _textview_update, o); 899 evas_object_show(vbox);
912 evas_object_event_callback_add(textview, EVAS_CALLBACK_MOVE, _textview_update, o); 900
913 evas_object_show(o); 901 char imgpath[PATH_MAX];
914 textproxy = o; 902 sprintf(imgpath, "%s/logo.png", _home_dir_get());
915 903 //sprintf(imgpath, "%s/displace_bad_with_alpha.png", _home_dir_get());
916 // Evas_Object_Image 904
917 //o = evas_object_image_filled_add(evas); 905 const Eina_Bool USE_ELM_IMAGE = 0;
918 vbox = elm_box_add(fr); 906 const Eina_Bool USE_FILLED_IMAGE = 1;
919 elm_box_horizontal_set(vbox, 1); 907 if (!USE_ELM_IMAGE)
920 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 908 {
921 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 909 int w, h;
922 elm_object_part_content_set(panes3, "right", vbox); 910 int l = 0, r = 0, t = 0, b = 0;
923 evas_object_show(vbox); 911 if (USE_FILLED_IMAGE)
924 912 {
925 char imgpath[PATH_MAX]; 913 o = evas_object_image_filled_add(evas);
926 sprintf(imgpath, "%s/logo.png", _home_dir_get()); 914 l = r = t = b = 30;
927 //sprintf(imgpath, "%s/displace_bad_with_alpha.png", _home_dir_get()); 915 }
928 916 else
929 const Eina_Bool USE_ELM_IMAGE = 0; 917 {
930 const Eina_Bool USE_FILLED_IMAGE = 1; 918 o = evas_object_image_add(evas);
931 if (!USE_ELM_IMAGE) 919 }
932 { 920 evas_object_image_file_set(o, imgpath, NULL);
933 int w, h; 921 evas_object_image_preload(o, EINA_FALSE);
934 int l = 0, r = 0, t = 0, b = 0; 922 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
935 if (USE_FILLED_IMAGE) 923 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
936 { 924 evas_object_image_size_get(o, &w, &h);
937 o = evas_object_image_filled_add(evas); 925 if (!USE_FILLED_IMAGE)
938 l = r = t = b = 30; 926 evas_object_image_fill_set(o, 0, 0, w + l + r, h + t + b);
939 } 927 elm_box_pack_end(vbox, o);
940 else 928 evas_object_show(o);
941 { 929 imageview = o;
942 o = evas_object_image_add(evas); 930 }
943 } 931 else
944 evas_object_image_file_set(o, imgpath, NULL); 932 {
945 evas_object_image_preload(o, EINA_FALSE); 933 o = elm_image_add(fr);
946 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 934 elm_image_file_set(o, imgpath, NULL);
947 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 935 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
948 evas_object_image_size_get(o, &w, &h); 936 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
949 if (!USE_FILLED_IMAGE) 937 evas_object_size_hint_max_set(o, 128, 128);
950 evas_object_image_fill_set(o, 0, 0, w + l + r, h + t + b); 938 elm_box_pack_end(vbox, o);
951 elm_box_pack_end(vbox, o); 939 evas_object_show(o);
952 evas_object_show(o); 940 imageview = elm_image_object_get(o);
953 imageview = o; 941 }
954 } 942
955 else 943 elm_object_part_content_set(panes2, "left", panes3);
956 { 944
957 o = elm_image_add(fr); 945 //_spacer_add(vbox);
958 elm_image_file_set(o, imgpath, NULL); 946
959 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 947 // Vbox with: string + edit entries
960 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 948 vbox = elm_box_add(fr);
961 evas_object_size_hint_max_set(o, 128, 128); 949 elm_box_horizontal_set(vbox, EINA_FALSE);
962 elm_box_pack_end(vbox, o); 950 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
963 evas_object_show(o); 951 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
964 imageview = elm_image_object_get(o); 952 evas_object_show(vbox);
965 } 953 elm_object_part_content_set(panes2, "right", vbox);
966 954
967 elm_object_part_content_set(panes2, "left", panes3); 955 // String entry
968 956 o = elm_entry_add(vbox);
969 //_spacer_add(vbox); 957 evas_object_show(o);
970 958 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
971 // Vbox with: string + edit entries 959 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
972 vbox = elm_box_add(fr); 960 elm_entry_scrollable_set(o, EINA_TRUE);
973 elm_box_horizontal_set(vbox, EINA_FALSE); 961 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
974 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 962 elm_entry_single_line_set(o, EINA_TRUE);
975 evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 963 evas_object_smart_callback_add(o, "changed", _entry_update_cb, NULL);
976 evas_object_show(vbox); 964 elm_box_pack_end(vbox, o);
977 elm_object_part_content_set(panes2, "right", vbox); 965 textentry = o;
978 966
979 // String entry 967 // Style entry
980 o = elm_entry_add(vbox); 968 o = elm_entry_add(vbox);
981 evas_object_show(o); 969 evas_object_show(o);
982 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 970 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
983 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0); 971 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
984 elm_entry_scrollable_set(o, EINA_TRUE); 972 elm_entry_scrollable_set(o, EINA_TRUE);
985 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); 973 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
986 elm_entry_single_line_set(o, EINA_TRUE); 974 elm_entry_single_line_set(o, EINA_FALSE);
987 evas_object_smart_callback_add(o, "changed", _entry_update_cb, NULL); 975 ok = evas_object_key_grab(o, "Return",
988 elm_box_pack_end(vbox, o); 976 evas_key_modifier_mask_get(evas, "Control"),
989 textentry = o; 977 0, EINA_TRUE);
990 978 if (!ok) fprintf(stderr, "Could not setup Ctrl+Return shortcut\n");
991 // Style entry 979 ok = evas_object_key_grab(o, "KP_Enter",
992 o = elm_entry_add(vbox); 980 evas_key_modifier_mask_get(evas, "Control"),
993 evas_object_show(o); 981 0, EINA_TRUE);
994 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 982 if (!ok) fprintf(stderr, "Could not setup Ctrl+KP_Enter shortcut\n");
995 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 983 elm_object_event_callback_add(o, _entry_cb, NULL);
996 elm_entry_scrollable_set(o, EINA_TRUE); 984 elm_box_pack_end(vbox, o);
997 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO); 985 styleentry = o;
998 elm_entry_single_line_set(o, EINA_FALSE); 986
999 ok = evas_object_key_grab(o, "Return", 987 // Escape to quit - grab doesn't work on 'panes'
1000 evas_key_modifier_mask_get(evas, "Control"), 988 ok = evas_object_key_grab(o, "Escape", 0, 0, EINA_TRUE);
1001 0, EINA_TRUE); 989 if (!ok) fprintf(stderr, "Could not setup ESC shortcut\n");
1002 if (!ok) fprintf(stderr, "Could not setup Ctrl+Return shortcut\n"); 990 else elm_object_event_callback_add(o, _panes_key_cb, NULL);
1003 ok = evas_object_key_grab(o, "KP_Enter", 991
1004 evas_key_modifier_mask_get(evas, "Control"), 992 // Bottom: font size, padding info
1005 0, EINA_TRUE); 993 Eo *hbox = elm_box_add(vbox);
1006 if (!ok) fprintf(stderr, "Could not setup Ctrl+KP_Enter shortcut\n"); 994 evas_object_show(hbox);
1007 elm_object_event_callback_add(o, _entry_cb, NULL); 995 elm_box_pack_end(vbox, hbox);
1008 elm_box_pack_end(vbox, o); 996 elm_box_horizontal_set(hbox, EINA_TRUE);
1009 styleentry = o; 997 elm_box_padding_set(hbox, PADDING, PADDING);
1010 998 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
1011 // Escape to quit - grab doesn't work on 'panes' 999 evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
1012 ok = evas_object_key_grab(o, "Escape", 0, 0, EINA_TRUE); 1000
1013 if (!ok) fprintf(stderr, "Could not setup ESC shortcut\n"); 1001 // Size: label
1014 else elm_object_event_callback_add(o, _panes_key_cb, NULL); 1002 o = elm_label_add(hbox);
1015 1003 evas_object_show(o);
1016 // Bottom: font size, padding info 1004 elm_box_pack_end(hbox, o);
1017 Eo *hbox = elm_box_add(vbox); 1005 evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
1018 evas_object_show(hbox); 1006 evas_object_size_hint_align_set(o, 0.0, EVAS_HINT_FILL);
1019 elm_box_pack_end(vbox, hbox); 1007 elm_object_text_set(o, _("Size:"));
1020 elm_box_horizontal_set(hbox, EINA_TRUE); 1008
1021 elm_box_padding_set(hbox, PADDING, PADDING); 1009 // Font size spinner
1022 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0); 1010 o = elm_spinner_add(hbox);
1023 evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); 1011 evas_object_show(o);
1024 1012 elm_box_pack_end(hbox, o);
1025 // Size: label 1013 evas_object_size_hint_weight_set(o, 0.0, 0.0);
1026 o = elm_label_add(hbox); 1014 evas_object_size_hint_align_set(o, 0.0, 0.5);
1027 evas_object_show(o); 1015 elm_spinner_min_max_set(o, 6.0, 600.0);
1028 elm_box_pack_end(hbox, o); 1016 elm_spinner_step_set(o, 1.0);
1029 evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND); 1017 elm_spinner_value_set(o, FONT_SIZE);
1030 evas_object_size_hint_align_set(o, 0.0, EVAS_HINT_FILL); 1018 elm_spinner_editable_set(o, EINA_TRUE);
1031 elm_object_text_set(o, _("Size:")); 1019 elm_object_style_set(o, "vertical");
1032 1020 evas_object_smart_callback_add(o, "changed", _size_spinner_cb, NULL);
1033 // Font size spinner 1021 evas_object_smart_callback_call(o, "changed", NULL);
1034 o = elm_spinner_add(hbox); 1022 size_spinner = o;
1035 evas_object_show(o); 1023
1036 elm_box_pack_end(hbox, o); 1024 // Apply button
1037 evas_object_size_hint_weight_set(o, 0.0, 0.0); 1025 o = elm_button_add(hbox);
1038 evas_object_size_hint_align_set(o, 0.0, 0.5); 1026 evas_object_show(o);
1039 elm_spinner_min_max_set(o, 6.0, 600.0); 1027 elm_box_pack_end(hbox, o);
1040 elm_spinner_step_set(o, 1.0); 1028 elm_object_text_set(o, _("Apply"));
1041 elm_spinner_value_set(o, FONT_SIZE); 1029 evas_object_smart_callback_add(o, "clicked", _apply_click_cb, NULL);
1042 elm_spinner_editable_set(o, EINA_TRUE); 1030
1043 elm_object_style_set(o, "vertical"); 1031 // Color button
1044 evas_object_smart_callback_add(o, "changed", _size_spinner_cb, NULL); 1032 o = elm_button_add(hbox);
1045 evas_object_smart_callback_call(o, "changed", NULL); 1033 evas_object_show(o);
1046 size_spinner = o; 1034 elm_box_pack_end(hbox, o);
1047 1035 elm_object_text_set(o, _("Colorize!"));
1048 // Apply button 1036 evas_object_smart_callback_add(o, "clicked", _color_click_cb, NULL);
1049 o = elm_button_add(hbox); 1037
1050 evas_object_show(o); 1038 // Padding label
1051 elm_box_pack_end(hbox, o); 1039 o = elm_label_add(hbox);
1052 elm_object_text_set(o, _("Apply")); 1040 evas_object_show(o);
1053 evas_object_smart_callback_add(o, "clicked", _apply_click_cb, NULL); 1041 elm_box_pack_end(hbox, o);
1054 1042 elm_object_text_set(o, _("Padding: "));
1055 // Color button 1043 paddinglbl = o;
1056 o = elm_button_add(hbox); 1044
1057 evas_object_show(o); 1045 _spacer_add(hbox);
1058 elm_box_pack_end(hbox, o); 1046
1059 elm_object_text_set(o, _("Colorize!")); 1047 // Quicksave
1060 evas_object_smart_callback_add(o, "clicked", _color_click_cb, NULL); 1048 o = elm_button_add(hbox);
1061 1049 evas_object_show(o);
1062 // Padding label 1050 elm_box_pack_end(hbox, o);
1063 o = elm_label_add(hbox); 1051 elm_object_text_set(o, _("Quick save"));
1064 evas_object_show(o); 1052 evas_object_smart_callback_add(o, "clicked", _quicksave_click_cb, NULL);
1065 elm_box_pack_end(hbox, o);
1066 elm_object_text_set(o, _("Padding: "));
1067 paddinglbl = o;
1068
1069 _spacer_add(hbox);
1070
1071 // Quicksave
1072 o = elm_button_add(hbox);
1073 evas_object_show(o);
1074 elm_box_pack_end(hbox, o);
1075 elm_object_text_set(o, _("Quick save"));
1076 evas_object_smart_callback_add(o, "clicked", _quicksave_click_cb, NULL);
1077 }
1078
1079 // Cube back: Textblock and full markup editor
1080 {
1081 // Frame with title
1082 Eo *fr = elm_frame_add(flip);
1083 evas_object_show(fr);
1084 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1085 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1086 elm_object_style_set(fr, "default");
1087 elm_object_text_set(fr, "Evas_Object_Textblock");
1088 elm_object_part_content_set(flip, "back", fr);
1089
1090 // Split
1091 panes2 = elm_panes_add(fr);
1092 elm_panes_horizontal_set(panes2, EINA_TRUE);
1093 elm_panes_fixed_set(panes2, EINA_FALSE);
1094 evas_object_size_hint_weight_set(panes2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1095 evas_object_size_hint_align_set(panes2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1096 elm_panes_content_left_size_set(panes2, (double) PANE_V_TOP / 100.);
1097 elm_object_part_content_set(fr, "default", panes2);
1098
1099 // Textblock view
1100 o = elm_entry_add(vbox);
1101 evas_object_show(o);
1102 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
1103 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
1104 elm_entry_editable_set(o, EINA_TRUE);
1105 elm_entry_single_line_set(o, EINA_FALSE);
1106 elm_entry_scrollable_set(o, EINA_TRUE);
1107 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
1108 evas_object_smart_callback_add(o, "changed,user", _textblock_update_cb, NULL);
1109 elm_object_part_content_set(panes2, "left", o);
1110 textblockview = o;
1111
1112 // Textblock editor
1113 o = elm_entry_add(vbox);
1114 evas_object_show(o);
1115 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
1116 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
1117 elm_entry_editable_set(o, EINA_TRUE);
1118 elm_entry_single_line_set(o, EINA_FALSE);
1119 elm_entry_scrollable_set(o, EINA_TRUE);
1120 elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
1121 evas_object_smart_callback_add(o, "changed,user", _markup_update_cb, NULL);
1122 elm_object_part_content_set(panes2, "right", o);
1123 textblockeditor = o;
1124 }
1125 1053
1126 // Object selector: right side of panes 1054 // Object selector: right side of panes
1127 vb = elm_box_add(panes); 1055 vb = elm_box_add(panes);
@@ -1304,72 +1232,60 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1304 } 1232 }
1305 1233
1306 // Reset & Quit: Bottom of the proxy bar 1234 // Reset & Quit: Bottom of the proxy bar
1307 { 1235 tbl = elm_table_add(vb);
1308 Eo *tbl = elm_table_add(vb); 1236 evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND, 0);
1309 evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND, 0); 1237 evas_object_size_hint_align_set(tbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1310 evas_object_size_hint_align_set(tbl, EVAS_HINT_FILL, EVAS_HINT_FILL); 1238 evas_object_show(tbl);
1311 evas_object_show(tbl); 1239 elm_box_pack_end(vb, tbl);
1312 elm_box_pack_end(vb, tbl); 1240
1313 1241 // Snapshot button
1314#if 0 1242 o = elm_button_add(tbl);
1315 // Flip button 1243 evas_object_show(o);
1316 o = elm_button_add(tbl); 1244 elm_object_text_set(o, _("Save snapshot"));
1317 evas_object_show(o); 1245 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1318 elm_object_text_set(o, _("Switch mode")); 1246 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1319 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1247 evas_object_smart_callback_add(o, "clicked", _snap_click_cb, textproxy);
1320 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1248 elm_table_pack(tbl, o, 0, 0, 2, 1);
1321 evas_object_smart_callback_add(o, "clicked", _flip_click_cb, NULL); 1249
1322 elm_table_pack(tbl, o, 0, 0, 2, 1); 1250 // Reset button
1323#endif 1251 o = elm_button_add(tbl);
1324 // Snapshot button 1252 evas_object_show(o);
1325 o = elm_button_add(tbl); 1253 elm_object_text_set(o, _("Reset images"));
1326 evas_object_show(o); 1254 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1327 elm_object_text_set(o, _("Save snapshot")); 1255 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1328 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1256 evas_object_smart_callback_add(o, "clicked", _reset_click_cb, NULL);
1329 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1257 elm_table_pack(tbl, o, 0, 2, 1, 1);
1330 evas_object_smart_callback_add(o, "clicked", _snap_click_cb, textproxy); 1258
1331 elm_table_pack(tbl, o, 0, 0, 2, 1); 1259 // Quit button
1332 1260 o = elm_button_add(tbl);
1333 // Reset button 1261 evas_object_show(o);
1334 o = elm_button_add(tbl); 1262 elm_object_text_set(o, _("Quit"));
1335 evas_object_show(o); 1263 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1336 elm_object_text_set(o, _("Reset images")); 1264 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1337 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1265 evas_object_smart_callback_add(o, "clicked", _quit_click_cb, NULL);
1338 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1266 elm_table_pack(tbl, o, 1, 2, 1, 1);
1339 evas_object_smart_callback_add(o, "clicked", _reset_click_cb, NULL); 1267
1340 elm_table_pack(tbl, o, 0, 2, 1, 1); 1268 // Save button
1341 1269 o = elm_fileselector_button_add(tbl);
1342 // Quit button 1270 evas_object_show(o);
1343 o = elm_button_add(tbl); 1271 elm_object_text_set(o, "Save...");
1344 evas_object_show(o); 1272 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1345 elm_object_text_set(o, _("Quit")); 1273 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1346 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1274 elm_fileselector_is_save_set(o, EINA_TRUE);
1347 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1275 elm_fileselector_path_set(o, home);
1348 evas_object_smart_callback_add(o, "clicked", _quit_click_cb, NULL); 1276 evas_object_smart_callback_add(o, "file,chosen", _save_file_chosen_cb, NULL);
1349 elm_table_pack(tbl, o, 1, 2, 1, 1); 1277 elm_table_pack(tbl, o, 0, 1, 1, 1);
1350 1278
1351 // Save button 1279 // Load button
1352 o = elm_fileselector_button_add(tbl); 1280 o = elm_fileselector_button_add(tbl);
1353 evas_object_show(o); 1281 evas_object_show(o);
1354 elm_object_text_set(o, "Save..."); 1282 elm_object_text_set(o, "Load...");
1355 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1283 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1356 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1284 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1357 elm_fileselector_is_save_set(o, EINA_TRUE); 1285 elm_fileselector_is_save_set(o, EINA_FALSE);
1358 elm_fileselector_path_set(o, home); 1286 elm_fileselector_path_set(o, home);
1359 evas_object_smart_callback_add(o, "file,chosen", _save_file_chosen_cb, NULL); 1287 evas_object_smart_callback_add(o, "file,chosen", _load_file_chosen_cb, NULL);
1360 elm_table_pack(tbl, o, 0, 1, 1, 1); 1288 elm_table_pack(tbl, o, 1, 1, 1, 1);
1361
1362 // Load button
1363 o = elm_fileselector_button_add(tbl);
1364 evas_object_show(o);
1365 elm_object_text_set(o, "Load...");
1366 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1367 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1368 elm_fileselector_is_save_set(o, EINA_FALSE);
1369 elm_fileselector_path_set(o, home);
1370 evas_object_smart_callback_add(o, "file,chosen", _load_file_chosen_cb, NULL);
1371 elm_table_pack(tbl, o, 1, 1, 1, 1);
1372 }
1373 1289
1374 // Reload config 1290 // Reload config
1375 _config_reload(AUTOSAVE_CONFIG); 1291 _config_reload(AUTOSAVE_CONFIG);
@@ -1377,10 +1293,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
1377 // Apply default style 1293 // Apply default style
1378 _style_apply(); 1294 _style_apply();
1379 1295
1380#ifndef HAS_FILTER_CHAIN
1381 elm_object_tooltip_text_set(flip, _("Program was compiled WITHOUT filter support!"));
1382#endif
1383
1384 elm_run(); 1296 elm_run();
1385 1297
1386 // Save config 1298 // Save config