summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/Efl_Ui.h31
-rw-r--r--src/lib/elementary/Elementary.h6
-rw-r--r--src/lib/elementary/Elementary_Options.h.in4
-rw-r--r--src/lib/elementary/efl_access_action.eo2
-rw-r--r--src/lib/elementary/efl_access_object.eo4
-rw-r--r--src/lib/elementary/efl_access_text.eo6
-rw-r--r--src/lib/elementary/efl_datetime_manager.c8
-rw-r--r--src/lib/elementary/efl_page_indicator_icon.c191
-rw-r--r--src/lib/elementary/efl_text_interactive.eo72
-rw-r--r--src/lib/elementary/efl_ui.eot23
-rw-r--r--src/lib/elementary/efl_ui_alert_popup.c38
-rw-r--r--src/lib/elementary/efl_ui_alert_popup.eo3
-rw-r--r--src/lib/elementary/efl_ui_alert_popup_part.eo8
-rw-r--r--src/lib/elementary/efl_ui_alert_popup_part_title.eo11
-rw-r--r--src/lib/elementary/efl_ui_animation_view.c772
-rw-r--r--src/lib/elementary/efl_ui_animation_view.eo294
-rw-r--r--src/lib/elementary/efl_ui_animation_view_eo.legacy.c162
-rw-r--r--src/lib/elementary/efl_ui_animation_view_private.h42
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.c4
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.eo10
-rw-r--r--src/lib/elementary/efl_ui_check.c3
-rw-r--r--src/lib/elementary/efl_ui_clock.c6
-rw-r--r--src/lib/elementary/efl_ui_collection.c34
-rw-r--r--src/lib/elementary/efl_ui_collection.eo17
-rw-r--r--src/lib/elementary/efl_ui_collection_view.c418
-rw-r--r--src/lib/elementary/efl_ui_collection_view.eo12
-rw-r--r--src/lib/elementary/efl_ui_datepicker.c4
-rw-r--r--src/lib/elementary/efl_ui_focus_manager.eo4
-rw-r--r--src/lib/elementary/efl_ui_format.c4
-rw-r--r--src/lib/elementary/efl_ui_format.eo2
-rw-r--r--src/lib/elementary/efl_ui_grid.eo2
-rw-r--r--src/lib/elementary/efl_ui_grid_view.eo4
-rw-r--r--src/lib/elementary/efl_ui_image.c25
-rw-r--r--src/lib/elementary/efl_ui_image.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c21
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.eo2
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c1600
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.eo29
-rw-r--r--src/lib/elementary/efl_ui_internal_text_scroller.c25
-rw-r--r--src/lib/elementary/efl_ui_internal_text_scroller.eo6
-rw-r--r--src/lib/elementary/efl_ui_item.c15
-rw-r--r--src/lib/elementary/efl_ui_item.eo6
-rw-r--r--src/lib/elementary/efl_ui_layout.c61
-rw-r--r--src/lib/elementary/efl_ui_layout_base.eo16
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.eo4
-rw-r--r--src/lib/elementary/efl_ui_list.eo2
-rw-r--r--src/lib/elementary/efl_ui_list_view.eo4
-rw-r--r--src/lib/elementary/efl_ui_multi_selectable.eo41
-rw-r--r--src/lib/elementary/efl_ui_multi_selectable_async.eo63
-rw-r--r--src/lib/elementary/efl_ui_multi_selectable_index_range.eo56
-rw-r--r--src/lib/elementary/efl_ui_multi_selectable_object_range.eo49
-rw-r--r--src/lib/elementary/efl_ui_pager.c27
-rw-r--r--src/lib/elementary/efl_ui_pager.eo10
-rw-r--r--src/lib/elementary/efl_ui_pan.c4
-rw-r--r--src/lib/elementary/efl_ui_panel.c35
-rw-r--r--src/lib/elementary/efl_ui_popup.c8
-rw-r--r--src/lib/elementary/efl_ui_popup.eo1
-rw-r--r--src/lib/elementary/efl_ui_position_manager_data_access_v1.eo1
-rw-r--r--src/lib/elementary/efl_ui_position_manager_entity.eo3
-rw-r--r--src/lib/elementary/efl_ui_position_manager_grid.c72
-rw-r--r--src/lib/elementary/efl_ui_position_manager_list.c87
-rw-r--r--src/lib/elementary/efl_ui_position_manager_list.eo2
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c198
-rw-r--r--src/lib/elementary/efl_ui_progressbar.eo49
-rw-r--r--src/lib/elementary/efl_ui_radio_box.eo4
-rw-r--r--src/lib/elementary/efl_ui_radio_group_impl.c12
-rw-r--r--src/lib/elementary/efl_ui_radio_group_impl.eo1
-rw-r--r--src/lib/elementary/efl_ui_relative_container.c (renamed from src/lib/elementary/efl_ui_relative_layout.c)198
-rw-r--r--src/lib/elementary/efl_ui_relative_container.eo97
-rw-r--r--src/lib/elementary/efl_ui_relative_container_private.h (renamed from src/lib/elementary/efl_ui_relative_layout_private.h)68
-rw-r--r--src/lib/elementary/efl_ui_relative_layout.eo73
-rw-r--r--src/lib/elementary/efl_ui_scroll_manager.c7
-rw-r--r--src/lib/elementary/efl_ui_scroll_manager.eo13
-rw-r--r--src/lib/elementary/efl_ui_scroll_util.c14
-rw-r--r--src/lib/elementary/efl_ui_scroller.c18
-rw-r--r--src/lib/elementary/efl_ui_scroller.eo1
-rw-r--r--src/lib/elementary/efl_ui_select_model.c78
-rw-r--r--src/lib/elementary/efl_ui_select_model.eo16
-rw-r--r--src/lib/elementary/efl_ui_selection_manager.c5
-rw-r--r--src/lib/elementary/efl_ui_separator.c46
-rw-r--r--src/lib/elementary/efl_ui_separator.eo20
-rw-r--r--src/lib/elementary/efl_ui_single_selectable.eo6
-rw-r--r--src/lib/elementary/efl_ui_slider.c48
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c9
-rw-r--r--src/lib/elementary/efl_ui_spotlight_container.c175
-rw-r--r--src/lib/elementary/efl_ui_spotlight_container.eo39
-rw-r--r--src/lib/elementary/efl_ui_spotlight_fade_manager.c221
-rw-r--r--src/lib/elementary/efl_ui_spotlight_fade_manager.eo (renamed from src/lib/elementary/efl_ui_spotlight_manager_stack.eo)5
-rw-r--r--src/lib/elementary/efl_ui_spotlight_icon_indicator.c158
-rw-r--r--src/lib/elementary/efl_ui_spotlight_icon_indicator.eo (renamed from src/lib/elementary/efl_ui_spotlight_indicator_icon.eo)4
-rw-r--r--src/lib/elementary/efl_ui_spotlight_indicator_icon.c114
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager.eo11
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_stack.c279
-rw-r--r--src/lib/elementary/efl_ui_spotlight_plain_manager.c (renamed from src/lib/elementary/efl_ui_spotlight_manager_plain.c)88
-rw-r--r--src/lib/elementary/efl_ui_spotlight_plain_manager.eo (renamed from src/lib/elementary/efl_ui_spotlight_manager_plain.eo)6
-rw-r--r--src/lib/elementary/efl_ui_spotlight_scroll_manager.c (renamed from src/lib/elementary/efl_ui_spotlight_manager_scroll.c)93
-rw-r--r--src/lib/elementary/efl_ui_spotlight_scroll_manager.eo (renamed from src/lib/elementary/efl_ui_spotlight_manager_scroll.eo)5
-rw-r--r--src/lib/elementary/efl_ui_spotlight_util.c2
-rw-r--r--src/lib/elementary/efl_ui_stack.c27
-rw-r--r--src/lib/elementary/efl_ui_stack.eo10
-rw-r--r--src/lib/elementary/efl_ui_tab_bar.c13
-rw-r--r--src/lib/elementary/efl_ui_tab_bar.eo1
-rw-r--r--src/lib/elementary/efl_ui_tab_bar_private.h1
-rw-r--r--src/lib/elementary/efl_ui_table.c2
-rw-r--r--src/lib/elementary/efl_ui_table_static.eo8
-rw-r--r--src/lib/elementary/efl_ui_tags.c8
-rw-r--r--src/lib/elementary/efl_ui_text.eo356
-rw-r--r--src/lib/elementary/efl_ui_text_async.eo9
-rw-r--r--src/lib/elementary/efl_ui_text_editable.eo8
-rw-r--r--src/lib/elementary/efl_ui_text_factory_emoticons.c2
-rw-r--r--src/lib/elementary/efl_ui_text_factory_emoticons.eo4
-rw-r--r--src/lib/elementary/efl_ui_text_factory_fallback.c8
-rw-r--r--src/lib/elementary/efl_ui_text_factory_fallback.eo4
-rw-r--r--src/lib/elementary/efl_ui_text_factory_images.c2
-rw-r--r--src/lib/elementary/efl_ui_text_factory_images.eo4
-rw-r--r--src/lib/elementary/efl_ui_text_part.eo8
-rw-r--r--src/lib/elementary/efl_ui_textbox.c (renamed from src/lib/elementary/efl_ui_text.c)2008
-rw-r--r--src/lib/elementary/efl_ui_textbox.eo137
-rw-r--r--src/lib/elementary/efl_ui_textbox_async.eo9
-rw-r--r--src/lib/elementary/efl_ui_textbox_part.eo8
-rw-r--r--src/lib/elementary/efl_ui_timepicker.c62
-rw-r--r--src/lib/elementary/efl_ui_timepicker.eo1
-rw-r--r--src/lib/elementary/efl_ui_vg_animation.c936
-rw-r--r--src/lib/elementary/efl_ui_vg_animation.eo207
-rw-r--r--src/lib/elementary/efl_ui_vg_animation.h (renamed from src/lib/elementary/efl_ui_animation_view.h)2
-rw-r--r--src/lib/elementary/efl_ui_vg_animation_eo.legacy.c200
-rw-r--r--src/lib/elementary/efl_ui_vg_animation_eo.legacy.h (renamed from src/lib/elementary/efl_ui_animation_view_eo.legacy.h)10
-rw-r--r--src/lib/elementary/efl_ui_vg_animation_legacy.h (renamed from src/lib/elementary/efl_ui_animation_view_legacy.h)2
-rw-r--r--src/lib/elementary/efl_ui_vg_animation_private.h43
-rw-r--r--src/lib/elementary/efl_ui_view_model.c3
-rw-r--r--src/lib/elementary/efl_ui_view_model.eo4
-rw-r--r--src/lib/elementary/efl_ui_widget.c44
-rw-r--r--src/lib/elementary/efl_ui_widget.eo4
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c14
-rw-r--r--src/lib/elementary/efl_ui_win.c268
-rw-r--r--src/lib/elementary/efl_ui_win.eo2
-rw-r--r--src/lib/elementary/elc_fileselector_entry.c14
-rw-r--r--src/lib/elementary/elc_hoversel.c9
-rw-r--r--src/lib/elementary/elc_naviframe.c4
-rw-r--r--src/lib/elementary/elm_code_file.c11
-rw-r--r--src/lib/elementary/elm_code_text.c3
-rw-r--r--src/lib/elementary/elm_code_widget.c4
-rw-r--r--src/lib/elementary/elm_config.c27
-rw-r--r--src/lib/elementary/elm_deprecated.h19
-rw-r--r--src/lib/elementary/elm_entry.c27
-rw-r--r--src/lib/elementary/elm_general.eot1
-rw-r--r--src/lib/elementary/elm_gengrid.c1
-rw-r--r--src/lib/elementary/elm_genlist.c175
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c61
-rw-r--r--src/lib/elementary/elm_interface_scrollable.eo3
-rw-r--r--src/lib/elementary/elm_label.c18
-rw-r--r--src/lib/elementary/elm_label_eo.c2
-rw-r--r--src/lib/elementary/elm_list.c3
-rw-r--r--src/lib/elementary/elm_main.c21
-rw-r--r--src/lib/elementary/elm_map.c3
-rw-r--r--src/lib/elementary/elm_need.h15
-rw-r--r--src/lib/elementary/elm_panel.c1
-rw-r--r--src/lib/elementary/elm_priv.h12
-rw-r--r--src/lib/elementary/elm_scroller.c1
-rw-r--r--src/lib/elementary/elm_slider.c58
-rw-r--r--src/lib/elementary/elm_slider_eo.legacy.h17
-rw-r--r--src/lib/elementary/elm_toolbar.c1
-rw-r--r--src/lib/elementary/elm_transit.c4
-rw-r--r--src/lib/elementary/elm_widget_genlist.h3
-rw-r--r--src/lib/elementary/elm_widget_layout.h1
-rw-r--r--src/lib/elementary/meson.build58
166 files changed, 6330 insertions, 5345 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 917ef5b..c010581 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -60,9 +60,7 @@
60# include <sys/siginfo.h> 60# include <sys/siginfo.h>
61#else 61#else
62# include <sys/time.h> 62# include <sys/time.h>
63# if !defined (EXOTIC_NO_SIGNAL) 63# include <signal.h>
64# include <signal.h>
65# endif
66#endif 64#endif
67 65
68#include <sys/types.h> 66#include <sys/types.h>
@@ -222,17 +220,16 @@ EAPI Eina_Bool efl_ui_win_autodel_get(const Efl_Ui_Win *obj);
222#endif 220#endif
223# include <efl_ui_win_inlined.eo.h> 221# include <efl_ui_win_inlined.eo.h>
224# include <efl_ui_win_socket.eo.h> 222# include <efl_ui_win_socket.eo.h>
225# include <efl_ui_relative_layout.eo.h> 223# include <efl_ui_relative_container.eo.h>
224
225// FIXME - Text object must stop using Context_Item_Clicked_Cb!
226typedef void (*Context_Item_Clicked_Cb)(void *data, Eo *obj, void *event_info);
226 227
227/* FIXME: Efl.Ui.Text must not use elm_general.h
228# include <elm_general.h>
229# include <efl_text_interactive.eo.h> 228# include <efl_text_interactive.eo.h>
230# include <efl_ui_text.eo.h> 229# include <efl_ui_textbox.eo.h>
231# include <efl_ui_text_editable.eo.h> 230# include <efl_ui_textbox_async.eo.h>
232# include <efl_ui_text_async.eo.h>
233*/
234 231
235# include <efl_ui_animation_view.eo.h> 232# include <efl_ui_vg_animation.eo.h>
236# include <efl_ui_clock.eo.h> 233# include <efl_ui_clock.eo.h>
237# include <efl_ui_video.eo.h> 234# include <efl_ui_video.eo.h>
238 235
@@ -269,10 +266,12 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
269# include <efl_ui_spotlight_container.eo.h> 266# include <efl_ui_spotlight_container.eo.h>
270# include <efl_ui_spotlight_manager.eo.h> 267# include <efl_ui_spotlight_manager.eo.h>
271# include <efl_ui_spotlight_indicator.eo.h> 268# include <efl_ui_spotlight_indicator.eo.h>
272# include <efl_ui_spotlight_indicator_icon.eo.h> 269# include <efl_ui_spotlight_icon_indicator.eo.h>
273# include <efl_ui_spotlight_manager_scroll.eo.h> 270# include <efl_ui_spotlight_scroll_manager.eo.h>
274# include <efl_ui_spotlight_manager_stack.eo.h> 271# include <efl_ui_spotlight_fade_manager.eo.h>
275# include <efl_ui_spotlight_util.eo.h> 272# include <efl_ui_spotlight_util.eo.h>
273# include <efl_ui_stack.eo.h>
274# include <efl_ui_pager.eo.h>
276 275
277# include <efl_ui_navigation_bar.eo.h> 276# include <efl_ui_navigation_bar.eo.h>
278# include <efl_ui_navigation_bar_part.eo.h> 277# include <efl_ui_navigation_bar_part.eo.h>
@@ -298,6 +297,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
298# include <efl_ui_selectable.eo.h> 297# include <efl_ui_selectable.eo.h>
299# include <efl_ui_single_selectable.eo.h> 298# include <efl_ui_single_selectable.eo.h>
300# include <efl_ui_multi_selectable.eo.h> 299# include <efl_ui_multi_selectable.eo.h>
300# include <efl_ui_multi_selectable_object_range.eo.h>
301# include <efl_ui_multi_selectable_index_range.eo.h>
301# include <efl_ui_popup.eo.h> 302# include <efl_ui_popup.eo.h>
302# include <efl_ui_alert_popup.eo.h> 303# include <efl_ui_alert_popup.eo.h>
303# include <efl_ui_popup_part_backwall.eo.h> 304# include <efl_ui_popup_part_backwall.eo.h>
@@ -307,7 +308,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
307# include <efl_ui_tab_bar.eo.h> 308# include <efl_ui_tab_bar.eo.h>
308# include <efl_ui_tab_page.eo.h> 309# include <efl_ui_tab_page.eo.h>
309# include <efl_ui_tab_pager.eo.h> 310# include <efl_ui_tab_pager.eo.h>
310# include <efl_ui_multi_selectable_async.eo.h>
311# include <efl_ui_select_model.eo.h> 311# include <efl_ui_select_model.eo.h>
312 312
313# include <efl_ui_list_view.eo.h> 313# include <efl_ui_list_view.eo.h>
@@ -328,6 +328,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
328# include <efl_ui_timepicker.eo.h> 328# include <efl_ui_timepicker.eo.h>
329# include <efl_ui_datepicker.eo.h> 329# include <efl_ui_datepicker.eo.h>
330# include <efl_ui_calendar.eo.h> 330# include <efl_ui_calendar.eo.h>
331# include <efl_ui_separator.eo.h>
331 332
332/** 333/**
333 * Initialize Elementary 334 * Initialize Elementary
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index cf58752..ddcb22d 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -73,10 +73,6 @@
73#include <Efreet_Trash.h> 73#include <Efreet_Trash.h>
74#include <Ethumb_Client.h> 74#include <Ethumb_Client.h>
75 75
76#ifdef ELM_ELOCATION
77#include <Elocation.h>
78#endif
79
80#ifdef ELM_EMAP 76#ifdef ELM_EMAP
81#include <EMap.h> 77#include <EMap.h>
82#endif 78#endif
@@ -197,7 +193,7 @@ EAPI extern Elm_Version *elm_version;
197#include <elm_cache.h> 193#include <elm_cache.h>
198#include <elm_calendar.h> 194#include <elm_calendar.h>
199/* this is elm_animation_view */ 195/* this is elm_animation_view */
200#include <efl_ui_animation_view.h> 196#include <efl_ui_vg_animation.h>
201#include <elm_check.h> 197#include <elm_check.h>
202#include <elm_clock.h> 198#include <elm_clock.h>
203#include <elm_cnp.h> 199#include <elm_cnp.h>
diff --git a/src/lib/elementary/Elementary_Options.h.in b/src/lib/elementary/Elementary_Options.h.in
index a52444d..2110b58 100644
--- a/src/lib/elementary/Elementary_Options.h.in
+++ b/src/lib/elementary/Elementary_Options.h.in
@@ -13,8 +13,4 @@
13@ELM_LIBINTL_H_DEF@ ELM_LIBINTL_H 13@ELM_LIBINTL_H_DEF@ ELM_LIBINTL_H
14@ELM_DIRENT_H_DEF@ ELM_DIRENT_H 14@ELM_DIRENT_H_DEF@ ELM_DIRENT_H
15 15
16#ifdef EFL_BETA_API_SUPPORT
17# define ELM_ELOCATION
18#endif
19
20#endif 16#endif
diff --git a/src/lib/elementary/efl_access_action.eo b/src/lib/elementary/efl_access_action.eo
index acaad80..c292624 100644
--- a/src/lib/elementary/efl_access_action.eo
+++ b/src/lib/elementary/efl_access_action.eo
@@ -47,7 +47,7 @@ mixin @beta Efl.Access.Action
47 get @pure_virtual { 47 get @pure_virtual {
48 } 48 }
49 values { 49 values {
50 actions: list<ptr(Efl.Access.Action_Data)>; 50 actions: list<Efl.Access.Action_Data> @move;
51 [[Contains statically allocated strings.]] 51 [[Contains statically allocated strings.]]
52 } 52 }
53 } 53 }
diff --git a/src/lib/elementary/efl_access_object.eo b/src/lib/elementary/efl_access_object.eo
index d7392f2..f3e70de 100644
--- a/src/lib/elementary/efl_access_object.eo
+++ b/src/lib/elementary/efl_access_object.eo
@@ -263,7 +263,7 @@ mixin @beta Efl.Access.Object requires Efl.Object
263 } 263 }
264 relations_get @protected @beta @const { 264 relations_get @protected @beta @const {
265 [[Gets an all relations between accessible object and other accessible objects.]] 265 [[Gets an all relations between accessible object and other accessible objects.]]
266 return: iterator<ptr(Efl.Access.Relation)>; [[Accessible relation set]] 266 return: iterator<Efl.Access.Relation> @move; [[Accessible relation set]]
267 } 267 }
268 @property role @beta { 268 @property role @beta {
269 [[The role of the object in accessibility domain.]] 269 [[The role of the object in accessibility domain.]]
@@ -296,7 +296,7 @@ mixin @beta Efl.Access.Object requires Efl.Object
296 get { 296 get {
297 } 297 }
298 values { 298 values {
299 attributes: list<ptr(Efl.Access.Attribute) @move> @move; [[List of object attributes. 299 attributes: list<Efl.Access.Attribute> @move; [[List of object attributes.
300 Must be freed by the user]] 300 Must be freed by the user]]
301 } 301 }
302 } 302 }
diff --git a/src/lib/elementary/efl_access_text.eo b/src/lib/elementary/efl_access_text.eo
index 0fe97c4..fe76de5 100644
--- a/src/lib/elementary/efl_access_text.eo
+++ b/src/lib/elementary/efl_access_text.eo
@@ -121,7 +121,7 @@ interface @beta Efl.Access.Text
121 end_offset: ptr(int); [[End offset]] 121 end_offset: ptr(int); [[End offset]]
122 } 122 }
123 values { 123 values {
124 attributes: list<ptr(Efl.Access.Text_Attribute) @move> @move; [[List of text attributes]] 124 attributes: list<Efl.Access.Text_Attribute> @move; [[List of text attributes]]
125 } 125 }
126 } 126 }
127 @property default_attributes @protected @beta { 127 @property default_attributes @protected @beta {
@@ -129,7 +129,7 @@ interface @beta Efl.Access.Text
129 get { 129 get {
130 } 130 }
131 values { 131 values {
132 attributes: list<ptr(Efl.Access.Text_Attribute) @move> @move; [[List of default attributes]] 132 attributes: list<Efl.Access.Text_Attribute> @move; [[List of default attributes]]
133 } 133 }
134 } 134 }
135 @property character_extents @protected @beta { 135 @property character_extents @protected @beta {
@@ -180,7 +180,7 @@ interface @beta Efl.Access.Text
180 yclip: Efl.Access.Text_Clip_Type; [[yclip]] 180 yclip: Efl.Access.Text_Clip_Type; [[yclip]]
181 } 181 }
182 values { 182 values {
183 ranges: list<ptr(Efl.Access.Text_Range) @move> @move; [[List of ranges]] 183 ranges: list<Efl.Access.Text_Range> @move; [[List of ranges]]
184 } 184 }
185 } 185 }
186 @property range_extents @protected @beta { 186 @property range_extents @protected @beta {
diff --git a/src/lib/elementary/efl_datetime_manager.c b/src/lib/elementary/efl_datetime_manager.c
index 24daa34..7445b8c 100644
--- a/src/lib/elementary/efl_datetime_manager.c
+++ b/src/lib/elementary/efl_datetime_manager.c
@@ -22,10 +22,9 @@ typedef struct
22{ 22{
23 Efl_Time time; 23 Efl_Time time;
24 char format[MAX_FORMAT_LEN]; 24 char format[MAX_FORMAT_LEN];
25 Eina_Bool init;
25} Efl_Datetime_Manager_Data; 26} Efl_Datetime_Manager_Data;
26 27
27Eina_Bool init = EINA_FALSE;
28
29static void 28static void
30_time_init(Efl_Time *curr_time) 29_time_init(Efl_Time *curr_time)
31{ 30{
@@ -33,8 +32,6 @@ _time_init(Efl_Time *curr_time)
33 32
34 t = time(NULL); 33 t = time(NULL);
35 localtime_r(&t, curr_time); 34 localtime_r(&t, curr_time);
36
37 init = EINA_TRUE;
38} 35}
39 36
40static char * 37static char *
@@ -162,7 +159,8 @@ _efl_datetime_manager_value_set(Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *
162EOLIAN static Efl_Time 159EOLIAN static Efl_Time
163_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd) 160_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd)
164{ 161{
165 if (!init) _time_init(&pd->time); 162 if (!pd->init) _time_init(&pd->time);
163 pd->init = EINA_TRUE;
166 164
167 return pd->time; 165 return pd->time;
168} 166}
diff --git a/src/lib/elementary/efl_page_indicator_icon.c b/src/lib/elementary/efl_page_indicator_icon.c
deleted file mode 100644
index 4a13db3..0000000
--- a/src/lib/elementary/efl_page_indicator_icon.c
+++ /dev/null
@@ -1,191 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_priv.h"
7
8#include "efl_page_indicator_icon.h"
9#include "efl_page_indicator.h"
10#include "efl_ui_widget_pager.h"
11
12#define MY_CLASS EFL_PAGE_INDICATOR_ICON_CLASS
13
14
15
16EOLIAN static void
17_efl_page_indicator_icon_update(Eo *obj,
18 Efl_Page_Indicator_Icon_Data *pd,
19 double pos)
20{
21 EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
22 double delta = fabs(pos);
23
24 if (pd->curr)
25 {
26 eina_value_set(pd->v, 0.0);
27 efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
28 if (pd->adj) efl_layout_signal_message_send(pd->adj, 1, *(pd->v));
29 }
30
31 efl_page_indicator_update(efl_super(obj, MY_CLASS), pos);
32
33 pd->curr = eina_list_nth(pd->items, spd->curr_idx);
34 eina_value_set(pd->v, (1.0 - delta));
35 efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
36
37 if (pos < 0)
38 pd->adj = eina_list_nth(pd->items, (spd->curr_idx - 1 + spd->cnt) % spd->cnt);
39 else if (pos > 0)
40 pd->adj = eina_list_nth(pd->items, (spd->curr_idx + 1 + spd->cnt) % spd->cnt);
41 else pd->adj = NULL;
42
43 if (pd->adj)
44 {
45 eina_value_set(pd->v, delta);
46 efl_layout_signal_message_send(pd->adj, 1, *(pd->v));
47 }
48}
49
50EOLIAN static void
51_efl_page_indicator_icon_pack(Eo *obj,
52 Efl_Page_Indicator_Icon_Data *pd,
53 int index)
54{
55 EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
56 Eo *item, *existing;
57
58 item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
59 elm_widget_theme_object_set(spd->idbox, item,
60 "pager", "indicator", "default");
61 efl_gfx_hint_align_set(item, 0.5, 0.5);
62 efl_gfx_hint_weight_set(item, 0, 0);
63 efl_gfx_hint_fill_set(item, 0, 0);
64
65 if (index == spd->cnt)
66 {
67 pd->items = eina_list_append(pd->items, item);
68 efl_pack_end(spd->idbox, item);
69 }
70 else
71 {
72 existing = eina_list_nth(pd->items, index);
73 pd->items = eina_list_prepend_relative(pd->items, item, existing);
74 efl_pack_before(spd->idbox, item, existing);
75 }
76
77 efl_page_indicator_pack(efl_super(obj, MY_CLASS), index);
78
79 if (!pd->curr)
80 {
81 pd->curr = eina_list_nth(pd->items, spd->curr_idx);
82 eina_value_set(pd->v, 1.0);
83 efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
84 }
85}
86
87EOLIAN static void
88_efl_page_indicator_icon_unpack(Eo *obj,
89 Efl_Page_Indicator_Icon_Data *pd,
90 int index)
91{
92 EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
93 Eo *item;
94
95 item = eina_list_nth(pd->items, index);
96 pd->items = eina_list_remove(pd->items, item);
97 efl_pack_unpack(spd->idbox, item);
98 efl_del(item);
99
100 if (index == spd->curr_idx) pd->curr = NULL;
101
102 efl_page_indicator_unpack(efl_super(obj, MY_CLASS), index);
103
104 if ((pd->curr == NULL) && (spd->curr_idx != -1))
105 {
106 pd->curr = eina_list_nth(pd->items, spd->curr_idx);
107 eina_value_set(pd->v, 1.0);
108 efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
109 }
110}
111
112EOLIAN static void
113_efl_page_indicator_icon_unpack_all(Eo *obj,
114 Efl_Page_Indicator_Icon_Data *pd)
115{
116 Eo *item;
117
118 EINA_LIST_FREE(pd->items, item)
119 {
120 efl_del(item);
121 }
122
123 pd->curr = NULL;
124
125 efl_page_indicator_unpack_all(efl_super(obj, MY_CLASS));
126}
127
128EOLIAN static void
129_efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
130 Efl_Page_Indicator_Icon_Data *pd,
131 Eo *pager,
132 Efl_Canvas_Group *idbox)
133{
134 EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
135 Eo *item;
136 int i, page;
137
138 if (spd->pager.obj)
139 {
140 EINA_LIST_FREE(pd->items, item)
141 {
142 efl_del(item);
143 }
144 }
145
146 efl_page_indicator_bind(efl_super(obj, MY_CLASS), pager, idbox);
147
148 if (spd->pager.obj)
149 {
150 efl_ui_layout_orientation_set(spd->idbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
151 efl_gfx_arrangement_content_padding_set(spd->idbox, 15, 15);
152
153 pd->v = eina_value_float_new(0.0);
154
155 if (spd->cnt != 0)
156 {
157 for (i = 0; i < spd->cnt; i++)
158 {
159 item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
160 pd->items = eina_list_append(pd->items, item);
161
162 elm_widget_theme_object_set(spd->idbox, item,
163 "pager", "indicator", "default");
164 efl_gfx_hint_align_set(item, 0.5, 0.5);
165 efl_gfx_hint_weight_set(item, 0, 0);
166 efl_gfx_hint_fill_set(item, 0, 0);
167 efl_pack_end(spd->idbox, item);
168 }
169
170 page = efl_ui_pager_current_page_get(spd->pager.obj);
171 item = eina_list_nth(pd->items, page);
172 eina_value_set(pd->v, 1.0);
173 efl_layout_signal_message_send(item, 1, *(pd->v));
174
175 pd->curr = item;
176 }
177 }
178}
179
180
181#define EFL_PAGE_INDICATOR_ICON_EXTRA_OPS \
182 EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \
183 _efl_page_indicator_icon_update), \
184 EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \
185 _efl_page_indicator_icon_pack), \
186 EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \
187 _efl_page_indicator_icon_unpack), \
188 EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack_all, \
189 _efl_page_indicator_icon_unpack_all)
190
191#include "efl_page_indicator_icon.eo.c"
diff --git a/src/lib/elementary/efl_text_interactive.eo b/src/lib/elementary/efl_text_interactive.eo
index 4d8d96d..cc15cdc 100644
--- a/src/lib/elementary/efl_text_interactive.eo
+++ b/src/lib/elementary/efl_text_interactive.eo
@@ -1,53 +1,87 @@
1import efl_text_types; 1import efl_text_types;
2 2
3interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text_Font, 3interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text_Font_Properties,
4 Efl.Text_Format, Efl.Text_Style 4 Efl.Text_Format, Efl.Text_Style
5{ 5{
6 [[This is an interface interactive text inputs should implement]] 6 [[Interface for interactive (editable) text inputs (text entries).
7
8 It handles cursors, edition and selection.
9 ]]
7 methods { 10 methods {
11 @property main_cursor {
12 [[The cursor used to insert new text, the one that's visible to the user.]]
13 get {}
14 values {
15 cursor: Efl.Text.Cursor; [[The cursor visible to the user.]]
16 }
17 }
8 @property selection_allowed { 18 @property selection_allowed {
9 [[Whether or not selection is allowed on this object]] 19 [[Whether or not text selection is allowed on this object.]]
10 set {} 20 set {}
11 get {} 21 get {}
12 values { 22 values {
13 allowed: bool; [[$true if enabled, $false otherwise]] 23 allowed: bool; [[$true if enabled.]]
14 } 24 }
15 } 25 }
16 @property selection_cursors { 26 @property selection_cursors {
17 [[The cursors used for selection handling. 27 [[The cursors used for selection handling.
18 28 If the cursors are equal there's no selection.
19 If the cursors are equal there's
20 no selection.
21
22 You are allowed to retain and modify them. Modifying them modifies
23 the selection of the object.
24 ]] 29 ]]
25 get {} 30 get {
31 [[You are allowed to retain and modify them. Modifying them modifies
32 the selection of the object (recommended to extend selection range).]]
33 }
34 set {
35 [[The positions of passed cursors will be used to set selection cursors positions.
36 Further modification for passed @Efl.Text.Cursor objects, will not affect selection.
37 Setter is recommended to set new range for selection.]]
38 }
26 values { 39 values {
27 start: ptr(Efl.Text_Cursor_Cursor); [[The start of the selection]] 40 start: Efl.Text.Cursor; [[The start of the selection.]]
28 end: ptr(Efl.Text_Cursor_Cursor); [[The end of the selection]] 41 end: Efl.Text.Cursor; [[The end of the selection.]]
29 } 42 }
30 } 43 }
31 @property editable { 44 @property editable {
32 [[Whether the entry is editable. 45 [[Whether the entry is editable.
33 46
34 By default text interactives are editable. However setting this 47 By default interactive text objects are editable. Setting this
35 property to $false will make it so that key input will be disregarded. 48 property to $false will disregard all keyboard input.
36 ]] 49 ]]
37 set { 50 set {
38 } 51 }
39 get { 52 get {
40 } 53 }
41 values { 54 values {
42 editable: bool; [[If $true, user input will be inserted in the entry, 55 editable: bool; [[If $true, user input can modify the text.
43 if not, the entry is read-only and no user input is allowed.]] 56 Otherwise, the entry is read-only and no user input is allowed.]]
44 } 57 }
45 } 58 }
46 select_none { 59 all_unselect {
47 [[Clears the selection.]] 60 [[Clears the selection.]]
48 } 61 }
62 all_select {
63 [[Select all the content.]]
64 }
65 @property have_selection {
66 [[Whether the entry has a selected text.
67 ]]
68 get {
69 }
70 values {
71 selected: bool; [[If $true, entry has selected text.]]
72 }
73 }
49 } 74 }
50 events { 75 events {
51 text,selection,changed: void; [[The selection on the object has changed. Query using @.selection_cursors]] 76 preedit,changed: void; [[Emitted when key presses do not result in a new character being added.
77 Multiple key presses are needed to produce a character in some languages like
78 Korean, for example. Each of these key presses will emit a @[.preedit,changed]
79 event but only the last one will emit a @[.changed,user] event.
80 ]]
81 have_selection,changed: bool; [[Emitted when the @.have_selection property value changes.]]
82 selection,changed: Eina.Range; [[Emitted when selection has changed. Query using @.selection_cursors.]]
83 redo,request: void; [[Emitted when a redo operation is requested.]]
84 undo,request: void; [[Emitted when a undo operation is requested.]]
85 changed,user: Efl.Text_Change_Info; [[Emitted when the text content has changed due to user interaction.]]
52 } 86 }
53} 87}
diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot
index e9c2fbc..29832b5 100644
--- a/src/lib/elementary/efl_ui.eot
+++ b/src/lib/elementary/efl_ui.eot
@@ -42,23 +42,9 @@ enum Efl.Ui.Focus.Move_Policy
42 Left, Right, Up, Down, Tab, or Shift+Tab.]] 42 Left, Right, Up, Down, Tab, or Shift+Tab.]]
43} 43}
44 44
45enum @beta Efl.Ui.Slider_Indicator_Visible_Mode 45enum @beta Efl.Ui.Focus.Autoscroll_Mode
46{
47 [[Slider's indicator visibility mode.
48
49 @since 1.13
50 ]]
51 on_drag, [[show indicator on mouse down or change in slider value]]
52 always, [[Always show the indicator.]]
53 on_focus, [[Show the indicator on focus]]
54 none [[Never show the indicator ]]
55}
56
57enum Efl.Ui.Focus.Autoscroll_Mode
58{ 46{
59 [[Focus Autoscroll Mode 47 [[Focus Autoscroll Mode
60
61 @since 1.10
62 ]] 48 ]]
63 show, [[Directly show the focused region or item automatically.]] 49 show, [[Directly show the focused region or item automatically.]]
64 none, [[Do not show the focused region or item automatically.]] 50 none, [[Do not show the focused region or item automatically.]]
@@ -102,8 +88,11 @@ enum @beta Efl.Ui.Widget_Orientation_Mode
102 not change according to the window or screen orientation.]] 88 not change according to the window or screen orientation.]]
103} 89}
104 90
105enum @beta Efl.Ui.Select_Mode { 91enum Efl.Ui.Select_Mode {
106 [[Type of multi selectable object.]] 92 [[Type of multi selectable object.
93
94 @since 1.24
95 ]]
107 single, [[Only single child is selected. If a child is selected, 96 single, [[Only single child is selected. If a child is selected,
108 previous selected child will be unselected.]] 97 previous selected child will be unselected.]]
109 multi, [[Allow multiple selection of children.]] 98 multi, [[Allow multiple selection of children.]]
diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c
index 0c5fc1b..65dcb49 100644
--- a/src/lib/elementary/efl_ui_alert_popup.c
+++ b/src/lib/elementary/efl_ui_alert_popup.c
@@ -8,7 +8,7 @@
8 8
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "efl_ui_alert_popup_private.h" 10#include "efl_ui_alert_popup_private.h"
11#include "efl_ui_alert_popup_part.eo.h" 11#include "efl_ui_alert_popup_part_title.eo.h"
12#include "elm_part_helper.h" 12#include "elm_part_helper.h"
13 13
14#define MY_CLASS EFL_UI_ALERT_POPUP_CLASS 14#define MY_CLASS EFL_UI_ALERT_POPUP_CLASS
@@ -257,18 +257,42 @@ _efl_ui_alert_popup_efl_object_destructor(Eo *obj, Efl_Ui_Alert_Popup_Data *pd)
257} 257}
258 258
259static Eina_Bool 259static Eina_Bool
260_part_is_efl_ui_alert_popup_part(const Eo *obj, const char *part) 260_part_is_efl_ui_alert_popup_part_title(const Eo *obj, const char *part)
261{ 261{
262 if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) return EINA_FALSE; 262 if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) return EINA_FALSE;
263 return eina_streq(part, "efl.text.title"); 263 return eina_streq(part, "efl.text.title");
264} 264}
265 265
266/* Efl.Part begin */ 266/* Efl.Part begin */
267ELM_PART_OVERRIDE_PARTIAL(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, 267EOLIAN static Efl_Object *
268 Efl_Ui_Alert_Popup_Data, _part_is_efl_ui_alert_popup_part) 268_efl_ui_alert_popup_efl_part_part_get(const Eo *obj, Efl_Ui_Alert_Popup_Data *priv EINA_UNUSED, const char *part)
269ELM_PART_OVERRIDE_TEXT_SET(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, Efl_Ui_Alert_Popup_Data) 269{
270ELM_PART_OVERRIDE_TEXT_GET(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, Efl_Ui_Alert_Popup_Data) 270 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
271#include "efl_ui_alert_popup_part.eo.c" 271 if (_part_is_efl_ui_alert_popup_part_title(obj, part))
272 return ELM_PART_IMPLEMENT(EFL_UI_ALERT_POPUP_PART_TITLE_CLASS, obj, part);
273 return efl_part_get(efl_super(obj, EFL_UI_ALERT_POPUP_CLASS), part);
274}
275
276EOLIAN static void
277_efl_ui_alert_popup_part_title_efl_text_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *text)
278{
279 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
280 Efl_Ui_Alert_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_ALERT_POPUP_CLASS);
281
282 _efl_ui_alert_popup_text_set(pd->obj, sd, pd->part, text);
283}
284
285EOLIAN static const char*
286_efl_ui_alert_popup_part_title_efl_text_text_get(const Eo *obj, void *_pd EINA_UNUSED)
287{
288 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
289 Efl_Ui_Alert_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_ALERT_POPUP_CLASS);
290
291 return _efl_ui_alert_popup_text_get(pd->obj, sd, pd->part);
292}
293
294
295#include "efl_ui_alert_popup_part_title.eo.c"
272 296
273/* Efl.Part end */ 297/* Efl.Part end */
274EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_alert_popup) 298EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_alert_popup)
diff --git a/src/lib/elementary/efl_ui_alert_popup.eo b/src/lib/elementary/efl_ui_alert_popup.eo
index c154bb2..3f05898 100644
--- a/src/lib/elementary/efl_ui_alert_popup.eo
+++ b/src/lib/elementary/efl_ui_alert_popup.eo
@@ -45,6 +45,9 @@ class Efl.Ui.Alert_Popup extends Efl.Ui.Popup
45 } 45 }
46 } 46 }
47 } 47 }
48 parts {
49 title : Efl.Ui.Alert_Popup_Part_Title; [[The title text of Alert Popup.]]
50 }
48 implements { 51 implements {
49 Efl.Object.constructor; 52 Efl.Object.constructor;
50 Efl.Object.destructor; 53 Efl.Object.destructor;
diff --git a/src/lib/elementary/efl_ui_alert_popup_part.eo b/src/lib/elementary/efl_ui_alert_popup_part.eo
deleted file mode 100644
index b5860a9..0000000
--- a/src/lib/elementary/efl_ui_alert_popup_part.eo
+++ /dev/null
@@ -1,8 +0,0 @@
1class @beta Efl.Ui.Alert_Popup_Part extends Efl.Ui.Layout_Part_Text
2{
3 [[Efl UI Alert Popup internal part class]]
4 data: null;
5 implements {
6 Efl.Text.text { get; set; }
7 }
8}
diff --git a/src/lib/elementary/efl_ui_alert_popup_part_title.eo b/src/lib/elementary/efl_ui_alert_popup_part_title.eo
new file mode 100644
index 0000000..ca75aba
--- /dev/null
+++ b/src/lib/elementary/efl_ui_alert_popup_part_title.eo
@@ -0,0 +1,11 @@
1class Efl.Ui.Alert_Popup_Part_Title extends Efl.Ui.Layout_Part_Text
2{
3 [[Efl UI Alert Popup internal part class.
4
5 @since 1.24
6 ]]
7 data: null;
8 implements {
9 Efl.Text.text { get; set; }
10 }
11}
diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c
deleted file mode 100644
index 82aba0f..0000000
--- a/src/lib/elementary/efl_ui_animation_view.c
+++ /dev/null
@@ -1,772 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_ACCESS_OBJECT_PROTECTED
6
7#include <Elementary.h>
8
9#include "elm_priv.h"
10#include "efl_ui_animation_view_private.h"
11
12#define MY_CLASS EFL_UI_ANIMATION_VIEW_CLASS
13
14#define MY_CLASS_NAME "Efl_Ui_Animation_View"
15#define MY_CLASS_NAME_LEGACY "efl_ui_animation_view"
16
17static const char SIG_FOCUSED[] = "focused";
18static const char SIG_UNFOCUSED[] = "unfocused";
19static const char SIG_PLAY_START[] = "play,start";
20static const char SIG_PLAY_REPEAT[] = "play,repeat";
21static const char SIG_PLAY_DONE[] = "play,done";
22static const char SIG_PLAY_PAUSE[] = "play,pause";
23static const char SIG_PLAY_RESUME[] = "play,resume";
24static const char SIG_PLAY_STOP[] = "play,stop";
25static const char SIG_PLAY_UPDATE[] = "play,update";
26
27/* smart callbacks coming from Efl_Ui_Animation_View objects: */
28static const Evas_Smart_Cb_Description _smart_callbacks[] = {
29 {SIG_FOCUSED, ""},
30 {SIG_UNFOCUSED, ""},
31 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
32 {SIG_PLAY_START, ""},
33 {SIG_PLAY_REPEAT, ""},
34 {SIG_PLAY_DONE, ""},
35 {SIG_PLAY_PAUSE, ""},
36 {SIG_PLAY_RESUME, ""},
37 {SIG_PLAY_STOP, ""},
38 {NULL, NULL}
39};
40
41static void
42_sizing_eval(Eo *obj, void *data)
43{
44 Efl_Ui_Animation_View_Data *pd = data;
45 if (!efl_file_loaded_get(obj)) return;
46
47 double hw,hh;
48 efl_gfx_hint_weight_get(obj, &hw, &hh);
49
50 Eina_Size2D size = efl_canvas_vg_object_default_size_get(pd->vg);
51
52 Eina_Size2D min = {-1, -1};
53 if (hw == 0) min.w = size.w;
54 if (hh == 0) min.h = size.h;
55
56 efl_gfx_hint_size_min_set(obj, min);
57}
58
59static void
60_size_hint_event_cb(void *data, const Efl_Event *event)
61{
62 _sizing_eval(event->object, data);
63}
64
65static void
66_transit_go_facade(Eo* obj, Efl_Ui_Animation_View_Data *pd)
67{
68 pd->repeat_times = 0;
69 if (pd->play_back)
70 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK;
71 else
72 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
73 evas_object_smart_callback_call(obj, SIG_PLAY_START, NULL);
74 if (pd->transit) elm_transit_go(pd->transit);
75}
76
77static Eina_Bool
78_visible_check(Eo *obj)
79{
80 if (!efl_gfx_entity_visible_get(obj)) return EINA_FALSE;
81
82 //TODO: Check Smart parents visibilities?
83
84 Eina_Size2D size = efl_gfx_entity_size_get(obj);
85 if (size.w == 0 || size.h == 0) return EINA_FALSE;
86
87 Evas_Coord output_w, output_h;
88 evas_output_size_get(evas_object_evas_get(obj), &output_w, &output_h);
89
90 Eina_Position2D pos = efl_gfx_entity_position_get(obj);
91
92 //Outside viewport
93 if ((pos.x + size.w < 0) || (pos.x > output_w) ||
94 (pos.y + size.h < 0) || (pos.y > output_h))
95 return EINA_FALSE;
96
97 //Inside viewport
98 return EINA_TRUE;
99}
100
101static void
102_auto_play(Eo *obj, Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
103{
104 if (!pd->auto_play || !pd->transit) return;
105
106 //Resume Animation
107 if (vis)
108 {
109 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PAUSE && pd->auto_play_pause)
110 {
111 elm_transit_paused_set(pd->transit, EINA_FALSE);
112 if (pd->play_back)
113 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK;
114 else
115 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
116 pd->auto_play_pause = EINA_FALSE;
117 evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL);
118 }
119 }
120 //Pause Animation
121 else
122 {
123 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) ||
124 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK))
125 {
126 elm_transit_paused_set(pd->transit, EINA_TRUE);
127 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE;
128 pd->auto_play_pause = EINA_TRUE;
129 evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
130 }
131 }
132}
133
134static void
135_transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
136{
137 Eo *obj = (Eo *) effect;
138 EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd);
139 if (!pd) return;
140
141 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY && pd->progress == 1) ||
142 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK && pd->progress == 0))
143 evas_object_smart_callback_call(obj, SIG_PLAY_DONE, NULL);
144
145 if (pd->transit != transit) return;
146
147 Efl_Ui_Animation_View_State prev_state = pd->state;
148 pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
149 pd->transit = NULL;
150 pd->auto_play_pause = EINA_FALSE;
151
152 if (prev_state != EFL_UI_ANIMATION_VIEW_STATE_STOP)
153 {
154 evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL);
155 pd->progress = 0;
156 }
157}
158
159static void
160_transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
161{
162 Eo *obj = (Eo *) effect;
163 EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd);
164
165 if (!pd || !pd->vg)
166 {
167 ERR("Vector Object is removed in wrong way!, Efl_Ui_Animation_View = %p", obj);
168 elm_transit_del(transit);
169 return;
170 }
171
172 if (pd->play_back)
173 {
174 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK;
175 progress = 1 - progress;
176 }
177 else pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
178
179 pd->progress = progress;
180 int minframe = (pd->frame_cnt - 1) * pd->min_progress;
181 int maxframe = (pd->frame_cnt - 1) * pd->max_progress;
182
183 int update_frame = (int)((maxframe - minframe) * progress) + minframe;
184 int current_frame = evas_object_vg_animated_frame_get(pd->vg);
185 evas_object_vg_animated_frame_set(pd->vg, update_frame);
186
187 if (pd->auto_repeat)
188 {
189 int repeat_times = elm_transit_current_repeat_times_get(pd->transit);
190 if (pd->repeat_times != repeat_times)
191 {
192 evas_object_smart_callback_call(obj, SIG_PLAY_REPEAT, NULL);
193 pd->repeat_times = repeat_times;
194 }
195 }
196
197 //transit_cb is always called with a progress value 0 ~ 1.
198 //SIG_PLAY_UPDATE callback is called only when there is a real change.
199 if (update_frame != current_frame)
200 evas_object_smart_callback_call(obj, SIG_PLAY_UPDATE, NULL);
201}
202
203EOLIAN static void
204_efl_ui_animation_view_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Animation_View_Data *priv)
205{
206 efl_canvas_group_add(efl_super(obj, MY_CLASS));
207 elm_widget_sub_object_parent_add(obj);
208
209 // Create vg to render vector animation
210 Eo *vg = evas_object_vg_add(evas_object_evas_get(obj));
211 elm_widget_resize_object_set(obj, vg);
212 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _size_hint_event_cb, priv);
213
214 priv->vg = vg;
215 priv->speed = 1;
216 priv->frame_duration = 0;
217 priv->min_progress = 0.0;
218 priv->max_progress = 1.0;
219}
220
221EOLIAN static void
222_efl_ui_animation_view_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
223{
224 if (pd->transit)
225 {
226 Elm_Transit *transit = pd->transit;
227 pd->transit = NULL; //Skip perform transit_del_cb()
228 elm_transit_del(transit);
229 }
230 pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY;
231
232 efl_canvas_group_del(efl_super(obj, MY_CLASS));
233}
234
235EOLIAN static void
236_efl_ui_animation_view_efl_object_destructor(Eo *obj,
237 Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
238{
239 Efl_Gfx_Vg_Value_Provider *vp;
240 EINA_LIST_FREE(pd->vp_list, vp)
241 efl_unref(vp);
242 eina_list_free(pd->vp_list);
243
244 efl_destructor(efl_super(obj, MY_CLASS));
245}
246
247EOLIAN static Eo *
248_efl_ui_animation_view_efl_object_constructor(Eo *obj,
249 Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
250{
251 obj = efl_constructor(efl_super(obj, MY_CLASS));
252 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
253 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
254
255 return obj;
256}
257
258static void
259_update_frame_duration(Efl_Ui_Animation_View_Data *pd)
260{
261 int frame_count = evas_object_vg_animated_frame_count_get(pd->vg);
262 int min_frame = (frame_count - 1) * pd->min_progress;
263 int max_frame = (frame_count - 1) * pd->max_progress;
264 double frame_rate = round((double)frame_count / evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0));
265
266 pd->frame_duration = (double)(max_frame - min_frame) / frame_rate;
267 if (pd->transit)
268 elm_transit_duration_set(pd->transit, pd->frame_duration * (1/pd->speed));
269}
270
271static Eina_Bool
272_ready_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
273{
274 pd->auto_play_pause = EINA_FALSE;
275 pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
276
277 if (pd->transit) elm_transit_del(pd->transit);
278
279 pd->frame_cnt = (double) evas_object_vg_animated_frame_count_get(pd->vg);
280 pd->frame_duration = evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0);
281 evas_object_vg_animated_frame_set(pd->vg, 0);
282
283 if (pd->frame_duration > 0)
284 {
285 Elm_Transit *transit = elm_transit_add();
286 elm_transit_object_add(transit, pd->vg);
287 if (pd->auto_repeat) elm_transit_repeat_times_set(transit, -1);
288 elm_transit_effect_add(transit, _transit_cb, obj, _transit_del_cb);
289 elm_transit_progress_value_set(transit, pd->progress);
290 elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
291 pd->transit = transit;
292 if (pd->min_progress != 0.0 || pd->max_progress != 1.0)
293 _update_frame_duration(pd);
294 else
295 elm_transit_duration_set(transit, pd->frame_duration * (1/pd->speed));
296
297 return EINA_TRUE;
298 }
299 return EINA_FALSE;
300}
301
302EOLIAN static void
303_efl_ui_animation_view_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
304{
305 pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY;
306 pd->frame_cnt = 0;
307 pd->frame_duration = 0;
308 if (pd->transit) elm_transit_del(pd->transit);
309}
310
311EOLIAN static Eina_Error
312_efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd)
313{
314 Eina_Error err;
315 Eina_Bool ret;
316 const char *file;
317 const char *key;
318
319 if (efl_file_loaded_get(obj)) return 0;
320
321 err = efl_file_load(efl_super(obj, MY_CLASS));
322 if (err) return err;
323
324 file = efl_file_get(obj);
325 key = efl_file_key_get(obj);
326 ret = efl_file_simple_load(pd->vg, file, key);
327 if (!ret)
328 {
329 efl_file_unload(obj);
330 return eina_error_get();
331 }
332
333 pd->progress = 0;
334
335 _sizing_eval(obj, pd);
336
337 if (!_ready_play(obj, pd)) return 1;
338
339 if (pd->auto_play)
340 {
341 _transit_go_facade(obj, pd);
342
343 if (!_visible_check(obj))
344 {
345 elm_transit_paused_set(pd->transit, EINA_TRUE);
346 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE;
347 pd->auto_play_pause = EINA_TRUE;
348 evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
349 }
350 }
351 return 0;
352}
353
354EOLIAN static void
355_efl_ui_animation_view_efl_gfx_entity_position_set(Eo *obj,
356 Efl_Ui_Animation_View_Data *pd,
357 Eina_Position2D pos EINA_UNUSED)
358{
359 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
360 return;
361
362 efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
363
364 _auto_play(obj, pd, _visible_check(obj));
365}
366
367EOLIAN static void
368_efl_ui_animation_view_efl_gfx_entity_size_set(Eo *obj,
369 Efl_Ui_Animation_View_Data *pd,
370 Eina_Size2D size)
371{
372 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h))
373 return;
374
375 efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
376
377 _sizing_eval(obj, pd);
378
379 _auto_play(obj, pd, _visible_check(obj));
380}
381
382EOLIAN static void
383_efl_ui_animation_view_efl_gfx_entity_visible_set(Eo *obj,
384 Efl_Ui_Animation_View_Data *pd,
385 Eina_Bool vis)
386{
387 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
388 return;
389
390 efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis);
391
392 _auto_play(obj, pd, _visible_check(obj));
393}
394
395EOLIAN static void
396_efl_ui_animation_view_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED,
397 Efl_Ui_Animation_View_Data *pd,
398 Eina_Size2D size)
399{
400 Eina_Rect viewbox;
401 viewbox.x = viewbox.y =0;
402 viewbox.w = size.w;
403 viewbox.h = size.h;
404
405 efl_canvas_vg_object_viewbox_set(pd->vg, viewbox);
406}
407
408EOLIAN Eina_Size2D
409_efl_ui_animation_view_efl_gfx_view_view_size_get(const Eo *obj EINA_UNUSED,
410 Efl_Ui_Animation_View_Data *pd)
411{
412 Eina_Rect viewbox = efl_canvas_vg_object_viewbox_get(pd->vg);
413
414 return EINA_SIZE2D(viewbox.w, viewbox.h);
415}
416
417EOLIAN static void
418_efl_ui_animation_view_auto_repeat_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, Eina_Bool auto_repeat)
419{
420 if (pd->auto_repeat == auto_repeat) return;
421 pd->auto_repeat = auto_repeat;
422 if (pd->transit)
423 {
424 if (auto_repeat) elm_transit_repeat_times_set(pd->transit, -1);
425 else elm_transit_repeat_times_set(pd->transit, 0);
426 }
427}
428
429EOLIAN static Eina_Bool
430_efl_ui_animation_view_auto_repeat_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
431{
432 return pd->auto_repeat;
433}
434
435EOLIAN static void
436_efl_ui_animation_view_auto_play_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd,
437 Eina_Bool auto_play)
438{
439 pd->auto_play = auto_play;
440 if (!auto_play) pd->auto_play_pause = EINA_FALSE;
441}
442
443EOLIAN static Eina_Bool
444_efl_ui_animation_view_auto_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
445{
446 return pd->auto_play;
447}
448
449EOLIAN static Eina_Bool
450_efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
451{
452 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) return EINA_FALSE;
453
454 Eina_Bool rewind = EINA_FALSE;
455 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK) rewind = EINA_TRUE;
456
457 pd->play_back = EINA_FALSE;
458 pd->auto_play_pause = EINA_FALSE;
459
460 if (!efl_file_loaded_get(obj)) return EINA_FALSE;
461 if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE;
462
463 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
464 _transit_go_facade(obj, pd);
465 else if (rewind)
466 elm_transit_progress_value_set(pd->transit, pd->progress);
467
468 return EINA_TRUE;
469}
470
471EOLIAN static Eina_Bool
472_efl_ui_animation_view_stop(Eo *obj, Efl_Ui_Animation_View_Data *pd)
473{
474 if (!pd->transit) return EINA_FALSE;
475
476 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_NOT_READY) ||
477 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP))
478 return EINA_FALSE;
479
480 evas_object_vg_animated_frame_set(pd->vg, 0);
481 pd->progress = 0;
482 pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
483 evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL);
484 elm_transit_del(pd->transit);
485
486 return EINA_TRUE;
487}
488
489EOLIAN static Eina_Bool
490_efl_ui_animation_view_pause(Eo *obj, Efl_Ui_Animation_View_Data *pd)
491{
492 if (!pd->transit) return EINA_FALSE;
493
494 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) ||
495 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK))
496 {
497 elm_transit_paused_set(pd->transit, EINA_TRUE);
498 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE;
499 pd->auto_play_pause = EINA_FALSE;
500 evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
501 return EINA_TRUE;
502 }
503
504 return EINA_FALSE;
505}
506
507EOLIAN static Eina_Bool
508_efl_ui_animation_view_resume(Eo *obj, Efl_Ui_Animation_View_Data *pd)
509{
510 if (!pd->transit) return EINA_FALSE;
511
512 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PAUSE)
513 {
514 elm_transit_paused_set(pd->transit, EINA_FALSE);
515 if (pd->play_back)
516 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK;
517 else
518 pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
519 pd->auto_play_pause = EINA_FALSE;
520
521 evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL);
522
523 return EINA_TRUE;
524 }
525
526 return EINA_FALSE;
527}
528
529EOLIAN static Eina_Bool
530_efl_ui_animation_view_play_back(Eo *obj, Efl_Ui_Animation_View_Data *pd)
531{
532 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK) return EINA_FALSE;
533
534 Eina_Bool rewind = EINA_FALSE;
535 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) rewind = EINA_TRUE;
536
537 pd->play_back = EINA_TRUE;
538 pd->auto_play_pause = EINA_FALSE;
539
540 if (!efl_file_loaded_get(obj)) return EINA_FALSE;
541 if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE;
542
543 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
544 {
545 if (pd->progress == 0) pd->progress = 1.0;
546 _transit_go_facade(obj, pd);
547 }
548 else if (rewind)
549 elm_transit_progress_value_set(pd->transit, 1 - pd->progress);
550
551 return EINA_TRUE;
552}
553
554EOLIAN static Eina_Bool
555_efl_ui_animation_view_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double speed)
556{
557 if (speed <= 0) return EINA_FALSE;
558 pd->speed = speed;
559
560 if (pd->transit)
561 elm_transit_duration_set(pd->transit, pd->frame_duration * (1/pd->speed));
562
563 return EINA_TRUE;
564}
565
566EOLIAN static void
567_efl_ui_animation_view_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress)
568{
569 if (progress < 0) progress = 0;
570 else if (progress > 1) progress = 1;
571 if (pd->progress == progress) return;
572
573 pd->progress = progress;
574
575 if (pd->frame_cnt > 0)
576 evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress));
577
578 if (pd->transit)
579 {
580 if (pd->play_back)
581 elm_transit_progress_value_set(pd->transit, 1 - progress);
582 else
583 elm_transit_progress_value_set(pd->transit, progress);
584 }
585}
586
587EOLIAN static double
588_efl_ui_animation_view_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
589{
590 return pd->progress;
591}
592
593EOLIAN static void
594_efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num)
595{
596 efl_ui_animation_view_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1));
597}
598
599EOLIAN static int
600_efl_ui_animation_view_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
601{
602 double progress = (pd->progress * (pd->max_progress - pd->min_progress)) + pd->min_progress;
603 return (int) ((double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1) * progress);
604}
605
606EOLIAN static double
607_efl_ui_animation_view_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
608{
609 return pd->speed;
610}
611
612EOLIAN static double
613_efl_ui_animation_view_duration_time_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
614{
615 return pd->frame_duration;
616}
617
618EOLIAN static Eina_Size2D
619_efl_ui_animation_view_default_view_size_get(const Eo *obj EINA_UNUSED,
620 Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
621{
622 return efl_canvas_vg_object_default_size_get(pd->vg);
623}
624
625EOLIAN static Efl_Ui_Animation_View_State
626_efl_ui_animation_view_state_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
627{
628 return pd->state;
629}
630
631EOLIAN static Eina_Bool
632_efl_ui_animation_view_is_playing_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
633{
634 return pd->play_back;
635}
636
637EOLIAN static int
638_efl_ui_animation_view_frame_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
639{
640 return efl_gfx_frame_controller_frame_count_get(pd->vg);
641}
642
643EOLIAN static void
644_efl_ui_animation_view_min_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double min_progress)
645{
646 if (min_progress < 0.0 || min_progress > 1.0 || min_progress > pd->max_progress) return;
647
648 pd->min_progress = min_progress;
649 _update_frame_duration(pd);
650}
651
652EOLIAN static double
653_efl_ui_animation_view_min_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
654{
655 return pd->min_progress;
656}
657
658EOLIAN static void
659_efl_ui_animation_view_max_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double max_progress)
660{
661 if (max_progress < 0.0 || max_progress > 1.0 || max_progress < pd->min_progress) return;
662
663 pd->max_progress = max_progress;
664 _update_frame_duration(pd);
665}
666
667EOLIAN static double
668_efl_ui_animation_view_max_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
669{
670 return pd->max_progress;
671}
672
673EOLIAN static void
674_efl_ui_animation_view_min_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int min_frame)
675{
676 int frame_count = evas_object_vg_animated_frame_count_get(pd->vg);
677 if (min_frame < 0) min_frame = 0;
678 else
679 {
680 int max_frame = (frame_count - 1) * pd->max_progress;
681 if (min_frame > max_frame) min_frame = max_frame;
682 }
683
684 pd->min_progress = (double)min_frame / (double)(frame_count - 1);
685 _update_frame_duration(pd);
686}
687
688EOLIAN static int
689_efl_ui_animation_view_min_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
690{
691 return pd->min_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1);
692}
693
694EOLIAN static void
695_efl_ui_animation_view_max_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int max_frame)
696{
697 int frame_count = evas_object_vg_animated_frame_count_get(pd->vg);
698 if (max_frame > frame_count - 1) max_frame = frame_count - 1;
699 else
700 {
701 int min_frame = (frame_count - 1) * pd->min_progress;
702 if (min_frame > max_frame) max_frame = min_frame;
703 }
704
705 pd->max_progress = (double)max_frame / (double)(frame_count - 1);
706 _update_frame_duration(pd);
707}
708
709EOLIAN static int
710_efl_ui_animation_view_max_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
711{
712 return pd->max_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1);
713}
714
715EOLIAN static void
716_efl_ui_animation_view_value_provider_override(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, Efl_Gfx_Vg_Value_Provider *value_provider)
717{
718 if (!value_provider) return;
719
720 if (pd->vp_list)
721 {
722 const char *keypath1 = efl_gfx_vg_value_provider_keypath_get(value_provider);
723 if (!keypath1)
724 {
725 ERR("Couldn't override Value Provider(%p). Keypath is NULL.", value_provider);
726 return;
727 }
728 const Eina_List *l;
729 Efl_Gfx_Vg_Value_Provider *_vp;
730 EINA_LIST_FOREACH(pd->vp_list, l, _vp)
731 {
732 const char *keypath2 = efl_gfx_vg_value_provider_keypath_get(_vp);
733 if (!strcmp(keypath1, keypath2))
734 {
735 pd->vp_list = eina_list_remove(pd->vp_list, _vp);
736 efl_unref(_vp);
737 break;
738 }
739 }
740 }
741
742 efl_ref(value_provider);
743 pd->vp_list = eina_list_append(pd->vp_list, value_provider);
744 efl_key_data_set(pd->vg, "_vg_value_providers", pd->vp_list);
745}
746
747EAPI Elm_Animation_View*
748elm_animation_view_add(Evas_Object *parent)
749{
750 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
751 return elm_legacy_add(MY_CLASS, parent);
752}
753
754EAPI Eina_Bool
755elm_animation_view_file_set(Elm_Animation_View *obj, const char *file, const char *key)
756{
757 return efl_file_simple_load(obj, file, key);
758}
759
760EAPI Elm_Animation_View_State
761elm_animation_view_state_get(Elm_Animation_View *obj)
762{
763 return efl_ui_animation_view_state_get(obj);
764}
765
766/* Internal EO APIs and hidden overrides */
767
768#define EFL_UI_ANIMATION_VIEW_EXTRA_OPS \
769 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_animation_view)
770
771#include "efl_ui_animation_view_eo.legacy.c"
772#include "efl_ui_animation_view.eo.c"
diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo
deleted file mode 100644
index 2d090bb..0000000
--- a/src/lib/elementary/efl_ui_animation_view.eo
+++ /dev/null
@@ -1,294 +0,0 @@
1
2enum @beta Efl.Ui.Animation_View_State
3{
4 [[State of animation view]]
5 not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file.]]
6 play, [[Animation is playing. See @Efl.Ui.Animation_View.play.]]
7 play_back, [[Animation is playing back (rewinding). See @Efl.Ui.Animation_View.play_back.]]
8 pause, [[Animation has been paused. To continue animation call @Efl.Ui.Animation_View.resume.
9 See @Efl.Ui.Animation_View.pause.]]
10 stop [[Animation view successfully loaded a file then readied for playing.
11 Otherwise after finished animation or stopped forcibly by request. See @Efl.Ui.Animation_View.stop.]]
12}
13
14class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.File
15{
16 [[Elementary Animation view class.
17 Animation view is designed to show and play animation of
18 vector graphics based content. It hides all @Efl.Canvas.Vg.Object details
19 but just open an API to read vector data from file. Also, it implements
20 details of animation control methods of Vector.
21
22 Vector data could contain static or animatable vector elements including
23 animation information. Available vector data file formats are SVG, JSON and EET.
24 @Efl.Ui.Animation_View currently only supports the animation information contained in
25 JSON (known as Lottie file as well) and EET files.
26 ]]
27 event_c_prefix: efl_ui_animation_view;
28 methods {
29 @property auto_play {
30 [[Animation will be started automatically when it's possible.
31
32 If @.auto_play is $true, animation will be started when it's readied.
33 The condition of $auto play is when animation view opened file successfully,
34 yet to play it plus when the object is visible.
35 If animation view is disabled, invisible,
36 it turns to pause state then resume animation when it's visible again.
37
38 $true Enable auto play mode, disable otherwise.
39
40 Warning: This auto play will be only affected to the next animation source.
41 So must be called before setting animation file.
42 ]]
43 set {
44 }
45 get {
46 }
47 values {
48 auto_play: bool(false); [[Auto play mode.]]
49 }
50 }
51 @property auto_repeat {
52 [[Turn on/off animation looping.
53
54 If @.auto_repeat is $true, it repeats animation when animation frame is reached to
55 end. This auto repeat mode is valid to both play and play_back cases.
56
57 $true Enable auto play mode, disable otherwise.
58 ]]
59 set {
60 }
61 get {
62 }
63 values {
64 auto_repeat: bool; [[Loop mode, Default is $false.]]
65 }
66 }
67 @property speed {
68 [[Control animation speed.
69
70 Control animation speed by multiplying $speed value. If you want to play
71 animation double-time faster, you can give $speed 2. If you want to play
72 animation double-time slower, you can give $speed 0.5.
73
74 Warning: speed must be greater than zero.
75 ]]
76 set {
77 return: bool; [[$true when it's successful. $false otherwise.]]
78 }
79 get {
80 }
81 values {
82 speed: double(1.0); [[Speed factor.]]
83 }
84 }
85 @property duration_time {
86 [[Get the duration of animation in seconds.
87
88 This API returns total duration time of current animation in the seconds.
89 If current animation source isn't animatable, it returns zero.
90 ]]
91 get {
92 }
93 values {
94 frame_duration: double; [[duration time in the seconds]]
95 }
96 }
97 @property progress {
98 [[Set current progress position of animation view object.
99
100 When you required to jump on a certain frame instantly,
101 you can change current position by using this API.
102
103 Warning: The range of progress is 0 ~ 1.
104 ]]
105 set {
106 }
107 get {
108 }
109 values {
110 progress: double; [[Progress position. Value must be 0 ~ 1.]]
111 }
112 }
113 @property frame {
114 [[Number of current frame.
115
116 Ranges from 0 to @.frame_count - 1.
117 ]]
118 set {
119 }
120 get {
121 }
122 values {
123 frame_num: int; [[Current frame number.]]
124 }
125 }
126 play {
127 [[Play animation one time instantly when it's available.
128
129 If current keyframe is on a certain position by playing back, this will
130 play forward from there.
131
132 Warning: Play request will be ignored if animation source is not set yet or
133 animation is paused state or it's already on playing.
134 ]]
135
136 return: bool; [[$true when it's successful. $false otherwise.]]
137 }
138 play_back {
139 [[Play back animation one time instantly when it's available.
140
141 If current keyframe is on a certain position by playing, this will
142 play backward from there.
143
144 Warning: Play back request will be ignored if animation source is not set yet or
145 animation is paused state or it's already on playing back.
146 ]]
147
148 return: bool; [[$true when it's successful. $false otherwise.]]
149 }
150 pause {
151 [[Pause current animation instantly.
152
153 Once animation is paused, animation view must get resume to play continue again.
154
155 Warning: Animation must be on playing or playing back status.
156 ]]
157
158 return: bool; [[$true when it's successful. $false otherwise.]]
159 }
160 resume {
161 [[Resume paused animation to continue animation.
162
163 Warning: This resume must be called on animation paused status.
164 ]]
165
166 return: bool; [[$true when it's successful. $false otherwise.]]
167 }
168 stop {
169 [[Stop playing animation.
170
171 Stop animation instantly regardless of its status and reset to
172 show first frame of animation. Even though current animation is paused,
173 the animation status will be stopped.
174 ]]
175
176 return: bool; [[$true when it's successful. $false otherwise.]]
177 }
178 @property default_view_size {
179 [[The default view size that specified from vector resource.
180 ]]
181 get {
182 }
183 values {
184 size: Eina.Size2D;
185 }
186 }
187 @property state {
188 [[Current animation view state.
189 See @Efl.Ui.Animation_View_State
190 ]]
191 get{
192 }
193 values {
194 state: Efl.Ui.Animation_View_State; [[Current animation view state]]
195 }
196 }
197 is_playing_back {
198 [[Returns the status whether current animation is on playing forward or backward.
199 Note: If animation view is not on playing, it will return $false.
200 ]]
201 return: bool; [[$true, if animation on playing back, $false otherwise.]]
202 }
203 @property frame_count {
204 [[The index of end frame of the animation view, if it's animated.
205 Note : frame number starts with 0.
206 ]]
207 get {
208 }
209 values {
210 frame_count: int; [[The number of frames. 0, if it's not animated.]]
211 }
212 }
213 @property min_progress {
214 [[The start progress of the play.
215 ]]
216 set {
217 }
218 get {
219 }
220 values {
221 min_progress: double(0.0); [[The minimum progress. Value must be 0 ~ 1.]]
222 }
223 }
224 @property max_progress {
225 [[The last progress of the play.
226 ]]
227 set {
228 }
229 get {
230 }
231 values {
232 max_progress: double(1.0); [[The maximum progress. Value must be 0 ~ 1.]]
233 }
234 }
235 @property min_frame {
236 [[The start frame of the play.
237 ]]
238 set {
239 }
240 get {
241 }
242 values {
243 min_frame: int(0); [[The minimum frame for play. Value must be 0 ~ @.max_frame]]
244 }
245 }
246 @property max_frame {
247 [[The last frame of the play.
248 ]]
249 set {
250 }
251 get {
252 }
253 values {
254 max_frame: int; [[The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1).
255 The default value is @.frame_count - 1.
256 ]]
257 }
258 }
259 value_provider_override{
260 [[Override each value of the animation object.
261 Values can be properties of Efl.Gfx.Vg.Value_provider such as color and matrix information.
262
263 Example:
264 Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, NULL);
265 @Efl.Gfx.Vg.Value_Provider.keypath.set(vp, "SomeLayer:SomeObject:SomeContents");
266 // Set vp property
267 @.value_provider_override(target_animation_view, vg);
268 See @Efl.Gfx.Vg.Value_Provider
269 ]]
270 params {
271 value_provider: Efl.Gfx.Vg.Value_Provider; [[ Override the values of the animation object. this should have keypath infomation. See @Efl.Gfx.Vg.Value_Provider ]]
272 }
273 }
274 }
275 implements {
276 Efl.Object.constructor;
277 Efl.Object.destructor;
278 Efl.File.load;
279 Efl.File.unload;
280 Efl.Gfx.Entity.visible { set; }
281 Efl.Gfx.Entity.position { set; }
282 Efl.Gfx.Entity.size { set; }
283 Efl.Gfx.View.view_size { set; get; }
284 }
285 events {
286 play,start: void; [[Called when animation is just started]]
287 play,repeat: void; [[Called when animation is just repeated]]
288 play,done: void; [[Called when animation is just finished]]
289 play,pause: void; [[Called when animation is just paused]]
290 play,resume: void; [[Called when animation is just resumed]]
291 play,stop: void; [[Called when animation is just stopped]]
292 play,update: void; [[Called when animation is just updated]]
293 }
294}
diff --git a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c b/src/lib/elementary/efl_ui_animation_view_eo.legacy.c
deleted file mode 100644
index 87ed323..0000000
--- a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c
+++ /dev/null
@@ -1,162 +0,0 @@
1
2EAPI void
3elm_animation_view_auto_play_set(Efl_Ui_Animation_View *obj, Eina_Bool auto_play)
4{
5 efl_ui_animation_view_auto_play_set(obj, auto_play);
6}
7
8EAPI Eina_Bool
9elm_animation_view_auto_play_get(const Efl_Ui_Animation_View *obj)
10{
11 return efl_ui_animation_view_auto_play_get(obj);
12}
13
14EAPI void
15elm_animation_view_auto_repeat_set(Efl_Ui_Animation_View *obj, Eina_Bool auto_repeat)
16{
17 efl_ui_animation_view_auto_repeat_set(obj, auto_repeat);
18}
19
20EAPI Eina_Bool
21elm_animation_view_auto_repeat_get(const Efl_Ui_Animation_View *obj)
22{
23 return efl_ui_animation_view_auto_repeat_get(obj);
24}
25
26EAPI Eina_Bool
27elm_animation_view_speed_set(Efl_Ui_Animation_View *obj, double speed)
28{
29 return efl_ui_animation_view_speed_set(obj, speed);
30}
31
32EAPI double
33elm_animation_view_speed_get(const Efl_Ui_Animation_View *obj)
34{
35 return efl_ui_animation_view_speed_get(obj);
36}
37
38EAPI double
39elm_animation_view_duration_time_get(const Efl_Ui_Animation_View *obj)
40{
41 return efl_ui_animation_view_duration_time_get(obj);
42}
43
44EAPI void
45elm_animation_view_progress_set(Efl_Ui_Animation_View *obj, double progress)
46{
47 efl_ui_animation_view_progress_set(obj, progress);
48}
49
50EAPI double
51elm_animation_view_progress_get(const Efl_Ui_Animation_View *obj)
52{
53 return efl_ui_animation_view_progress_get(obj);
54}
55
56EAPI void
57elm_animation_view_frame_set(Efl_Ui_Animation_View *obj, int frame_num)
58{
59 efl_ui_animation_view_frame_set(obj, frame_num);
60}
61
62EAPI int
63elm_animation_view_frame_get(const Efl_Ui_Animation_View *obj)
64{
65 return efl_ui_animation_view_frame_get(obj);
66}
67
68EAPI Eina_Bool
69elm_animation_view_play(Efl_Ui_Animation_View *obj)
70{
71 return efl_ui_animation_view_play(obj);
72}
73
74EAPI Eina_Bool
75elm_animation_view_play_back(Efl_Ui_Animation_View *obj)
76{
77 return efl_ui_animation_view_play_back(obj);
78}
79
80EAPI Eina_Bool
81elm_animation_view_pause(Efl_Ui_Animation_View *obj)
82{
83 return efl_ui_animation_view_pause(obj);
84}
85
86EAPI Eina_Bool
87elm_animation_view_resume(Efl_Ui_Animation_View *obj)
88{
89 return efl_ui_animation_view_resume(obj);
90}
91
92EAPI Eina_Bool
93elm_animation_view_stop(Efl_Ui_Animation_View *obj)
94{
95 return efl_ui_animation_view_stop(obj);
96}
97
98EAPI Eina_Size2D
99elm_animation_view_default_size_get(const Efl_Ui_Animation_View *obj)
100{
101 return efl_ui_animation_view_default_view_size_get(obj);
102}
103
104EAPI Eina_Bool
105elm_animation_view_is_playing_back(Efl_Ui_Animation_View *obj)
106{
107 return efl_ui_animation_view_is_playing_back(obj);
108}
109
110EAPI int
111elm_animation_view_frame_count_get(const Efl_Ui_Animation_View *obj)
112{
113 return efl_ui_animation_view_frame_count_get(obj);
114}
115
116EAPI void
117elm_animation_view_min_progress_set(Efl_Ui_Animation_View *obj, double min_progress)
118{
119 efl_ui_animation_view_min_progress_set(obj, min_progress);
120}
121
122EAPI double
123elm_animation_view_min_progress_get(const Efl_Ui_Animation_View *obj)
124{
125 return efl_ui_animation_view_min_progress_get(obj);
126}
127
128EAPI void
129elm_animation_view_max_progress_set(Efl_Ui_Animation_View *obj, double max_progress)
130{
131 efl_ui_animation_view_max_progress_set(obj, max_progress);
132}
133
134EAPI double
135elm_animation_view_max_progress_get(const Efl_Ui_Animation_View *obj)
136{
137 return efl_ui_animation_view_max_progress_get(obj);
138}
139
140EAPI void
141elm_animation_view_min_frame_set(Efl_Ui_Animation_View *obj, int min_frame)
142{
143 efl_ui_animation_view_min_frame_set(obj, min_frame);
144}
145
146EAPI int
147elm_animation_view_min_frame_get(const Efl_Ui_Animation_View *obj)
148{
149 return efl_ui_animation_view_min_frame_get(obj);
150}
151
152EAPI void
153elm_animation_view_max_frame_set(Efl_Ui_Animation_View *obj, int max_frame)
154{
155 efl_ui_animation_view_max_frame_set(obj, max_frame);
156}
157
158EAPI int
159elm_animation_view_max_frame_get(const Efl_Ui_Animation_View *obj)
160{
161 return efl_ui_animation_view_max_frame_get(obj);
162}
diff --git a/src/lib/elementary/efl_ui_animation_view_private.h b/src/lib/elementary/efl_ui_animation_view_private.h
deleted file mode 100644
index 9199dc7..0000000
--- a/src/lib/elementary/efl_ui_animation_view_private.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef EFL_UI_ANIMATION_VIEW_PRIVATE_H
2#define EFL_UI_ANIMATION_VIEW_PRIVATE_H
3
4#include "Elementary.h"
5#include "efl_ui_animation_view.eo.h"
6
7typedef struct _Efl_Ui_Animation_View_Data Efl_Ui_Animation_View_Data;
8
9struct _Efl_Ui_Animation_View_Data
10{
11 Eo* vg; //Evas_Object_Vg
12 Efl_Ui_Animation_View_State state;
13 Elm_Transit *transit;
14 Eina_Stringshare *file;
15 double speed;
16 double progress;
17 double frame_cnt;
18 int repeat_times;
19 double frame_duration;
20 double min_progress;
21 double max_progress;
22 Eina_List *vp_list;
23
24 Eina_Bool play_back : 1;
25 Eina_Bool auto_play : 1;
26 Eina_Bool auto_play_pause: 1;
27 Eina_Bool auto_repeat : 1;
28};
29
30#define EFL_UI_ANIMATION_VIEW_DATA_GET(o, sd) \
31 Efl_Ui_Animation_View_Data * sd = efl_data_scope_safe_get(o, EFL_UI_ANIMATION_VIEW_CLASS)
32
33#define EFL_UI_ANIMATION_VIEW_DATA_GET_OR_RETURN(o, ptr) \
34 EFL_UI_ANIMATION_VIEW_DATA_GET(o, ptr); \
35 if (EINA_UNLIKELY(!ptr)) \
36 { \
37 ERR("No widget data for object %p (%s)", \
38 o, evas_object_type_get(o)); \
39 return; \
40 }
41
42#endif
diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c
index 5c714d9..1ec9bd1 100644
--- a/src/lib/elementary/efl_ui_caching_factory.c
+++ b/src/lib/elementary/efl_ui_caching_factory.c
@@ -438,8 +438,8 @@ _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED)
438 Efl_Ui_Caching_Factory_Data *pd = data; 438 Efl_Ui_Caching_Factory_Data *pd = data;
439 Efl_Gfx_Entity *entity; 439 Efl_Gfx_Entity *entity;
440 440
441 // Application is going into background, let's free ressource 441 // Application is going into background, let's free resources.
442 // Possible improvement would be to delay that by a few second. 442 // Possible improvement would be to delay that by a few seconds.
443 EINA_LIST_FREE(pd->cache, entity) 443 EINA_LIST_FREE(pd->cache, entity)
444 efl_del(entity); 444 efl_del(entity);
445 445
diff --git a/src/lib/elementary/efl_ui_caching_factory.eo b/src/lib/elementary/efl_ui_caching_factory.eo
index 9907da7..18643f7 100644
--- a/src/lib/elementary/efl_ui_caching_factory.eo
+++ b/src/lib/elementary/efl_ui_caching_factory.eo
@@ -1,4 +1,6 @@
1class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory 1parse efl_app;
2
3class Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
2{ 4{
3 [[Efl UI Factory that provides object caching. 5 [[Efl UI Factory that provides object caching.
4 6
@@ -6,14 +8,14 @@ class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
6 defined. 8 defined.
7 This factory will rely on its parent class @Efl.Ui.Widget_Factory for creating the subset of class that match the 9 This factory will rely on its parent class @Efl.Ui.Widget_Factory for creating the subset of class that match the
8 @Efl.Ui.Widget interface. 10 @Efl.Ui.Widget interface.
9 The factory will automatically empties the cache when the application goes into pause. 11 The factory will automatically empty the cache when the application goes into the background
12 (@[Efl.App.pause] event).
10 13
11 Creating objects is costly and time consuming, keeping a few on hand for when you next will need them helps a lot. 14 Creating objects is costly and time consuming, keeping a few on hand for when you next will need them helps a lot.
12 This is what this factory caching infrastructure provides. It will create the object from the class defined on it 15 This is what this factory caching infrastructure provides. It will create the object from the class defined on it
13 and set the parent and the model as needed for all created items. The View has to release the Item using the 16 and set the parent and the model as needed for all created items. The View has to release the Item using the
14 release function of the Factory interface for all of this to work properly. 17 release function of the Factory interface for all of this to work properly.
15 18 @since 1.24
16 The cache might decide to flush itself when the application event pause is triggered.
17 ]] 19 ]]
18 methods { 20 methods {
19 @property memory_limit { 21 @property memory_limit {
diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c
index 15f5281..1ac817e 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -319,6 +319,9 @@ _efl_ui_check_efl_ui_selectable_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, Ein
319 319
320 pd->selected = value; 320 pd->selected = value;
321 321
322 pd->legacy_changed_emitted_select = !pd->selected;
323 pd->legacy_changed_emitted_unselect = pd->selected;
324
322 if (!elm_widget_is_legacy(obj)) 325 if (!elm_widget_is_legacy(obj))
323 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTED_CHANGED, &pd->selected); 326 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTED_CHANGED, &pd->selected);
324} 327}
diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c
index 462f2be..89a0d4a 100644
--- a/src/lib/elementary/efl_ui_clock.c
+++ b/src/lib/elementary/efl_ui_clock.c
@@ -197,11 +197,11 @@ field_create(Eo *obj, Efl_Ui_Clock_Type field_type)
197 } 197 }
198 else 198 else
199 { 199 {
200 field_obj = efl_add(EFL_UI_TEXT_CLASS,obj, 200 field_obj = efl_add(EFL_UI_TEXTBOX_CLASS,obj,
201 efl_text_multiline_set(efl_added, EINA_FALSE), 201 efl_text_multiline_set(efl_added, EINA_FALSE),
202 efl_text_interactive_editable_set(efl_added, EINA_FALSE), 202 efl_text_interactive_editable_set(efl_added, EINA_FALSE),
203 efl_ui_text_input_panel_enabled_set(efl_added, EINA_FALSE), 203 efl_input_text_input_panel_autoshow_set(efl_added, EINA_FALSE),
204 efl_ui_text_context_menu_disabled_set(efl_added, EINA_TRUE)); 204 efl_ui_textbox_context_menu_enabled_set(efl_added, EINA_FALSE));
205 } 205 }
206 evas_object_data_set(field_obj, "_field_type", (void *)field_type); 206 evas_object_data_set(field_obj, "_field_type", (void *)field_type);
207 207
diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c
index 6c3c5fe..b6f96ba 100644
--- a/src/lib/elementary/efl_ui_collection.c
+++ b/src/lib/elementary/efl_ui_collection.c
@@ -146,6 +146,7 @@ typedef struct {
146 Fast_Accessor size_accessor; 146 Fast_Accessor size_accessor;
147 Efl_Gfx_Entity *sizer; 147 Efl_Gfx_Entity *sizer;
148 unsigned int start_id, end_id; 148 unsigned int start_id, end_id;
149 Eina_Bool allow_manual_deselection : 1;
149} Efl_Ui_Collection_Data; 150} Efl_Ui_Collection_Data;
150 151
151static Eina_Bool register_item(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Item *item); 152static Eina_Bool register_item(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Item *item);
@@ -261,7 +262,7 @@ _efl_ui_collection_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA
261} 262}
262 263
263EOLIAN static Eina_Iterator* 264EOLIAN static Eina_Iterator*
264_efl_ui_collection_efl_ui_multi_selectable_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) 265_efl_ui_collection_efl_ui_multi_selectable_object_range_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd)
265{ 266{
266 return eina_list_iterator_new(pd->selected); 267 return eina_list_iterator_new(pd->selected);
267} 268}
@@ -360,6 +361,8 @@ _efl_ui_collection_efl_object_constructor(Eo *obj, Efl_Ui_Collection_Data *pd EI
360{ 361{
361 Eo *o; 362 Eo *o;
362 363
364 efl_ui_selectable_allow_manual_deselection_set(obj, EINA_TRUE);
365
363 pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; 366 pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
364 367
365 _fast_accessor_init(&pd->obj_accessor, &pd->items); 368 _fast_accessor_init(&pd->obj_accessor, &pd->items);
@@ -438,6 +441,9 @@ _efl_ui_collection_efl_object_invalidate(Eo *obj, Efl_Ui_Collection_Data *pd EIN
438 while(pd->items) 441 while(pd->items)
439 efl_del(pd->items->data); 442 efl_del(pd->items->data);
440 443
444 // pan is given to edje, which reparents it, which forces us to manually deleting it
445 efl_del(pd->pan);
446
441 efl_invalidate(efl_super(obj, MY_CLASS)); 447 efl_invalidate(efl_super(obj, MY_CLASS));
442} 448}
443 449
@@ -704,6 +710,7 @@ unregister_item(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Item *item)
704 efl_event_callback_array_del(item, active_item(), obj); 710 efl_event_callback_array_del(item, active_item(), obj);
705 efl_ui_position_manager_entity_item_removed(pd->pos_man, id, item); 711 efl_ui_position_manager_entity_item_removed(pd->pos_man, id, item);
706 efl_ui_item_container_set(item, NULL); 712 efl_ui_item_container_set(item, NULL);
713 efl_canvas_group_member_remove(pd->pan, item);
707 714
708 return EINA_TRUE; 715 return EINA_TRUE;
709} 716}
@@ -961,6 +968,7 @@ _efl_ui_collection_position_manager_set(Eo *obj, Efl_Ui_Collection_Data *pd, Efl
961 { 968 {
962 case 1: 969 case 1:
963 efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man, 970 efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man,
971 efl_provider_find(obj, EFL_UI_WIN_CLASS),
964 &pd->obj_accessor, _obj_accessor_get_at, NULL, 972 &pd->obj_accessor, _obj_accessor_get_at, NULL,
965 &pd->size_accessor, _size_accessor_get_at, NULL, 973 &pd->size_accessor, _size_accessor_get_at, NULL,
966 eina_list_count(pd->items)); 974 eina_list_count(pd->items));
@@ -1082,7 +1090,7 @@ _efl_ui_collection_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_Data *pd
1082 } 1090 }
1083 else 1091 else
1084 { 1092 {
1085 _item_scroll_internal(obj, pd, new_obj, .0, EINA_TRUE); 1093 _item_scroll_internal(obj, pd, efl_provider_find(new_obj, EFL_UI_ITEM_CLASS), .0, EINA_TRUE);
1086 } 1094 }
1087 1095
1088 return new_obj; 1096 return new_obj;
@@ -1147,13 +1155,13 @@ _range_selection_find(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a,
1147} 1155}
1148 1156
1149EOLIAN static void 1157EOLIAN static void
1150_efl_ui_collection_efl_ui_multi_selectable_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) 1158_efl_ui_collection_efl_ui_multi_selectable_object_range_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b)
1151{ 1159{
1152 _range_selection_find(obj, pd, a, b, EINA_TRUE); 1160 _range_selection_find(obj, pd, a, b, EINA_TRUE);
1153} 1161}
1154 1162
1155EOLIAN static void 1163EOLIAN static void
1156_efl_ui_collection_efl_ui_multi_selectable_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) 1164_efl_ui_collection_efl_ui_multi_selectable_object_range_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b)
1157{ 1165{
1158 _range_selection_find(obj, pd, a, b, EINA_FALSE); 1166 _range_selection_find(obj, pd, a, b, EINA_FALSE);
1159} 1167}
@@ -1171,6 +1179,19 @@ _efl_ui_collection_efl_ui_single_selectable_fallback_selection_get(const Eo *obj
1171 return pd->fallback; 1179 return pd->fallback;
1172} 1180}
1173 1181
1182EOLIAN static void
1183_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd, Eina_Bool allow_manual_deselection)
1184{
1185 pd->allow_manual_deselection = !!allow_manual_deselection;
1186}
1187
1188EOLIAN static Eina_Bool
1189_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd)
1190{
1191 return pd->allow_manual_deselection;
1192}
1193
1194
1174#include "efl_ui_collection.eo.c" 1195#include "efl_ui_collection.eo.c"
1175 1196
1176#define ITEM_IS_OUTSIDE_VISIBLE(id) id < collection_pd->start_id || id > collection_pd->end_id 1197#define ITEM_IS_OUTSIDE_VISIBLE(id) id < collection_pd->start_id || id > collection_pd->end_id
@@ -1203,8 +1224,9 @@ _efl_ui_collection_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_
1203 1224
1204 if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) 1225 if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
1205 { 1226 {
1206 int new_id = efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction); 1227 unsigned int new_id;
1207 if (new_id == -1) 1228
1229 if (!efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction, &new_id))
1208 { 1230 {
1209 new_item = NULL; 1231 new_item = NULL;
1210 } 1232 }
diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo
index 6071c2a..d890b16 100644
--- a/src/lib/elementary/efl_ui_collection.eo
+++ b/src/lib/elementary/efl_ui_collection.eo
@@ -1,7 +1,7 @@
1class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements 1class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements
2 Efl.Pack_Linear, 2 Efl.Pack_Linear,
3 Efl.Ui.Layout_Orientable, 3 Efl.Ui.Layout_Orientable,
4 Efl.Ui.Multi_Selectable, 4 Efl.Ui.Multi_Selectable_Object_Range,
5 Efl.Ui.Focus.Manager_Sub, 5 Efl.Ui.Focus.Manager_Sub,
6 Efl.Ui.Widget_Focus_Manager, 6 Efl.Ui.Widget_Focus_Manager,
7 Efl.Ui.Item_Clickable 7 Efl.Ui.Item_Clickable
@@ -24,7 +24,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements
24 If all items do not fit in the current widget size scrolling facilities are provided. 24 If all items do not fit in the current widget size scrolling facilities are provided.
25 25
26 Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode 26 Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode
27 policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. 27 policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new.
28 28
29 @since 1.23 29 @since 1.23
30 ]] 30 ]]
@@ -53,6 +53,12 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements
53 } 53 }
54 @property position_manager @beta { 54 @property position_manager @beta {
55 [[Position manager object that handles placement of items.]] 55 [[Position manager object that handles placement of items.]]
56 get {
57 values {
58 position_manager : Efl.Ui.Position_Manager.Entity; [[A borrowed handle to the item container.]]
59 }
60 }
61 set { }
56 values { 62 values {
57 position_manager : Efl.Ui.Position_Manager.Entity @move; [[Ownership is passed to the item container.]] 63 position_manager : Efl.Ui.Position_Manager.Entity @move; [[Ownership is passed to the item container.]]
58 } 64 }
@@ -84,13 +90,14 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements
84 Efl.Ui.Widget.focus_state_apply; 90 Efl.Ui.Widget.focus_state_apply;
85 Efl.Ui.Focus.Manager.move; 91 Efl.Ui.Focus.Manager.move;
86 Efl.Ui.Single_Selectable.last_selected { get; } 92 Efl.Ui.Single_Selectable.last_selected { get; }
87 Efl.Ui.Multi_Selectable.selected_iterator_new;
88 Efl.Ui.Multi_Selectable.select_mode {get; set;} 93 Efl.Ui.Multi_Selectable.select_mode {get; set;}
89 Efl.Ui.Multi_Selectable.all_select; 94 Efl.Ui.Multi_Selectable.all_select;
90 Efl.Ui.Multi_Selectable.all_unselect; 95 Efl.Ui.Multi_Selectable.all_unselect;
91 Efl.Ui.Multi_Selectable.range_select; 96 Efl.Ui.Multi_Selectable_Object_Range.selected_iterator_new;
92 Efl.Ui.Multi_Selectable.range_unselect; 97 Efl.Ui.Multi_Selectable_Object_Range.range_select;
98 Efl.Ui.Multi_Selectable_Object_Range.range_unselect;
93 Efl.Ui.Single_Selectable.fallback_selection {get; set;} 99 Efl.Ui.Single_Selectable.fallback_selection {get; set;}
100 Efl.Ui.Single_Selectable.allow_manual_deselection {get; set;}
94 } 101 }
95} 102}
96 103
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index fa2dd42..433f5d3 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -38,7 +38,7 @@ struct _Efl_Ui_Collection_Item_Lookup
38{ 38{
39 EINA_RBTREE; 39 EINA_RBTREE;
40 40
41 uint64_t index; 41 unsigned int index;
42 Efl_Ui_Collection_Item item; 42 Efl_Ui_Collection_Item item;
43}; 43};
44 44
@@ -46,7 +46,7 @@ struct _Efl_Ui_Collection_Viewport
46{ 46{
47 Efl_Ui_Collection_Item *items; 47 Efl_Ui_Collection_Item *items;
48 48
49 uint64_t offset; 49 unsigned int offset;
50 uint16_t count; 50 uint16_t count;
51}; 51};
52 52
@@ -54,11 +54,10 @@ struct _Efl_Ui_Collection_Request
54{ 54{
55 Eina_Future *f; 55 Eina_Future *f;
56 56
57 uint64_t offset; 57 unsigned int offset;
58 uint64_t length; 58 unsigned int length;
59 59
60 Eina_Bool model_requested : 1; 60 Eina_Bool need_size : 1;
61 Eina_Bool model_fetched : 1;
62 Eina_Bool need_entity : 1; 61 Eina_Bool need_entity : 1;
63 Eina_Bool entity_requested : 1; 62 Eina_Bool entity_requested : 1;
64}; 63};
@@ -80,8 +79,13 @@ struct _Efl_Ui_Collection_View_Data
80 79
81 Eina_List *requests; // Array of Efl_Ui_Collection_Request in progress 80 Eina_List *requests; // Array of Efl_Ui_Collection_Request in progress
82 81
83 uint64_t start_id; 82 struct {
84 uint64_t end_id; 83 Efl_Gfx_Entity *last; // The last item of the collection, so focus can start by the end if necessary.
84 Efl_Gfx_Entity *previously; // The previously selected item in the collection, so focus can come back to it.
85 } focus;
86
87 unsigned int start_id;
88 unsigned int end_id;
85 89
86 Eina_Size2D content_min_size; 90 Eina_Size2D content_min_size;
87 91
@@ -109,7 +113,7 @@ static const char *COLLECTION_VIEW_MANAGED_YES = "yes";
109#define MY_DATA_GET(obj, pd) \ 113#define MY_DATA_GET(obj, pd) \
110 Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS); 114 Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS);
111 115
112static void _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request); 116static Eina_Bool _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request);
113static void _idle_cb(void *data, const Efl_Event *event); 117static void _idle_cb(void *data, const Efl_Event *event);
114 118
115static int 119static int
@@ -117,7 +121,7 @@ _cache_tree_lookup(const Eina_Rbtree *node, const void *key,
117 int length EINA_UNUSED, void *data EINA_UNUSED) 121 int length EINA_UNUSED, void *data EINA_UNUSED)
118{ 122{
119 const Efl_Ui_Collection_Item_Lookup *n = (Efl_Ui_Collection_Item_Lookup *)node; 123 const Efl_Ui_Collection_Item_Lookup *n = (Efl_Ui_Collection_Item_Lookup *)node;
120 const uint64_t *index = key; 124 const unsigned int *index = key;
121 125
122 if (n->index > *index) 126 if (n->index > *index)
123 return 1; 127 return 1;
@@ -294,6 +298,9 @@ _all_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd)
294 } 298 }
295#endif 299#endif
296 300
301 efl_replace(&pd->focus.previously, NULL);
302 efl_replace(&pd->focus.last, NULL);
303
297 EINA_LIST_FOREACH_SAFE(pd->requests, l, ll, request) 304 EINA_LIST_FOREACH_SAFE(pd->requests, l, ll, request)
298 eina_future_cancel(request->f); 305 eina_future_cancel(request->f);
299} 306}
@@ -345,13 +352,14 @@ _size_to_model(Efl_Model *model, Eina_Size2D state)
345 352
346static Eina_List * 353static Eina_List *
347_request_add(Eina_List *requests, Efl_Ui_Collection_Request **request, 354_request_add(Eina_List *requests, Efl_Ui_Collection_Request **request,
348 uint64_t index, Eina_Bool need_entity) 355 unsigned int index, Eina_Bool need_entity)
349{ 356{
350 if (!(*request)) goto create; 357 if (!(*request)) goto create;
351 358
352 if ((*request)->offset + (*request)->length == index) 359 if ((*request)->offset + (*request)->length == index)
353 { 360 {
354 if (need_entity) (*request)->need_entity = EINA_TRUE; 361 if (need_entity) (*request)->need_entity = EINA_TRUE;
362 if (!need_entity) (*request)->need_size = EINA_TRUE;
355 (*request)->length += 1; 363 (*request)->length += 1;
356 return requests; 364 return requests;
357 } 365 }
@@ -364,8 +372,8 @@ _request_add(Eina_List *requests, Efl_Ui_Collection_Request **request,
364 (*request)->offset = index; 372 (*request)->offset = index;
365 (*request)->length = 1; 373 (*request)->length = 1;
366 // At this point, we rely on the model caching ability to avoid recreating model 374 // At this point, we rely on the model caching ability to avoid recreating model
367 (*request)->model_requested = EINA_TRUE;
368 (*request)->need_entity = !!need_entity; 375 (*request)->need_entity = !!need_entity;
376 (*request)->need_size = EINA_TRUE;
369 377
370 return requests; 378 return requests;
371} 379}
@@ -379,7 +387,6 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
379 unsigned int i, len; 387 unsigned int i, len;
380 Eina_Bool request_entity = EINA_FALSE; 388 Eina_Bool request_entity = EINA_FALSE;
381 389
382 request->model_fetched = EINA_TRUE;
383 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) 390 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
384 { 391 {
385 Efl_Ui_Collection_Item_Lookup *insert; 392 Efl_Ui_Collection_Item_Lookup *insert;
@@ -394,7 +401,7 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
394 if ((pd->viewport[v]->offset <= request->offset + i) && 401 if ((pd->viewport[v]->offset <= request->offset + i) &&
395 (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) 402 (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count))
396 { 403 {
397 uint64_t index = request->offset + i - pd->viewport[v]->offset; 404 unsigned int index = request->offset + i - pd->viewport[v]->offset;
398 405
399 efl_replace(&pd->viewport[v]->items[index].model, child); 406 efl_replace(&pd->viewport[v]->items[index].model, child);
400 child = NULL; 407 child = NULL;
@@ -406,7 +413,7 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
406 // When requesting a model, it should not be in the cache prior to the request 413 // When requesting a model, it should not be in the cache prior to the request
407 if (!child) continue; 414 if (!child) continue;
408 415
409 uint64_t search_index = request->offset + i; 416 unsigned int search_index = request->offset + i;
410 417
411 insert = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, 418 insert = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index,
412 sizeof (search_index), _cache_tree_lookup, 419 sizeof (search_index), _cache_tree_lookup,
@@ -419,7 +426,7 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
419 efl_replace(&insert->item.model, child); 426 efl_replace(&insert->item.model, child);
420 } 427 }
421 else 428 else
422 ERR("Inserting a model that was already fetched, dropping new model %" PRIu64, search_index); 429 ERR("Inserting a model that was already fetched, dropping new model %u", search_index);
423 } 430 }
424 else 431 else
425 { 432 {
@@ -437,7 +444,14 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
437 if (request_entity) 444 if (request_entity)
438 { 445 {
439 request->need_entity = EINA_TRUE; 446 request->need_entity = EINA_TRUE;
440 _entity_request(obj, request); 447
448 if (!request->entity_requested)
449 _entity_request(obj, request);
450 }
451 else if (request->need_size)
452 {
453 efl_ui_position_manager_entity_item_size_changed(pd->manager, request->offset,
454 request->offset + len);
441 } 455 }
442 456
443 return v; 457 return v;
@@ -449,12 +463,7 @@ _model_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED)
449 MY_DATA_GET(o, pd); 463 MY_DATA_GET(o, pd);
450 Efl_Ui_Collection_Request *request = data; 464 Efl_Ui_Collection_Request *request = data;
451 465
452 if (request->need_entity) 466 if (!request->entity_requested)
453 {
454 if (!request->entity_requested)
455 _entity_request(o, request);
456 }
457 else
458 { 467 {
459 pd->requests = eina_list_remove(pd->requests, request); 468 pd->requests = eina_list_remove(pd->requests, request);
460 free(request); 469 free(request);
@@ -484,6 +493,33 @@ _entity_fetch_cb(Eo *obj, void *data EINA_UNUSED, const Eina_Value v)
484 return eina_future_as_value(r); 493 return eina_future_as_value(r);
485} 494}
486 495
496static inline unsigned int
497_lookup_entity_index(Efl_Gfx_Entity *entity, Efl_Model **model)
498{
499 Efl_Model *fetch;
500
501 fetch = efl_ui_view_model_get(entity);
502 if (model) *model = fetch;
503 return efl_composite_model_index_get(fetch);
504}
505
506static void
507_last_entity_update(Efl_Ui_Collection_View_Data *pd, Efl_Gfx_Entity *entity)
508{
509 Efl_Model *new_model, *old_model;
510 unsigned int new_index, old_index;
511
512 if (!pd->focus.last) goto replace;
513
514 new_index = _lookup_entity_index(entity, &new_model);
515 old_index = _lookup_entity_index(pd->focus.last, &old_model);
516
517 if (new_index <= old_index) return;
518
519 replace:
520 efl_replace(&pd->focus.last, entity);
521}
522
487static inline Eina_Bool 523static inline Eina_Bool
488_entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity) 524_entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity)
489{ 525{
@@ -517,13 +553,17 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
517 Efl_Ui_Collection_Request *request = data; 553 Efl_Ui_Collection_Request *request = data;
518 Efl_Gfx_Entity *child; 554 Efl_Gfx_Entity *child;
519 unsigned int i, len; 555 unsigned int i, len;
520 uint64_t updated_size_start_id = 0, updated_entity_start_id = 0; 556 unsigned int updated_size_start_id = 0, updated_entity_start_id = 0;
521 Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; 557 Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE;
558 Evas *e;
559
560 e = evas_object_evas_get(obj);
561 evas_event_freeze(e);
522 562
523 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) 563 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
524 { 564 {
525 Efl_Ui_Collection_Item_Lookup *lookup; 565 Efl_Ui_Collection_Item_Lookup *lookup;
526 uint64_t search_index; 566 unsigned int search_index;
527 //unsigned int v; 567 //unsigned int v;
528 568
529 efl_key_data_set(child, COLLECTION_VIEW_MANAGED, COLLECTION_VIEW_MANAGED_YES); 569 efl_key_data_set(child, COLLECTION_VIEW_MANAGED, COLLECTION_VIEW_MANAGED_YES);
@@ -541,7 +581,7 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
541 if ((pd->viewport[v]->offset <= request->offset + i) && 581 if ((pd->viewport[v]->offset <= request->offset + i) &&
542 (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) 582 (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count))
543 { 583 {
544 uint64_t index = request->offset + i - pd->viewport[v]->offset; 584 unsigned int index = request->offset + i - pd->viewport[v]->offset;
545 585
546 if (pd->viewport[v]->items[index].entity) 586 if (pd->viewport[v]->items[index].entity)
547 { 587 {
@@ -575,7 +615,6 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
575 } 615 }
576 } 616 }
577#endif 617#endif
578
579 // When requesting an entity, the model should already be in the cache 618 // When requesting an entity, the model should already be in the cache
580 if (!child) continue; 619 if (!child) continue;
581 620
@@ -593,7 +632,7 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
593 } 632 }
594 if (lookup->item.entity) 633 if (lookup->item.entity)
595 { 634 {
596 ERR("Entity already existing for id %" PRIu64, search_index); 635 ERR("Entity already existing for id %u", search_index);
597 _entity_cleanup(obj, pd->factory, &lookup->item, NULL); 636 _entity_cleanup(obj, pd->factory, &lookup->item, NULL);
598 } 637 }
599 638
@@ -624,16 +663,22 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
624 search_index - 1); 663 search_index - 1);
625 updated_size = EINA_FALSE; 664 updated_size = EINA_FALSE;
626 } 665 }
627 }} 666 }
628 ; 667 }
668
669 evas_event_thaw(e);
670 evas_event_thaw_eval(e);
671
672 // Check if the last child is also the list item in the list
673 _last_entity_update(pd, child);
629 674
630 // Currently position manager will flush its entire size cache on update, so only do 675 // Currently position manager will flush its entire size cache on update, so only do
631 // it when necessary to improve performance. 676 // it when necessary to improve performance.
632 if (updated_size) 677 if (updated_size || request->need_size)
633 { 678 {
634 efl_ui_position_manager_entity_item_size_changed(pd->manager, 679 efl_ui_position_manager_entity_item_size_changed(pd->manager,
635 updated_size_start_id, 680 updated_size_start_id,
636 i - 1); 681 request->offset + i - 1);
637 updated_size = EINA_FALSE; 682 updated_size = EINA_FALSE;
638 } 683 }
639 684
@@ -642,7 +687,7 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
642 { 687 {
643 efl_ui_position_manager_entity_entities_ready(pd->manager, 688 efl_ui_position_manager_entity_entities_ready(pd->manager,
644 updated_entity_start_id, 689 updated_entity_start_id,
645 i - 1); 690 request->offset + i - 1);
646 691
647 efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); 692 efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj);
648 efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); 693 efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj);
@@ -660,15 +705,63 @@ _entity_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED)
660 free(request); 705 free(request);
661} 706}
662 707
708static Eina_Bool
709_focus_lookup(Efl_Ui_Collection_View_Data *pd, unsigned int search_index,
710 Efl_Gfx_Entity **entity, Efl_Model **model)
711{
712 unsigned int idx;
713
714 if (entity) *entity = pd->focus.last;
715 if (pd->focus.last)
716 {
717 idx = _lookup_entity_index(pd->focus.last, model);
718 if (idx == search_index) return EINA_TRUE;
719 }
720 if (entity) *entity = pd->focus.previously;
721 if (pd->focus.previously)
722 {
723 idx = _lookup_entity_index(pd->focus.previously, model);
724 if (idx == search_index) return EINA_TRUE;
725 }
726
727 if (entity) *entity = NULL;
728 if (model) *model = NULL;
729 return EINA_FALSE;
730}
731
732static Efl_Ui_Collection_Item_Lookup *
733_build_from_focus(Efl_Ui_Collection_View_Data *pd, unsigned int search_index,
734 Efl_Model **model)
735{
736 Efl_Ui_Collection_Item_Lookup *insert;
737 Efl_Gfx_Entity *entity = NULL;
738
739 // Not found in the cache lookup, but just maybe
740 if (!_focus_lookup(pd, search_index, &entity, model)) return NULL;
741
742 // Lucky us, let's add it to the cache
743 insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup));
744 if (!insert) return NULL;
745
746 insert->index = search_index;
747 insert->item.model = efl_ref(*model);
748 insert->item.entity = efl_ref(entity);
749
750 pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert),
751 _cache_tree_cmp, NULL);
752
753 return insert;
754}
755
663static Eina_List * 756static Eina_List *
664_cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, 757_cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
665 Efl_Ui_Collection_View_Data *pd, 758 Efl_Ui_Collection_View_Data *pd,
666 uint64_t search_index, 759 unsigned int search_index,
667 Efl_Ui_Position_Manager_Size_Batch_Entity *target, 760 Efl_Ui_Position_Manager_Size_Batch_Entity *target,
668 Eina_Size2D item_base) 761 Eina_Size2D item_base)
669{ 762{
670 Efl_Ui_Collection_Item_Lookup *lookup; 763 Efl_Ui_Collection_Item_Lookup *lookup;
671 Efl_Model *model; 764 Efl_Model *model = NULL;
672 Eina_Size2D item_size = item_base; 765 Eina_Size2D item_size = item_base;
673 766
674 if (!pd->cache) goto not_found; 767 if (!pd->cache) goto not_found;
@@ -676,10 +769,16 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
676 lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, 769 lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index,
677 sizeof (search_index), _cache_tree_lookup, 770 sizeof (search_index), _cache_tree_lookup,
678 NULL); 771 NULL);
679 if (!lookup) goto not_found;
680
681 // In the cache we should always have model, so no need to check for it 772 // In the cache we should always have model, so no need to check for it
682 model = lookup->item.model; 773 if (lookup)
774 {
775 model = lookup->item.model;
776 }
777 else
778 {
779 lookup = _build_from_focus(pd, search_index, &model);
780 if (!lookup) goto not_found;
781 }
683 782
684 // If we do not know the size 783 // If we do not know the size
685 if (!ITEM_SIZE_FROM_MODEL(model, item_size)) 784 if (!ITEM_SIZE_FROM_MODEL(model, item_size))
@@ -720,16 +819,18 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
720static Eina_List * 819static Eina_List *
721_cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, 820_cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
722 Efl_Ui_Collection_View_Data *pd, 821 Efl_Ui_Collection_View_Data *pd,
723 uint64_t search_index, 822 unsigned int search_index,
724 Efl_Ui_Position_Manager_Object_Batch_Entity *target) 823 Efl_Ui_Position_Manager_Object_Batch_Entity *target)
725{ 824{
726 Efl_Ui_Collection_Item_Lookup *lookup; 825 Efl_Ui_Collection_Item_Lookup *lookup;
826 Efl_Model *model = NULL;
727 827
728 if (!pd->cache) goto not_found; 828 if (!pd->cache) goto not_found;
729 829
730 lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, 830 lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index,
731 sizeof (search_index), _cache_tree_lookup, 831 sizeof (search_index), _cache_tree_lookup,
732 NULL); 832 NULL);
833 if (!lookup) lookup = _build_from_focus(pd, search_index, &model);
733 if (!lookup) goto not_found; 834 if (!lookup) goto not_found;
734 if (!lookup->item.entity) goto not_found; 835 if (!lookup->item.entity) goto not_found;
735 836
@@ -749,10 +850,10 @@ _cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
749 return requests; 850 return requests;
750} 851}
751 852
752static void 853static Eina_Bool
753_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request) 854_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request)
754{ 855{
755 if (request->model_requested && (!request->model_fetched)) return; 856 if (request->entity_requested) return EINA_TRUE;
756 request->f = efl_future_then(obj, request->f, 857 request->f = efl_future_then(obj, request->f,
757 .success_type = EINA_VALUE_TYPE_ARRAY, 858 .success_type = EINA_VALUE_TYPE_ARRAY,
758 .success = _entity_fetch_cb); 859 .success = _entity_fetch_cb);
@@ -762,17 +863,20 @@ _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request)
762 .data = request, 863 .data = request,
763 .free = _entity_free_cb); 864 .free = _entity_free_cb);
764 request->entity_requested = EINA_TRUE; 865 request->entity_requested = EINA_TRUE;
866 request->need_entity = EINA_TRUE;
867
868 return EINA_TRUE;
765} 869}
766 870
767static inline void 871static inline Eina_Bool
768_entity_inflight_request(Efl_Ui_Collection_View *obj, 872_entity_inflight_request(Efl_Ui_Collection_View *obj,
769 Efl_Ui_Collection_Request *request, 873 Efl_Ui_Collection_Request *request,
770 Efl_Ui_Collection_Request *inflight) 874 Efl_Ui_Collection_Request *inflight)
771{ 875{
772 if (request->need_entity == EINA_FALSE) return ; 876 inflight->need_size |= request->need_size;
773 if (inflight->entity_requested) return ; 877 if (request->need_entity == EINA_FALSE) return EINA_TRUE;
774 878
775 _entity_request(obj, inflight); 879 return _entity_request(obj, inflight);
776} 880}
777 881
778static Eina_List * 882static Eina_List *
@@ -792,10 +896,10 @@ _batch_request_flush(Eina_List *requests,
792 896
793 EINA_LIST_FOREACH(pd->requests, l, inflight) 897 EINA_LIST_FOREACH(pd->requests, l, inflight)
794 { 898 {
795 uint64_t istart = inflight->offset; 899 unsigned int istart = inflight->offset;
796 uint64_t iend = inflight->offset + inflight->length; 900 unsigned int iend = inflight->offset + inflight->length;
797 uint64_t rstart = request->offset; 901 unsigned int rstart = request->offset;
798 uint64_t rend = request->offset + request->length; 902 unsigned int rend = request->offset + request->length;
799 903
800 // Way before 904 // Way before
801 if (rend < istart) continue; 905 if (rend < istart) continue;
@@ -805,7 +909,7 @@ _batch_request_flush(Eina_List *requests,
805 // request included in current inflight request 909 // request included in current inflight request
806 if (rstart >= istart && rend <= iend) 910 if (rstart >= istart && rend <= iend)
807 { 911 {
808 _entity_inflight_request(obj, request, inflight); 912 if (!_entity_inflight_request(obj, request, inflight)) continue;
809 913
810 // In this case no need to start a request 914 // In this case no need to start a request
811 requests = eina_list_remove_list(requests, ll); 915 requests = eina_list_remove_list(requests, ll);
@@ -817,6 +921,8 @@ _batch_request_flush(Eina_List *requests,
817 // request overflow left and right 921 // request overflow left and right
818 if (rstart < istart && iend < rend) 922 if (rstart < istart && iend < rend)
819 { 923 {
924 if (!_entity_inflight_request(obj, request, inflight)) continue;
925
820 // Remove the center portion of the request by emitting a new one 926 // Remove the center portion of the request by emitting a new one
821 Efl_Ui_Collection_Request *rn; 927 Efl_Ui_Collection_Request *rn;
822 928
@@ -825,30 +931,29 @@ _batch_request_flush(Eina_List *requests,
825 931
826 rn->offset = iend; 932 rn->offset = iend;
827 rn->length = rend - iend; 933 rn->length = rend - iend;
828 rn->model_requested = request->model_requested;
829 rn->need_entity = request->need_entity; 934 rn->need_entity = request->need_entity;
935 rn->need_size = request->need_size;
830 936
831 requests = eina_list_append(requests, rn); 937 requests = eina_list_append(requests, rn);
832 938
833 request->length = istart - rstart; 939 request->length = istart - rstart;
834 _entity_inflight_request(obj, request, inflight);
835 continue; 940 continue;
836 } 941 }
837 942
838 // request overflow left 943 // request overflow left
839 if (rstart < istart && rend > istart && rend <= iend) 944 if (rstart < istart && rend > istart && rend <= iend)
840 { 945 {
946 if (!_entity_inflight_request(obj, request, inflight)) continue;
841 request->length = istart - rstart; 947 request->length = istart - rstart;
842 _entity_inflight_request(obj, request, inflight);
843 continue; 948 continue;
844 } 949 }
845 950
846 // request overflow right 951 // request overflow right
847 if (rstart >= istart && rstart < iend && iend <= rend) 952 if (rstart >= istart && rstart < iend && iend <= rend)
848 { 953 {
954 if (!_entity_inflight_request(obj, request, inflight)) continue;
849 request->offset = iend; 955 request->offset = iend;
850 request->length = rend - iend; 956 request->length = rend - iend;
851 _entity_inflight_request(obj, request, inflight);
852 continue; 957 continue;
853 } 958 }
854 } 959 }
@@ -878,12 +983,6 @@ _batch_request_flush(Eina_List *requests,
878 983
879 // We now have a request, time to trigger a fetch 984 // We now have a request, time to trigger a fetch
880 // We assume here that we are always fetching the model (model_requested must be true) 985 // We assume here that we are always fetching the model (model_requested must be true)
881 if (!request->model_requested)
882 {
883 CRI("Someone forgot to set model_requested for %" PRIu64 " to %" PRIu64 ".",
884 request->offset, request->offset + request->length);
885 request->model_requested = EINA_TRUE;
886 }
887 request->f = efl_model_children_slice_get(model, request->offset, request->length); 986 request->f = efl_model_children_slice_get(model, request->offset, request->length);
888 request->f = efl_future_then(obj, request->f, 987 request->f = efl_future_then(obj, request->f,
889 .success = _model_fetched_cb, 988 .success = _model_fetched_cb,
@@ -892,7 +991,7 @@ _batch_request_flush(Eina_List *requests,
892 991
893 eina_list_move_list(&pd->requests, &requests, ll); 992 eina_list_move_list(&pd->requests, &requests, ll);
894 } 993 }
895 return NULL; 994 return eina_list_free(requests);
896} 995}
897 996
898static Efl_Ui_Position_Manager_Size_Batch_Result 997static Efl_Ui_Position_Manager_Size_Batch_Result
@@ -918,11 +1017,11 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
918 1017
919 // Look in the temporary cache now for the beginning of the buffer 1018 // Look in the temporary cache now for the beginning of the buffer
920#ifdef VIEWPORT_ENABLE 1019#ifdef VIEWPORT_ENABLE
921 if (pd->viewport[0] && ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset)) 1020 if (pd->viewport[0] && ((unsigned int)(conf.range.start_id + idx) < pd->viewport[0]->offset))
922 { 1021 {
923 while ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset && idx < limit) 1022 while ((unsigned int)(conf.range.start_id + idx) < pd->viewport[0]->offset && idx < limit)
924 { 1023 {
925 uint64_t search_index = conf.range.start_id + idx; 1024 unsigned int search_index = conf.range.start_id + idx;
926 requests = _cache_size_fetch(requests, &request, pd, 1025 requests = _cache_size_fetch(requests, &request, pd,
927 search_index, &sizes[idx], item_base); 1026 search_index, &sizes[idx], item_base);
928 idx++; 1027 idx++;
@@ -938,7 +1037,7 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
938 (pd->viewport[i]->offset <= conf.range.start_id + idx) && 1037 (pd->viewport[i]->offset <= conf.range.start_id + idx) &&
939 (conf.range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) 1038 (conf.range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count)))
940 { 1039 {
941 uint64_t offset = conf.range.start_id + idx - pd->viewport[i]->offset; 1040 unsigned int offset = conf.range.start_id + idx - pd->viewport[i]->offset;
942 Efl_Model *model = pd->viewport[i]->items[offset].model; 1041 Efl_Model *model = pd->viewport[i]->items[offset].model;
943 Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; 1042 Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity;
944 Eina_Bool entity_request = EINA_FALSE; 1043 Eina_Bool entity_request = EINA_FALSE;
@@ -994,7 +1093,7 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
994 // Look in the temporary cache now for the end of the buffer 1093 // Look in the temporary cache now for the end of the buffer
995 while (idx < limit) 1094 while (idx < limit)
996 { 1095 {
997 uint64_t search_index = conf.range.start_id + idx; 1096 unsigned int search_index = conf.range.start_id + idx;
998 requests = _cache_size_fetch(requests, &request, pd, 1097 requests = _cache_size_fetch(requests, &request, pd,
999 search_index, &sizes[idx], item_base); 1098 search_index, &sizes[idx], item_base);
1000 idx++; 1099 idx++;
@@ -1017,7 +1116,7 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
1017 { 1116 {
1018 while (idx < limit) 1117 while (idx < limit)
1019 { 1118 {
1020 uint64_t search_index = conf.range.start_id + idx; 1119 unsigned int search_index = conf.range.start_id + idx;
1021 requests = _cache_size_fetch(requests, &request, pd, 1120 requests = _cache_size_fetch(requests, &request, pd,
1022 search_index, &sizes[idx], item_base); 1121 search_index, &sizes[idx], item_base);
1023 idx++; 1122 idx++;
@@ -1054,15 +1153,15 @@ _batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_R
1054 1153
1055 entities = memory.mem; 1154 entities = memory.mem;
1056 //count = efl_model_children_count_get(parent); 1155 //count = efl_model_children_count_get(parent);
1057 limit = range.end_id - range.start_id;; 1156 limit = range.end_id - range.start_id;
1058 1157
1059 // Look in the temporary cache now for the beginning of the buffer 1158 // Look in the temporary cache now for the beginning of the buffer
1060#ifdef VIEWPORT_ENABLE 1159#ifdef VIEWPORT_ENABLE
1061 if (pd->viewport[0] && ((uint64_t)(range.start_id + idx) < pd->viewport[0]->offset)) 1160 if (pd->viewport[0] && ((unsigned int)(range.start_id + idx) < pd->viewport[0]->offset))
1062 { 1161 {
1063 while (idx < limit && (uint64_t)(range.start_id + idx) < pd->viewport[0]->offset) 1162 while (idx < limit && (unsigned int)(range.start_id + idx) < pd->viewport[0]->offset)
1064 { 1163 {
1065 uint64_t search_index = range.start_id + idx; 1164 unsigned int search_index = range.start_id + idx;
1066 1165
1067 requests = _cache_entity_fetch(requests, &request, pd, 1166 requests = _cache_entity_fetch(requests, &request, pd,
1068 search_index, &entities[idx]); 1167 search_index, &entities[idx]);
@@ -1080,7 +1179,7 @@ _batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_R
1080 (pd->viewport[i]->offset <= range.start_id + idx) && 1179 (pd->viewport[i]->offset <= range.start_id + idx) &&
1081 (range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) 1180 (range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count)))
1082 { 1181 {
1083 uint64_t offset = range.start_id + idx - pd->viewport[i]->offset; 1182 unsigned int offset = range.start_id + idx - pd->viewport[i]->offset;
1084 Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; 1183 Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity;
1085 1184
1086 if (!entity) 1185 if (!entity)
@@ -1107,11 +1206,10 @@ _batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_R
1107 // Look in the temporary cache now for the end of the buffer 1206 // Look in the temporary cache now for the end of the buffer
1108 while (idx < limit) 1207 while (idx < limit)
1109 { 1208 {
1110 uint64_t search_index = range.start_id + idx; 1209 unsigned int search_index = range.start_id + idx;
1111 1210
1112 requests = _cache_entity_fetch(requests, &request, pd, 1211 requests = _cache_entity_fetch(requests, &request, pd,
1113 search_index, &entities[idx]); 1212 search_index, &entities[idx]);
1114
1115 idx++; 1213 idx++;
1116 } 1214 }
1117 // Done, but flush request first 1215 // Done, but flush request first
@@ -1184,7 +1282,7 @@ _viewport_walk_fill(Eina_List *requests,
1184 for (j = 0; j < viewport->count; j++) 1282 for (j = 0; j < viewport->count; j++)
1185 { 1283 {
1186 Efl_Ui_Collection_Item_Lookup *lookup; 1284 Efl_Ui_Collection_Item_Lookup *lookup;
1187 uint64_t index = viewport->offset + j; 1285 unsigned int index = viewport->offset + j;
1188 1286
1189 if (viewport->items[j].model) goto check_entity; 1287 if (viewport->items[j].model) goto check_entity;
1190 1288
@@ -1316,7 +1414,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1316 idx = lower_end; 1414 idx = lower_end;
1317 while (idx < upper_end) 1415 while (idx < upper_end)
1318 { 1416 {
1319 uint64_t search_index = idx; 1417 unsigned int search_index = idx;
1320 1418
1321 requests = _cache_entity_fetch(requests, &request, pd, 1419 requests = _cache_entity_fetch(requests, &request, pd,
1322 search_index, NULL); 1420 search_index, NULL);
@@ -1339,7 +1437,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1339 Eina_List *requests = NULL; 1437 Eina_List *requests = NULL;
1340 long baseid; 1438 long baseid;
1341 unsigned int delta, marginup, margindown; 1439 unsigned int delta, marginup, margindown;
1342 uint64_t upperlimit_offset, lowerlimit_offset; 1440 unsigned int upperlimit_offset, lowerlimit_offset;
1343 unsigned int i; 1441 unsigned int i;
1344 1442
1345 pd->start_id = event->start_id; 1443 pd->start_id = event->start_id;
@@ -1445,7 +1543,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1445 // We could optimize this to actually just move viewport around in most cases 1543 // We could optimize this to actually just move viewport around in most cases
1446 Efl_Ui_Collection_Item *items[3]; 1544 Efl_Ui_Collection_Item *items[3];
1447 unsigned int j = 0, t = 0; 1545 unsigned int j = 0, t = 0;
1448 uint64_t target, current; 1546 unsigned int target, current;
1449 1547
1450 // Case where are at the top 1548 // Case where are at the top
1451 if (pd->start_id < delta && pd->viewport[0]->offset == 0) goto build_request; 1549 if (pd->start_id < delta && pd->viewport[0]->offset == 0) goto build_request;
@@ -1534,7 +1632,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1534 request->offset = lowerlimit_offset; 1632 request->offset = lowerlimit_offset;
1535 // This length work over multiple viewport as they are contiguous 1633 // This length work over multiple viewport as they are contiguous
1536 request->length = lowerlimit_offset - pd->viewport[0]->offset; 1634 request->length = lowerlimit_offset - pd->viewport[0]->offset;
1537 request->model_requested = EINA_TRUE; 1635 request->need_size = EINA_TRUE;
1538 request->need_entity = EINA_TRUE; 1636 request->need_entity = EINA_TRUE;
1539 1637
1540 requests = eina_list_append(requests, request); 1638 requests = eina_list_append(requests, request);
@@ -1551,7 +1649,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1551 request->offset = upperlimit_offset; 1649 request->offset = upperlimit_offset;
1552 // This length work over multiple viewport as they are contiguous 1650 // This length work over multiple viewport as they are contiguous
1553 request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset; 1651 request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset;
1554 request->model_requested = EINA_TRUE; 1652 request->need_size = EINA_TRUE;
1555 request->need_entity = EINA_TRUE; 1653 request->need_entity = EINA_TRUE;
1556 1654
1557 requests = eina_list_append(requests, request); 1655 requests = eina_list_append(requests, request);
@@ -1571,7 +1669,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(manager_cbs,
1571static void 1669static void
1572_item_scroll_internal(Eo *obj EINA_UNUSED, 1670_item_scroll_internal(Eo *obj EINA_UNUSED,
1573 Efl_Ui_Collection_View_Data *pd, 1671 Efl_Ui_Collection_View_Data *pd,
1574 uint64_t index, 1672 unsigned int index,
1575 double align EINA_UNUSED, 1673 double align EINA_UNUSED,
1576 Eina_Bool anim) 1674 Eina_Bool anim)
1577{ 1675{
@@ -1644,6 +1742,7 @@ _efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Dat
1644 { 1742 {
1645 case 1: 1743 case 1:
1646 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, 1744 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager,
1745 efl_provider_find(obj, EFL_UI_WIN_CLASS),
1647 efl_ref(obj), _batch_entity_cb, _unref_cb, 1746 efl_ref(obj), _batch_entity_cb, _unref_cb,
1648 efl_ref(obj), _batch_size_cb, _unref_cb, 1747 efl_ref(obj), _batch_size_cb, _unref_cb,
1649 count); 1748 count);
@@ -1663,8 +1762,27 @@ _efl_ui_collection_view_position_manager_get(const Eo *obj EINA_UNUSED,
1663} 1762}
1664 1763
1665static void 1764static void
1666_efl_model_count_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 1765_efl_model_count_changed(void *data, const Efl_Event *event EINA_UNUSED)
1667{ 1766{
1767 Efl_Ui_Collection_Request *request = NULL;
1768 Eina_List *requests = NULL;
1769 MY_DATA_GET(data, pd);
1770 unsigned int index;
1771 unsigned int count = 0;
1772
1773 count = efl_model_children_count_get(pd->model);
1774 if (pd->focus.last)
1775 {
1776 index = _lookup_entity_index(pd->focus.last, NULL);
1777
1778 if (index + 1 == count)
1779 return ;
1780 }
1781
1782 // The last item is not the last item anymore
1783 requests = _request_add(requests, &request, count, EINA_TRUE);
1784 requests = _batch_request_flush(requests, data, pd);
1785
1668 // We are not triggering efl_ui_position_manager_entity_data_access_set as it is can 1786 // We are not triggering efl_ui_position_manager_entity_data_access_set as it is can
1669 // only be slow, we rely on child added/removed instead (If we were to not rely on 1787 // only be slow, we rely on child added/removed instead (If we were to not rely on
1670 // child added/removed we could maybe use count changed) 1788 // child added/removed we could maybe use count changed)
@@ -1761,7 +1879,7 @@ _efl_model_child_added(void *data, const Efl_Event *event)
1761 if (!request) break; 1879 if (!request) break;
1762 request->offset = ev->index; 1880 request->offset = ev->index;
1763 request->length = 1; 1881 request->length = 1;
1764 request->model_requested = EINA_TRUE; 1882 request->need_size = EINA_TRUE;
1765 request->need_entity = EINA_TRUE; 1883 request->need_entity = EINA_TRUE;
1766 1884
1767 requests = eina_list_append(requests, request); 1885 requests = eina_list_append(requests, request);
@@ -1773,7 +1891,6 @@ _efl_model_child_added(void *data, const Efl_Event *event)
1773 1891
1774 notify_manager: 1892 notify_manager:
1775#endif 1893#endif
1776 // FIXME this function must be called with an entity
1777 efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL); 1894 efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL);
1778} 1895}
1779 1896
@@ -1789,7 +1906,7 @@ _efl_model_child_removed(void *data, const Efl_Event *event)
1789 unsigned int upper_end; 1906 unsigned int upper_end;
1790 long length; 1907 long length;
1791 unsigned int count; 1908 unsigned int count;
1792 uint64_t request_length; 1909 unsigned int request_length;
1793 1910
1794 // FIXME: later optimization, instead of reloading everyone, we could actually track index and self 1911 // FIXME: later optimization, instead of reloading everyone, we could actually track index and self
1795 // update would be more efficient, but it is also more tricky 1912 // update would be more efficient, but it is also more tricky
@@ -1842,7 +1959,7 @@ _efl_model_child_removed(void *data, const Efl_Event *event)
1842 if (!request) break; 1959 if (!request) break;
1843 request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1; 1960 request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1;
1844 request->length = 1; 1961 request->length = 1;
1845 request->model_requested = EINA_TRUE; 1962 request->need_size = EINA_TRUE;
1846 request->need_entity = EINA_TRUE; 1963 request->need_entity = EINA_TRUE;
1847 1964
1848 requests = eina_list_append(requests, request); 1965 requests = eina_list_append(requests, request);
@@ -1859,6 +1976,7 @@ _efl_model_child_removed(void *data, const Efl_Event *event)
1859 if (request_length > 0) 1976 if (request_length > 0)
1860 { 1977 {
1861 Efl_Ui_Collection_Request *request = NULL; 1978 Efl_Ui_Collection_Request *request = NULL;
1979
1862 requests = _request_add(requests, &request, ev->index, EINA_TRUE); 1980 requests = _request_add(requests, &request, ev->index, EINA_TRUE);
1863 request->length = request_length; 1981 request->length = request_length;
1864 requests = eina_list_append(requests, request); 1982 requests = eina_list_append(requests, request);
@@ -1887,24 +2005,21 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1887 Efl_Model *mselect = NULL; 2005 Efl_Model *mselect = NULL;
1888 Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE; 2006 Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE;
1889 2007
1890 if (ev->previous) efl_event_callback_array_del(ev->previous, model_cbs(), data); 2008 // Cleanup all object, pending request to prepare refetching everything
1891 if (ev->current) efl_event_callback_array_add(ev->current, model_cbs(), data);
1892
1893 // Cleanup all object, pending request and refetch everything
1894 _all_cleanup(data, pd); 2009 _all_cleanup(data, pd);
1895 2010 if (pd->model) efl_event_callback_array_del(pd->model, model_cbs(), data);
1896 efl_replace(&pd->model, NULL); 2011 if (pd->multi_selectable_async_model)
2012 {
2013 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
2014 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
2015 data);
2016 efl_composite_detach(data, pd->multi_selectable_async_model);
2017 }
1897 2018
1898 if (!ev->current) 2019 if (!ev->current)
1899 { 2020 {
1900 if (pd->multi_selectable_async_model) 2021 efl_replace(&pd->model, NULL);
1901 { 2022 efl_replace(&pd->multi_selectable_async_model, NULL);
1902 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
1903 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1904 data);
1905 efl_composite_detach(data, pd->multi_selectable_async_model);
1906 efl_replace(&pd->multi_selectable_async_model, NULL);
1907 }
1908 return ; 2023 return ;
1909 } 2024 }
1910 2025
@@ -1926,11 +2041,11 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1926 // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC 2041 // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC
1927 mselect = ev->current; 2042 mselect = ev->current;
1928 while (mselect && 2043 while (mselect &&
1929 !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE) && 2044 !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE) &&
1930 efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS)) 2045 efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS))
1931 mselect = efl_ui_view_model_get(mselect); 2046 mselect = efl_ui_view_model_get(mselect);
1932 2047
1933 if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE)) 2048 if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE))
1934 { 2049 {
1935 mselect = NULL; 2050 mselect = NULL;
1936 selection = EINA_FALSE; 2051 selection = EINA_FALSE;
@@ -1943,15 +2058,9 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1943 // Build and connect the selection model properly 2058 // Build and connect the selection model properly
1944 if (!mselect) 2059 if (!mselect)
1945 { 2060 {
1946 mselect = model = efl_add(EFL_UI_SELECT_MODEL_CLASS, data, 2061 mselect = model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, data,
1947 efl_ui_view_model_set(efl_added, model)); 2062 efl_ui_view_model_set(efl_added, model),
1948 } 2063 efl_loop_model_volatile_make(efl_added));
1949 if (pd->multi_selectable_async_model)
1950 {
1951 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
1952 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1953 data);
1954 efl_composite_detach(data, pd->multi_selectable_async_model);
1955 } 2064 }
1956 efl_replace(&pd->multi_selectable_async_model, mselect); 2065 efl_replace(&pd->multi_selectable_async_model, mselect);
1957 efl_composite_attach(data, pd->multi_selectable_async_model); 2066 efl_composite_attach(data, pd->multi_selectable_async_model);
@@ -1959,15 +2068,21 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1959 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, 2068 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1960 data); 2069 data);
1961 2070
1962 if (!sizing) model = efl_add(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data, 2071 if (!sizing) model = efl_add_ref(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data,
1963 efl_ui_view_model_set(efl_added, model)); 2072 efl_ui_view_model_set(efl_added, model),
2073 efl_loop_model_volatile_make(efl_added));
2074
2075 efl_replace(&pd->model, model);
2076 efl_event_callback_array_add(pd->model, model_cbs(), data);
2077
2078 if (mselect) efl_unref(mselect);
2079 if (!sizing) efl_unref(model);
1964 2080
1965 count = efl_model_children_count_get(model); 2081 count = efl_model_children_count_get(model);
1966 2082
1967#ifdef VIEWPORT_ENABLE 2083#ifdef VIEWPORT_ENABLE
1968 for (i = 0; i < 3; i++) 2084 for (i = 0; i < 3; i++)
1969 { 2085 {
1970 Efl_Ui_Collection_Request *request;
1971 2086
1972 if (!pd->viewport[i]) continue ; 2087 if (!pd->viewport[i]) continue ;
1973 if (pd->viewport[i]->count == 0) continue ; 2088 if (pd->viewport[i]->count == 0) continue ;
@@ -1977,27 +2092,36 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1977 2092
1978 request->offset = pd->viewport[i]->offset; 2093 request->offset = pd->viewport[i]->offset;
1979 request->length = pd->viewport[i]->count; 2094 request->length = pd->viewport[i]->count;
1980 request->model_requested = EINA_TRUE; 2095 request->need_size = EINA_TRUE;
1981 request->need_entity = EINA_TRUE; 2096 request->need_entity = EINA_TRUE;
1982 2097
1983 requests = eina_list_append(requests, request); 2098 requests = eina_list_append(requests, request);
1984 } 2099 }
1985#endif 2100#endif
2101
2102 // Fetch last item if necessary for later focus
2103 if (efl_model_children_count_get(model))
2104 {
2105 Efl_Ui_Collection_Request *request = NULL;
2106 uint64_t index = efl_model_children_count_get(model) - 1;
2107
2108 requests = _request_add(requests, &request, index, EINA_TRUE);
2109 }