summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-10-22 20:17:23 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-10-22 20:17:23 +0900
commit475af7d220e230f5b0593ce4ebcdb84847b87b6f (patch)
tree5fb2cef033a2cbfa244314c218ef45505be74f8a
parentb21a0de6813bda1c7007f4bcd562ea7ad8fbd572 (diff)
prepare resize
-rw-r--r--data/edc/default.edc1
-rw-r--r--data/edc/eynote_edc.h1
-rw-r--r--data/edc/widget_edit_bg.edc21
-rw-r--r--data/edc/widget_handles.edc102
-rw-r--r--data/images/handles.pngbin0 -> 311 bytes
-rw-r--r--data/images/onehandle.pngbin0 -> 235 bytes
-rw-r--r--lib/eynote.c2
-rw-r--r--lib/eynote_image.c29
-rw-r--r--lib/eynote_image.eo1
-rw-r--r--lib/eynote_slide.c9
-rw-r--r--lib/eynote_slide.eo4
-rw-r--r--lib/eynote_widget.c39
-rw-r--r--lib/eynote_widget.eo9
13 files changed, 178 insertions, 40 deletions
diff --git a/data/edc/default.edc b/data/edc/default.edc
index 366d31f..f3ee758 100644
--- a/data/edc/default.edc
+++ b/data/edc/default.edc
@@ -4,6 +4,7 @@ collections {
4#include "eynote_edc.h" 4#include "eynote_edc.h"
5#include "main_layout.edc" 5#include "main_layout.edc"
6#include "widget_edit_bg.edc" 6#include "widget_edit_bg.edc"
7#include "widget_handles.edc"
7#include "label.edc" 8#include "label.edc"
8#include "slide.edc" 9#include "slide.edc"
9#include "colorsel.edc" 10#include "colorsel.edc"
diff --git a/data/edc/eynote_edc.h b/data/edc/eynote_edc.h
index 51eff62..f2fea63 100644
--- a/data/edc/eynote_edc.h
+++ b/data/edc/eynote_edc.h
@@ -22,6 +22,7 @@
22// Group and swallow names 22// Group and swallow names
23#define EYNOTE_BG_LAYOUT "/eynote/bg/layout" 23#define EYNOTE_BG_LAYOUT "/eynote/bg/layout"
24 24
25#define EYNOTE_WIDGET_HANDLES "/eynote/widget/handles"
25#define EYNOTE_WIDGET_COLORSEL "/eynote/widget/colorsel" 26#define EYNOTE_WIDGET_COLORSEL "/eynote/widget/colorsel"
26 27
27#define EYNOTE_WIDGET_LABEL "/eynote/widget/label" 28#define EYNOTE_WIDGET_LABEL "/eynote/widget/label"
diff --git a/data/edc/widget_edit_bg.edc b/data/edc/widget_edit_bg.edc
index 4e20871..c967ca6 100644
--- a/data/edc/widget_edit_bg.edc
+++ b/data/edc/widget_edit_bg.edc
@@ -3,26 +3,27 @@
3collections { 3collections {
4#endif 4#endif
5 5
6 group { name: EYNOTE_WIDGET_BG; 6 group { name: "/eynote/widget/bg";
7 images { 7 images {
8 image: "part_highlight.png" COMP; 8 image: "part_highlight.png" COMP;
9 } 9 }
10 parts { 10 parts {
11 part { name: "hilight"; 11 image { "hilight";
12 type: IMAGE; 12 desc { "default";
13 desc { "default" 0.0;
14 image { 13 image {
15 normal: "part_highlight.png"; 14 normal: "part_highlight.png";
16 border: 2 2 2 2; 15 border: 2 2 2 2;
17 } 16 }
18 color: 51 153 255 128; 17 color: 51 153 255 128;
18 rel1.offset: -2 -2;
19 rel2.offset: 1 1;
19 } 20 }
20 desc { "edit_shine" 0.0; 21 desc { "edit_shine";
21 inherit: "default" 0.0; 22 inherit: "default";
22 color: 51 153 255 128; 23 color: 51 153 255 128;
23 } 24 }
24 desc { "edit_dimmed" 0.0; 25 desc { "edit_dimmed";
25 inherit: "default" 0.0; 26 inherit: "default";
26 color: 51 153 255 48; 27 color: 51 153 255 48;
27 } 28 }
28 desc { "selected_shine"; 29 desc { "selected_shine";
@@ -33,8 +34,8 @@ collections {
33 inherit: "default"; 34 inherit: "default";
34 color: 51 255 51 96; 35 color: 51 255 51 96;
35 } 36 }
36 desc { "invisible" 0.0; 37 desc { "invisible";
37 inherit: "default" 0.0; 38 inherit: "default";
38 color: 0 0 0 0; 39 color: 0 0 0 0;
39 } 40 }
40 } 41 }
diff --git a/data/edc/widget_handles.edc b/data/edc/widget_handles.edc
new file mode 100644
index 0000000..02d573a
--- /dev/null
+++ b/data/edc/widget_handles.edc
@@ -0,0 +1,102 @@
1#ifndef COLLECTIONS
2#include "eynote_edc.h"
3collections {
4#endif
5
6 group {
7 name: "/eynote/widget/handles";
8 images {
9 image: "handles.png" COMP;
10 image: "onehandle.png" COMP;
11 }
12 parts {
13 image { "main";
14 desc { "default";
15 image {
16 normal: "handles.png";
17 border: 12 12 12 12;
18 }
19 color: 51 153 255 255;
20 rel1.offset: -7 -7;
21 rel2.offset: 6 6;
22 }
23 }
24
25 image {
26 "top";
27 desc {
28 "default";
29 min: 12 12;
30 max: 12 12;
31 image {
32 normal: "onehandle.png";
33 }
34 color: 51 153 255 255;
35 rel1.to: "main";
36 rel1.relative: 0.0 0.0;
37 rel1.offset: 0 2;
38 rel2.relative: 1.0 0.0;
39 rel2.offset: 0 2;
40 }
41 }
42
43 image {
44 "left";
45 desc {
46 "default";
47 min: 12 12;
48 max: 12 12;
49 image {
50 normal: "onehandle.png";
51 }
52 color: 51 153 255 255;
53 rel1.to: "main";
54 rel1.relative: 0.0 0.0;
55 rel1.offset: 2 0;
56 rel2.relative: 0.0 1.0;
57 rel2.offset: 2 0;
58 }
59 }
60
61 image {
62 "right";
63 desc {
64 "default";
65 min: 12 12;
66 max: 12 12;
67 image {
68 normal: "onehandle.png";
69 }
70 color: 51 153 255 255;
71 rel1.to: "main";
72 rel1.relative: 1.0 0.0;
73 rel1.offset: -3 0;
74 rel2.relative: 1.0 1.0;
75 rel2.offset: -3 0;
76 }
77 }
78
79 image {
80 "bottom";
81 desc {
82 "default";
83 min: 12 12;
84 max: 12 12;
85 image {
86 normal: "onehandle.png";
87 }
88 color: 51 153 255 255;
89 rel1.to: "main";
90 rel1.relative: 0.0 1.0;
91 rel1.offset: 0 -3;
92 rel2.relative: 1.0 1.0;
93 rel2.offset: 0 -3;
94 }
95 }
96
97 }
98 }
99
100#ifndef COLLECTIONS
101}
102#endif
diff --git a/data/images/handles.png b/data/images/handles.png
new file mode 100644
index 0000000..31ea056
--- /dev/null
+++ b/data/images/handles.png
Binary files differ
diff --git a/data/images/onehandle.png b/data/images/onehandle.png
new file mode 100644
index 0000000..5a65c06
--- /dev/null
+++ b/data/images/onehandle.png
Binary files differ
diff --git a/lib/eynote.c b/lib/eynote.c
index ff0394d..0778209 100644
--- a/lib/eynote.c
+++ b/lib/eynote.c
@@ -447,7 +447,7 @@ _key_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
447 eo_do(pd->current, eynote_slide_edit_widget_set(NULL)); 447 eo_do(pd->current, eynote_slide_edit_widget_set(NULL));
448 return; 448 return;
449 } 449 }
450 else if (eo_geti(pd->current, eynote_slide_selected_widgets_has())) 450 else if (eo_geti(pd->current, eynote_slide_selected_widgets_count()))
451 { 451 {
452 eo_do(pd->current, eynote_slide_selected_widgets_set(NULL)); 452 eo_do(pd->current, eynote_slide_selected_widgets_set(NULL));
453 return; 453 return;
diff --git a/lib/eynote_image.c b/lib/eynote_image.c
index 1b5f82c..0b7a3c0 100644
--- a/lib/eynote_image.c
+++ b/lib/eynote_image.c
@@ -21,8 +21,6 @@ typedef struct
21static bool 21static bool
22_image_set(Eynote_Image_Data *pd, const char *file, const char *key) 22_image_set(Eynote_Image_Data *pd, const char *file, const char *key)
23{ 23{
24 int w, h;
25
26 eina_stringshare_replace(&pd->file, file); 24 eina_stringshare_replace(&pd->file, file);
27 eina_stringshare_replace(&pd->key, key); 25 eina_stringshare_replace(&pd->key, key);
28 if (!elm_image_file_set(pd->image, pd->file, pd->key)) 26 if (!elm_image_file_set(pd->image, pd->file, pd->key))
@@ -39,22 +37,6 @@ _image_set(Eynote_Image_Data *pd, const char *file, const char *key)
39 elm_image_animated_play_set(pd->image, false); 37 elm_image_animated_play_set(pd->image, false);
40 } 38 }
41 39
42 elm_image_object_size_get(pd->image, &w, &h);
43 if (!w || !h) goto err;
44
45 // keep width, change height
46 /*
47 int x, y;
48 evas_object_geometry_get(pd->self, &x, &y, &w, &h);
49 INF("%d %d %d %d", x, y, w, h);
50
51 evas_object_geometry_get(pd->image, &x, &y, &w, &h);
52 INF("%d %d %d %d", x, y, w, h);
53
54 evas_object_geometry_get(pd->events, &x, &y, &w, &h);
55 INF("%d %d %d %d", x, y, w, h);
56 */
57
58 return true; 40 return true;
59 41
60err: 42err:
@@ -66,7 +48,7 @@ err:
66static bool 48static bool
67_image_resize(Eynote_Image_Data *pd, int colspan, int rowspan) 49_image_resize(Eynote_Image_Data *pd, int colspan, int rowspan)
68{ 50{
69 int w, h, gw, gh; 51 int w, h, gw, gh, iw, ih;
70 52
71 gw = eynote_config_geti(pd->self, eynote_config_grid_w); 53 gw = eynote_config_geti(pd->self, eynote_config_grid_w);
72 gh = eynote_config_geti(pd->self, eynote_config_grid_h); 54 gh = eynote_config_geti(pd->self, eynote_config_grid_h);
@@ -85,6 +67,7 @@ _resize_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EIN
85 Eynote_Image_Data *pd = data; 67 Eynote_Image_Data *pd = data;
86 68
87 _image_resize(pd, pd->colspan, pd->rowcspan); 69 _image_resize(pd, pd->colspan, pd->rowcspan);
70
88 return true; 71 return true;
89} 72}
90 73
@@ -156,8 +139,8 @@ _eynote_image_serializable_deserialize(Eo *obj, Eynote_Image_Data *pd, void *_da
156 if (!data) return true; 139 if (!data) return true;
157 140
158 eo_do_super(obj, MY_CLASS, serializable_deserialize(wd_data)); 141 eo_do_super(obj, MY_CLASS, serializable_deserialize(wd_data));
159 _image_resize(pd, data->colspan, data->rowspan);
160 _image_set(pd, data->file, data->key); 142 _image_set(pd, data->file, data->key);
143 _image_resize(pd, data->colspan, data->rowspan);
161 144
162 return true; 145 return true;
163} 146}
@@ -215,4 +198,10 @@ _eynote_image_efl_file_file_set(Eo *obj EINA_UNUSED, Eynote_Image_Data *pd, cons
215 return _image_set(pd, file, key); 198 return _image_set(pd, file, key);
216} 199}
217 200
201EOLIAN static Eina_Bool
202_eynote_image_eynote_widget_resizeable_get(Eo *obj EINA_UNUSED, Eynote_Image_Data *pd EINA_UNUSED)
203{
204 return true;
205}
206
218#include "eynote_image.eo.c" 207#include "eynote_image.eo.c"
diff --git a/lib/eynote_image.eo b/lib/eynote_image.eo
index c226af3..03c6bb4 100644
--- a/lib/eynote_image.eo
+++ b/lib/eynote_image.eo
@@ -8,6 +8,7 @@ class Eynote.Image(Eynote.Widget, Efl.File, Serializable)
8 implements { 8 implements {
9 Eo.Base.constructor; 9 Eo.Base.constructor;
10 //Eynote.Widget.object.get; 10 //Eynote.Widget.object.get;
11 Eynote.Widget.resizeable.get;
11 Efl.File.file.get; 12 Efl.File.file.get;
12 Efl.File.file.set; 13 Efl.File.file.set;
13 Serializable.serialize; 14 Serializable.serialize;
diff --git a/lib/eynote_slide.c b/lib/eynote_slide.c
index a293d97..7101480 100644
--- a/lib/eynote_slide.c
+++ b/lib/eynote_slide.c
@@ -335,19 +335,20 @@ _eynote_slide_serializable_deserialize(Eo *obj EINA_UNUSED, Eynote_Slide_Data *p
335 return ok; 335 return ok;
336} 336}
337 337
338EOLIAN static Eina_Bool 338EOLIAN static int
339_eynote_slide_selected_widgets_has(Eo *obj EINA_UNUSED, Eynote_Slide_Data *pd) 339_eynote_slide_selected_widgets_count(Eo *obj EINA_UNUSED, Eynote_Slide_Data *pd)
340{ 340{
341 Eynote_Widget *wd; 341 Eynote_Widget *wd;
342 Eina_List *li; 342 Eina_List *li;
343 int cnt = 0;
343 344
344 EINA_LIST_FOREACH(pd->widgets, li, wd) 345 EINA_LIST_FOREACH(pd->widgets, li, wd)
345 { 346 {
346 if (eo_geti(wd, eynote_widget_selected_get())) 347 if (eo_geti(wd, eynote_widget_selected_get()))
347 return true; 348 cnt++;
348 } 349 }
349 350
350 return false; 351 return cnt;
351} 352}
352 353
353#include "eynote_slide.eo.c" 354#include "eynote_slide.eo.c"
diff --git a/lib/eynote_slide.eo b/lib/eynote_slide.eo
index 8604647..b68e5e3 100644
--- a/lib/eynote_slide.eo
+++ b/lib/eynote_slide.eo
@@ -14,8 +14,8 @@ class Eynote.Slide(Elm.Layout, Serializable)
14 set { [[Set to NULL to clear the selection.]] } 14 set { [[Set to NULL to clear the selection.]] }
15 values { list: Eina_List*(0); [[List of Eynote.Widget*]] } 15 values { list: Eina_List*(0); [[List of Eynote.Widget*]] }
16 } 16 }
17 selected_widgets_has { 17 selected_widgets_count {
18 return: bool; 18 return: int;
19 } 19 }
20 } 20 }
21 implements { 21 implements {
diff --git a/lib/eynote_widget.c b/lib/eynote_widget.c
index 7f827d2..fd1410b 100644
--- a/lib/eynote_widget.c
+++ b/lib/eynote_widget.c
@@ -13,9 +13,10 @@ typedef struct
13{ 13{
14 Eynote_Widget *self; 14 Eynote_Widget *self;
15 Eynote_Widget_Type type; 15 Eynote_Widget_Type type;
16 Elm_Layout *bg; 16 Elm_Layout *bg, *handles;
17 int row, col; 17 int row, col;
18 bool edit_mode; 18 bool edit_mode;
19 bool resize_mode;
19 bool selected; 20 bool selected;
20 struct { 21 struct {
21 int orig_x, orig_y; 22 int orig_x, orig_y;
@@ -70,6 +71,7 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
70 eo_do(slide, eynote_slide_widget_select(pd->self, false)); 71 eo_do(slide, eynote_slide_widget_select(pd->self, false));
71 else 72 else
72 eo_do(slide, eynote_slide_widget_select(pd->self, true)); 73 eo_do(slide, eynote_slide_widget_select(pd->self, true));
74
73 } 75 }
74 76
75 // Right-click 77 // Right-click
@@ -170,7 +172,7 @@ _eynote_widget_edit_mode_set(Eo *obj, Eynote_Widget_Data *pd, Eina_Bool enable)
170 if (enable) 172 if (enable)
171 { 173 {
172 Eo *slide; 174 Eo *slide;
173 evas_object_show(pd->bg); 175 S(pd->bg);
174 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_EDIT_START, MY_CLASS_NAME); 176 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_EDIT_START, MY_CLASS_NAME);
175 eo_do(obj, slide = eo_parent_get()); 177 eo_do(obj, slide = eo_parent_get());
176 eo_do(slide, eynote_slide_edit_widget_set(obj)); 178 eo_do(slide, eynote_slide_edit_widget_set(obj));
@@ -221,11 +223,24 @@ _eynote_widget_selected_set(Eo *obj EINA_UNUSED, Eynote_Widget_Data *pd, Eina_Bo
221 pd->selected = is_selected; 223 pd->selected = is_selected;
222 if (is_selected) 224 if (is_selected)
223 { 225 {
224 evas_object_show(pd->bg); 226 if (eo_geti(pd->self, eynote_widget_resizeable_get()) &&
227 (eo_geti(eo_parent(pd->self), eynote_slide_selected_widgets_count()) == 1))
228 {
229 if (!pd->handles)
230 {
231 pd->handles = elm_layout_add(obj);
232 elm_layout_file_set(pd->handles, eynote_theme(obj), EYNOTE_WIDGET_HANDLES);
233 elm_table_pack(obj, pd->handles, 0, 0, 1, 1);
234 evas_object_size_hint_align_set(pd->handles, EVAS_HINT_FILL, EVAS_HINT_FILL);
235 }
236 S(pd->handles);
237 }
225 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_SELECT_START, MY_CLASS_NAME); 238 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_SELECT_START, MY_CLASS_NAME);
239 S(pd->bg);
226 } 240 }
227 else 241 else
228 { 242 {
243 H(pd->handles);
229 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_SELECT_STOP, MY_CLASS_NAME); 244 elm_layout_signal_emit(pd->bg, EYNOTE_SIGNAL_SELECT_STOP, MY_CLASS_NAME);
230 } 245 }
231} 246}
@@ -285,4 +300,22 @@ _eynote_widget_eo_base_constructor(Eo *obj, Eynote_Widget_Data *pd)
285 return obj; 300 return obj;
286} 301}
287 302
303EOLIAN static Eina_Bool
304_eynote_widget_resizeable_get(Eo *obj EINA_UNUSED, Eynote_Widget_Data *pd EINA_UNUSED)
305{
306 return false;
307}
308
309EOLIAN static void
310_eynote_widget_resize_mode_set(Eo *obj, Eynote_Widget_Data *pd, Eina_Bool enable)
311{
312
313}
314
315EOLIAN static Eina_Bool
316_eynote_widget_resize_mode_get(Eo *obj, Eynote_Widget_Data *pd)
317{
318
319}
320
288#include "eynote_widget.eo.c" 321#include "eynote_widget.eo.c"
diff --git a/lib/eynote_widget.eo b/lib/eynote_widget.eo
index a388863..ddf0b78 100644
--- a/lib/eynote_widget.eo
+++ b/lib/eynote_widget.eo
@@ -6,6 +6,11 @@ class Eynote.Widget(Elm.Table, Serializable)
6 get {} 6 get {}
7 values { enable: bool; } 7 values { enable: bool; }
8 } 8 }
9 @property resize_mode {
10 set {}
11 get {}
12 values { enable: bool; }
13 }
9 @property object { 14 @property object {
10 get {} 15 get {}
11 values { object: Evas_Object*; } 16 values { object: Evas_Object*; }
@@ -24,6 +29,10 @@ class Eynote.Widget(Elm.Table, Serializable)
24 get {} 29 get {}
25 values { val: bool; } 30 values { val: bool; }
26 } 31 }
32 @property resizeable {
33 get {}
34 values { val: bool; }
35 }
27 update { [[Call this to force repositionning.]] } 36 update { [[Call this to force repositionning.]] }
28 } 37 }
29 implements { 38 implements {