summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-07-09 17:05:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-07-09 17:05:51 +0900
commit57b5bc8f96142d024e8a04d2ab01880cc7ea65d0 (patch)
tree5e3c37e068c3bf1141ea4d6b9221933e058ebb3f
parentdc940fb5b4d33e8f801a2751243026e05f7a22c7 (diff)
Font config with effects and colors :)
-rw-r--r--lib/config.c57
-rw-r--r--lib/config.eo54
-rw-r--r--lib/config.h14
-rw-r--r--lib/eynote.c8
-rw-r--r--lib/eynote.h2
-rw-r--r--lib/eynote_config.c14
-rw-r--r--lib/eynote_config.h9
-rw-r--r--lib/eynote_hud.c54
-rw-r--r--lib/eynote_label.c158
-rw-r--r--lib/eynote_label.eo6
-rw-r--r--lib/serializable.c5
11 files changed, 313 insertions, 68 deletions
diff --git a/lib/config.c b/lib/config.c
index 39311db..eae2b18 100644
--- a/lib/config.c
+++ b/lib/config.c
@@ -32,7 +32,7 @@ _config_value_del(void *data)
32} 32}
33 33
34EOLIAN static const char * 34EOLIAN static const char *
35_config_gets(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key) 35_config_gets(const Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
36{ 36{
37 Config_Value *val; 37 Config_Value *val;
38 38
@@ -47,7 +47,7 @@ _config_gets(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
47} 47}
48 48
49EOLIAN static int 49EOLIAN static int
50_config_geti(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key) 50_config_geti(const Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
51{ 51{
52 Config_Value *val; 52 Config_Value *val;
53 53
@@ -62,7 +62,7 @@ _config_geti(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
62} 62}
63 63
64EOLIAN static double 64EOLIAN static double
65_config_getf(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key) 65_config_getf(const Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
66{ 66{
67 Config_Value *val; 67 Config_Value *val;
68 68
@@ -76,6 +76,31 @@ _config_getf(Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key)
76 return val->f; 76 return val->f;
77} 77}
78 78
79EOLIAN static Config_Value *
80_config_getc(const Eo *obj EINA_UNUSED, Config_Data *pd, Eina_Stringshare *key, int *r, int *g, int *b, int *a)
81{
82 Config_Value *val;
83
84 if (r) *r = 0;
85 if (g) *g = 0;
86 if (b) *b = 0;
87 if (a) *a = 0;
88
89 val = eina_hash_find(pd->hash, key);
90 if (!val) return NULL;
91 if (val->type != CONFIG_COLOR)
92 {
93 ERR("Value is not a color: '%s' type: %d", key, val->type);
94 return NULL;
95 }
96
97 if (r) *r = val->c.r;
98 if (g) *g = val->c.g;
99 if (b) *b = val->c.b;
100 if (a) *a = val->c.a;
101 return val;
102}
103
79EOLIAN static void 104EOLIAN static void
80_config_sets(Eo *obj, Config_Data *pd, Eina_Stringshare *key, const char *str) 105_config_sets(Eo *obj, Config_Data *pd, Eina_Stringshare *key, const char *str)
81{ 106{
@@ -142,6 +167,32 @@ _config_setf(Eo *obj, Config_Data *pd, Eina_Stringshare *key, double f)
142 eo_do(obj, eo_event_callback_call(CONFIG_EVENT_VALUE_SET, val)); 167 eo_do(obj, eo_event_callback_call(CONFIG_EVENT_VALUE_SET, val));
143} 168}
144 169
170EOLIAN static void
171_config_setc(Eo *obj, Config_Data *pd, Eina_Stringshare *key, int r, int g, int b, int a)
172{
173 Config_Value *val;
174
175 val = eina_hash_find(pd->hash, key);
176 if (val)
177 {
178 if ((val->type == CONFIG_COLOR) &&
179 (r == val->c.r) && (g == val->c.g) && (b == val->c.b) && (a == val->c.a))
180 return;
181 _config_value_clear(val);
182 }
183 else
184 val = new(Config_Value);
185
186 eina_stringshare_replace(&val->key, key);
187 val->type = CONFIG_COLOR;
188 val->c.r = r;
189 val->c.g = g;
190 val->c.b = b;
191 val->c.a = a;
192 eina_hash_set(pd->hash, key, val);
193 eo_do(obj, eo_event_callback_call(CONFIG_EVENT_VALUE_SET, val));
194}
195
145/* 196/*
146EOLIAN static Eina_Bool 197EOLIAN static Eina_Bool
147_config_efl_file_file_set(Eo *obj, Config_Data *pd, const char *file, const char *key) 198_config_efl_file_file_set(Eo *obj, Config_Data *pd, const char *file, const char *key)
diff --git a/lib/config.eo b/lib/config.eo
index 2f17d3a..1518b93 100644
--- a/lib/config.eo
+++ b/lib/config.eo
@@ -1,28 +1,64 @@
1import eina_types; 1import eina_types;
2 2
3struct @extern Config_Value;
4
3class Config(Eo.Base, Serializable, Efl.File) 5class Config(Eo.Base, Serializable, Efl.File)
4{ 6{
5 methods { 7 methods {
6 gets { 8 gets @const {
7 return: const(char)*(0); 9 return: const(char)*(0);
8 params { key: Eina_Stringshare*; } 10 params {
11 @in key: Eina_Stringshare*;
12 }
9 } 13 }
10 geti { 14 geti @const {
11 return: int(0); 15 return: int(0);
12 params { key: Eina_Stringshare*; } 16 params {
17 @in key: Eina_Stringshare*;
18 }
13 } 19 }
14 getf { 20 getf @const {
15 return: double(0.0); 21 return: double(0.0);
16 params { key: Eina_Stringshare*; } 22 params {
23 @in key: Eina_Stringshare*;
24 }
25 }
26 getc @const {
27 return: Config_Value *;
28 params {
29 @in key: Eina_Stringshare*;
30 @out r: int;
31 @out g: int;
32 @out b: int;
33 @out a: int;
34 }
17 } 35 }
18 sets { 36 sets {
19 params { key: Eina_Stringshare*; val: const(char)*; } 37 params {
38 @in key: Eina_Stringshare*;
39 @in val: const(char)*;
40 }
20 } 41 }
21 seti { 42 seti {
22 params { key: Eina_Stringshare*; val: int; } 43 params {
44 @in key: Eina_Stringshare*;
45 @in val: int;
46 }
23 } 47 }
24 setf { 48 setf {
25 params { key: Eina_Stringshare*; val: double; } 49 params {
50 @in key: Eina_Stringshare*;
51 @in val: double;
52 }
53 }
54 setc {
55 params {
56 @in key: Eina_Stringshare*;
57 @in r: int;
58 @in g: int;
59 @in b: int;
60 @in a: int;
61 }
26 } 62 }
27 } 63 }
28 implements { 64 implements {
diff --git a/lib/config.h b/lib/config.h
index 045f4ff..4bee62f 100644
--- a/lib/config.h
+++ b/lib/config.h
@@ -1,26 +1,32 @@
1#ifndef CONFIG_H 1#ifndef CONFIG_H
2#define CONFIG_H 2#define CONFIG_H
3 3
4// General config stuff
5#include <Elementary.h> 4#include <Elementary.h>
5
6typedef struct _Config_Value Config_Value;
7
6#include "config.eo.h" 8#include "config.eo.h"
7#include "serializable.eo.h" 9#include "serializable.eo.h"
8 10
9typedef enum { 11typedef enum {
10 CONFIG_INT, 12 CONFIG_INT,
11 CONFIG_DOUBLE, 13 CONFIG_DOUBLE,
12 CONFIG_STRING 14 CONFIG_STRING,
15 CONFIG_COLOR
13} Config_Value_Type; 16} Config_Value_Type;
14 17
15typedef struct { 18struct _Config_Value {
16 Config_Value_Type type; 19 Config_Value_Type type;
17 Eina_Stringshare *key; 20 Eina_Stringshare *key;
18 union { 21 union {
19 int i; 22 int i;
20 double f; 23 double f;
21 char *str; 24 char *str;
25 struct {
26 int r, g, b, a;
27 } c;
22 }; 28 };
23} Config_Value; 29};
24 30
25#endif // CONFIG_H 31#endif // CONFIG_H
26 32
diff --git a/lib/eynote.c b/lib/eynote.c
index f81776c..a94d4b4 100644
--- a/lib/eynote.c
+++ b/lib/eynote.c
@@ -444,10 +444,14 @@ _eynote_class_constructor(Eo_Class *klass)
444 } 444 }
445 445
446 eynote_config_init(); 446 eynote_config_init();
447 eynote_config_seti(eynote_config_font_size, 36);
448 eynote_config_sets(eynote_config_font_name, "Sans");
449 eynote_config_seti(eynote_config_grid_w, 60); 447 eynote_config_seti(eynote_config_grid_w, 60);
450 eynote_config_seti(eynote_config_grid_h, 40); 448 eynote_config_seti(eynote_config_grid_h, 40);
449 eynote_config_seti(eynote_config_font_size, 36);
450 eynote_config_sets(eynote_config_font_name, "Sans");
451 eynote_config_sets(eynote_config_font_effect, EVAS_TEXT_STYLE_PLAIN);
452 eynote_config_setc(eynote_config_font_color1, 255, 255, 255, 255);
453 eynote_config_setc(eynote_config_font_color2, 0, 0, 0, 255);
454 eynote_config_setc(eynote_config_font_color3, 0, 0, 0, 255);
451} 455}
452 456
453#include "eynote.eo.c" 457#include "eynote.eo.c"
diff --git a/lib/eynote.h b/lib/eynote.h
index bd5c1fb..06ab994 100644
--- a/lib/eynote.h
+++ b/lib/eynote.h
@@ -18,6 +18,8 @@
18#include "eynote_hud.eo.h" 18#include "eynote_hud.eo.h"
19#include "eynote.eo.h" 19#include "eynote.eo.h"
20 20
21typedef struct _Config_Value Config_Value;
22
21#include "eynote_data.h" 23#include "eynote_data.h"
22#include "eynote_config.h" 24#include "eynote_config.h"
23#include "eynote_edc.h" 25#include "eynote_edc.h"
diff --git a/lib/eynote_config.c b/lib/eynote_config.c
index 58bd219..313c7e1 100644
--- a/lib/eynote_config.c
+++ b/lib/eynote_config.c
@@ -2,11 +2,12 @@
2 2
3static Config *_config = NULL; 3static Config *_config = NULL;
4 4
5Eina_Stringshare *eynote_config_font_size = NULL;
6Eina_Stringshare *eynote_config_font_name = NULL;
7Eina_Stringshare *eynote_config_grid_w = NULL; 5Eina_Stringshare *eynote_config_grid_w = NULL;
8Eina_Stringshare *eynote_config_grid_h = NULL; 6Eina_Stringshare *eynote_config_grid_h = NULL;
9Eina_Stringshare *eynote_config_font_color = NULL; 7Eina_Stringshare *eynote_config_font_size = NULL;
8Eina_Stringshare *eynote_config_font_name = NULL;
9Eina_Stringshare *eynote_config_font_effect = NULL;
10Eina_Stringshare *eynote_config_font_color1 = NULL;
10Eina_Stringshare *eynote_config_font_color2 = NULL; 11Eina_Stringshare *eynote_config_font_color2 = NULL;
11Eina_Stringshare *eynote_config_font_color3 = NULL; 12Eina_Stringshare *eynote_config_font_color3 = NULL;
12 13
@@ -15,11 +16,12 @@ eynote_config_init(void)
15{ 16{
16 if (!eynote_config_font_size) 17 if (!eynote_config_font_size)
17 { 18 {
18 eynote_config_font_size = eina_stringshare_add("font_size");
19 eynote_config_font_name = eina_stringshare_add("font_name");
20 eynote_config_grid_w = eina_stringshare_add("grid_w"); 19 eynote_config_grid_w = eina_stringshare_add("grid_w");
21 eynote_config_grid_h = eina_stringshare_add("grid_h"); 20 eynote_config_grid_h = eina_stringshare_add("grid_h");
22 eynote_config_font_color = eina_stringshare_add("font_color"); 21 eynote_config_font_size = eina_stringshare_add("font_size");
22 eynote_config_font_name = eina_stringshare_add("font_name");
23 eynote_config_font_effect = eina_stringshare_add("font_effect");
24 eynote_config_font_color1 = eina_stringshare_add("font_color1");
23 eynote_config_font_color2 = eina_stringshare_add("font_color2"); 25 eynote_config_font_color2 = eina_stringshare_add("font_color2");
24 eynote_config_font_color3 = eina_stringshare_add("font_color3"); 26 eynote_config_font_color3 = eina_stringshare_add("font_color3");
25 } 27 }
diff --git a/lib/eynote_config.h b/lib/eynote_config.h
index 8d02c18..fcfe4cb 100644
--- a/lib/eynote_config.h
+++ b/lib/eynote_config.h
@@ -23,16 +23,19 @@ Config *eynote_config(void);
23#define eynote_config_seti(k,v) eo_do(eynote_config(), config_seti(k,v)) 23#define eynote_config_seti(k,v) eo_do(eynote_config(), config_seti(k,v))
24#define eynote_config_setf(k,v) eo_do(eynote_config(), config_setf(k,v)) 24#define eynote_config_setf(k,v) eo_do(eynote_config(), config_setf(k,v))
25#define eynote_config_sets(k,v) eo_do(eynote_config(), config_sets(k,v)) 25#define eynote_config_sets(k,v) eo_do(eynote_config(), config_sets(k,v))
26#define eynote_config_setc(k,r,g,b,a) eo_do(eynote_config(), config_setc(k,r,g,b,a))
26 27
27#define eynote_config_geti(k) ({ int r; eo_do(eynote_config(), r = config_geti(k)); r; }) 28#define eynote_config_geti(k) ({ int r; eo_do(eynote_config(), r = config_geti(k)); r; })
28#define eynote_config_getf(k) ({ double r; eo_do(eynote_config(), r = config_getf(k)); r; }) 29#define eynote_config_getf(k) ({ double r; eo_do(eynote_config(), r = config_getf(k)); r; })
29#define eynote_config_gets(k) ({ const char *r; eo_do(eynote_config(), r = config_gets(k)); r; }) 30#define eynote_config_gets(k) ({ const char *r; eo_do(eynote_config(), r = config_gets(k)); r; })
31#define eynote_config_getc(k,r,g,b,a) ({ Config_Value *c; eo_do(eynote_config(), c = config_getc(k, r, g, b, a)); c; })
30 32
31Eina_Stringshare *eynote_config_font_size;
32Eina_Stringshare *eynote_config_font_name;
33Eina_Stringshare *eynote_config_grid_w; 33Eina_Stringshare *eynote_config_grid_w;
34Eina_Stringshare *eynote_config_grid_h; 34Eina_Stringshare *eynote_config_grid_h;
35Eina_Stringshare *eynote_config_font_color; 35Eina_Stringshare *eynote_config_font_size;
36Eina_Stringshare *eynote_config_font_name;
37Eina_Stringshare *eynote_config_font_effect;
38Eina_Stringshare *eynote_config_font_color1;
36Eina_Stringshare *eynote_config_font_color2; 39Eina_Stringshare *eynote_config_font_color2;
37Eina_Stringshare *eynote_config_font_color3; 40Eina_Stringshare *eynote_config_font_color3;
38 41
diff --git a/lib/eynote_hud.c b/lib/eynote_hud.c
index 5999dbc..d6520fa 100644
--- a/lib/eynote_hud.c
+++ b/lib/eynote_hud.c
@@ -216,6 +216,15 @@ _font_size_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc
216} 216}
217 217
218static Eina_Bool 218static Eina_Bool
219_font_effect_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUSED, void *event_info EINA_UNUSED)
220{
221 int idx;
222 eo_do(obj, idx = elm_obj_spinner_value_get());
223 eynote_config_seti(eynote_config_font_effect, idx);
224 return EO_CALLBACK_CONTINUE;
225}
226
227static Eina_Bool
219_font_name_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUSED, void *event_info EINA_UNUSED) 228_font_name_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUSED, void *event_info EINA_UNUSED)
220{ 229{
221 Font_Desc *fd; 230 Font_Desc *fd;
@@ -391,6 +400,43 @@ _spinner_font_list_fill(Elm_Spinner *o)
391 elm_spinner_editable_set(o, false); 400 elm_spinner_editable_set(o, false);
392} 401}
393 402
403static const char *
404_strlower(const char *str)
405{
406 static char lower[64];
407 char *p = lower;
408
409 *p++ = *str++;
410 for (; *str; str++, p++)
411 {
412 if (*str == '_')
413 *p = ' ';
414 else
415 *p = tolower(*str);
416 }
417 *p = 0;
418
419 return lower;
420}
421
422static void
423_spinner_effect_list_fill(Elm_Spinner *o)
424{
425 elm_spinner_min_max_set(o, EVAS_TEXT_STYLE_PLAIN, EVAS_TEXT_STYLE_FAR_SOFT_SHADOW);
426#define EFFECT_ADD(a) elm_spinner_special_value_add(o, (double) EVAS_TEXT_STYLE_ ## a, _strlower(#a))
427 EFFECT_ADD(PLAIN);
428 EFFECT_ADD(OUTLINE);
429 EFFECT_ADD(SOFT_OUTLINE);
430 EFFECT_ADD(GLOW);
431 EFFECT_ADD(SHADOW);
432 EFFECT_ADD(OUTLINE_SHADOW);
433 EFFECT_ADD(FAR_SHADOW);
434 EFFECT_ADD(OUTLINE_SOFT_SHADOW);
435 EFFECT_ADD(SOFT_SHADOW);
436 EFFECT_ADD(FAR_SOFT_SHADOW);
437#undef EFFECT_ADD
438}
439
394static void 440static void
395_utils_text_bar_add(Eo *obj, Eynote_Hud_Data *pd) 441_utils_text_bar_add(Eo *obj, Eynote_Hud_Data *pd)
396{ 442{
@@ -425,6 +471,14 @@ _utils_text_bar_add(Eo *obj, Eynote_Hud_Data *pd)
425 elm_box_pack_end(pd->items_bar, o); 471 elm_box_pack_end(pd->items_bar, o);
426 SXV(o); 472 SXV(o);
427 473
474 o = elm_spinner_add(obj);
475 elm_object_style_set(o, "vertical");
476 elm_spinner_wrap_set(o, true);
477 _spinner_effect_list_fill(o);
478 eo_do(o, eo_event_callback_add(ELM_SPINNER_EVENT_CHANGED, _font_effect_cb, pd));
479 elm_box_pack_end(pd->items_bar, o);
480 SXV(o);
481
428 o = elm_button_add(obj); 482 o = elm_button_add(obj);
429 o2 = elm_layout_add(obj); 483 o2 = elm_layout_add(obj);
430 elm_layout_file_set(o2, eynote_theme(obj), EYNOTE_WIDGET_COLORSEL); 484 elm_layout_file_set(o2, eynote_theme(obj), EYNOTE_WIDGET_COLORSEL);
diff --git a/lib/eynote_label.c b/lib/eynote_label.c
index 17bc465..a7ed99f 100644
--- a/lib/eynote_label.c
+++ b/lib/eynote_label.c
@@ -5,8 +5,7 @@
5*/ 5*/
6 6
7#include "eynote.h" 7#include "eynote.h"
8#include "eynote_widget.eo.h" 8#include "assert.h"
9#include "eynote_label.eo.h"
10 9
11#define MY_CLASS eynote_label_class_get() 10#define MY_CLASS eynote_label_class_get()
12 11
@@ -18,12 +17,11 @@ typedef struct
18 Evas_Object *text; 17 Evas_Object *text;
19 struct { 18 struct {
20 Eina_Stringshare *name, *style; 19 Eina_Stringshare *name, *style;
20 Evas_Text_Style_Type effect;
21 int size; 21 int size;
22 struct { 22 struct {
23 int r1, g1, b1, a1; 23 int r, g, b, a;
24 int r2, g2, b2, a2; 24 } color[3];
25 int r3, g3, b3, a3;
26 } color;
27 } font; 25 } font;
28} Eynote_Label_Data; 26} Eynote_Label_Data;
29 27
@@ -34,7 +32,7 @@ _font_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, const char *name, int size
34 char style[1024]; 32 char style[1024];
35 33
36 // FIXME: Font names suck 34 // FIXME: Font names suck
37 snprintf(style, sizeof(style), "DEFAULT='font=%s font_size=%d color=%s style=%s'", name, size, opt); 35 snprintf(style, sizeof(style), "DEFAULT='font=%s font_size=%d style=%s'", name, size, opt);
38 style[sizeof(style) - 1] = 0; 36 style[sizeof(style) - 1] = 0;
39 37
40 elm_entry_text_style_user_pop(pd->entry); 38 elm_entry_text_style_user_pop(pd->entry);
@@ -47,6 +45,16 @@ _font_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, const char *name, int size
47} 45}
48 46
49static void 47static void
48_color_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int k, int r, int g, int b, int a)
49{
50 assert(k >= 1 && k <= 3);
51 pd->font.color[k - 1].r = r;
52 pd->font.color[k - 1].g = g;
53 pd->font.color[k - 1].b = b;
54 pd->font.color[k - 1].a = a;
55}
56
57static void
50_text_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, const char *text, bool user) 58_text_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, const char *text, bool user)
51{ 59{
52 if (!user) 60 if (!user)
@@ -61,6 +69,39 @@ static void
61_style_apply(Eo *obj, Eynote_Label_Data *pd) 69_style_apply(Eo *obj, Eynote_Label_Data *pd)
62{ 70{
63 _font_set(obj, pd, pd->font.name, pd->font.size); 71 _font_set(obj, pd, pd->font.name, pd->font.size);
72 evas_object_color_set(pd->text, pd->font.color[0].r, pd->font.color[0].g,
73 pd->font.color[0].b, pd->font.color[0].a);
74
75 // Stupid APIs
76 evas_object_text_style_set(pd->text, pd->font.effect);
77 switch (pd->font.effect & (EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM - 1))
78 {
79 case EVAS_TEXT_STYLE_PLAIN:
80 break;
81 case EVAS_TEXT_STYLE_OUTLINE:
82 case EVAS_TEXT_STYLE_SOFT_OUTLINE:
83 evas_object_text_outline_color_set(pd->text, pd->font.color[1].r, pd->font.color[1].g,
84 pd->font.color[1].b, pd->font.color[1].a);
85 break;
86 case EVAS_TEXT_STYLE_GLOW:
87 evas_object_text_glow_color_set(pd->text, pd->font.color[1].r, pd->font.color[1].g,
88 pd->font.color[1].b, pd->font.color[1].a);
89 evas_object_text_glow2_color_set(pd->text, pd->font.color[2].r, pd->font.color[2].g,
90 pd->font.color[2].b, pd->font.color[2].a);
91 break;
92 case EVAS_TEXT_STYLE_SHADOW:
93 case EVAS_TEXT_STYLE_OUTLINE_SHADOW:
94 case EVAS_TEXT_STYLE_FAR_SHADOW:
95 case EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW:
96 case EVAS_TEXT_STYLE_SOFT_SHADOW:
97 case EVAS_TEXT_STYLE_FAR_SOFT_SHADOW:
98 evas_object_text_shadow_color_set(pd->text, pd->font.color[1].r, pd->font.color[1].g,
99 pd->font.color[1].b, pd->font.color[1].a);
100 break;
101 default:
102 CRI("Invalid effect!");
103 return;
104 }
64} 105}
65 106
66static void 107static void
@@ -158,57 +199,76 @@ _eynote_label_eynote_widget_movable_get(Eo *obj, Eynote_Label_Data *pd EINA_UNUS
158} 199}
159 200
160EOLIAN static void 201EOLIAN static void
161_eynote_label_color1_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int r, int g, int b, int a) 202_eynote_label_color1_set(Eo *obj, Eynote_Label_Data *pd, int r, int g, int b, int a)
162{ 203{
163 pd->font.color.r1 = r; 204 pd->font.color[0].r = r;
164 pd->font.color.g1 = g; 205 pd->font.color[0].g = g;
165 pd->font.color.b1 = b; 206 pd->font.color[0].b = b;
166 pd->font.color.a1 = a; 207 pd->font.color[0].a = a;
208 _style_apply(obj, pd);
167} 209}
168 210
169EOLIAN static void 211EOLIAN static void
170_eynote_label_color1_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a) 212_eynote_label_color1_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a)
171{ 213{
172 if (r) *r = pd->font.color.r1; 214 if (r) *r = pd->font.color[0].r;
173 if (g) *g = pd->font.color.g1; 215 if (g) *g = pd->font.color[0].g;
174 if (b) *b = pd->font.color.b1; 216 if (b) *b = pd->font.color[0].b;
175 if (a) *a = pd->font.color.a1; 217 if (a) *a = pd->font.color[0].a;
176} 218}
177 219
178EOLIAN static void 220EOLIAN static void
179_eynote_label_color2_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int r, int g, int b, int a) 221_eynote_label_color2_set(Eo *obj, Eynote_Label_Data *pd, int r, int g, int b, int a)
180{ 222{
181 pd->font.color.r2 = r; 223 pd->font.color[1].r = r;
182 pd->font.color.g2 = g; 224 pd->font.color[1].g = g;
183 pd->font.color.b2 = b; 225 pd->font.color[1].b = b;
184 pd->font.color.a2 = a; 226 pd->font.color[1].a = a;
227 _style_apply(obj, pd);
185} 228}
186 229
187EOLIAN static void 230EOLIAN static void
188_eynote_label_color2_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a) 231_eynote_label_color2_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a)
189{ 232{
190 if (r) *r = pd->font.color.r2; 233 if (r) *r = pd->font.color[1].r;
191 if (g) *g = pd->font.color.g2; 234 if (g) *g = pd->font.color[1].g;
192 if (b) *b = pd->font.color.b2; 235 if (b) *b = pd->font.color[1].b;
193 if (a) *a = pd->font.color.a2; 236 if (a) *a = pd->font.color[1].a;
194} 237}
195 238
196EOLIAN static void 239EOLIAN static void
197_eynote_label_color3_set(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int r, int g, int b, int a) 240_eynote_label_color3_set(Eo *obj, Eynote_Label_Data *pd, int r, int g, int b, int a)
198{ 241{
199 pd->font.color.r3 = r; 242 pd->font.color[2].r = r;
200 pd->font.color.g3 = g; 243 pd->font.color[2].g = g;
201 pd->font.color.b3 = b; 244 pd->font.color[2].b = b;
202 pd->font.color.a3 = a; 245 pd->font.color[2].a = a;
246 _style_apply(obj, pd);
203} 247}
204 248
205EOLIAN static void 249EOLIAN static void
206_eynote_label_color3_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a) 250_eynote_label_color3_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd, int *r, int *g, int *b, int *a)
207{ 251{
208 if (r) *r = pd->font.color.r3; 252 if (r) *r = pd->font.color[2].r;
209 if (g) *g = pd->font.color.g3; 253 if (g) *g = pd->font.color[2].g;
210 if (b) *b = pd->font.color.b3; 254 if (b) *b = pd->font.color[2].b;
211 if (a) *a = pd->font.color.a3; 255 if (a) *a = pd->font.color[2].a;
256}
257
258EOLIAN static void
259_eynote_label_effect_set(Eo *obj, Eynote_Label_Data *pd, Evas_Text_Style_Type effect)
260{
261 if (pd->font.effect == effect)
262 return;
263
264 pd->font.effect = effect;
265 _style_apply(obj, pd);
266}
267
268EOLIAN static Evas_Text_Style_Type
269_eynote_label_effect_get(Eo *obj EINA_UNUSED, Eynote_Label_Data *pd)
270{
271 return pd->font.effect;
212} 272}
213 273
214static void 274static void
@@ -229,13 +289,21 @@ _config_changed(void *data, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUS
229 Eynote_Label_Data *pd = data; 289 Eynote_Label_Data *pd = data;
230 bool edit_mode; 290 bool edit_mode;
231 291
232 if (eo_do_ret(pd->self, edit_mode, eynote_widget_edit_mode_get())) 292 if (!eo_do_ret(pd->self, edit_mode, eynote_widget_edit_mode_get()))
233 { 293 return EO_CALLBACK_CONTINUE;
234 if (val->key == eynote_config_font_size) 294
235 _font_set(obj, pd, pd->font.name, val->i); 295 if (val->key == eynote_config_font_size)
236 else if (val->key == eynote_config_font_name) 296 _font_set(obj, pd, pd->font.name, val->i);
237 _font_set(obj, pd, val->str, pd->font.size); 297 else if (val->key == eynote_config_font_name)
238 } 298 _font_set(obj, pd, val->str, pd->font.size);
299 else if (val->key == eynote_config_font_effect)
300 eo_do(pd->self, eynote_label_effect_set(val->i));
301 else if (val->key == eynote_config_font_color1)
302 eo_do(pd->self, eynote_label_color1_set(val->c.r, val->c.g, val->c.b, val->c.a));
303 else if (val->key == eynote_config_font_color2)
304 eo_do(pd->self, eynote_label_color2_set(val->c.r, val->c.g, val->c.b, val->c.a));
305 else if (val->key == eynote_config_font_color3)
306 eo_do(pd->self, eynote_label_color3_set(val->c.r, val->c.g, val->c.b, val->c.a));
239 307
240 return EO_CALLBACK_CONTINUE; 308 return EO_CALLBACK_CONTINUE;
241} 309}
@@ -243,6 +311,7 @@ _config_changed(void *data, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUS
243EOLIAN static Eo_Base * 311EOLIAN static Eo_Base *
244_eynote_label_eo_base_constructor(Eo *obj, Eynote_Label_Data *pd) 312_eynote_label_eo_base_constructor(Eo *obj, Eynote_Label_Data *pd)
245{ 313{
314 Config_Value *val;
246 const char *edj; 315 const char *edj;
247 316
248 obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 317 obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
@@ -264,6 +333,13 @@ _eynote_label_eo_base_constructor(Eo *obj, Eynote_Label_Data *pd)
264 333
265 elm_layout_content_set(pd->ly, EYNOTE_WIDGET_LABEL_SWALLOW_ENTRY, pd->entry); 334 elm_layout_content_set(pd->ly, EYNOTE_WIDGET_LABEL_SWALLOW_ENTRY, pd->entry);
266 335
336 val = eynote_config_getc(eynote_config_font_color1, NULL, NULL, NULL, NULL);
337 _color_set(obj, pd, 1, val->c.r, val->c.g, val->c.b, val->c.a);
338 val = eynote_config_getc(eynote_config_font_color2, NULL, NULL, NULL, NULL);
339 _color_set(obj, pd, 2, val->c.r, val->c.g, val->c.b, val->c.a);
340 val = eynote_config_getc(eynote_config_font_color3, NULL, NULL, NULL, NULL);
341 _color_set(obj, pd, 3, val->c.r, val->c.g, val->c.b, val->c.a);
342 pd->font.effect = eynote_config_geti(eynote_config_font_effect);
267 _font_set(obj, pd, eynote_config_gets(eynote_config_font_name), eynote_config_geti(eynote_config_font_size)); 343 _font_set(obj, pd, eynote_config_gets(eynote_config_font_name), eynote_config_geti(eynote_config_font_size));
268 _text_set(obj, pd, "Your text here", false); 344 _text_set(obj, pd, "Your text here", false);
269 345
diff --git a/lib/eynote_label.eo b/lib/eynote_label.eo
index e54a2f2..f613eb8 100644
--- a/lib/eynote_label.eo
+++ b/lib/eynote_label.eo
@@ -34,6 +34,12 @@ class Eynote.Label(Eynote.Widget, Serializable)
34 a: int; 34 a: int;
35 } 35 }
36 } 36 }
37 @property effect {
38 [[Standard Evas text effect (not filter).]]
39 get {}
40 set {}
41 values { effect: Evas_Text_Style_Type; }
42 }
37 } 43 }
38 implements { 44 implements {
39 Eo.Base.constructor; 45 Eo.Base.constructor;
diff --git a/lib/serializable.c b/lib/serializable.c
new file mode 100644
index 0000000..7a61d51
--- /dev/null
+++ b/lib/serializable.c
@@ -0,0 +1,5 @@
1#define EFL_BETA_API_SUPPORT
2#include <Eo.h>
3#include "serializable.eo.h"
4
5#include "serializable.eo.c"