containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / proxy_text_random.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME proxy_text_random
7 #define NAME "Proxy Text Random"
8 #define ICON "text.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_texts[OBNUM];
19
20 /* setup */
21 static void _setup(void)
22 {
23    int i = 0;
24    Evas_Object *o;
25    Evas_Coord x, y, w, h;
26    char buf[1024];
27    const char *strs[] = {
28       "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I",
29         "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy",
30         "Fiddly", "Family", "Lair", "Monkeys", "Magazine"
31    };
32    srnd();
33    o = evas_object_text_add(evas);
34    o_texts[0] = o;
35    snprintf(buf, sizeof(buf), "%s %s %s %s.",
36             strs[rnd() % (sizeof(strs) / sizeof(char *))],
37             strs[rnd() % (sizeof(strs) / sizeof(char *))],
38             strs[rnd() % (sizeof(strs) / sizeof(char *))],
39             strs[rnd() % (sizeof(strs) / sizeof(char *))]);
40 #if 0
41    efl_text_font_family_set(o, "Vera-Bold");
42    efl_text_font_size_set(o, 20);
43    efl_text_set(o, buf);
44 #else
45    evas_object_text_font_set(o, "Vera-Bold", 20);
46    evas_object_text_text_set(o, buf);
47 #endif
48
49    efl_gfx_color_set(o, 0, 0, 0, 255);
50    exp_size_get(o, &w, &h);
51    x = (win_w / 2) - (w / 2);
52    x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2);
53    y = (win_h / 2) - (h / 2);
54    y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2);
55    efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
56    efl_gfx_entity_visible_set(o, EINA_TRUE);
57    for (i = 1  ; i < OBNUM ; i ++)
58      {
59         o = efl_add(EFL_CANVAS_PROXY_CLASS, evas);
60         o_texts[i] = o;
61         efl_canvas_proxy_source_set(o, o_texts[0]);
62         exp_size_get(o_texts[0], &w, &h);
63         efl_gfx_entity_size_set(o, EINA_SIZE2D(w, h));
64         efl_gfx_fill_set(o, EINA_RECT(0, 0, w, h));
65         x = (win_w / 2) - (w / 2);
66         x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2);
67         y = (win_h / 2) - (h / 2);
68         y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2);
69         efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
70         efl_gfx_entity_visible_set(o, EINA_TRUE);
71      }
72
73    done = 0;
74 }
75
76 /* cleanup */
77 static void _cleanup(void)
78 {
79    int i;
80    for (i = 0; i < OBNUM; i++) efl_del(o_texts[i]);
81 }
82
83 /* loop - do things */
84 static void _loop(double t, int f)
85 {
86    int i,w,h;
87    char buf[1024];
88    const char *strs[] = {
89       "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I",
90       "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy",
91       "Fiddly", "Family", "Lair", "Monkeys", "Magazine"
92    };
93    snprintf(buf, sizeof(buf), "%s %s %s %s.",
94             strs[rnd() % (sizeof(strs) / sizeof(char *))],
95             strs[rnd() % (sizeof(strs) / sizeof(char *))],
96             strs[rnd() % (sizeof(strs) / sizeof(char *))],
97             strs[rnd() % (sizeof(strs) / sizeof(char *))]);
98    efl_text_set(o_texts[0], buf);
99    exp_size_get(o_texts[0], &w, &h);
100    for (i = 1; i < OBNUM; i++)
101      {
102         efl_gfx_entity_size_set(o_texts[i], EINA_SIZE2D(w, h));
103         efl_gfx_fill_set(o_texts[i], EINA_RECT(0, 0, w, h));
104      }
105    FPS_STD(NAME);
106 }
107
108 /* prepend special key handlers if interactive (before STD) */
109 static void _key(const char *key)
110 {
111    KEY_STD;
112 }
113
114
115
116
117
118
119
120
121
122
123
124
125 /* template stuff - ignore */
126 # endif
127 #endif
128
129 #ifdef UI
130 _ui_menu_item_add(ICON, NAME, FNAME);
131 #endif
132
133 #ifdef PROTO
134 void FNAME(void);
135 #endif
136
137 #ifndef PROTO
138 # ifndef UI
139 void FNAME(void)
140 {
141    ui_func_set(_key, _loop, _setup);
142 }
143 # endif
144 #endif
145 #undef FNAME
146 #undef NAME
147 #undef ICON