diff --git a/NEWS b/NEWS index 2e209bf5a7..d33c99d3bc 100644 --- a/NEWS +++ b/NEWS @@ -29,26 +29,6 @@ Features: Fixes: - * eo: Fix missing varags cleanup (CID1399080) - * efl_core_command_line: Fix logically dead code (CID1399106) - * efl_ui_widget_common: Fix potential resource leak (CID1399088) - * efl_ui_selection_manager: Fix unchecked return value (CID1399092) - * evas_device: Fix dereferencing null pointer (CID1399091) - * efl_ui_stack: Fix dereference null return value (CID1399082) - * efl_ui_datepicker: Fix uninitialized scalar value (CID1397006) - * efl_ui_grid: Fix dereferencing null pointer (CID1397000) - * ecore_con: Fix dereferencing of null pointer (CID1396990) - * elm_atspi_bridge: Fix resource leak (CID1399429) - * efl_ui_win: Fix dereference null return value (CID1399428) - * efl_ui_win: Fix dereference null return (CID1399427) - * efl_ui_win: Fix dereference null return (CID1399426) - * efl_ui_win: Fix dereference null return value (CID1399425) - * efreet: Fix resource leak (CID1399090) - * efl_ui_text: Fix resource leak (CID1396998) - * eldbus: Fix dereference after null check (CID1399422) - * efl_ui_focus_manager_calc: Fix resource leaks (CID1396984, CID1396965) - * elm_focus_legacy: Fix resource leaks (CID1399096, CID1399095) - * eldbus: Fix resource leak (CID1399097) * efl_canvas_vg_object: Fix dereference after null check (CID1399423, CID1399421) * efl_ui_win: fix hw accel detection * efl_ui_layout: Eina_Error type has been modified to work correctly. @@ -229,6 +209,8 @@ Fixes: * fix xpm loader to be threadable - fixes so much stuff... * efl: check file's mtime in efl.file::file_set to determine if file is the same * meson.build: allow to disable tiff evas loader + * ecore/signal: also use nonblock for writing side of signal pipe + * ector engine: +null checking. Changes since 1.21.0: --------------------- diff --git a/data/elementary/themes/edc/efl/bg.edc b/data/elementary/themes/edc/efl/bg.edc index f66ef6517e..8fe902e54f 100644 --- a/data/elementary/themes/edc/efl/bg.edc +++ b/data/elementary/themes/edc/efl/bg.edc @@ -7,7 +7,7 @@ */ group { "efl/bg"; - data.item: "version" "119"; + data.item: "version" "123"; images.image: "bevel_dark_out.png" COMP; parts { part { name: "clipper"; type: RECT; diff --git a/data/elementary/themes/edc/efl/border.edc b/data/elementary/themes/edc/efl/border.edc index 1bd5a738ac..12f52b73c2 100644 --- a/data/elementary/themes/edc/efl/border.edc +++ b/data/elementary/themes/edc/efl/border.edc @@ -7,7 +7,7 @@ * - virtual keyboard */ -group { "efl/border"; +group { "efl/border"; data.item: "version" "123"; images.image: "vgrad_med_lighter.png" COMP; images.image: "vgrad_med_dark.png" COMP; images.image: "bevel_out.png" COMP; @@ -130,7 +130,7 @@ group { "efl/border"; rel.to: "efl.menu"; } } - swallow { "efl.menu"; + swallow { "efl.menu"; required; required: 1; // since 1.19 desc { "default"; rel.to: "indicator_spacer"; @@ -162,7 +162,7 @@ group { "efl/border"; } /* application contents */ - swallow { "efl.client"; + swallow { "efl.client"; required; clip: "client_clip"; desc { "default"; rel.to: "client_spacer"; @@ -308,7 +308,7 @@ group { "efl/border"; rel2.relative: 1.2 1.2; } } - swallow { "efl.icon"; nomouse; + swallow { "efl.icon"; nomouse; required; clip_to: "top_clip"; desc { "default"; rel1.to: "icon"; @@ -694,7 +694,7 @@ group { "efl/border"; color: 0 0 0 0; } } - swallow { "efl.indicator"; + swallow { "efl.indicator"; required; clip: "bg_clip"; desc { "default"; rel.to: "top_clip"; @@ -1124,6 +1124,7 @@ group { "efl/border"; group { "efl/border/dialog"; inherit: "efl/border"; + data.item: "version" "123"; parts { text { "efl.text.title"; clip: "top_clip"; @@ -1191,6 +1192,7 @@ group { "efl/border/dialog"; group { "efl/border/naviframe"; inherit: "efl/border"; + data.item: "version" "123"; images.image: "sym_left_dark_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_light_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index 203e467cc7..bd07559076 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -1,4 +1,4 @@ -group { name: "efl/button"; +group { name: "efl/button"; data.item: "version" "123"; images.image: "button_normal.png" COMP; images.image: "button_clicked.png" COMP; @@ -320,7 +320,7 @@ group { name: "efl/button"; } } program { name: "buttonactivate"; - signal: "efl,anim,activate"; source: "efl"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "base"; after: "button_unpressed_anim"; @@ -331,7 +331,7 @@ group { name: "efl/button"; target: "base"; } program { name: "button_text_visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -339,7 +339,7 @@ group { name: "efl/button"; } } program { name: "button_text_hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -347,7 +347,7 @@ group { name: "efl/button"; } } program { name: "button_icon_visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -355,7 +355,7 @@ group { name: "efl/button"; } } program { name: "button_icon_hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); @@ -403,7 +403,7 @@ group { name: "efl/button"; #undef BACKGROUND } -group { name: "efl/button:anchor"; +group { name: "efl/button:anchor"; data.item: "version" "123"; images.image: "horizontal_separated_bar_small_glow.png" COMP; #define ICON 1 #define LABEL 2 @@ -696,7 +696,7 @@ group { name: "efl/button:anchor"; target: "text2"; } program { - signal: "efl,anim,activate"; source: "efl"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "clicked" 0.0; target: "bar2"; target: "text2"; @@ -713,7 +713,7 @@ group { name: "efl/button:anchor"; action: SIGNAL_EMIT "efl,action,click" "efl"; } program { name: "button_text_visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -721,7 +721,7 @@ group { name: "efl/button:anchor"; } } program { name: "button_text_hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -729,7 +729,7 @@ group { name: "efl/button:anchor"; } } program { name: "button_icon_visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -737,7 +737,7 @@ group { name: "efl/button:anchor"; } } program { name: "button_icon_hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/calendar.edc b/data/elementary/themes/edc/efl/calendar.edc index 5408d44951..7ec30b14fb 100644 --- a/data/elementary/themes/edc/efl/calendar.edc +++ b/data/elementary/themes/edc/efl/calendar.edc @@ -420,7 +420,7 @@ } \ } -group { "efl/calendar"; +group { "efl/calendar"; data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; @@ -541,7 +541,7 @@ group { "efl/calendar"; #undef CIT #undef CH - group { name: "efl/calendar/inc_button"; + group { name: "efl/calendar/inc_button"; data.item: "version" "123"; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_right_glow_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP; @@ -647,7 +647,7 @@ group { "efl/calendar"; action: SIGNAL_EMIT "efl,action,click" ""; } program { name: "access_pressed"; - signal: "efl,action,anim,activate"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "arrow.image"; @@ -693,6 +693,7 @@ group { "efl/calendar"; group { name: "efl/calendar/dec_button"; inherit: "efl/calendar/inc_button"; + data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_dark_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/check.edc b/data/elementary/themes/edc/efl/check.edc index aed5ac6762..5aabedee9e 100644 --- a/data/elementary/themes/edc/efl/check.edc +++ b/data/elementary/themes/edc/efl/check.edc @@ -1,4 +1,4 @@ -group { "efl/check"; +group { "efl/check"; data.item: "version" "123"; images.image: "inset_shadow_tiny.png" COMP; images.image: "bevel_in.png" COMP; images.image: "sym_check_alum.png" COMP; @@ -258,17 +258,17 @@ group { "efl/check"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,check,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; action: STATE_SET "selected" 0.0; target: "indicator"; } program { - signal: "efl,state,check,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; action: STATE_SET "default" 0.0; target: "indicator"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -276,7 +276,7 @@ group { "efl/check"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -284,7 +284,7 @@ group { "efl/check"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -292,7 +292,7 @@ group { "efl/check"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); @@ -322,7 +322,7 @@ group { "efl/check"; #undef DISABLE } -group { "efl/check:toggle"; +group { "efl/check:toggle"; data.item: "version" "123"; images.image: "inset_shadow_tiny.png" COMP; images.image: "bevel_in.png" COMP; images.image: "bevel_out.png" COMP; @@ -773,7 +773,7 @@ group { "efl/check:toggle"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,check,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; script { new Float:drag; if (get_int(is_rtl) == 0) { @@ -785,7 +785,7 @@ group { "efl/check:toggle"; } } program { - signal: "efl,state,check,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; script { new Float:drag; if (get_int(is_rtl) == 0) { @@ -809,9 +809,9 @@ group { "efl/check:toggle"; } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { - emit("efl,action,check,off", "efl"); + emit("efl,action,unselect", "efl"); } else { - emit("efl,action,check,on", "efl"); + emit("efl,action,select", "efl"); } } } @@ -842,9 +842,9 @@ group { "efl/check:toggle"; } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { - emit("efl,action,check,on", "efl"); + emit("efl,action,select", "efl"); } else { - emit("efl,action,check,off", "efl"); + emit("efl,action,unselect", "efl"); } set_int(was_drag, 1); set_int(is_drag, 0); @@ -864,7 +864,7 @@ group { "efl/check:toggle"; target: "glow_but"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -872,7 +872,7 @@ group { "efl/check:toggle"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -880,7 +880,7 @@ group { "efl/check:toggle"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -888,7 +888,7 @@ group { "efl/check:toggle"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/collection.edc b/data/elementary/themes/edc/efl/collection.edc index d74981dbb2..47183573f4 100644 --- a/data/elementary/themes/edc/efl/collection.edc +++ b/data/elementary/themes/edc/efl/collection.edc @@ -1,3 +1,4 @@ group { "efl/collection"; inherit: "efl/scroller"; + data.item: "version" "123"; } diff --git a/data/elementary/themes/edc/efl/cursor.edc b/data/elementary/themes/edc/efl/cursor.edc index a62817708b..9376befe75 100644 --- a/data/elementary/themes/edc/efl/cursor.edc +++ b/data/elementary/themes/edc/efl/cursor.edc @@ -78,7 +78,7 @@ // "watch" // "xterm" -group { name: "efl/cursor/hand1"; +group { name: "efl/cursor/hand1"; data.item: "version" "123"; images.image: "pointer_hand1.png" COMP; parts { part { name: "base"; mouse_events: 0; scale: 1; @@ -103,7 +103,7 @@ group { name: "efl/cursor/hand1"; } } -group { name: "efl/cursor/blank"; +group { name: "efl/cursor/blank"; data.item: "version" "123"; parts { part { name: "efl.hotspot"; type: SWALLOW; description { state: "default" 0.0; @@ -116,7 +116,7 @@ group { name: "efl/cursor/blank"; } } -group { name: "efl/cursor/xterm"; +group { name: "efl/cursor/xterm"; data.item: "version" "123"; images.image: "pointer_entry_bar.png" COMP; images.image: "led_dot_white.png" COMP; parts { diff --git a/data/elementary/themes/edc/efl/datepicker.edc b/data/elementary/themes/edc/efl/datepicker.edc index cdc76e38e6..cc913e253b 100644 --- a/data/elementary/themes/edc/efl/datepicker.edc +++ b/data/elementary/themes/edc/efl/datepicker.edc @@ -1,4 +1,4 @@ -group { "efl/datepicker"; +group { "efl/datepicker"; data.item: "version" "123"; parts { spacer { "base"; scale; @@ -182,7 +182,7 @@ group { "efl/datepicker"; } } -group { "efl/datepicker/spin_button"; +group { "efl/datepicker/spin_button"; data.item: "version" "123"; parts { rect { "clip"; desc { "default"; @@ -282,25 +282,25 @@ group { "efl/datepicker/spin_button"; } programs { program { "entry_active"; - signal: "efl,state,entry,active"; + signal: "efl,entry,visible,on"; source: "efl"; action: STATE_SET "active"; target: "efl.entry"; } program { "entry_inactive"; - signal: "efl,state,entry,inactive"; + signal: "efl,entry,visible,off"; source: "efl"; action: STATE_SET "default"; target: "efl.entry"; } program { "text_button_active"; - signal: "efl,state,button,active"; + signal: "efl,button,visible,on"; source: "efl"; action: STATE_SET "default"; target: "efl.text_button"; } program { "text_button_inactive"; - signal: "efl,state,button,inactive"; + signal: "efl,button,visible,off"; source: "efl"; action: STATE_SET "inactive"; target: "efl.text_button"; diff --git a/data/elementary/themes/edc/efl/focus.edc b/data/elementary/themes/edc/efl/focus.edc index a5edbe49b3..c1f4695668 100644 --- a/data/elementary/themes/edc/efl/focus.edc +++ b/data/elementary/themes/edc/efl/focus.edc @@ -1,4 +1,4 @@ -group { name: "efl/focus_highlight/top"; +group { name: "efl/focus_highlight/top"; data.item: "version" "123"; images.image: "box_glow.png" COMP; images.image: "box_outline.png" COMP; data.item: "animate" "on"; @@ -118,7 +118,7 @@ group { name: "efl/focus_highlight/top"; } programs { program { - signal: "efl,action,focus,show"; source: "efl"; + signal: "efl,focus,visible,on"; source: "efl"; action: ACTION_STOP; target: "pulse"; target: "pulse2"; @@ -132,17 +132,17 @@ group { name: "efl/focus_highlight/top"; after: "go3"; } program { name: "go3"; - action: SIGNAL_EMIT "efl,action,focus,show,end" "efl"; + action: SIGNAL_EMIT "efl,focus,visible,on,done" "efl"; } program { - signal: "efl,action,focus,hide"; source: "efl"; + signal: "efl,focus,visible,off"; source: "efl"; action: STATE_SET "default" 0.0; transition: DECELERATE 0.4; target: "clip"; after: "stop2"; } program { name: "stop2"; - action: SIGNAL_EMIT "efl,action,focus,hide,end" "efl"; + action: SIGNAL_EMIT "efl,focus,visible,off,done" "efl"; after: "stop3"; } program { name: "stop3"; @@ -164,14 +164,14 @@ group { name: "efl/focus_highlight/top"; after: "pulse"; } program { - signal: "efl,state,anim,stop"; source: "efl"; + signal: "efl,state,animating,stopped"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; } } } -group { name: "efl/focus_highlight/top:blank"; +group { name: "efl/focus_highlight/top:blank"; data.item: "version" "123"; parts { } } diff --git a/data/elementary/themes/edc/efl/frame.edc b/data/elementary/themes/edc/efl/frame.edc index d964e47502..1844d25f22 100644 --- a/data/elementary/themes/edc/efl/frame.edc +++ b/data/elementary/themes/edc/efl/frame.edc @@ -1,4 +1,4 @@ -group { name: "efl/frame"; +group { name: "efl/frame"; data.item: "version" "123"; images.image: "shadow_square_tiny.png" COMP; images.image: "vgrad_med_curved.png" COMP; images.image: "bevel_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/grid.edc b/data/elementary/themes/edc/efl/grid.edc index fec2e8e110..4018bc0de4 100644 --- a/data/elementary/themes/edc/efl/grid.edc +++ b/data/elementary/themes/edc/efl/grid.edc @@ -1,12 +1,14 @@ group { "efl/grid"; inherit: "efl/scroller"; + data.item: "version" "123"; } group { "efl/view_grid"; inherit: "efl/grid"; + data.item: "version" "123"; } -group { "efl/grid_item"; +group { "efl/grid_item"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_dark_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/group_item.edc b/data/elementary/themes/edc/efl/group_item.edc index 44a19d820b..c052f6dd55 100644 --- a/data/elementary/themes/edc/efl/group_item.edc +++ b/data/elementary/themes/edc/efl/group_item.edc @@ -1,6 +1,6 @@ -group { "efl/group_item"; nomouse; program_source: "efl"; +group { "efl/group_item"; data.item: "version" "123"; nomouse; program_source: "efl"; images.image: "shadow_square_tiny.png" COMP; images.image: "bevel_out.png" COMP; images.image: "horizontal_separated_bar_small_glow.png" COMP; diff --git a/data/elementary/themes/edc/efl/image_zoomable.edc b/data/elementary/themes/edc/efl/image_zoomable.edc index 8f4492c33f..7ec3644d60 100644 --- a/data/elementary/themes/edc/efl/image_zoomable.edc +++ b/data/elementary/themes/edc/efl/image_zoomable.edc @@ -1,5 +1,6 @@ group { name: "efl/image_zoomable"; inherit: "efl/scroller"; + data.item: "version" "123"; images.image: "knob_round_busy.png" COMP; images.image: "glow_round_corners.png" COMP; parts { @@ -45,7 +46,7 @@ group { name: "efl/image_zoomable"; } programs { program { name: "spin"; - signal: "efl,state,busy,start"; source: "efl"; + signal: "efl,state,busy,started"; source: "efl"; action: ACTION_STOP; target: "spin"; target: "spin0"; @@ -73,14 +74,14 @@ group { name: "efl/image_zoomable"; } program { - signal: "efl,state,busy,start"; source: "efl"; + signal: "efl,state,busy,started"; source: "efl"; action: STATE_SET "active" 0.0; transition: SINUSOIDAL 0.25; target: "busy_clip"; } program { - signal: "efl,state,busy,stop"; source: "efl"; + signal: "efl,state,busy,stopped"; source: "efl"; action: STATE_SET "default" 0.0; transition: SINUSOIDAL 1.0; target: "busy_clip"; diff --git a/data/elementary/themes/edc/efl/list.edc b/data/elementary/themes/edc/efl/list.edc index b0a08c1e50..23a99f6760 100644 --- a/data/elementary/themes/edc/efl/list.edc +++ b/data/elementary/themes/edc/efl/list.edc @@ -1,12 +1,14 @@ group { "efl/list"; inherit: "efl/scroller"; + data.item: "version" "123"; } group { "efl/list_view"; inherit: "efl/list"; + data.item: "version" "123"; } -group { "efl/list_item"; +group { "efl/list_item"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; @@ -293,7 +295,7 @@ group { "efl/list_item"; } } -group { "efl/list_item:placeholder"; +group { "efl/list_item:placeholder"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/navigation_bar.edc b/data/elementary/themes/edc/efl/navigation_bar.edc index c2b4cee795..ab51d4aea6 100644 --- a/data/elementary/themes/edc/efl/navigation_bar.edc +++ b/data/elementary/themes/edc/efl/navigation_bar.edc @@ -1,5 +1,5 @@ //Efl.Ui.Navigation_Bar Themes -group { "efl/navigation_bar"; +group { "efl/navigation_bar"; data.item: "version" "123"; styles { style { name: "navigation_bar_text"; base: "font="FNBD" font_size=10 text_class=label align=center color=#fff color_class=navigation_bar_text style=shadow,bottom shadow_color=#00000080 ellipsis=1.0 wrap=mixed"; @@ -101,6 +101,7 @@ group { "efl/navigation_bar"; group { name: "efl/navigation_bar/back_button"; inherit: "efl/button"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; parts { image { name: "icon_arrow_left"; diff --git a/data/elementary/themes/edc/efl/navigation_layout.edc b/data/elementary/themes/edc/efl/navigation_layout.edc index 9947d6d313..a75157da28 100644 --- a/data/elementary/themes/edc/efl/navigation_layout.edc +++ b/data/elementary/themes/edc/efl/navigation_layout.edc @@ -1,5 +1,5 @@ //Efl.Ui.Navigation_Layout Themes -group { "efl/navigation_layout"; +group { "efl/navigation_layout"; data.item: "version" "123"; parts { spacer { "base"; desc { "default"; diff --git a/data/elementary/themes/edc/efl/pager.edc b/data/elementary/themes/edc/efl/pager.edc index b6b286e999..6f45c3680c 100644 --- a/data/elementary/themes/edc/efl/pager.edc +++ b/data/elementary/themes/edc/efl/pager.edc @@ -1,4 +1,4 @@ -group { "efl/pager"; +group { "efl/pager"; data.item: "version" "123"; parts { spacer { "base"; scale; @@ -32,7 +32,7 @@ group { "efl/pager"; } } -group { "efl/pager/indicator"; +group { "efl/pager/indicator"; data.item: "version" "123"; images { image: "ring_white_middle.png" COMP; } diff --git a/data/elementary/themes/edc/efl/panel.edc b/data/elementary/themes/edc/efl/panel.edc index aee2e31f6f..6ad3afc727 100644 --- a/data/elementary/themes/edc/efl/panel.edc +++ b/data/elementary/themes/edc/efl/panel.edc @@ -1,4 +1,4 @@ -group { name: "efl/panel"; +group { name: "efl/panel"; data.item: "version" "123"; data { item: "handler_size" "30"; } @@ -10,7 +10,7 @@ group { name: "efl/panel"; } } } -group { name: "efl/panel/scrollable/left"; +group { name: "efl/panel/scrollable/left"; data.item: "version" "123"; parts { part { name: "efl.panel_area"; type: SWALLOW; @@ -102,7 +102,7 @@ group { name: "efl/panel/scrollable/left"; } } -group { name: "efl/panel/scrollable/right"; +group { name: "efl/panel/scrollable/right"; data.item: "version" "123"; parts { part { name: "efl.event_area"; type: SWALLOW; @@ -194,7 +194,7 @@ group { name: "efl/panel/scrollable/right"; } } -group { name: "efl/panel/scrollable/top"; +group { name: "efl/panel/scrollable/top"; data.item: "version" "123"; parts { part { name: "efl.panel_area"; type: SWALLOW; @@ -286,7 +286,7 @@ group { name: "efl/panel/scrollable/top"; } } -group { name: "efl/panel/scrollable/bottom"; +group { name: "efl/panel/scrollable/bottom"; data.item: "version" "123"; parts { part { name: "efl.event_area"; type: SWALLOW; @@ -378,7 +378,7 @@ group { name: "efl/panel/scrollable/bottom"; } } -group { name: "efl/panel/left"; +group { name: "efl/panel/left"; data.item: "version" "123"; images.image: "bevel_out.png" COMP; images.image: "shine.png" COMP; images.image: "shadow_square_tiny.png" COMP; @@ -627,6 +627,7 @@ group { name: "efl/panel/left"; group { name: "efl/panel/right"; inherit: "efl/panel/left"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; @@ -681,6 +682,7 @@ group { name: "efl/panel/right"; group { name: "efl/panel/top"; inherit: "efl/panel/left"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; @@ -775,6 +777,7 @@ group { name: "efl/panel/top"; group { name: "efl/panel/bottom"; inherit: "efl/panel/top"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/panes.edc b/data/elementary/themes/edc/efl/panes.edc index 5bd90aed7d..7b8993401a 100644 --- a/data/elementary/themes/edc/efl/panes.edc +++ b/data/elementary/themes/edc/efl/panes.edc @@ -13,7 +13,7 @@ #define PANEMIN2 16 #define PANEWID 32 -group { name: "efl/panes/vertical"; +group { name: "efl/panes/vertical"; data.item: "version" "123"; images.image: "holes_vert.png" COMP; parts { //TODO: remove left/right @@ -143,7 +143,7 @@ group { name: "efl/panes/vertical"; } } -group { name: "efl/panes/horizontal"; +group { name: "efl/panes/horizontal"; data.item: "version" "123"; images.image: "holes_horiz.png" COMP; parts { //TODO: remove left/right @@ -273,7 +273,7 @@ group { name: "efl/panes/horizontal"; } } -group { name: "efl/panes/vertical:flush"; +group { name: "efl/panes/vertical:flush"; data.item: "version" "123"; images.image: "downlight_glow_left.png" COMP; images.image: "downlight_glow_right.png" COMP; parts { @@ -490,7 +490,7 @@ group { name: "efl/panes/vertical:flush"; } } -group { name: "efl/panes/horizontal:flush"; +group { name: "efl/panes/horizontal:flush"; data.item: "version" "123"; images.image: "downlight_glow.png" COMP; images.image: "downlight_glow_up.png" COMP; parts { @@ -709,6 +709,7 @@ group { name: "efl/panes/horizontal:flush"; group { name: "efl/panes/vertical:left-fold"; inherit: "efl/panes/vertical"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; images.image: "icon_arrow_right.png" COMP; script { @@ -772,6 +773,7 @@ group { name: "efl/panes/vertical:left-fold"; group { name: "efl/panes/vertical:right-fold"; inherit: "efl/panes/vertical"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; images.image: "icon_arrow_right.png" COMP; script { @@ -835,6 +837,7 @@ group { name: "efl/panes/vertical:right-fold"; group { name: "efl/panes/horizontal:up-fold"; inherit: "efl/panes/horizontal"; + data.item: "version" "123"; images.image: "icon_arrow_up.png" COMP; images.image: "icon_arrow_down.png" COMP; script { @@ -898,6 +901,7 @@ group { name: "efl/panes/horizontal:up-fold"; group { name: "efl/panes/horizontal:down-fold"; inherit: "efl/panes/horizontal"; + data.item: "version" "123"; images.image: "icon_arrow_up.png" COMP; images.image: "icon_arrow_down.png" COMP; script { diff --git a/data/elementary/themes/edc/efl/pointer.edc b/data/elementary/themes/edc/efl/pointer.edc index 0794400b23..d720005b90 100644 --- a/data/elementary/themes/edc/efl/pointer.edc +++ b/data/elementary/themes/edc/efl/pointer.edc @@ -1,4 +1,4 @@ -group { name: "efl/pointer"; +group { name: "efl/pointer"; data.item: "version" "123"; images { image: "pointer.png" COMP; image: "pointer_glow.png" COMP; @@ -105,6 +105,7 @@ group { name: "efl/pointer"; group { name: "efl/pointer:bottom_right_corner"; inherit: "efl/pointer"; + data.item: "version" "123"; images.image: "mini_box_glow.png" COMP; parts { part { name: "box"; @@ -141,6 +142,7 @@ group { name: "efl/pointer:bottom_right_corner"; group { name: "efl/pointer:bottom_left_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -158,6 +160,7 @@ group { name: "efl/pointer:bottom_left_corner"; group { name: "efl/pointer:bottom_side"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -174,6 +177,7 @@ group { name: "efl/pointer:bottom_side"; group { name: "efl/pointer:top_right_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -190,6 +194,7 @@ group { name: "efl/pointer:top_right_corner"; group { name: "efl/pointer:top_left_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -206,6 +211,7 @@ group { name: "efl/pointer:top_left_corner"; group { name: "efl/pointer:top_side"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index ed75534791..c67eabc932 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -1,5 +1,6 @@ //Efl.Ui.Popup Themes group { "efl/popup"; + data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { spacer { "base"; @@ -28,10 +29,9 @@ group { "efl/popup"; } } -group { "efl/alert_popup"; +group { "efl/alert_popup"; data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { - alias: "title" "efl.text.title"; image { "bg"; desc { "default"; min: 100 100; @@ -106,20 +106,26 @@ group { "efl/alert_popup"; } programs { program { - signal: "efl,title,show"; source: "efl"; + signal: "efl,title,visible,on"; source: "efl"; action: STATE_SET "title_visible" 0.0; target: "title_bg"; target: "efl.text.title"; } program { - signal: "efl,buttons,show"; source: "efl"; + signal: "efl,title,visible,off"; source: "efl"; + action: STATE_SET "default" 0.0; + target: "title_bg"; + target: "efl.text.title"; + } + program { + signal: "efl,buttons,visible,on"; source: "efl"; action: STATE_SET "button_visible" 0.0; target: "efl.buttons"; } } } -group { "efl/popup/backwall"; +group { "efl/popup/backwall"; data.item: "version" "123"; alias: "efl/alert_popup/backwall"; parts { rect { "base"; @@ -151,32 +157,32 @@ group { "efl/popup/backwall"; programs { program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; action: STATE_SET "content_visible" 0.0; target: "base"; target: "efl.content"; } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; target: "efl.content"; } program { signal: "mouse,clicked,1"; source: "block"; - action: SIGNAL_EMIT "efl,action,clicked" "efl"; + action: SIGNAL_EMIT "efl,action,click" "efl"; } } } -group { "efl/alert_popup/button_layout1"; +group { "efl/alert_popup/button_layout1"; data.item: "version" "123"; parts { swallow { "efl.button1"; required; } } } -group { "efl/alert_popup/button_layout2"; +group { "efl/alert_popup/button_layout2"; data.item: "version" "123"; parts { spacer { "div1"; desc { "default"; @@ -200,7 +206,7 @@ group { "efl/alert_popup/button_layout2"; } } -group { "efl/alert_popup/button_layout3"; +group { "efl/alert_popup/button_layout3"; data.item: "version" "123"; parts { spacer { "div1"; desc { "default"; @@ -241,12 +247,15 @@ group { "efl/alert_popup/button_layout3"; group { "efl/alert_popup/left_button"; inherit: "efl/button"; + data.item: "version" "123"; } group { "efl/alert_popup/right_button"; inherit: "efl/button"; + data.item: "version" "123"; } group { "efl/alert_popup/button"; inherit: "efl/button"; + data.item: "version" "123"; } diff --git a/data/elementary/themes/edc/efl/progress.edc b/data/elementary/themes/edc/efl/progress.edc index 1d48b20545..d319097727 100644 --- a/data/elementary/themes/edc/efl/progress.edc +++ b/data/elementary/themes/edc/efl/progress.edc @@ -1,4 +1,5 @@ group { "efl/progressbar/horizontal"; + data.item: "version" "123"; images.image: "inset_bar_horiz_base.png" COMP; images.image: "inset_bar_horiz_light.png" COMP; images.image: "inset_bar_horiz_inside_base.png" COMP; @@ -504,7 +505,7 @@ group { "efl/progressbar/horizontal"; target: "efl.text.status"; } program { name: "text-visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(slmode); m |= LABEL; set_int(slmode, m); @@ -512,7 +513,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "text-hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~LABEL; set_int(slmode, m); @@ -520,7 +521,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "icon-visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(slmode); m |= ICON; set_int(slmode, m); @@ -528,7 +529,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "icon-hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~ICON; set_int(slmode, m); @@ -559,6 +560,7 @@ group { "efl/progressbar/horizontal"; } group { "efl/progressbar/vertical"; + data.item: "version" "123"; images.image: "inset_bar_vert_base.png" COMP; images.image: "inset_bar_vert_light.png" COMP; images.image: "inset_bar_vert_inside_base.png" COMP; @@ -1077,7 +1079,7 @@ group { "efl/progressbar/vertical"; target: "efl.text.status"; } program { name: "text-visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(slmode); m |= LABEL; set_int(slmode, m); @@ -1085,7 +1087,7 @@ group { "efl/progressbar/vertical"; } } program { name: "text-hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~LABEL; set_int(slmode, m); @@ -1093,7 +1095,7 @@ group { "efl/progressbar/vertical"; } } program { name: "icon-visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(slmode); m |= ICON; set_int(slmode, m); @@ -1101,7 +1103,7 @@ group { "efl/progressbar/vertical"; } } program { name: "icon-hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~ICON; set_int(slmode, m); @@ -1132,6 +1134,7 @@ group { "efl/progressbar/vertical"; } group { "efl/progressbar/horizontal:wheel"; + data.item: "version" "123"; alias: "efl/progressbar/vertical:wheel"; images.image: "knob_round_busy.png" COMP; images.image: "glow_round_corners.png" COMP; @@ -1226,6 +1229,7 @@ group { "efl/progressbar/horizontal:wheel"; group { "efl/progressbar/horizontal:double"; inherit: "efl/progressbar/horizontal"; + data.item: "version" "123"; images { image: "inset_bar_horiz_glow_base_double.png" COMP; image: "inset_bar_horiz_glow_inv_base_double.png" COMP; @@ -1315,6 +1319,7 @@ group { "efl/progressbar/horizontal:double"; group { "efl/progressbar/vertical:double"; inherit: "efl/progressbar/vertical"; + data.item: "version" "123"; images { image: "inset_bar_vert_glow_base_double.png" COMP; image: "inset_bar_vert_glow_inv_base_double.png" COMP; diff --git a/data/elementary/themes/edc/efl/radio.edc b/data/elementary/themes/edc/efl/radio.edc index 35744936f7..06b064cd4c 100644 --- a/data/elementary/themes/edc/efl/radio.edc +++ b/data/elementary/themes/edc/efl/radio.edc @@ -1,4 +1,5 @@ group { "efl/radio"; + data.item: "version" "123"; images.image: "inset_shadow_circle_tiny.png" COMP; images.image: "inset_circle_tiny.png" COMP; images.image: "sym_radio_alum.png" COMP; @@ -224,17 +225,17 @@ group { "efl/radio"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,radio,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; action: STATE_SET "selected" 0.0; target: "indicator"; } program { - signal: "efl,state,radio,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; action: STATE_SET "default" 0.0; target: "indicator"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -242,7 +243,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -250,7 +251,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -258,7 +259,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index d53f6d5663..478a973639 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -1,4 +1,5 @@ group { name: "efl/scroller"; + data.item: "version" "123"; images.image: "inset_shadow.png" COMP; images.image: "bevel_in.png" COMP; images.image: "bevel_out.png" COMP; @@ -300,7 +301,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,action,show,vbar"; source: "efl"; + signal: "efl,vertical_bar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -315,7 +316,7 @@ group { name: "efl/scroller"; target: "arrow2_vbar_indent"; } program { - signal: "efl,action,hide,vbar"; source: "efl"; + signal: "efl,vertical_bar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -377,20 +378,6 @@ group { name: "efl/scroller"; action_on_pos_vbar(10); } } - program { name: "loop_set_vbar"; - signal: "efl,loop_y,set"; source: "efl"; - script { - set_int(loop_y, 1); - action_on_pos_vbar(10); - } - } - program { name: "loop_unset_vbar"; - signal: "efl,loop_y,unset"; source: "efl"; - script { - set_int(loop_y, 0); - action_on_pos_vbar(10); - } - } // horiz bar ///////////////////////////////////////////////////////////// part { name: "sb_hbar_show"; type: RECT; @@ -581,7 +568,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,action,show,hbar"; source: "efl"; + signal: "efl,horizontal_bar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; @@ -596,7 +583,7 @@ group { name: "efl/scroller"; target: "arrow2_hbar_indent"; } program { - signal: "efl,action,hide,hbar"; source: "efl"; + signal: "efl,horizontal_bar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; @@ -658,20 +645,6 @@ group { name: "efl/scroller"; action_on_pos_hbar(10); } } - program { name: "loop_set_hbar"; - signal: "efl,loop_x,set"; source: "efl"; - script { - set_int(loop_x, 1); - action_on_pos_hbar(10); - } - } - program { name: "loop_unset_hbar"; - signal: "efl,loop_x,unset"; source: "efl"; - script { - set_int(loop_x, 0); - action_on_pos_hbar(10); - } - } part { name: "bg"; type: RECT; description { state: "default" 0.0; rel1.to: "efl.background"; @@ -1128,7 +1101,7 @@ group { name: "efl/scroller"; } program { signal: "mouse,down,*"; source: "efl.dragable.vbar"; - action: SIGNAL_EMIT "efl,vbar,press" "efl"; + action: SIGNAL_EMIT "efl,vertical_bar,press" "efl"; } program { signal: "mouse,up,1"; source: "efl.dragable.vbar"; @@ -1152,7 +1125,7 @@ group { name: "efl/scroller"; } program { signal: "mouse,down,*"; source: "efl.dragable.hbar"; - action: SIGNAL_EMIT "efl,hbar,press" "efl"; + action: SIGNAL_EMIT "efl,horizontal_bar,press" "efl"; } program { signal: "mouse,up,1"; source: "efl.dragable.hbar"; @@ -1164,77 +1137,14 @@ group { name: "efl/scroller"; } program { signal: "mouse,up,*"; source: "efl.dragable.hbar"; - action: SIGNAL_EMIT "efl,hbar,unpress" "efl"; - } - program { - signal: "efl,action,looping,left"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,left,done"; - } - program { name: "looping,left,done"; - action: SIGNAL_EMIT "efl,looping,left,done" "efl"; - } - program { - signal: "efl,action,looping,left,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,right"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,right,done"; - } - program { name: "looping,right,done"; - action: SIGNAL_EMIT "efl,looping,right,done" "efl"; - } - program { - signal: "efl,action,looping,right,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,up"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,up,done"; - } - program { name: "looping,up,done"; - action: SIGNAL_EMIT "efl,looping,up,done" "efl"; - } - program { - signal: "efl,action,looping,up,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,down"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,down,done"; - } - program { name: "looping,down,done"; - action: SIGNAL_EMIT "efl,looping,down,done" "efl"; - } - program { - signal: "efl,action,looping,down,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; + action: SIGNAL_EMIT "efl,horizontal_bar,unpress" "efl"; } } } group { name: "efl/scroller:noclip"; inherit: "efl/scroller"; + data.item: "version" "123"; parts { part { name: "clipper"; description { state: "default" 0.0; @@ -1269,6 +1179,7 @@ group { name: "efl/scroller:noclip"; group { name: "efl/scroller:popup/no_inset_shadow"; inherit: "efl/scroller"; + data.item: "version" "123"; parts { part { name: "inset"; description { state: "default" 0.0; @@ -1282,55 +1193,3 @@ group { name: "efl/scroller:popup/no_inset_shadow"; } } } - -group { name: "efl/scroller/contents"; - parts { - part { name: "efl.content"; required; - type: SWALLOW; - description { state: "default" 0.0; - } - } - part { name: "efl.content_r"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 1.0 0.0; - to: "efl.content"; - } - rel2 { - relative: 2.0 1.0; - to: "efl.content"; - } - } - } - part { name: "efl.content_b"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 0.0 1.0; - to: "efl.content"; - } - rel2 { - relative: 1.0 2.0; - to: "efl.content"; - } - } - } - part { name: "efl.content_rb"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 1.0 1.0; - to: "efl.content"; - } - rel2 { - relative: 2.0 2.0; - to: "efl.content"; - } - } - } - } -} diff --git a/data/elementary/themes/edc/efl/slider.edc b/data/elementary/themes/edc/efl/slider.edc index 095e3aca33..d29fd6359b 100644 --- a/data/elementary/themes/edc/efl/slider.edc +++ b/data/elementary/themes/edc/efl/slider.edc @@ -1,4 +1,5 @@ group { "efl/slider/horizontal"; + data.item: "version" "123"; alias: "efl/slider/horizontal:disabled"; images.image: "slider_run_base_horiz.png" COMP; images.image: "slider_run_bevel_horiz.png" COMP; @@ -235,6 +236,7 @@ group { "efl/slider/horizontal"; } group { "efl/slider/vertical"; + data.item: "version" "123"; alias: "efl/slider/vertical:disabled"; images.image: "slider_run_base_vert.png" COMP; images.image: "slider_run_bevel_vert.png" COMP; @@ -473,6 +475,7 @@ group { "efl/slider/vertical"; //Range group { "efl/slider_interval/horizontal"; + data.item: "version" "123"; alias: "efl/slider/horizontal:disabled"; images.image: "slider_run_base_horiz.png" COMP; images.image: "slider_run_bevel_horiz.png" COMP; @@ -755,6 +758,7 @@ group { "efl/slider_interval/horizontal"; } group { "efl/slider_interval/vertical"; + data.item: "version" "123"; alias: "efl/slider/vertical:disabled"; images.image: "slider_run_base_vert.png" COMP; images.image: "slider_run_bevel_vert.png" COMP; diff --git a/data/elementary/themes/edc/efl/spin.edc b/data/elementary/themes/edc/efl/spin.edc index d16d15e8ce..131548fb01 100644 --- a/data/elementary/themes/edc/efl/spin.edc +++ b/data/elementary/themes/edc/efl/spin.edc @@ -1,4 +1,5 @@ group { "efl/spin"; + data.item: "version" "123"; parts { rect { "bg"; scale; diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc index 070144de28..d359fc3384 100644 --- a/data/elementary/themes/edc/efl/spin_button.edc +++ b/data/elementary/themes/edc/efl/spin_button.edc @@ -1,4 +1,5 @@ group { "efl/spin_button/horizontal"; + data.item: "version" "123"; images.image: "vert_bar_inset.png" COMP; parts { rect { "clip"; @@ -100,25 +101,25 @@ group { "efl/spin_button/horizontal"; } programs { program { "entry_active"; - signal: "efl,state,entry,active"; + signal: "efl,entry,visible,on"; source: "efl"; action: STATE_SET "active"; target: "efl.entry"; } program { "entry_inactive"; - signal: "efl,state,entry,inactive"; + signal: "efl,entry,visible,off"; source: "efl"; action: STATE_SET "default"; target: "efl.entry"; } program { "text_button_active"; - signal: "efl,state,button,active"; + signal: "efl,button,visible,on"; source: "efl"; action: STATE_SET "default"; target: "efl.text_button"; } program { "text_button_inactive"; - signal: "efl,state,button,inactive"; + signal: "efl,button,visible,off"; source: "efl"; action: STATE_SET "inactive"; target: "efl.text_button"; @@ -152,6 +153,7 @@ group { "efl/spin_button/horizontal"; group { "efl/spin_button/vertical"; inherit: "efl/spin_button/horizontal"; + data.item: "version" "123"; parts { image { "inset"; nomouse; desc { "default"; @@ -203,6 +205,7 @@ group { "efl/spin_button/vertical"; } group { "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_right_glow_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP; @@ -308,7 +311,7 @@ group { "efl/spin_button/horizontal/inc_button"; action: SIGNAL_EMIT "efl,action,click" ""; } program { name: "access_pressed"; - signal: "efl,action,anim,activate"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "arrow.image"; @@ -355,10 +358,12 @@ group { "efl/spin_button/horizontal/inc_button"; group { "efl/spin_button/horizontal/entry"; alias: "efl/spin_button/vertical/entry"; inherit: "efl/text"; + data.item: "version" "123"; } group { "efl/spin_button/horizontal/dec_button"; inherit: "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_dark_normal.png" COMP; @@ -384,6 +389,7 @@ group { "efl/spin_button/horizontal/dec_button"; group { "efl/spin_button/horizontal/text_button"; alias: "efl/spin_button/vertical/text_button"; + data.item: "version" "123"; parts { part { name: "bg"; type: SPACER; @@ -461,6 +467,7 @@ group { "efl/spin_button/horizontal/text_button"; group { "efl/spin_button/vertical/inc_button"; inherit: "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_up_light_normal.png" COMP; images.image: "sym_up_glow_normal.png" COMP; images.image: "sym_up_dark_normal.png" COMP; @@ -486,6 +493,7 @@ group { "efl/spin_button/vertical/inc_button"; group { "efl/spin_button/vertical/dec_button"; inherit: "efl/spin_button/horizontal/dec_button"; + data.item: "version" "123"; images.image: "sym_down_light_normal.png" COMP; images.image: "sym_down_glow_normal.png" COMP; images.image: "sym_down_dark_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/tab_bar.edc b/data/elementary/themes/edc/efl/tab_bar.edc index d48ed8589f..8f1a10549e 100644 --- a/data/elementary/themes/edc/efl/tab_bar.edc +++ b/data/elementary/themes/edc/efl/tab_bar.edc @@ -1,4 +1,5 @@ group { "efl/tab_bar"; + data.item: "version" "123"; images.image: "vgrad_med_lighter.png" COMP; images.image: "bevel_out.png" COMP; images.image: "shine.png" COMP; @@ -60,6 +61,7 @@ group { "efl/tab_bar"; } group { "efl/tab_bar/tab"; + data.item: "version" "123"; images.image: "shadow_inset_bevels.png" COMP; images.image: "shadow_angled_in_sides.png" COMP; images.image: "horizontal_separated_bar_small_glow.png" COMP; @@ -434,13 +436,13 @@ group { "efl/tab_bar/tab"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,orient,horizontal"; source: "efl"; + signal: "efl,state,horizontal"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; target: "bend_clip"; } program { - signal: "efl,orient,vertical"; source: "efl"; + signal: "efl,state,vertical"; source: "efl"; action: STATE_SET "vert" 0.0; target: "base"; target: "bend_clip"; @@ -482,7 +484,7 @@ group { "efl/tab_bar/tab"; target: "highlight"; } program { name: "st1"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -490,7 +492,7 @@ group { "efl/tab_bar/tab"; } } program { name: "st2"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/tab_page.edc b/data/elementary/themes/edc/efl/tab_page.edc index 68bbd6b55c..84a84d7b79 100644 --- a/data/elementary/themes/edc/efl/tab_page.edc +++ b/data/elementary/themes/edc/efl/tab_page.edc @@ -1,4 +1,5 @@ group { "efl/tab_page"; + data.item: "version" "123"; parts { spacer { "base"; scale; diff --git a/data/elementary/themes/edc/efl/tab_pager.edc b/data/elementary/themes/edc/efl/tab_pager.edc index 11ea591441..19ff8becf0 100644 --- a/data/elementary/themes/edc/efl/tab_pager.edc +++ b/data/elementary/themes/edc/efl/tab_pager.edc @@ -1,4 +1,5 @@ group { "efl/tab_pager"; + data.item: "version" "123"; parts { spacer { "base"; scale; diff --git a/data/elementary/themes/edc/efl/tags.edc b/data/elementary/themes/edc/efl/tags.edc index 9c9b7352d8..415bc7ab3b 100644 --- a/data/elementary/themes/edc/efl/tags.edc +++ b/data/elementary/themes/edc/efl/tags.edc @@ -1,4 +1,5 @@ group { "efl/tags"; + data.item: "version" "123"; data.item: "horizontal_pad" 0; data.item: "vertical_pad" 0; data.item: "closed_height" 0; @@ -24,6 +25,7 @@ group { "efl/tags"; } group { "efl/tags/label"; + data.item: "version" "123"; parts { text { "efl.text"; nomouse; @@ -46,6 +48,7 @@ group { "efl/tags/label"; } group { "efl/tags/btn"; + data.item: "version" "123"; images.image: "button_normal.png" COMP; images.image: "button_clicked.png" COMP; images.image: "sym_close_dark_normal.png" COMP; @@ -289,6 +292,7 @@ group { "efl/tags/btn"; } group { "efl/tags/number"; + data.item: "version" "123"; parts { text { "efl.text"; nomouse; diff --git a/data/elementary/themes/edc/efl/text.edc b/data/elementary/themes/edc/efl/text.edc index 7f905a0a77..3bbba5645e 100644 --- a/data/elementary/themes/edc/efl/text.edc +++ b/data/elementary/themes/edc/efl/text.edc @@ -1,6 +1,7 @@ group { "efl/text/scroller"; inherit: "efl/scroller"; + data.item: "version" "123"; image: "bg_glow_in.png" COMP; parts { part { name: "efl.background"; type: SWALLOW; @@ -157,6 +158,7 @@ group { "efl/text/scroller"; } group { "efl/text/single/scroller"; + data.item: "version" "123"; images.image: "bevel_in.png" COMP; images.image: "inset_shadow.png" COMP; image: "bg_glow_in.png" COMP; @@ -389,6 +391,7 @@ group { "efl/text/single/scroller"; } group { "efl/text/cursor"; + data.item: "version" "123"; min: 1 0; images.image: "white_bar_vert_glow.png" COMP; parts { @@ -491,6 +494,7 @@ group { "efl/text/cursor"; } group { "efl/text/selection"; + data.item: "version" "123"; parts { part { name: "base"; type: RECT; description { state: "default" 0.0; @@ -501,6 +505,7 @@ group { "efl/text/selection"; } group { "efl/text/anchor"; + data.item: "version" "123"; images.image: "horizontal_separated_bar_small_glow.png" COMP; parts { part { name: "bar"; @@ -518,6 +523,7 @@ group { "efl/text/anchor"; } group { "efl/text"; + data.item: "version" "123"; data { item: "font.name" "Sans"; item: "font.size" "10"; @@ -637,6 +643,7 @@ group { "efl/text"; } group { "efl/text/magnifier"; + data.item: "version" "123"; images.image: "frame_rounded.png" COMP; parts { part { name: "bg"; type: RECT; mouse_events: 0; @@ -699,6 +706,7 @@ group { "efl/text/magnifier"; } group { "efl/text/handler/start"; + data.item: "version" "123"; images.image: "handle_pick_up_left.png" COMP; parts { part { name: "base"; mouse_events: 0; @@ -747,6 +755,7 @@ group { "efl/text/handler/start"; } group { "efl/text/handler/end"; + data.item: "version" "123"; images.image: "handle_pick_up_right.png" COMP; parts { part { name: "base"; mouse_events: 0; @@ -800,124 +809,124 @@ group { "efl/text/handler/end"; // Tanya - Latvia // http://lazycrazy.deviantart.com/ // http://lazycrazy.deviantart.com/art/Very-Emotional-Emoticons-144461621 -group { "efl/text/emoticon/angry"; images.image: +group { "efl/text/emoticon/angry"; data.item: "version" "123"; images.image: "emo-angry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-angry.png"; } } } } -group { "efl/text/emoticon/angry-shout"; images.image: +group { "efl/text/emoticon/angry-shout"; data.item: "version" "123"; images.image: "emo-angry-shout.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-angry-shout.png"; } } } } -group { "efl/text/emoticon/crazy-laugh"; images.image: +group { "efl/text/emoticon/crazy-laugh"; data.item: "version" "123"; images.image: "emo-crazy-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-crazy-laugh.png"; } } } } -group { "efl/text/emoticon/evil-laugh"; images.image: +group { "efl/text/emoticon/evil-laugh"; data.item: "version" "123"; images.image: "emo-evil-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-evil-laugh.png"; } } } } -group { "efl/text/emoticon/evil"; images.image: +group { "efl/text/emoticon/evil"; data.item: "version" "123"; images.image: "emo-evil.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-evil.png"; } } } } -group { "efl/text/emoticon/goggle-smile"; images.image: +group { "efl/text/emoticon/goggle-smile"; data.item: "version" "123"; images.image: "emo-goggle-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-goggle-smile.png"; } } } } -group { "efl/text/emoticon/grumpy"; images.image: +group { "efl/text/emoticon/grumpy"; data.item: "version" "123"; images.image: "emo-grumpy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-grumpy.png"; } } } } -group { "efl/text/emoticon/grumpy-smile"; images.image: +group { "efl/text/emoticon/grumpy-smile"; data.item: "version" "123"; images.image: "emo-grumpy-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-grumpy-smile.png"; } } } } -group { "efl/text/emoticon/guilty"; images.image: +group { "efl/text/emoticon/guilty"; data.item: "version" "123"; images.image: "emo-guilty.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-guilty.png"; } } } } -group { "efl/text/emoticon/guilty-smile"; images.image: +group { "efl/text/emoticon/guilty-smile"; data.item: "version" "123"; images.image: "emo-guilty-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-guilty-smile.png"; } } } } -group { "efl/text/emoticon/haha"; images.image: +group { "efl/text/emoticon/haha"; data.item: "version" "123"; images.image: "emo-haha.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-haha.png"; } } } } -group { "efl/text/emoticon/half-smile"; images.image: +group { "efl/text/emoticon/half-smile"; data.item: "version" "123"; images.image: "emo-half-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-half-smile.png"; } } } } -group { "efl/text/emoticon/happy-panting"; images.image: +group { "efl/text/emoticon/happy-panting"; data.item: "version" "123"; images.image: "emo-happy-panting.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-happy-panting.png"; } } } } -group { "efl/text/emoticon/happy"; images.image: +group { "efl/text/emoticon/happy"; data.item: "version" "123"; images.image: "emo-happy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-happy.png"; } } } } -group { "efl/text/emoticon/indifferent"; images.image: +group { "efl/text/emoticon/indifferent"; data.item: "version" "123"; images.image: "emo-indifferent.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-indifferent.png"; } } } } -group { "efl/text/emoticon/kiss"; images.image: +group { "efl/text/emoticon/kiss"; data.item: "version" "123"; images.image: "emo-kiss.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-kiss.png"; } } } } -group { "efl/text/emoticon/knowing-grin"; images.image: +group { "efl/text/emoticon/knowing-grin"; data.item: "version" "123"; images.image: "emo-knowing-grin.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-knowing-grin.png"; } } } } -group { "efl/text/emoticon/laugh"; images.image: +group { "efl/text/emoticon/laugh"; data.item: "version" "123"; images.image: "emo-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-laugh.png"; } } } } -group { "efl/text/emoticon/little-bit-sorry"; images.image: +group { "efl/text/emoticon/little-bit-sorry"; data.item: "version" "123"; images.image: "emo-little-bit-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-little-bit-sorry.png"; } } } } -group { "efl/text/emoticon/love-lots"; images.image: +group { "efl/text/emoticon/love-lots"; data.item: "version" "123"; images.image: "emo-love-lots.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-love-lots.png"; } } } } -group { "efl/text/emoticon/love"; images.image: +group { "efl/text/emoticon/love"; data.item: "version" "123"; images.image: "emo-love.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-love.png"; } } } } -group { "efl/text/emoticon/minimal-smile"; images.image: +group { "efl/text/emoticon/minimal-smile"; data.item: "version" "123"; images.image: "emo-minimal-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-minimal-smile.png"; } } } } -group { "efl/text/emoticon/not-happy"; images.image: +group { "efl/text/emoticon/not-happy"; data.item: "version" "123"; images.image: "emo-not-happy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-not-happy.png"; } } } } -group { "efl/text/emoticon/not-impressed"; images.image: +group { "efl/text/emoticon/not-impressed"; data.item: "version" "123"; images.image: "emo-not-impressed.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-not-impressed.png"; } } } } -group { "efl/text/emoticon/omg"; images.image: +group { "efl/text/emoticon/omg"; data.item: "version" "123"; images.image: "emo-omg.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-omg.png"; } } } } -group { "efl/text/emoticon/opensmile"; images.image: +group { "efl/text/emoticon/opensmile"; data.item: "version" "123"; images.image: "emo-opensmile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-opensmile.png"; } } } } -group { "efl/text/emoticon/smile"; images.image: +group { "efl/text/emoticon/smile"; data.item: "version" "123"; images.image: "emo-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-smile.png"; } } } } -group { "efl/text/emoticon/sorry"; images.image: +group { "efl/text/emoticon/sorry"; data.item: "version" "123"; images.image: "emo-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-sorry.png"; } } } } -group { "efl/text/emoticon/squint-laugh"; images.image: +group { "efl/text/emoticon/squint-laugh"; data.item: "version" "123"; images.image: "emo-squint-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-squint-laugh.png"; } } } } -group { "efl/text/emoticon/surprised"; images.image: +group { "efl/text/emoticon/surprised"; data.item: "version" "123"; images.image: "emo-surprised.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-surprised.png"; } } } } -group { "efl/text/emoticon/suspicious"; images.image: +group { "efl/text/emoticon/suspicious"; data.item: "version" "123"; images.image: "emo-suspicious.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-suspicious.png"; } } } } -group { "efl/text/emoticon/tongue-dangling"; images.image: +group { "efl/text/emoticon/tongue-dangling"; data.item: "version" "123"; images.image: "emo-tongue-dangling.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-tongue-dangling.png"; } } } } -group { "efl/text/emoticon/tongue-poke"; images.image: +group { "efl/text/emoticon/tongue-poke"; data.item: "version" "123"; images.image: "emo-tongue-poke.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-tongue-poke.png"; } } } } -group { "efl/text/emoticon/uh"; images.image: +group { "efl/text/emoticon/uh"; data.item: "version" "123"; images.image: "emo-uh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-uh.png"; } } } } -group { "efl/text/emoticon/unhappy"; images.image: +group { "efl/text/emoticon/unhappy"; data.item: "version" "123"; images.image: "emo-unhappy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-unhappy.png"; } } } } -group { "efl/text/emoticon/very-sorry"; images.image: +group { "efl/text/emoticon/very-sorry"; data.item: "version" "123"; images.image: "emo-very-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-very-sorry.png"; } } } } -group { "efl/text/emoticon/what"; images.image: +group { "efl/text/emoticon/what"; data.item: "version" "123"; images.image: "emo-what.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-what.png"; } } } } -group { "efl/text/emoticon/wink"; images.image: +group { "efl/text/emoticon/wink"; data.item: "version" "123"; images.image: "emo-wink.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-wink.png"; } } } } -group { "efl/text/emoticon/worried"; images.image: +group { "efl/text/emoticon/worried"; data.item: "version" "123"; images.image: "emo-worried.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-worried.png"; } } } } -group { "efl/text/emoticon/wtf"; images.image: +group { "efl/text/emoticon/wtf"; data.item: "version" "123"; images.image: "emo-wtf.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-wtf.png"; } } } } //------------------------------------------------------------ diff --git a/data/elementary/themes/edc/efl/textpath.edc b/data/elementary/themes/edc/efl/textpath.edc index 3f880c11a5..76b06c9fca 100644 --- a/data/elementary/themes/edc/efl/textpath.edc +++ b/data/elementary/themes/edc/efl/textpath.edc @@ -1,4 +1,5 @@ group { name: "efl/textpath"; + data.item: "version" "123"; styles { style { name: "textpath_style2"; base: "font="FN" font_size=16 text_class=tb_plain wrap=none align=left color=#ffffffff style=shadow,bottom shadow_color=#00000080"; diff --git a/data/elementary/themes/edc/efl/timepicker.edc b/data/elementary/themes/edc/efl/timepicker.edc index 050a470068..9560fd5264 100644 --- a/data/elementary/themes/edc/efl/timepicker.edc +++ b/data/elementary/themes/edc/efl/timepicker.edc @@ -1,4 +1,5 @@ group { "efl/timepicker"; + data.item: "version" "123"; nomouse; parts { spacer { "base"; @@ -321,7 +322,7 @@ group { "efl/timepicker"; } programs { program { "visible_ampm"; - signal: "efl,state,ampm,visible"; + signal: "efl,ampm,visible,on"; source: "efl"; script { set_state(PART:"base", "default", 0.0); @@ -330,7 +331,7 @@ group { "efl/timepicker"; } } program { "invisible_ampm"; - signal: "efl,state,ampm,invisible"; + signal: "efl,ampm,visible,off"; source: "efl"; script { set_state(PART:"base", "24layout", 0.0); @@ -339,7 +340,7 @@ group { "efl/timepicker"; } } program { "visible_colon_field0"; - signal: "efl,state,colon,visible,field0"; + signal: "efl,colon_field0,visible,on"; source: "efl"; action: STATE_SET "default"; target: "padding_center1"; @@ -348,7 +349,7 @@ group { "efl/timepicker"; target: "padding_center2"; } program { "invisible_colon_field0"; - signal: "efl,state,colon,invisible,field0"; + signal: "efl,colon_field0,visible,off"; source: "efl"; action: STATE_SET "invisible"; target: "padding_center1"; @@ -357,7 +358,7 @@ group { "efl/timepicker"; target: "padding_center2"; } program { "visible_colon_field1"; - signal: "efl,state,colon,visible,field1"; + signal: "efl,colon_field1,visible,on"; source: "efl"; action: STATE_SET "default"; target: "padding_center3"; @@ -366,7 +367,7 @@ group { "efl/timepicker"; target: "padding_center4"; } program { "invisible_colon_field1"; - signal: "efl,state,colon,invisible,field1"; + signal: "efl,colon_field1,visible,off"; source: "efl"; action: STATE_SET "invisible"; target: "padding_center3"; @@ -379,6 +380,7 @@ group { "efl/timepicker"; group { "efl/timepicker/button"; inherit: "efl/button"; + data.item: "version" "123"; parts { image { "base"; desc { "default"; diff --git a/data/elementary/themes/edc/efl/uiclock.edc b/data/elementary/themes/edc/efl/uiclock.edc index ce448b37ea..21fad3b2bf 100644 --- a/data/elementary/themes/edc/efl/uiclock.edc +++ b/data/elementary/themes/edc/efl/uiclock.edc @@ -103,6 +103,7 @@ } group { "efl/uiclock"; + data.item: "version" "123"; parts { rect { "bg"; desc { "default"; @@ -213,15 +214,18 @@ group { "efl/uiclock"; // AM_PM_BUTTON group { "efl/uiclock/ampm" + data.item: "version" "123"; inherit: "efl/button"; } //ENTRY group { "efl/uiclock/text" + data.item: "version" "123"; inherit: "efl/text"; alias: "efl/uiclock/text/single"; alias: "efl/uiclock/text/single-noedit"; } group { "efl/uiclock/text/selection" + data.item: "version" "123"; inherit: "efl/text/selection"; } diff --git a/data/elementary/themes/edc/efl/video.edc b/data/elementary/themes/edc/efl/video.edc index e6de3dd88e..54b228c194 100644 --- a/data/elementary/themes/edc/efl/video.edc +++ b/data/elementary/themes/edc/efl/video.edc @@ -1,4 +1,5 @@ group { name: "efl/video"; + data.item: "version" "123"; parts { part { name: "clipper"; type: RECT; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/win.edc b/data/elementary/themes/edc/efl/win.edc index b0223d4ebc..081efae5d1 100644 --- a/data/elementary/themes/edc/efl/win.edc +++ b/data/elementary/themes/edc/efl/win.edc @@ -1,5 +1,5 @@ group { "efl/win"; - data.item: "version" "119"; + data.item: "version" "123"; parts { rect { "client_clip"; nomouse; } swallow { "efl.menu"; diff --git a/src/benchmarks/elementary/collection.c b/src/benchmarks/elementary/collection.c index 99b8472ed2..ec18d22c28 100644 --- a/src/benchmarks/elementary/collection.c +++ b/src/benchmarks/elementary/collection.c @@ -155,8 +155,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) } win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Item_Container benchmark"), + efl_text_set(efl_added, "Efl.Ui.Item_Container benchmark"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); printf("Building %d objects\n", items); diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build index 388623d5c0..debce1ded8 100644 --- a/src/bin/elementary/meson.build +++ b/src/bin/elementary/meson.build @@ -157,6 +157,7 @@ elementary_test_src = [ 'test_ui_tab_pager.c', 'test_ui_relative_layout.c', 'test_ui_collection.c', + 'test_ui_collection_view.c', 'test_ui_items.c', 'test_ui_frame.c', 'test_efl_ui_animation_view.c', diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index bf90382bd4..8d5e997140 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -399,8 +399,9 @@ void test_ui_spotlight_scroll(void *data, Evas_Object *obj, void *event_info); void test_ui_relative_layout(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info); -void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info ); +void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info); +void test_efl_ui_collection_view(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_item(void *data, Evas_Object *obj, void *event_info); void test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); @@ -909,6 +910,7 @@ add_tests: ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Relative_Layout", test_ui_relative_layout); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid); + ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection_View", test_efl_ui_collection_view); ADD_TEST_EO(NULL, "Containers", "Items", test_efl_ui_item); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Frame", test_ui_frame); diff --git a/src/bin/elementary/test_efl_anim_alpha.c b/src/bin/elementary/test_efl_anim_alpha.c index 0a42b920eb..d75733f8c8 100644 --- a/src/bin/elementary/test_efl_anim_alpha.c +++ b/src/bin/elementary/test_efl_anim_alpha.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_group_parallel.c b/src/bin/elementary/test_efl_anim_group_parallel.c index b7128883d0..6283e2262f 100644 --- a/src/bin/elementary/test_efl_anim_group_parallel.c +++ b/src/bin/elementary/test_efl_anim_group_parallel.c @@ -54,7 +54,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_group_sequential.c b/src/bin/elementary/test_efl_anim_group_sequential.c index 655c37c571..3488149af0 100644 --- a/src/bin/elementary/test_efl_anim_group_sequential.c +++ b/src/bin/elementary/test_efl_anim_group_sequential.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_interpolator.c b/src/bin/elementary/test_efl_anim_interpolator.c index ca2e2446f9..be177d7ed4 100644 --- a/src/bin/elementary/test_efl_anim_interpolator.c +++ b/src/bin/elementary/test_efl_anim_interpolator.c @@ -113,7 +113,7 @@ _anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) int index = (uintptr_t)evas_object_data_get(obj, "index"); //Let Animation Object start animation - efl_player_start(ad->anim_obj[index]); + efl_player_playing_set(ad->anim_obj[index], EINA_TRUE); elm_object_disabled_set(obj, EINA_TRUE); elm_object_disabled_set(ad->start_all_btn, EINA_TRUE); @@ -128,7 +128,7 @@ _anim_start_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) for (i = 0; i < INTERP_NUM; i++) { //Let Animation Object start animation - efl_player_start(ad->anim_obj[i]); + efl_player_playing_set(ad->anim_obj[i], EINA_TRUE); elm_object_disabled_set(ad->btn[i], EINA_TRUE); } diff --git a/src/bin/elementary/test_efl_anim_pause.c b/src/bin/elementary/test_efl_anim_pause.c index c73b7bcf6c..3730db33cf 100644 --- a/src/bin/elementary/test_efl_anim_pause.c +++ b/src/bin/elementary/test_efl_anim_pause.c @@ -69,7 +69,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void @@ -82,13 +82,13 @@ _pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED if (ad->is_anim_paused) { //Pause animation - efl_player_play_set(ad->anim_obj, EINA_FALSE); + efl_player_paused_set(ad->anim_obj, EINA_TRUE); elm_object_text_set(obj, "Resume Animation"); } else { //Resume animation - efl_player_play_set(ad->anim_obj, EINA_TRUE); + efl_player_paused_set(ad->anim_obj, EINA_FALSE); elm_object_text_set(obj, "Pause Animation"); } } diff --git a/src/bin/elementary/test_efl_anim_repeat.c b/src/bin/elementary/test_efl_anim_repeat.c index 50df2035c8..55bf98c748 100644 --- a/src/bin/elementary/test_efl_anim_repeat.c +++ b/src/bin/elementary/test_efl_anim_repeat.c @@ -106,7 +106,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void @@ -122,8 +122,7 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void App_Data *ad = calloc(1, sizeof(App_Data)); if (!ad) return; - Evas_Object *win = elm_win_add(NULL, "Efl Animation Repeat", ELM_WIN_BASIC); - elm_win_title_set(win, "Efl Animation Repeat"); + Evas_Object *win = elm_win_util_standard_add(NULL, "Efl Animation Repeat"); elm_win_autodel_set(win, EINA_TRUE); evas_object_smart_callback_add(win, "delete,request", _win_del_cb, ad); diff --git a/src/bin/elementary/test_efl_anim_rotate.c b/src/bin/elementary/test_efl_anim_rotate.c index 454ca0f262..10df8caf89 100644 --- a/src/bin/elementary/test_efl_anim_rotate.c +++ b/src/bin/elementary/test_efl_anim_rotate.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_scale.c b/src/bin/elementary/test_efl_anim_scale.c index bd380bd145..5e5f9abc58 100644 --- a/src/bin/elementary/test_efl_anim_scale.c +++ b/src/bin/elementary/test_efl_anim_scale.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_start_delay.c b/src/bin/elementary/test_efl_anim_start_delay.c index c94b515b62..e3c7b255b5 100644 --- a/src/bin/elementary/test_efl_anim_start_delay.c +++ b/src/bin/elementary/test_efl_anim_start_delay.c @@ -68,7 +68,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_translate.c b/src/bin/elementary/test_efl_anim_translate.c index a562d17d65..9f30cc3b63 100644 --- a/src/bin/elementary/test_efl_anim_translate.c +++ b/src/bin/elementary/test_efl_anim_translate.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_ui_animation_view.c b/src/bin/elementary/test_efl_ui_animation_view.c index 36e28c4421..31bdb5bfaf 100644 --- a/src/bin/elementary/test_efl_ui_animation_view.c +++ b/src/bin/elementary/test_efl_ui_animation_view.c @@ -142,8 +142,7 @@ test_efl_ui_animation_view(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, char buf[255]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), + efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); // Create a box in Canvas @@ -297,8 +296,7 @@ test_efl_ui_animation_view(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, char buf[255]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), + efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); // Create a box diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index a939304965..8a4da1e849 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -42,8 +42,7 @@ test_efl_ui_text_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi char *markup; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Canvas_Layout"), + efl_text_set(efl_added, "Efl Canvas_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -146,8 +145,7 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve Eo *bt; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text"), + efl_text_set(efl_added, "Efl Ui Text"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -205,8 +203,7 @@ test_efl_ui_text_inputfield(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED Eo *win, *bx, *en; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text Input Field"), + efl_text_set(efl_added, "Efl Ui Text Input Field"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -295,8 +292,7 @@ test_ui_text_item_factory(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Eina_File *f; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text Item Factory"), + efl_text_set(efl_added, "Efl Ui Text Item Factory"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); diff --git a/src/bin/elementary/test_evas_snapshot.c b/src/bin/elementary/test_evas_snapshot.c index ea79aa85fe..f1395f2750 100644 --- a/src/bin/elementary/test_evas_snapshot.c +++ b/src/bin/elementary/test_evas_snapshot.c @@ -46,8 +46,12 @@ _anim_toggle(void *data, const Efl_Event *ev EINA_UNUSED) it = efl_content_iterate(table); EINA_ITERATOR_FOREACH(it, o) { - if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_player_playable_get(o)) - efl_player_play_set(o, !efl_player_play_get(o)); + if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_playable_get(o)) + { + if (!efl_player_playing_get(o)) + efl_player_playing_set(o, EINA_TRUE); + efl_player_paused_set(o, !efl_player_paused_get(o)); + } } eina_iterator_free(it); } diff --git a/src/bin/elementary/test_gfx_filters.c b/src/bin/elementary/test_gfx_filters.c index 4fdee9dccb..11ee74cae3 100644 --- a/src/bin/elementary/test_gfx_filters.c +++ b/src/bin/elementary/test_gfx_filters.c @@ -407,8 +407,8 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve efl_file_set(efl_added, buf), efl_name_set(efl_added, images[k].src_name), elm_object_tooltip_text_set(efl_added, images[k].src_name)); - if (efl_player_playable_get(o)) - efl_player_play_set(o, 1); + if (efl_playable_get(o)) + efl_player_playing_set(o, 1); efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _img_click, win); efl_pack(box2, o); } diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 42ef33f671..c26be3a334 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -152,8 +152,8 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) } if (file && eina_str_has_extension(file, ".gif") - && efl_player_playable_get(ph)) - efl_player_play_set(ph, EINA_TRUE); + && efl_playable_get(ph)) + efl_player_playing_set(ph, EINA_TRUE); } static void @@ -754,11 +754,11 @@ test_photocam_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e static void _zoomable_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - Eina_Bool play; + Eina_Bool paused; - play = !efl_player_play_get(ev->object); - printf("image clicked! play = %d\n", play); - efl_player_play_set(ev->object, play); + paused = efl_player_paused_get(ev->object); + printf("image clicked! paused = %d\n", paused); + efl_player_paused_set(ev->object, !paused); } static void @@ -806,8 +806,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE char buf[PATH_MAX]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Image_Zoomable animation"), + efl_text_set(efl_added, "Efl.Ui.Image_Zoomable animation"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, @@ -830,10 +829,10 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _zoomable_clicked_cb, NULL) ); - if (efl_player_playable_get(zoomable)) + if (efl_playable_get(zoomable)) { printf("animation is available for this image.\n"); - efl_player_play_set(zoomable, EINA_TRUE); + efl_player_playing_set(zoomable, EINA_TRUE); } rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win, diff --git a/src/bin/elementary/test_ui_button.c b/src/bin/elementary/test_ui_button.c index 9571930f6f..0cd1e9315c 100644 --- a/src/bin/elementary/test_ui_button.c +++ b/src/bin/elementary/test_ui_button.c @@ -30,8 +30,7 @@ test_ui_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event char buf[PATH_MAX]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Button"), + efl_text_set(efl_added, "Efl.Ui.Button"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_clock.c b/src/bin/elementary/test_ui_clock.c index d8cfd175e1..4542fe81f3 100644 --- a/src/bin/elementary/test_ui_clock.c +++ b/src/bin/elementary/test_ui_clock.c @@ -49,8 +49,7 @@ test_ui_clock(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Evas_Object *win, *bx; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Clock"), + efl_text_set(efl_added, "Efl.Ui.Clock"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_collection.c b/src/bin/elementary/test_ui_collection.c index 1cc275f2c1..f407a6988a 100644 --- a/src/bin/elementary/test_ui_collection.c +++ b/src/bin/elementary/test_ui_collection.c @@ -5,15 +5,15 @@ #include static void -_select_all(void *data, const Efl_Event *ev EINA_UNUSED) +_all_select(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_select_all(data); + efl_ui_all_select(data); } static void -_unselect_all(void *data, const Efl_Event *ev EINA_UNUSED) +_all_unselect(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_unselect_all(data); + efl_ui_all_unselect(data); } static void @@ -176,8 +176,7 @@ void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class Match_Content_Ctx *ctx = calloc(1, sizeof(*ctx)); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, name), + efl_text_set(efl_added, name), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); tbl = efl_add(EFL_UI_TABLE_CLASS, win); efl_content_set(win, tbl); @@ -285,14 +284,14 @@ void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), efl_gfx_hint_align_set(efl_added, 0, 0.5)); efl_text_set(o, "Select All"); - efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _select_all, item_container); + efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _all_select, item_container); efl_pack_table(tbl, o, 0, 11, 1, 1); o = efl_add(EFL_UI_BUTTON_CLASS, tbl, efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), efl_gfx_hint_align_set(efl_added, 0, 0.5)); efl_text_set(o, "Unselect All"); - efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _unselect_all, item_container); + efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _all_unselect, item_container); efl_pack_table(tbl, o, 0, 12, 1, 1); diff --git a/src/bin/elementary/test_ui_collection_view.c b/src/bin/elementary/test_ui_collection_view.c new file mode 100644 index 0000000000..4a3f2f7b7c --- /dev/null +++ b/src/bin/elementary/test_ui_collection_view.c @@ -0,0 +1,144 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include + +#define NUM_ITEMS 50 + +static Efl_Model* +_make_model(Efl_Ui_Win *win) +{ + Eina_Value vi; + Efl_Generic_Model *model, *child; + unsigned int i; + + model = efl_add(EFL_GENERIC_MODEL_CLASS, win); + model = efl_add(EFL_UI_VIEW_MODEL_CLASS, model, + efl_ui_view_model_set(efl_added, model)); + eina_value_setup(&vi, EINA_VALUE_TYPE_INT); + + efl_ui_view_model_property_string_add(model, "relative", "Relative index ${child.index}", "WRONG", "WRONG"); + efl_ui_view_model_property_string_add(model, "title", "Initial index ${initial}", "WRONG", "WRONG"); + + + for (i = 0; i < (NUM_ITEMS); i++) + { + child = efl_model_child_add(model); + eina_value_set(&vi, i); + efl_model_property_set(child, "initial", &vi); + } + + eina_value_flush(&vi); + return model; +} + +static void +_item_constructing(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Gfx_Entity *item = ev->info; + + if (!efl_ui_item_calc_locked_get(item)) + efl_gfx_hint_size_min_set(item, EINA_SIZE2D(100, 50)); +} + +static void +_item_select(void *data, const Efl_Event *ev) +{ + Efl_Ui_Widget *w = efl_ui_single_selectable_last_selected_get(ev->object); + Efl_Model *m = efl_ui_view_model_get(w); + + if (m) efl_ui_view_model_set(data, m); +} + +void test_efl_ui_collection_view(void *data EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Efl_Ui_Win *win; + Efl_Model *model; + Efl_Ui_Frame *f; + Efl_Ui_Table *tbl; + Efl_Ui_List_View *lv; + Efl_Ui_Grid_View *gv; + Efl_Ui_Factory *fg, *fl; + Efl_Ui_Box *ib; + Efl_Ui_Widget *o; + Efl_Model_Provider *provider; + + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_text_set(efl_added, "Efl.Ui.Collection_View"), + efl_ui_win_autodel_set(efl_added, EINA_TRUE)); + tbl = efl_add(EFL_UI_TABLE_CLASS, win, + efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(500, 300))); + efl_content_set(win, tbl); + + model = _make_model(win); + fg = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_GRID_DEFAULT_ITEM_CLASS)); + efl_event_callback_add(fg, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _item_constructing, NULL); + fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS)); + provider = efl_add(EFL_MODEL_PROVIDER_CLASS, win); + + lv = efl_add(EFL_UI_LIST_VIEW_CLASS, tbl, + efl_ui_collection_view_factory_set(efl_added, fl), + efl_ui_view_model_set(efl_added, model)); + efl_pack_table(tbl, lv, 0, 1, 1, 1); + + gv = efl_add(EFL_UI_GRID_VIEW_CLASS, tbl, + efl_ui_collection_view_factory_set(efl_added, fg), + efl_ui_view_model_set(efl_added, model)); + efl_pack_table(tbl, gv, 2, 1, 1, 1); + + f = efl_add(EFL_UI_FRAME_CLASS, tbl, + efl_text_set(efl_added, "Selected item"), + efl_ui_frame_autocollapse_set(efl_added, EINA_FALSE)); + efl_provider_register(f, EFL_MODEL_PROVIDER_CLASS, provider); + efl_pack_table(tbl, f, 1, 1, 1, 1); + efl_event_callback_add(lv, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, _item_select, provider); + + ib = efl_add(EFL_UI_BOX_CLASS, f, + efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL), + efl_gfx_hint_weight_set(efl_added, 1, 1), + efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE), + efl_content_set(f, efl_added)); + + o = elm_label_add(ib); + elm_object_text_set(o, "title:"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "NONE"); + efl_ui_property_bind(o, "elm.text", "title"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "relative:"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "NONE"); + efl_ui_property_bind(o, "elm.text", "relative"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); +} diff --git a/src/bin/elementary/test_ui_datepicker.c b/src/bin/elementary/test_ui_datepicker.c index 5b12f35ac4..7898f12065 100644 --- a/src/bin/elementary/test_ui_datepicker.c +++ b/src/bin/elementary/test_ui_datepicker.c @@ -19,8 +19,7 @@ test_ui_datepicker(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *bx; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Datepicker"), + efl_text_set(efl_added, "Efl.Ui.Datepicker"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_frame.c b/src/bin/elementary/test_ui_frame.c index 84e574778e..4f37a26a10 100644 --- a/src/bin/elementary/test_ui_frame.c +++ b/src/bin/elementary/test_ui_frame.c @@ -16,8 +16,7 @@ test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Eo *win, *bx, *f, *txt; win = efl_add_ref(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Frame"), + efl_text_set(efl_added, "Efl.Ui.Frame"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_items.c b/src/bin/elementary/test_ui_items.c index 54dcb64767..b2540699ad 100644 --- a/src/bin/elementary/test_ui_items.c +++ b/src/bin/elementary/test_ui_items.c @@ -54,8 +54,7 @@ void test_efl_ui_item(void *data EINA_UNUSED, Eo *win, *box, *o; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Item examples"), + efl_text_set(efl_added, "Item examples"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_pager.c b/src/bin/elementary/test_ui_pager.c index df9afd5ad9..e0df202244 100644 --- a/src/bin/elementary/test_ui_pager.c +++ b/src/bin/elementary/test_ui_pager.c @@ -701,8 +701,7 @@ void test_ui_pager(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Pager"), + efl_text_set(efl_added, "Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c index 1ac37da74d..b6548a4b88 100644 --- a/src/bin/elementary/test_ui_pager_scroll.c +++ b/src/bin/elementary/test_ui_pager_scroll.c @@ -901,8 +901,7 @@ void test_ui_pager_scroll(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Pager"), + efl_text_set(efl_added, "Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_panel.c b/src/bin/elementary/test_ui_panel.c index 928dd2d201..d5045c6730 100644 --- a/src/bin/elementary/test_ui_panel.c +++ b/src/bin/elementary/test_ui_panel.c @@ -11,8 +11,7 @@ test_ui_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Eo *win, *table, *panel; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panel"), + efl_text_set(efl_added, "Efl.Ui.Panel"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); table = efl_add(EFL_UI_TABLE_CLASS, win, @@ -104,8 +103,7 @@ test_ui_panel2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event Eo *win, *box, *check, *btn, *table, *list, *panel; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panel"), + efl_text_set(efl_added, "Efl.Ui.Panel"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); box = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_panes.c b/src/bin/elementary/test_ui_panes.c index 96f30fbba1..72d2ab9a09 100644 --- a/src/bin/elementary/test_ui_panes.c +++ b/src/bin/elementary/test_ui_panes.c @@ -10,8 +10,7 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *panes, *panes_h; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panes"), + efl_text_set(efl_added, "Efl.Ui.Panes"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_progressbar.c b/src/bin/elementary/test_ui_progressbar.c index 016c5307a9..c0bf12f765 100644 --- a/src/bin/elementary/test_ui_progressbar.c +++ b/src/bin/elementary/test_ui_progressbar.c @@ -152,8 +152,7 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf pd = (pbdata *)calloc(1, sizeof(pbdata)); pd->win = win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Progressbar"), + efl_text_set(efl_added, "Efl.Ui.Progressbar"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_UI_WIN_EVENT_DELETE_REQUEST, _win_delete_req_cb, pd) diff --git a/src/bin/elementary/test_ui_radio.c b/src/bin/elementary/test_ui_radio.c index 487c6aa932..e03dcf5ee0 100644 --- a/src/bin/elementary/test_ui_radio.c +++ b/src/bin/elementary/test_ui_radio.c @@ -96,8 +96,7 @@ void test_efl_ui_radio(void *data EINA_UNUSED, Efl_Ui_Button *o; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Radio_Box"), + efl_text_set(efl_added, "Efl.Ui.Radio_Box"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); table = efl_add(EFL_UI_TABLE_CLASS, win); efl_content_set(win, table); diff --git a/src/bin/elementary/test_ui_relative_layout.c b/src/bin/elementary/test_ui_relative_layout.c index e4fa8c9a59..052b3ba145 100644 --- a/src/bin/elementary/test_ui_relative_layout.c +++ b/src/bin/elementary/test_ui_relative_layout.c @@ -276,8 +276,7 @@ test_ui_relative_layout(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo Eo *win, *vbox, *f, *hbox; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); vbox = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_scroller.c b/src/bin/elementary/test_ui_scroller.c index 02cae9a6da..e5f2a6177b 100644 --- a/src/bin/elementary/test_ui_scroller.c +++ b/src/bin/elementary/test_ui_scroller.c @@ -32,8 +32,7 @@ test_efl_ui_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void int i, j; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller"), + efl_text_set(efl_added, "Efl Ui Scroller"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); @@ -137,8 +136,7 @@ test_efl_ui_scroller_simple(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED int i; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller Simple"), + efl_text_set(efl_added, "Efl Ui Scroller Simple"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); @@ -173,8 +171,7 @@ test_efl_ui_scroller_simple2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE int i; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller Simple2"), + efl_text_set(efl_added, "Efl Ui Scroller Simple2"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); diff --git a/src/bin/elementary/test_ui_slider.c b/src/bin/elementary/test_ui_slider.c index 36155e9e5d..5aa31004f9 100644 --- a/src/bin/elementary/test_ui_slider.c +++ b/src/bin/elementary/test_ui_slider.c @@ -53,8 +53,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event Eo *win, *bx, *hbx; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Slider"), + efl_text_set(efl_added, "Efl.Ui.Slider"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_slider_interval.c b/src/bin/elementary/test_ui_slider_interval.c index 75dcbe2354..186e2daadd 100644 --- a/src/bin/elementary/test_ui_slider_interval.c +++ b/src/bin/elementary/test_ui_slider_interval.c @@ -34,8 +34,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void double step; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Slider_Interval"), + efl_text_set(efl_added, "Efl.Ui.Slider_Interval"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spin.c b/src/bin/elementary/test_ui_spin.c index 6f325bb034..965c88ea26 100644 --- a/src/bin/elementary/test_ui_spin.c +++ b/src/bin/elementary/test_ui_spin.c @@ -40,8 +40,7 @@ test_ui_spin(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i Eo *win, *bx, *sp; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spin"), + efl_text_set(efl_added, "Efl.Ui.Spin"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spin_button.c b/src/bin/elementary/test_ui_spin_button.c index d6b9a96061..600611eb45 100644 --- a/src/bin/elementary/test_ui_spin_button.c +++ b/src/bin/elementary/test_ui_spin_button.c @@ -29,8 +29,7 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void * }; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spin_Button"), + efl_text_set(efl_added, "Efl.Ui.Spin_Button"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c index c2bc6b436c..384da6e751 100644 --- a/src/bin/elementary/test_ui_spotlight.c +++ b/src/bin/elementary/test_ui_spotlight.c @@ -856,8 +856,7 @@ test_ui_spotlight_stack(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, @@ -955,8 +954,7 @@ test_ui_spotlight_plain(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, @@ -1050,8 +1048,7 @@ test_ui_spotlight_scroll(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c index 01ca807a2e..1f35bf01a8 100644 --- a/src/bin/elementary/test_ui_tab_pager.c +++ b/src/bin/elementary/test_ui_tab_pager.c @@ -104,8 +104,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Tab_Pager"), + efl_text_set(efl_added, "Efl.Ui.Tab_Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_EVENT_DEL, _win_del_cb, ad)); diff --git a/src/bin/elementary/test_ui_tags.c b/src/bin/elementary/test_ui_tags.c index efd87dc749..c5d7425fe3 100644 --- a/src/bin/elementary/test_ui_tags.c +++ b/src/bin/elementary/test_ui_tags.c @@ -60,8 +60,7 @@ test_ui_tags(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i char buf[PATH_MAX]; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Tags"), + efl_text_set(efl_added, "Efl.Ui.Tags"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get()); diff --git a/src/bin/elementary/test_ui_timepicker.c b/src/bin/elementary/test_ui_timepicker.c index c57ee6bb2d..3249699bc8 100644 --- a/src/bin/elementary/test_ui_timepicker.c +++ b/src/bin/elementary/test_ui_timepicker.c @@ -20,8 +20,7 @@ test_ui_timepicker(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *bx; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Timepicker"), + efl_text_set(efl_added, "Efl.Ui.Timepicker"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_win_indicator.c b/src/bin/elementary/test_win_indicator.c index aa9606f316..98ba2e2bf3 100644 --- a/src/bin/elementary/test_win_indicator.c +++ b/src/bin/elementary/test_win_indicator.c @@ -93,8 +93,7 @@ test_win_indicator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e // FIXME: Resizing window should no cause sizing issues! win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Win.Indicator"), + efl_text_set(efl_added, "Efl.Win.Indicator"), efl_gfx_hint_size_max_set(efl_added, EINA_SIZE2D(300, -1)), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_event_callback_add(win, EFL_EVENT_DEL, _win_del, indicator); diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index e9af2e867f..6b016eb4ee 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c @@ -27,13 +27,8 @@ _generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf) char *n = strdup(eolian_object_name_get(decl)); char *p = n; while ((p = strchr(p, '.'))) *p = '_'; - if (eolian_object_type_get(decl) == EOLIAN_OBJECT_VARIABLE) - { - const Eolian_Variable *v = (const Eolian_Variable *)decl; - /* constants are emitted as macros */ - if (eolian_variable_type_get(v) == EOLIAN_VAR_CONSTANT) - eina_str_toupper(&n); - } + if (eolian_object_type_get(decl) == EOLIAN_OBJECT_CONSTANT) + eina_str_toupper(&n); eina_strbuf_append(wbuf, n); free(n); return; diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 0545430eb5..114f989ac4 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -392,8 +392,11 @@ _write_source(const Eolian_State *eos, const char *ofname, const Eolian_Class *cl = eolian_state_class_by_file_get(eos, ifname); eo_gen_types_source_gen(eolian_state_objects_by_file_get(eos, ifname), buf); eo_gen_source_gen(cl, buf); - if (cl || (eot && eina_strbuf_length_get(buf))) + if (cl || eot) { + /* always have at least a stub in order to allow unconditional generation */ + if (!eina_strbuf_length_get(buf)) + eina_strbuf_append(buf, "/* Nothing to implement. */\n"); if (!_write_file(ofname, buf)) goto done; ret = EINA_TRUE; diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index 75426f1220..96232833cd 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c @@ -168,12 +168,12 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp, } static Eina_Strbuf * -_var_generate(const Eolian_State *state, const Eolian_Variable *vr) +_const_generate(const Eolian_State *state, const Eolian_Constant *vr) { - char *fn = strdup(eolian_variable_name_get(vr)); + char *fn = strdup(eolian_constant_name_get(vr)); char *p = strrchr(fn, '.'); if (p) *p = '\0'; - Eina_Strbuf *buf = eo_gen_docs_full_gen(state, eolian_variable_documentation_get(vr), + Eina_Strbuf *buf = eo_gen_docs_full_gen(state, eolian_constant_documentation_get(vr), fn, 0); if (p) { @@ -184,31 +184,23 @@ _var_generate(const Eolian_State *state, const Eolian_Variable *vr) eina_str_toupper(&fn); if (!buf) buf = eina_strbuf_new(); else eina_strbuf_append_char(buf, '\n'); - const Eolian_Type *vt = eolian_variable_base_type_get(vr); - if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT) - { - /* we generate a define macro here, as it's a constant */ - eina_strbuf_prepend_printf(buf, "#ifndef %s\n", fn); - eina_strbuf_append_printf(buf, "#define %s ", fn); - const Eolian_Expression *vv = eolian_variable_value_get(vr); - Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); - Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); - eina_strbuf_append(buf, lit); - Eina_Stringshare *exp = eolian_expression_serialize(vv); - if (exp && strcmp(lit, exp)) - eina_strbuf_append_printf(buf, " /* %s */", exp); - eina_stringshare_del(lit); - eina_stringshare_del(exp); - eina_strbuf_append(buf, "\n#endif"); - } - else - { - Eina_Stringshare *ct = eolian_type_c_type_get(vt); - eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); - eina_stringshare_del(ct); - } + + /* we generate a define macro here, as it's a constant */ + eina_strbuf_prepend_printf(buf, "#ifndef %s\n", fn); + eina_strbuf_append_printf(buf, "#define %s ", fn); + const Eolian_Expression *vv = eolian_constant_value_get(vr); + Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); + Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); + eina_strbuf_append(buf, lit); + Eina_Stringshare *exp = eolian_expression_serialize(vv); + if (exp && strcmp(lit, exp)) + eina_strbuf_append_printf(buf, " /* %s */", exp); + eina_stringshare_del(lit); + eina_stringshare_del(exp); + eina_strbuf_append(buf, "\n#endif"); + free(fn); - if (eolian_variable_is_beta(vr)) + if (eolian_constant_is_beta(vr)) { eina_strbuf_prepend(buf, "#ifdef EFL_BETA_API_SUPPORT\n"); eina_strbuf_append(buf, "\n#endif /* EFL_BETA_API_SUPPORT */"); @@ -259,13 +251,13 @@ void eo_gen_types_header_gen(const Eolian_State *state, { Eolian_Object_Type dt = eolian_object_type_get(decl); - if (dt == EOLIAN_OBJECT_VARIABLE) + if (dt == EOLIAN_OBJECT_CONSTANT) { - const Eolian_Variable *vr = (const Eolian_Variable *)decl; - if (!vr || eolian_variable_is_extern(vr)) + const Eolian_Constant *vr = (const Eolian_Constant *)decl; + if (!vr || eolian_constant_is_extern(vr)) continue; - Eina_Strbuf *vbuf = _var_generate(state, vr); + Eina_Strbuf *vbuf = _const_generate(state, vr); if (vbuf) { eina_strbuf_append(buf, eina_strbuf_string_get(vbuf)); @@ -375,43 +367,6 @@ _source_gen_error(Eina_Strbuf *buf, const Eolian_Error *err) eina_strbuf_append(buf, " return err;\n}\n\n"); } -static void -_source_gen_var(Eina_Strbuf *buf, const Eolian_Variable *vr) -{ - if (eolian_variable_is_extern(vr)) - return; - - if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT) - return; - - const Eolian_Expression *vv = eolian_variable_value_get(vr); - if (!vv) - return; - - char *fn = strdup(eolian_variable_name_get(vr)); - for (char *p = strchr(fn, '.'); p; p = strchr(p, '.')) - *p = '_'; - eina_str_toupper(&fn); - - const Eolian_Type *vt = eolian_variable_base_type_get(vr); - Eina_Stringshare *ct = eolian_type_c_type_get(vt); - eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); - eina_stringshare_del(ct); - free(fn); - - Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); - Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); - eina_strbuf_append(buf, lit); - eina_strbuf_append_char(buf, ';'); - Eina_Stringshare *exp = eolian_expression_serialize(vv); - if (exp && strcmp(lit, exp)) - eina_strbuf_append_printf(buf, " /* %s */", exp); - eina_stringshare_del(lit); - eina_stringshare_del(exp); - - eina_strbuf_append(buf, "\n"); -} - void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) { const Eolian_Object *decl; @@ -421,8 +376,6 @@ void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) if (dt == EOLIAN_OBJECT_ERROR) _source_gen_error(buf, (const Eolian_Error *)decl); - else if (dt == EOLIAN_OBJECT_VARIABLE) - _source_gen_var(buf, (const Eolian_Variable *)decl); } eina_iterator_free(itr); } diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh index c46f2f4de7..95a5000225 100644 --- a/src/bin/eolian_mono/eolian/mono/blacklist.hh +++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh @@ -17,7 +17,7 @@ inline bool is_function_blacklisted(std::string const& c_name) return c_name == "efl_event_callback_array_priority_add" || c_name == "efl_constructor" - || c_name == "efl_player_position_get" + || c_name == "efl_player_playback_position_get" || c_name == "efl_ui_widget_focus_set" || c_name == "efl_ui_widget_focus_get" || c_name == "efl_ui_text_password_get" diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index 234ce49430..6ed8169632 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -187,17 +187,14 @@ struct documentation_generator ref += function_conversion(data, (const ::Eolian_Function *)data2, name_tail); is_beta = eolian_object_is_beta(data) || eolian_object_is_beta(data2); break; - case ::EOLIAN_OBJECT_VARIABLE: - if (::eolian_variable_type_get((::Eolian_Variable *)data) == ::EOLIAN_VAR_CONSTANT) - { - auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); - names.pop_back(); // Remove var name - ref = name_helpers::join_namespaces(names, '.'); - ref += "Constants."; - ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); - } - // Otherwise, do nothing and no tag will be generated. Because, who would - // reference a global (non-constant) variable in the docs? + case ::EOLIAN_OBJECT_CONSTANT: + { + auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); + names.pop_back(); // Remove var name + ref = name_helpers::join_namespaces(names, '.'); + ref += "Constants."; + ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); + } break; case ::EOLIAN_OBJECT_UNKNOWN: // If the reference cannot be resolved, just return an empty string and diff --git a/src/bin/eolian_mono/eolian/mono/variable_definition.hh b/src/bin/eolian_mono/eolian/mono/variable_definition.hh index fdc5219794..c34a18cc7f 100644 --- a/src/bin/eolian_mono/eolian/mono/variable_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/variable_definition.hh @@ -28,7 +28,7 @@ namespace eolian_mono { struct constant_definition_generator { template - bool generate(OutputIterator sink, attributes::variable_def constant, Context const& context) const + bool generate(OutputIterator sink, attributes::constant_def constant, Context const& context) const { // Open partial class if (!name_helpers::open_namespaces(sink, constant.namespaces, context)) diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc index 42f8034a03..83379b28cb 100644 --- a/src/bin/eolian_mono/eolian_mono.cc +++ b/src/bin/eolian_mono/eolian_mono.cc @@ -177,10 +177,10 @@ run(options_type const& opts) // Constants { auto var_cxt = context_add_tag(class_context{class_context::variables}, context); - for (efl::eina::iterator var_iterator( ::eolian_state_constants_by_file_get(opts.state, basename_input.c_str())) + for (efl::eina::iterator var_iterator( ::eolian_state_constants_by_file_get(opts.state, basename_input.c_str())) , var_last; var_iterator != var_last; ++var_iterator) { - efl::eolian::grammar::attributes::variable_def var(&*var_iterator, opts.unit); + efl::eolian::grammar::attributes::constant_def var(&*var_iterator, opts.unit); if (!eolian_mono::constant_definition.generate(iterator, var, var_cxt)) { throw std::runtime_error("Failed to generate enum"); diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 7fec606c10..8671fc5c2a 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -25,7 +25,7 @@ ffi.cdef [[ typedef struct _Eolian_Constructor Eolian_Constructor; typedef struct _Eolian_Event Eolian_Event; typedef struct _Eolian_Expression Eolian_Expression; - typedef struct _Eolian_Variable Eolian_Variable; + typedef struct _Eolian_Constant Eolian_Constant; typedef struct _Eolian_Error Eolian_Error; typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field; typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field; @@ -43,7 +43,7 @@ ffi.cdef [[ EOLIAN_OBJECT_STRUCT_FIELD, EOLIAN_OBJECT_ENUM_FIELD, EOLIAN_OBJECT_TYPE, - EOLIAN_OBJECT_VARIABLE, + EOLIAN_OBJECT_CONSTANT, EOLIAN_OBJECT_EXPRESSION, EOLIAN_OBJECT_FUNCTION, EOLIAN_OBJECT_FUNCTION_PARAMETER, @@ -207,12 +207,6 @@ ffi.cdef [[ | EOLIAN_MASK_NULL } Eolian_Expression_Mask; - typedef enum { - EOLIAN_VAR_UNKNOWN = 0, - EOLIAN_VAR_CONSTANT, - EOLIAN_VAR_GLOBAL - } Eolian_Variable_Type; - typedef union { char c; Eina_Bool b; @@ -325,11 +319,9 @@ ffi.cdef [[ Eina_Iterator *eolian_unit_objects_get(const Eolian_Unit *unit); const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name); Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); - const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); - const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); + const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name); Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); - Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); Eina_Iterator *eolian_unit_errors_get(const Eolian_Unit *unit); const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name); const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name); @@ -339,7 +331,6 @@ ffi.cdef [[ Eina_Iterator *eolian_unit_enums_get(const Eolian_Unit *unit); Eina_Iterator *eolian_state_objects_by_file_get(const Eolian_State *state, const char *file_name); const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name); - Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name); @@ -348,7 +339,7 @@ ffi.cdef [[ Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass); - const char *eolian_class_eo_prefix_get(const Eolian_Class *klass); + const char *eolian_class_c_prefix_get(const Eolian_Class *klass); const char *eolian_class_event_prefix_get(const Eolian_Class *klass); const char *eolian_class_data_type_get(const Eolian_Class *klass); const Eolian_Class *eolian_class_parent_get(const Eolian_Class *klass); @@ -462,11 +453,10 @@ ffi.cdef [[ Eolian_Unary_Operator eolian_expression_unary_operator_get(const Eolian_Expression *expr); const Eolian_Expression *eolian_expression_unary_expression_get(const Eolian_Expression *expr); Eolian_Value_t eolian_expression_value_get(const Eolian_Expression *expr); - Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); - const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); - const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); - const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); - Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); + const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); + const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); + const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); + Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); const char *eolian_documentation_summary_get(const Eolian_Documentation *doc); const char *eolian_documentation_description_get(const Eolian_Documentation *doc); const char *eolian_documentation_since_get(const Eolian_Documentation *doc); @@ -522,7 +512,7 @@ M.object_type = { STRUCT_FIELD = 3, ENUM_FIELD = 4, TYPE = 5, - VARIABLE = 6, + CONSTANT = 6, EXPRESSION = 7, FUNCTION = 8, FUNCTION_PARAMETER = 9, @@ -674,12 +664,6 @@ local unit_idx, wrap_unit = gen_wrap { eolian.eolian_unit_classes_get(cast_unit(self))) end, - global_by_name_get = function(self, name) - local v = eolian.eolian_unit_global_by_name_get(cast_unit(self), name) - if v == nil then return nil end - return v - end, - constant_by_name_get = function(self, name) local v = eolian.eolian_unit_constant_by_name_get(cast_unit(self), name) if v == nil then return nil end @@ -693,15 +677,10 @@ local unit_idx, wrap_unit = gen_wrap { end, constants_get = function(self) - return Ptr_Iterator("const Eolian_Variable *", + return Ptr_Iterator("const Eolian_Constant *", eolian.eolian_unit_constants_get(cast_unit(self))) end, - globals_get = function(self) - return Ptr_Iterator("const Eolian_Variable *", - eolian.eolian_unit_globals_get(cast_unit(self))) - end, - errors_get = function(self) return Ptr_Iterator("const Eolian_Error *", eolian.eolian_unit_errors_get(cast_unit(self))) @@ -860,13 +839,8 @@ ffi.metatype("Eolian_State", { return v end, - globals_by_file_get = function(unit, fname) - return Ptr_Iterator("const Eolian_Variable*", - eolian.eolian_state_globals_by_file_get(self, fname)) - end, - constants_by_file_get = function(unit, fname) - return Ptr_Iterator("const Eolian_Variable*", + return Ptr_Iterator("const Eolian_Constant*", eolian.eolian_state_constants_by_file_get(self, fname)) end, @@ -1461,8 +1435,8 @@ M.Class = ffi.metatype("Eolian_Class", { return v end, - eo_prefix_get = function(self) - local v = eolian.eolian_class_eo_prefix_get(self) + c_prefix_get = function(self) + local v = eolian.eolian_class_c_prefix_get(self) if v == nil then local buf = self:namespaces_get() buf[#buf + 1] = self:short_name_get() @@ -1474,7 +1448,7 @@ M.Class = ffi.metatype("Eolian_Class", { event_prefix_get = function(self) local v = eolian.eolian_class_event_prefix_get(self) if v == nil then - return self:eo_prefix_get() + return self:c_prefix_get() end return ffi.string(v) end, @@ -1606,12 +1580,6 @@ emask.NUMBER = bit.bor(emask.INT , emask.FLOAT) emask.ALL = bit.bor(emask.NUMBER, emask.BOOL, emask.STRING, emask.CHAR, emask.NULL) -M.variable_type = { - UNKNOWN = 0, - CONSTANT = 1, - GLOBAL = 2 -} - local value_con = { [etype.INT ] = function(v) return tonumber(v.value.i ) end, [etype.UINT ] = function(v) return tonumber(v.value.u ) end, @@ -1737,32 +1705,28 @@ M.Expression = ffi.metatype("Eolian_Expression", { } }) -M.Variable = ffi.metatype("Eolian_Variable", { +M.Constant = ffi.metatype("Eolian_Constant", { __index = wrap_object { - type_get = function(self) - return tonumber(eolian.eolian_variable_type_get(self)) - end, - documentation_get = function(self) - local v = eolian.eolian_variable_documentation_get(self) + local v = eolian.eolian_constant_documentation_get(self) if v == nil then return nil end return v end, - base_type_get = function(self) - local v = eolian.eolian_variable_base_type_get(self) + type_get = function(self) + local v = eolian.eolian_constant_type_get(self) if v == nil then return nil end return v end, value_get = function(self) - local v = eolian.eolian_variable_value_get(self) + local v = eolian.eolian_constant_value_get(self) if v == nil then return nil end return v end, is_extern = function(self) - return eolian.eolian_variable_is_extern(self) ~= 0 + return eolian.eolian_constant_is_extern(self) ~= 0 end } }) @@ -1890,8 +1854,8 @@ M.Eolian_Doc_Token = ffi.metatype("Eolian_Doc_Token", { elseif tp == reft.ENUM_FIELD then return tp, ffi.cast("const Eolian_Typedecl *", stor[0]), ffi.cast("const Eolian_Enum_Type_Field *", stor[1]) - elseif tp == reft.VARIABLE then - return tp, ffi.cast("const Eolian_Variable *", stor[0]) + elseif tp == reft.CONSTANT then + return tp, ffi.cast("const Eolian_Constant *", stor[0]) else return reft.UNKNOWN end diff --git a/src/bindings/mono/efl_mono/Bind.cs b/src/bindings/mono/efl_mono/Bind.cs index 14c45d9dd0..c31186cbb7 100644 --- a/src/bindings/mono/efl_mono/Bind.cs +++ b/src/bindings/mono/efl_mono/Bind.cs @@ -112,8 +112,7 @@ public class BindableFactoryPart /// Binds the given factory to this part. public Eina.Error BindFactory(Efl.Ui.IFactory factory) { - this.Binder.BindFactory(this.PartName, factory); - return Eina.Error.NO_ERROR; + return this.Binder.BindFactory(this.PartName, factory); } } diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs index 1805071175..79d597c7b6 100644 --- a/src/bindings/mono/eo_mono/EoWrapper.cs +++ b/src/bindings/mono/eo_mono/EoWrapper.cs @@ -413,4 +413,15 @@ public abstract class EoWrapper : IWrapper, IDisposable } // namespace Eo +/// Concrete realization of Efl.Object. +/// +/// Some legacy classes (like Evas.Canvas) may be returned by some methods. As these classes are not bound, we +/// allow minimal interaction with them through . +/// +/// But as is abstract, whis realized class will allow us to create C# instances of it. +internal class ObjectRealized : Efl.Object +{ + protected ObjectRealized(Efl.Eo.Globals.WrappingHandle ch) : base(ch) { } +} + } // namespace Efl diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index a03e48a326..8fe4b0623f 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -843,7 +843,7 @@ public static class ClassRegister if (t == null) { - return typeof(Efl.Object); + return typeof(Efl.ObjectRealized); } } diff --git a/src/examples/elementary/efl_canvas_layout_text.c b/src/examples/elementary/efl_canvas_layout_text.c index bb4fa7b97c..593dbe8872 100644 --- a/src/examples/elementary/efl_canvas_layout_text.c +++ b/src/examples/elementary/efl_canvas_layout_text.c @@ -121,8 +121,7 @@ efl_main(void *data EINA_UNUSED, Eo *win; win = efl_add(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Canvas_Layout"), + efl_text_set(efl_added, "Efl Canvas_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_UI_WIN_EVENT_DELETE_REQUEST, _on_win_delete, NULL)); diff --git a/src/examples/elementary/efl_ui_collection_view_example_1.c b/src/examples/elementary/efl_ui_collection_view_example_1.c new file mode 100644 index 0000000000..72960651fb --- /dev/null +++ b/src/examples/elementary/efl_ui_collection_view_example_1.c @@ -0,0 +1,107 @@ +// gcc -o efl_ui_collection_view_example_1 efl_ui_collection_view_example_1.c `pkg-config --cflags --libs efl-ui + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#else +# define EFL_BETA_API_SUPPORT 1 +#endif + +#include +#include +#include +#include +#include + +#define NUM_ITEMS 400 + +static Efl_Model* +_make_model(Evas_Object *win) +{ + Eina_Value vtext; + Efl_Generic_Model *model, *child; + unsigned int i; + char buf[256]; + + model = efl_add(EFL_GENERIC_MODEL_CLASS, win); + eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING); + + for (i = 0; i < (NUM_ITEMS); i++) + { + child = efl_model_child_add(model); + snprintf(buf, sizeof(buf), "Item # %i", i); + eina_value_set(&vtext, buf); + efl_model_property_set(child, "title", &vtext); + } + + eina_value_flush(&vtext); + return model; +} + +static void +_item_constructing(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Gfx_Entity *item = ev->info; + + if (!efl_ui_item_calc_locked_get(item)) + efl_gfx_hint_size_min_set(item, EINA_SIZE2D(50, 50)); +} + +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Ui_Factory *factory; + Evas_Object *win, *li; + Eo *model; + Eo *position_manager; + Efl_App *app = ev->object; + Eina_Accessor *ac; + Eina_Bool list = EINA_TRUE, multi = EINA_FALSE, none = EINA_FALSE; + Efl_Ui_Select_Mode mode = EFL_UI_SELECT_MODE_SINGLE; + const char *arg; + unsigned int i; + + ac = efl_core_command_line_command_access(app); + EINA_ACCESSOR_FOREACH(ac, i, arg) + { + if (eina_streq(arg, "grid")) list = EINA_FALSE; + if (eina_streq(arg, "multi")) multi = EINA_TRUE; + if (eina_streq(arg, "none")) none = EINA_TRUE; + } + eina_accessor_free(ac); + + if (multi) mode = EFL_UI_SELECT_MODE_MULTI; + if (none) mode = EFL_UI_SELECT_MODE_NONE; + + win = efl_add(EFL_UI_WIN_CLASS, app, + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_ui_win_autohide_set(efl_added, EINA_TRUE)); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + model = _make_model(win); + + factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); + efl_ui_property_bind(factory, "text", "title"); + + if (list) + { + position_manager = efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS); + efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); + } + else + { + position_manager = efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS); + efl_ui_widget_factory_item_class_set(factory, EFL_UI_GRID_DEFAULT_ITEM_CLASS); + efl_event_callback_add(factory, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _item_constructing, NULL); + } + + li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win, + efl_ui_collection_view_position_manager_set(efl_added, position_manager), + efl_ui_view_model_set(efl_added, model), + efl_ui_multi_selectable_async_select_mode_set(efl_added, mode), + efl_ui_collection_view_factory_set(efl_added, factory)); + + efl_content_set(win, li); + + //showall + efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 320)); +} +EFL_MAIN() diff --git a/src/examples/elementary/efl_ui_grid_example_1.c b/src/examples/elementary/efl_ui_grid_example_1.c index fb854fc0e2..032e5d8fdf 100644 --- a/src/examples/elementary/efl_ui_grid_example_1.c +++ b/src/examples/elementary/efl_ui_grid_example_1.c @@ -23,8 +23,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) Efl_Ui_Item *gitem; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Grid"), + efl_text_set(efl_added, "Efl.Ui.Grid"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); box = efl_add(EFL_UI_BOX_CLASS, win); diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c index 16664142a6..dab45ae261 100644 --- a/src/examples/elementary/efl_ui_list_example_1.c +++ b/src/examples/elementary/efl_ui_list_example_1.c @@ -30,7 +30,7 @@ _list_selected(void *data EINA_UNUSED, const Efl_Event *ev) Eo *item = ev->info, *tmp; printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_selectable_selected_get(item)? "selected" : "unselected")); - Eina_Iterator *selects = efl_ui_selected_items_get(list); + Eina_Iterator *selects = efl_ui_selected_iterator_new(list); EINA_ITERATOR_FOREACH(selects, tmp) printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp)); @@ -110,8 +110,7 @@ elm_main(int argc EINA_UNUSED, char **argv) win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.List"), + efl_text_set(efl_added, "Efl.Ui.List"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c index 757082aa9d..5c1f4f5fe1 100644 --- a/src/examples/elementary/efl_ui_list_view_example_1.c +++ b/src/examples/elementary/efl_ui_list_view_example_1.c @@ -14,39 +14,20 @@ #define NUM_ITEMS 400 -const char *styles[] = { - "odd", - "even" - }; - -char edj_path[PATH_MAX]; - static void _realized_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; - if (!ie->layout) return; + Efl_Gfx_Entity *layout = event->info; - Efl_Ui_Layout *layout = ie->layout; elm_object_focus_allow_set(layout, EINA_TRUE); } -/* -static void -_unrealized_cb(void *data EINA_UNUSED, const Efl_Event *event) -{ - Efl_Ui_List_View_Item_Event *ie = event->info; - - efl_ui_view_model_set(ie->layout, NULL); - efl_del(ie->layout); -} -*/ static Efl_Model* _make_model(Evas_Object *win) { Eina_Value vtext; Efl_Generic_Model *model, *child; - unsigned int i, s; + unsigned int i; char buf[256]; model = efl_add(EFL_GENERIC_MODEL_CLASS, win); @@ -54,10 +35,7 @@ _make_model(Evas_Object *win) for (i = 0; i < (NUM_ITEMS); i++) { - s = i%2; child = efl_model_child_add(model); - eina_value_set(&vtext, styles[s]); - efl_model_property_set(child, "odd_style", &vtext); snprintf(buf, sizeof(buf), "Item # %i", i); eina_value_set(&vtext, buf); @@ -88,17 +66,13 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); - efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style"); - efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected"); efl_ui_property_bind(factory, "efl.text", "title"); - li = efl_add(EFL_UI_LIST_VIEW_CLASS, win - , efl_ui_list_view_layout_factory_set(efl_added, factory) - , efl_ui_view_model_set(efl_added, selmodel) - ); + li = efl_add(EFL_UI_LIST_VIEW_CLASS, win, + efl_ui_collection_view_factory_set(efl_added, factory), + efl_ui_view_model_set(efl_added, selmodel)); - efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL); -// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL); + efl_event_callback_add(li, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL); elm_win_resize_object_add(win, li); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/src/examples/elementary/efl_ui_list_view_example_2.c b/src/examples/elementary/efl_ui_list_view_example_2.c index 5a4d680614..3464af5841 100644 --- a/src/examples/elementary/efl_ui_list_view_example_2.c +++ b/src/examples/elementary/efl_ui_list_view_example_2.c @@ -37,13 +37,12 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_property_bind(factory, "efl.text", "filename"); li = efl_add(EFL_UI_LIST_VIEW_CLASS, win); - efl_ui_list_view_layout_factory_set(li, factory); + efl_ui_collection_view_factory_set(li, factory); efl_ui_view_model_set(li, model); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); - imgf = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, win); efl_ui_property_bind(imgf, "", "path"); //connect to "path" property efl_ui_factory_bind(factory, "efl.icon", imgf); diff --git a/src/examples/elementary/efl_ui_list_view_example_3.c b/src/examples/elementary/efl_ui_list_view_example_3.c index 5a233b3430..ca839bcf59 100644 --- a/src/examples/elementary/efl_ui_list_view_example_3.c +++ b/src/examples/elementary/efl_ui_list_view_example_3.c @@ -52,17 +52,15 @@ static void _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Priv_Data *priv = (Priv_Data*)data; - efl_unref(priv->model); + efl_del(priv->model); } static void -_focused(void *data, const Efl_Event *event) +_selected(void *data, const Efl_Event *event) { Priv_Data *priv = (Priv_Data*)data; - Evas_Object *focused = efl_ui_focus_manager_focus_get(event->object); - if (focused) - priv->selected = focused; + priv->selected = efl_ui_single_selectable_last_selected_get(event->object); } static void @@ -77,7 +75,7 @@ _bt_add_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_ child = efl_model_child_add(priv->model); eina_value_set(&vtext, elm_object_text_get(priv->e_name)); - efl_model_property_set(child, "name", &vtext); + efl_model_property_set(child, "filename", &vtext); eina_value_set(&vtext, elm_object_text_get(priv->e_occ)); efl_model_property_set(child, "occupation", &vtext); @@ -95,7 +93,6 @@ _bt_del_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_ Priv_Data *priv = (Priv_Data*)data; Eo *child = NULL; - //l = efl_ui_focus_manager_focus_get(priv->list1); if(priv->selected) { printf("focused %p\n", priv->selected); @@ -113,21 +110,21 @@ static void _bt_none_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_NONE); + efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_NONE); } static void -_bt_donly_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_bt_donly_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + /* Evas_Object *li = data; */ + /* efl_ui_multi_selectable_async_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); */ } static void _bt_default_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DEFAULT); + efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_SINGLE); } static void @@ -146,28 +143,21 @@ _bt_unset_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN static void _realized_1_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; + Efl_Gfx_Entity *layout = event->info; - evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_property_bind(ie->layout, "efl.text", "name"); - efl_ui_property_bind(ie->layout, "signal/efl,state,%v", "odd_style"); + efl_ui_property_bind(layout, "efl.text", "filename"); } static void _realized_2_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; - printf("relized 2\n"); + Efl_Gfx_Entity *layout = event->info; - elm_object_focus_allow_set(ie->layout, EINA_TRUE); - evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_property_bind(ie->layout, "efl.text", "occupation"); + efl_ui_property_bind(layout, "efl.text", "occupation"); } static Efl_Model* -_make_model() +_make_model(void) { Eina_Value vtext, value; Efl_Generic_Model *model, *child; @@ -182,11 +172,8 @@ _make_model() { child = efl_model_child_add(model); - i%2 ? eina_value_set(&vtext, "even") : eina_value_set(&vtext, "odd"); - efl_model_property_set(child, "odd_style", &vtext); - eina_value_set(&vtext, texts[(i % len)]); - efl_model_property_set(child, "name", &vtext); + efl_model_property_set(child, "filename", &vtext); eina_value_set(&vtext, subtexts[(i % len)]); efl_model_property_set(child, "occupation", &vtext); @@ -226,21 +213,20 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); priv->list1 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); - efl_event_callback_add(priv->list1, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_1_cb, priv); + efl_event_callback_add(priv->list1, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_1_cb, priv); evas_object_size_hint_weight_set(priv->list1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(priv->list1, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(bx, priv->list1); - efl_ui_list_view_layout_factory_set(priv->list1, factory); + efl_ui_collection_view_factory_set(priv->list1, factory); factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); efl_ui_property_bind(factory, "efl.text", "filename"); - efl_ui_property_bind(factory, "signal/efl,state,%v", "selected"); efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); priv->list2 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); - efl_event_callback_add(priv->list2, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2); + efl_event_callback_add(priv->list2, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2); evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(priv->list2, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_list_view_layout_factory_set(priv->list2, factory); + efl_ui_collection_view_factory_set(priv->list2, factory); vbx = elm_box_add(win); elm_box_pack_end(bx, vbx); @@ -313,7 +299,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) elm_box_pack_end(vbx, bt); elm_box_pack_end(bx, priv->list2); - efl_event_callback_add(priv->list2, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, _focused ,priv); + efl_event_callback_add(priv->list2, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, _selected, priv); evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, priv); diff --git a/src/examples/elementary/efl_ui_radio_example_01.c b/src/examples/elementary/efl_ui_radio_example_01.c index b6b72e2ae2..3ab57b87fb 100644 --- a/src/examples/elementary/efl_ui_radio_example_01.c +++ b/src/examples/elementary/efl_ui_radio_example_01.c @@ -25,8 +25,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Radio example"), + efl_text_set(efl_added, "Efl.Ui.Radio example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/examples/elementary/efl_ui_relative_layout_example_01.c b/src/examples/elementary/efl_ui_relative_layout_example_01.c index e2d2af7948..77453cf7ce 100644 --- a/src/examples/elementary/efl_ui_relative_layout_example_01.c +++ b/src/examples/elementary/efl_ui_relative_layout_example_01.c @@ -16,8 +16,7 @@ elm_main(int argc, char **argv) Eo *win, *layout, *btn1, *btn2, *btn3; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, diff --git a/src/examples/elementary/efl_ui_relative_layout_example_02.c b/src/examples/elementary/efl_ui_relative_layout_example_02.c index fe254633bb..bc3740d601 100644 --- a/src/examples/elementary/efl_ui_relative_layout_example_02.c +++ b/src/examples/elementary/efl_ui_relative_layout_example_02.c @@ -16,8 +16,7 @@ elm_main(int argc, char **argv) Eo *win, *layout, *btn1, *btn2; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, diff --git a/src/examples/elementary/efl_ui_theme_example_01.c b/src/examples/elementary/efl_ui_theme_example_01.c index fe09a83556..27ad63f1c4 100644 --- a/src/examples/elementary/efl_ui_theme_example_01.c +++ b/src/examples/elementary/efl_ui_theme_example_01.c @@ -52,8 +52,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) efl_ui_theme_extension_add(default_theme, EXAMPLE_EDJ_FILE_PATH); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Theme example"), + efl_text_set(efl_added, "Efl.Ui.Theme example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/examples/elementary/efl_ui_theme_example_02.c b/src/examples/elementary/efl_ui_theme_example_02.c index 1b7e61c96a..52b1952f9d 100644 --- a/src/examples/elementary/efl_ui_theme_example_02.c +++ b/src/examples/elementary/efl_ui_theme_example_02.c @@ -52,8 +52,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) efl_ui_theme_overlay_add(default_theme, EXAMPLE_EDJ_FILE_PATH); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Theme example"), + efl_text_set(efl_added, "Efl.Ui.Theme example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/examples/elementary/layout_property_bind.c b/src/examples/elementary/layout_property_bind.c index da4c5e6020..f9c5cf979e 100644 --- a/src/examples/elementary/layout_property_bind.c +++ b/src/examples/elementary/layout_property_bind.c @@ -169,7 +169,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property efl_ui_factory_bind(priv->bt, "icon", img_factory); - efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL, bxr), + efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL), .success = _wait_for_image, .data = priv); diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build index 53d1213d4c..53489299cb 100644 --- a/src/examples/elementary/meson.build +++ b/src/examples/elementary/meson.build @@ -114,6 +114,7 @@ examples = [ 'efl_ui_list_view_example_1', 'efl_ui_list_view_example_2', 'efl_ui_list_view_example_3', + 'efl_ui_collection_view_example_1', 'efl_canvas_layout_text', 'efl_ui_theme_example_01', 'efl_ui_theme_example_02', diff --git a/src/examples/evas/evas-vg-json.c b/src/examples/evas/evas-vg-json.c index 7447373711..248dcb1054 100644 --- a/src/examples/evas/evas-vg-json.c +++ b/src/examples/evas/evas-vg-json.c @@ -124,7 +124,7 @@ main(void) Eo *player = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, evas); efl_animation_player_animation_set(player, anim); efl_event_callback_add(player, EFL_ANIMATION_PLAYER_EVENT_RUNNING, running_cb, NULL); - efl_player_start(player); + efl_player_playing_set(player, EINA_TRUE); ecore_main_loop_begin(); ecore_evas_shutdown(); diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index 2e09930fb0..4c440f1ffb 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -8,6 +8,7 @@ typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data; typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value; +typedef struct _Efl_Boolean_Model_Storage_Range Efl_Boolean_Model_Storage_Range; struct _Efl_Boolean_Model_Data { @@ -15,19 +16,106 @@ struct _Efl_Boolean_Model_Data Eina_Hash *values; }; +struct _Efl_Boolean_Model_Storage_Range +{ + EINA_RBTREE; + + unsigned int offset; + uint16_t length; // Maximum length of the buffer will be 256, to avoid math error we rely on 16bits here. + + // We over allocate this buffer to have things fitting in one alloc + unsigned char buffer[256]; +}; + struct _Efl_Boolean_Model_Value { Eina_Stringshare *property; - // This is not the best for supporting sparse bitfield with random insertion - // but will do for now (Would be best to have a tree of fixed size array - // or something along that line). - unsigned char *buffer; - unsigned int buffer_count; + Eina_Rbtree *buffers_root; + Efl_Boolean_Model_Storage_Range *last; Eina_Bool default_value; }; +static Eina_Rbtree_Direction +_storage_range_cmp(const Efl_Boolean_Model_Storage_Range *left, + const Efl_Boolean_Model_Storage_Range *right, + void *data EINA_UNUSED) +{ + // We should not have any overlapping range + if (left->offset < right->offset) + return EINA_RBTREE_LEFT; + return EINA_RBTREE_RIGHT; +} + +static int +_storage_range_key(const Efl_Boolean_Model_Storage_Range *node, + const unsigned int *key, int length EINA_UNUSED, void *data EINA_UNUSED) +{ + if (node->offset > *key) return 1; + if (node->offset + node->length < *key) return -1; + // The key is in the range! + return 0; +} + +static void +_storage_range_free(Eina_Rbtree *node, void *data EINA_UNUSED) +{ + free(node); +} + +static Efl_Boolean_Model_Storage_Range * +_storage_lookup(Efl_Boolean_Model_Data *pd, + const char *property, + unsigned int index, + Eina_Bool allocate, + Eina_Bool value, + Eina_Bool *found, + Eina_Bool *default_value) +{ + Efl_Boolean_Model_Storage_Range *lookup; + Efl_Boolean_Model_Value *v; + Eina_Stringshare *s; + + // Check if this is requesting a defined boolean property + // Property are defined and their value are stored on the parent BOOLEAN + s = eina_stringshare_add(property); + v = eina_hash_find(pd->parent->values, s); + eina_stringshare_del(s); + + if (!v) return NULL; + *found = EINA_TRUE; + *default_value = !!v->default_value; + + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), NULL); + if (lookup) return lookup; + if (!allocate) return NULL; + + // The value is the same as the default value, why bother allocate + if (*default_value == value) return NULL; + + // For simplicity we do not create a sparse array, every boolean potentially needed are allocated + // FIXME: keep it a sparse allocated buffer and only allocate needed buffer on demand + do + { + lookup = calloc(1, sizeof (Efl_Boolean_Model_Storage_Range)); + if (!lookup) return NULL; + + lookup->offset = v->last ? v->last->offset + v->last->length + 1 : 0; + lookup->length = sizeof (lookup->buffer) * 8; // Number of bits in the buffer + // Initialize the buffer to the right default value + if (default_value) memset(&lookup->buffer[0], *default_value, sizeof (&lookup->buffer)); + + v->buffers_root = eina_rbtree_inline_insert(v->buffers_root, EINA_RBTREE_GET(lookup), + EINA_RBTREE_CMP_NODE_CB(_storage_range_cmp), NULL); + v->last = lookup; + } + while (v->last->offset + v->last->length < index); + + return lookup; +} + static Eina_Iterator * _efl_boolean_model_efl_model_properties_get(const Eo *obj, Efl_Boolean_Model_Data *pd) @@ -47,10 +135,12 @@ _efl_boolean_model_efl_model_property_get(const Eo *obj, Efl_Boolean_Model_Data *pd, const char *property) { - Efl_Boolean_Model_Value *v; - Eina_Stringshare *s; + Efl_Boolean_Model_Storage_Range *sr; Eina_Bool flag; unsigned int index; + unsigned int offset; + Eina_Bool found = EINA_FALSE; + Eina_Bool default_value = EINA_FALSE; if (property == NULL) return NULL; @@ -58,23 +148,20 @@ _efl_boolean_model_efl_model_property_get(const Eo *obj, if (!pd->parent) return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); - // Check if this is requesting a defined boolean property - // Property are defined and their value are stored on the parent BOOLEAN - s = eina_stringshare_add(property); - v = eina_hash_find(pd->parent->values, s); - eina_stringshare_del(s); - - if (!v) // Not a property handle by this object, forward - return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); - index = efl_composite_model_index_get(obj); - // As an optimization we do optimistically allocate the boolean array - // Better would be to have a sparse boolean array - if ((index >> 3) >= v->buffer_count) - flag = v->default_value; - else - flag = v->buffer[index >> 3] & (((unsigned char)1) << (index & 0x7)); + + sr = _storage_lookup(pd, property, index, EINA_FALSE, EINA_FALSE, &found, &default_value); + if (!found) // Not a property handle by this object, forward + return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); + + if (!sr) // Not found in storage, should be the default value + return eina_value_bool_new(default_value); + + // Calculate the matching offset for the requested index + offset = index - sr->offset; + + flag = sr->buffer[offset >> 3] & (((unsigned char)1) << (offset & 0x7)); return eina_value_bool_new(!!flag); } @@ -84,54 +171,45 @@ _efl_boolean_model_efl_model_property_set(Eo *obj, Efl_Boolean_Model_Data *pd, const char *property, Eina_Value *value) { - Efl_Boolean_Model_Value *v; - Eina_Stringshare *s; - Eina_Bool flag; + Efl_Boolean_Model_Storage_Range *sr; unsigned int index; + unsigned int offset; + Eina_Bool flag = EINA_FALSE; + Eina_Bool found = EINA_FALSE; + Eina_Bool convert_fail = EINA_FALSE; + Eina_Bool default_value = EINA_FALSE; - if (!property) - return efl_loop_future_rejected(obj, - EFL_MODEL_ERROR_UNKNOWN); + if (!property) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN); // If we do not have a parent set that his a BOOLEAN, then we should just forward up the call if (!pd->parent) return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property, value); - // Check if this is requesting a defined boolean property - // Property are defined and their value are stored on the parent BOOLEAN - s = eina_stringshare_add(property); - v = eina_hash_find(pd->parent->values, s); - eina_stringshare_del(s); + index = efl_composite_model_index_get(obj); + if (!eina_value_bool_convert(value, &flag)) + convert_fail = EINA_TRUE; - if (!v) + sr = _storage_lookup(pd, property, index, EINA_TRUE, flag, &found, &default_value); + if (!found) return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property, value); - if (!eina_value_bool_convert(value, &flag)) + // Convert did fail and we actually should have a valid Boolean to put in the buffer + if (convert_fail) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN); - index = efl_composite_model_index_get(obj); + if (!sr) + return efl_loop_future_resolved(obj, eina_value_bool_init(default_value)); - // We are optimistically allocating the boolean buffer now. - // Aligning it on 64bits - if (v->buffer_count < (((index) >> 3) | 0x7) + 1) - { - unsigned int rcount = (((index | 0xF) >> 3) | 0x7) + 1; - unsigned char *tmp; - - tmp = realloc(v->buffer, rcount); - if (!tmp) return efl_loop_future_rejected(obj, ENOMEM); - v->buffer = tmp; - memset(v->buffer + v->buffer_count, 0, rcount - v->buffer_count); - v->buffer_count = rcount; - } + // Calculate the matching offset for the requested index + offset = index - sr->offset; // It is assumed that during slice get the buffer is properly sized if (flag) - v->buffer[index >> 3] |= ((unsigned char)1) << (index & 0x7); + sr->buffer[offset >> 3] |= ((unsigned char)1) << (offset & 0x7); else - v->buffer[index >> 3] &= ~(((unsigned char)1) << (index & 0x7)); + sr->buffer[offset >> 3] &= ~(((unsigned char)1) << (offset & 0x7)); // Calling "properties,changed" event efl_model_properties_changed(obj, property); @@ -148,13 +226,116 @@ _boolean_value_free(void *data) eina_stringshare_del(value->property); value->property = NULL; - free(value->buffer); - value->buffer = NULL; - value->buffer_count = 0; + eina_rbtree_delete(value->buffers_root, _storage_range_free, NULL); + value->last = NULL; free(value); } +static void +_mark_greater(Efl_Boolean_Model_Storage_Range *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->offset > upper) + { + eina_array_push(mark, root); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } +} + +static void +_child_removed(void *data, const Efl_Event *event) +{ + Efl_Boolean_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + Efl_Boolean_Model_Value *v; + Eina_Iterator *it; + Eina_Array updated; + + if (!pd->parent) return; + + eina_array_step_set(&updated, sizeof (Eina_Array), 8); + + it = eina_hash_iterator_data_new(pd->parent->values); + EINA_ITERATOR_FOREACH(it, v) + { + Efl_Boolean_Model_Storage_Range *lookup; + Eina_Array_Iterator iterator; + unsigned int i; + + // Remove the data from the buffer it belong to + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &ev->index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), NULL); + if (lookup) + { + unsigned char lower_mask = (((unsigned char)1) << (ev->index & 0x7)) - 1; + unsigned char upper_mask = (~(((unsigned char)1) << (ev->index & 0x7))) & (~lower_mask); + unsigned char offset = (ev->index - lookup->offset) >> 3; + uint16_t byte_length = lookup->length >> 3; + + // Manually shift all the byte in the buffer + while (offset < byte_length) + { + lookup->buffer[offset] = (lookup->buffer[offset] & upper_mask) | + ((lookup->buffer[offset] & lower_mask) << 1); + if (offset + 1 < byte_length) + lookup->buffer[offset] |= lookup->buffer[offset + 1] & 0x1; + + lower_mask = 0; + upper_mask = 0xFE; + offset++; + } + + lookup->length--; + if (lookup->length == 0) + { + v->buffers_root = eina_rbtree_inline_remove(v->buffers_root, EINA_RBTREE_GET(lookup), + EINA_RBTREE_CMP_NODE_CB(_storage_range_cmp), NULL); + free(lookup); + + if (lookup == v->last) + { + if (v->buffers_root) + { + unsigned int last_index = ev->index - 1; + + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &last_index, + sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), + NULL); + v->last = lookup; + } + else + { + // Nobody left + v->last = NULL; + } + } + } + } + + _mark_greater((void*) v->buffers_root, &updated, ev->index); + + // Correct all the buffer after it + // There is no need to remove and reinsert them as their relative order will not change. + EINA_ARRAY_ITER_NEXT(&updated, i, lookup, iterator) + { + lookup->offset--; + } + + eina_array_clean(&updated); + } + eina_iterator_free(it); + + eina_array_flush(&updated); +} + static Eo * _efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd) { @@ -170,6 +351,8 @@ _efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd) if (efl_isa(parent, EFL_BOOLEAN_MODEL_CLASS)) pd->parent = efl_data_scope_get(parent, EFL_BOOLEAN_MODEL_CLASS); + efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed, pd); + return obj; } @@ -220,6 +403,8 @@ struct _Eina_Iterator_Boolean Eo *obj; Efl_Boolean_Model_Data *pd; Efl_Boolean_Model_Value *v; + Efl_Boolean_Model_Storage_Range *sr; + Eina_Iterator *infix; uint64_t index; uint64_t total; @@ -227,59 +412,85 @@ struct _Eina_Iterator_Boolean Eina_Bool request; }; -static inline Eina_Bool -_lookup_next_chunk(uint64_t *index, uint64_t total, - Efl_Boolean_Model_Value *v, unsigned char pattern) +static Eina_Bool +_efl_boolean_model_iterator_storage_index_find(Eina_Iterator_Boolean *it) { - uint64_t upidx = *index >> 3; + uint16_t offset; + uint16_t byte_length; - while (upidx < v->buffer_count && - v->buffer[upidx] == pattern) - upidx++; + offset = it->index - it->sr->offset; + byte_length = it->sr->length >> 3; - *index = upidx << 3; - if (upidx == v->buffer_count && - *index >= total) return EINA_FALSE; - return EINA_TRUE; + while (offset < it->sr->length) + { + uint64_t upidx; + + upidx = offset >> 3; + + // Quickly dismiss byte that really do not match + while (upidx < byte_length && + it->sr->buffer[upidx] == (it->request ? 0x00 : 0xFF)) + upidx++; + + // Make the indexes jump + if (upidx != (offset >> 3)) + { + offset = upidx << 3; + it->index = it->sr->offset + offset; + } + + // Search inside the said byte + while (((offset >> 3) == upidx) && + (offset < it->sr->length)) + { + Eina_Bool flag = it->sr->buffer[offset >> 3] & + (((unsigned char)1) << (offset & 0x7)); + + if (it->request == !!flag) + return EINA_TRUE; + + it->index++; + offset++; + } + } + + return EINA_FALSE; +} + +static Eina_Bool +_efl_boolean_model_iterator_index_find(Eina_Iterator_Boolean *it) +{ + while (it->index < it->total) + { + // If we are not walking on an existing storage range, look for a new one + if (!it->sr) + { + if (!eina_iterator_next(it->infix, (void**) &it->sr)) + { + // All the rest of the data are not allocated and there value is still default + if (it->v->default_value != it->request) + return EINA_FALSE; + return EINA_TRUE; + } + } + + if (_efl_boolean_model_iterator_storage_index_find(it)) + return EINA_TRUE; + + // Nothing more to look at in this buffer + it->sr = NULL; + } + + return EINA_FALSE; } static Eina_Bool efl_boolean_model_iterator_next(Eina_Iterator_Boolean *it, void **data) { - uint64_t upidx; - *data = &it->index; it->index++; - retry: - if (it->index >= it->total) return EINA_FALSE; - if ((it->index >> 3) >= it->v->buffer_count) - { - if (it->v->default_value != it->request) - return EINA_FALSE; - return EINA_TRUE; - } - - upidx = it->index >> 3; - while ((it->index >> 3) == upidx) - { - Eina_Bool flag = it->v->buffer[it->index >> 3] & - (((unsigned char)1) << (it->index & 0x7)); - - if (it->request == !!flag) - break; - - it->index++; - } - - if ((it->index >> 3) != upidx) - { - if (!_lookup_next_chunk(&it->index, it->total, it->v, it->request ? 0x00 : 0xFF)) - return EINA_FALSE; - goto retry; - } - - return EINA_TRUE; + return _efl_boolean_model_iterator_index_find(it); } static Eo * @@ -291,6 +502,7 @@ efl_boolean_model_iterator_get_container(Eina_Iterator_Boolean *it) static void efl_boolean_model_iterator_free(Eina_Iterator_Boolean *it) { + eina_iterator_free(it->infix); efl_unref(it->obj); EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_NONE); free(it); @@ -314,6 +526,9 @@ _efl_boolean_model_boolean_iterator_get(Eo *obj, Efl_Boolean_Model_Data *pd, con itb->obj = efl_ref(obj); itb->pd = pd; itb->v = v; + itb->infix = eina_rbtree_iterator_infix(v->buffers_root); + // Search the first index that do have the valid value + _efl_boolean_model_iterator_index_find(itb); itb->index = 0; itb->total = efl_model_children_count_get(obj); itb->request = !!request; diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 26322357d2..b3896bc99e 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -40,7 +40,26 @@ static int _children_indexed_key(const Efl_Composite_Model_Data *node, const int *key, int length EINA_UNUSED, void *data EINA_UNUSED) { - return node->index - *key; + if (node->index > (unsigned int) *key) return 1; + if (node->index < (unsigned int) *key) return -1; + return 0; +} + +static void +_mark_greater(Efl_Composite_Model_Data *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->index > upper) + { + eina_array_push(mark, root); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } } static void @@ -136,20 +155,75 @@ _efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd) return r; } +static void +_efl_composite_model_child_event(Efl_Composite_Model_Data *pd, + const Efl_Model_Children_Event *ev, + const Efl_Event_Description *description) +{ + Efl_Composite_Model_Data *cpd; + Efl_Model_Children_Event cev = { 0 }; + Eina_Array mark; + Eina_Array_Iterator iterator; + unsigned int i; + + cev.index = ev->index; + if (ev->child) + { + cev.child = _efl_composite_lookup(efl_class_get(pd->self), + pd->self, ev->child, ev->index); + } + else + { + cpd = (void*) eina_rbtree_inline_lookup(pd->indexed, &cev.index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_children_indexed_key), NULL); + if (cpd) cev.child = efl_ref(cpd->self); + } + + if (cev.child && description == EFL_MODEL_EVENT_CHILD_REMOVED) + { + cpd = efl_data_scope_get(cev.child, EFL_COMPOSITE_MODEL_CLASS); + + // Remove child from lookup tree if it exist before triggering anything further + pd->indexed = eina_rbtree_inline_remove(pd->indexed, EINA_RBTREE_GET(cpd), + EINA_RBTREE_CMP_NODE_CB(_children_indexed_cmp), NULL); + cpd->inserted = EINA_FALSE; + efl_replace(&cpd->source, NULL); + } + + // Update all index above this one if necessaryy + eina_array_step_set(&mark, sizeof (Eina_Array), 8); + _mark_greater((void*) pd->indexed, &mark, cev.index); + + // Correct index of the object stored that need to + // There is no need to remove and reinsert them as their relative order will not change. + EINA_ARRAY_ITER_NEXT(&mark, i, cpd, iterator) + { + if (description == EFL_MODEL_EVENT_CHILD_REMOVED) cpd->index--; + else cpd->index++; + + efl_ref(cpd->self); + } + + efl_event_callback_call(pd->self, description, &cev); + + // Notify of the index change only after notifying of the removal top avoid overlap + EINA_ARRAY_ITER_NEXT(&mark, i, cpd, iterator) + { + efl_model_properties_changed(cpd->self, EFL_COMPOSITE_MODEL_CHILD_INDEX); + efl_unref(cpd->self); + } + eina_array_flush(&mark); + + efl_unref(cev.child); +} + static void _efl_composite_model_child_added(void *data, const Efl_Event *event) { Efl_Composite_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; - Efl_Model_Children_Event cev = { 0 }; - cev.index = ev->index; - if (ev->child) - cev.child = _efl_composite_lookup(efl_class_get(pd->self), - pd->self, ev->child, ev->index); - efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_ADDED, &cev); - - efl_unref(cev.child); + _efl_composite_model_child_event(pd, ev, EFL_MODEL_EVENT_CHILD_ADDED); } static void @@ -157,16 +231,8 @@ _efl_composite_model_child_removed(void *data, const Efl_Event *event) { Efl_Composite_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; - Efl_Model_Children_Event cev = { 0 }; - cev.index = ev->index; - if (ev->child) - cev.child = _efl_composite_lookup(efl_class_get(pd->self), - pd->self, ev->child, ev->index); - - efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_REMOVED, &cev); - - efl_unref(cev.child); + _efl_composite_model_child_event(pd, ev, EFL_MODEL_EVENT_CHILD_REMOVED); } EFL_CALLBACKS_ARRAY_DEFINE(composite_callbacks, @@ -427,8 +493,7 @@ _efl_composite_model_efl_object_destructor(Eo *obj, Efl_Composite_Model_Data *pd efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, obj); efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_PROPERTIES_CHANGED, obj); - efl_unref(pd->source); - pd->source = NULL; + efl_replace(&pd->source, NULL); } efl_destructor(efl_super(obj, EFL_COMPOSITE_MODEL_CLASS)); diff --git a/src/lib/ecore/efl_composite_model.eo b/src/lib/ecore/efl_composite_model.eo index 4244e930bc..34c2e203d4 100644 --- a/src/lib/ecore/efl_composite_model.eo +++ b/src/lib/ecore/efl_composite_model.eo @@ -1,4 +1,4 @@ -class @beta Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View +class Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View { [[Efl model for all composite class which provide a unified API to set source of data. diff --git a/src/lib/ecore/efl_filter_model.eo b/src/lib/ecore/efl_filter_model.eo index 4dafb94f51..760887a8f6 100644 --- a/src/lib/ecore/efl_filter_model.eo +++ b/src/lib/ecore/efl_filter_model.eo @@ -10,12 +10,13 @@ function @beta EflFilterModel { class @beta Efl.Filter_Model extends Efl.Composite_Model { - [[Efl model designed to filter its children.]] + [[Filtering data that @Efl.Model provides is the main feature of this class. + This class provides a filter function so only children that match it are returned.]] methods { filter_set { [[Set a filter function that will catch children from the composited model.]] params { - filter: EflFilterModel; [[Filter callback]] + filter: EflFilterModel; [[Filter callback.]] } } } diff --git a/src/lib/ecore/efl_loop_model.eo b/src/lib/ecore/efl_loop_model.eo index 3a15490fce..ec2488e4fd 100644 --- a/src/lib/ecore/efl_loop_model.eo +++ b/src/lib/ecore/efl_loop_model.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model +abstract Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model { data: null; methods { diff --git a/src/lib/ecore_con/Efl_Net.h b/src/lib/ecore_con/Efl_Net.h index be2147105f..7cab05efa3 100644 --- a/src/lib/ecore_con/Efl_Net.h +++ b/src/lib/ecore_con/Efl_Net.h @@ -81,6 +81,161 @@ EAPI int ecore_con_url_init(void); */ EAPI int ecore_con_url_shutdown(void); +#ifdef EFL_BETA_API_SUPPORT +/** HTTP error: bad content encoding */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_CONTENT_ENCODING; + +/** HTTP error: bad download resume */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_DOWNLOAD_RESUME; + +/** HTTP error: bad function argument */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_FUNCTION_ARGUMENT; + +/** HTTP error: chunk failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CHUNK_FAILED; + +/** HTTP error: conv failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CONV_FAILED; + +/** HTTP error: conv reqd */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CONV_REQD; + +/** HTTP error: failed init */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FAILED_INIT; + +/** HTTP error: could not read file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FILE_COULDNT_READ_FILE; + +/** HTTP error: filesize exceeded */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FILESIZE_EXCEEDED; + +/** HTTP error: function not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FUNCTION_NOT_FOUND; + +/** HTTP error: got nothing */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_GOT_NOTHING; + +/** HTTP error: http2 */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP2; + +/** HTTP error: http2 stream */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP2_STREAM; + +/** HTTP error: http post error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP_POST_ERROR; + +/** HTTP error: http returned error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP_RETURNED_ERROR; + +/** HTTP error: interface failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_INTERFACE_FAILED; + +/** HTTP error: login denied */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_LOGIN_DENIED; + +/** HTTP error: no connection available */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_NO_CONNECTION_AVAILABLE; + +/** HTTP error: not built in */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_NOT_BUILT_IN; + +/** HTTP error: operation timeout */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_OPERATION_TIMEDOUT; + +/** HTTP error: partial file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_PARTIAL_FILE; + +/** HTTP error: peer failed verification */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_PEER_FAILED_VERIFICATION; + +/** HTTP error: range error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_RANGE_ERROR; + +/** HTTP error: read error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_READ_ERROR; + +/** HTTP error: receive error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_RECV_ERROR; + +/** HTTP error: remote access denied */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_ACCESS_DENIED; + +/** HTTP error: remote disk full */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_DISK_FULL; + +/** HTTP error: remote file exists */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_FILE_EXISTS; + +/** HTTP error: remote file not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_FILE_NOT_FOUND; + +/** HTTP error: send error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SEND_ERROR; + +/** HTTP error: send fail rewind */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SEND_FAIL_REWIND; + +/** HTTP error: SSL cacert */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CACERT; + +/** HTTP error: SSL cacert bad file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CACERT_BADFILE; + +/** HTTP error: SSL certproblem */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CERTPROBLEM; + +/** HTTP error: SSL cipher */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CIPHER; + +/** HTTP error: SSL connect error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CONNECT_ERROR; + +/** HTTP error: SSL crl bad file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CRL_BADFILE; + +/** HTTP error: SSL engine init failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_INITFAILED; + +/** HTTP error: SSL engine not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_NOTFOUND; + +/** HTTP error: SSL engine set failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_SETFAILED; + +/** HTTP error: SSL invalid cert status */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_INVALIDCERTSTATUS; + +/** HTTP error: SSL issuer error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ISSUER_ERROR; + +/** HTTP error: SSL pinned pub key does not match */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_PINNEDPUBKEYNOTMATCH; + +/** HTTP error: SSL shutdown failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_SHUTDOWN_FAILED; + +/** HTTP error: too many redirects */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_TOO_MANY_REDIRECTS; + +/** HTTP error: unknown option */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UNKNOWN_OPTION; + +/** HTTP error: unsupported protocol */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UNSUPPORTED_PROTOCOL; + +/** HTTP error: upload failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UPLOAD_FAILED; + +/** HTTP error: URL mal-formatted */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_URL_MALFORMAT; + +/** HTTP error: usage of SSL failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_USE_SSL_FAILED; + +/** HTTP error: write error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_WRITE_ERROR; +#endif /* EFL_BETA_API_SUPPORT */ + #include "efl_net_types.eot.h" #include "efl_net_ip_address.eo.h" diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 75f083ac9f..8a4e0fb43e 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -48,6 +48,8 @@ #include "Ecore_Con.h" #include "ecore_con_private.h" +#include "efl_net_types.eot.c" + #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 /* noop */ #endif @@ -57,15 +59,6 @@ int sd_fd_index = 0; int sd_fd_max = 0; #endif -EWAPI Eina_Error EFL_NET_ERROR_COULDNT_RESOLVE_HOST = 0; - -EWAPI Eina_Error EFL_NET_DIALER_ERROR_COULDNT_CONNECT = 0; -EWAPI Eina_Error EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY = 0; -EWAPI Eina_Error EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED = 0; - -EWAPI Eina_Error EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE = 0; -EWAPI Eina_Error EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED = 0; - static int _ecore_con_init_count = 0; int _ecore_con_log_dom = -1; @@ -102,14 +95,16 @@ ecore_con_init(void) ecore_con_mempool_init(); ecore_con_legacy_init(); - EFL_NET_ERROR_COULDNT_RESOLVE_HOST = eina_error_msg_static_register("Couldn't resolve host name"); + /* initialize the .eo file errors once to guarantee thread safety */ - EFL_NET_DIALER_ERROR_COULDNT_CONNECT = eina_error_msg_static_register("Couldn't connect to server"); - EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY = eina_error_msg_static_register("Couldn't resolve proxy name"); - EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED = eina_error_msg_static_register("Proxy authentication failed"); + EFL_NET_ERROR_COULDNT_RESOLVE_HOST; - EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE = eina_error_msg_static_register("Failed SSL handshake"); - EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED = eina_error_msg_static_register("Failed to verify peer's certificate"); + EFL_NET_DIALER_ERROR_COULDNT_CONNECT; + EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY; + EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED; + + EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE; + EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED; #ifdef HAVE_SYSTEMD sd_fd_max = sd_listen_fds(0); diff --git a/src/lib/ecore_con/efl_net_dialer.eo b/src/lib/ecore_con/efl_net_dialer.eo index 8570e6538e..6ba5656c2b 100644 --- a/src/lib/ecore_con/efl_net_dialer.eo +++ b/src/lib/ecore_con/efl_net_dialer.eo @@ -1,6 +1,6 @@ -var @beta Efl.Net.Dialer_Error.COULDNT_CONNECT: Eina.Error; [[The dialer could not connect to the remote]] -var @beta Efl.Net.Dialer_Error.COULDNT_RESOLVE_PROXY: Eina.Error; [[The dialer could not resolve the given proxy server]] -var @beta Efl.Net.Dialer_Error.PROXY_AUTHENTICATION_FAILED: Eina.Error; [[The dialer failed to authenticate against the proxy server]] +error @beta Efl.Net.Dialer_Error.COULDNT_CONNECT = "Couldn't connect to server"; [[The dialer could not connect to the remote]] +error @beta Efl.Net.Dialer_Error.COULDNT_RESOLVE_PROXY = "Couldn't resolve proxy name"; [[The dialer could not resolve the given proxy server]] +error @beta Efl.Net.Dialer_Error.PROXY_AUTHENTICATION_FAILED = "Proxy authentication failed"; [[The dialer failed to authenticate against the proxy server]] interface @beta Efl.Net.Dialer extends Efl.Net.Socket { [[Creates a client socket to reach a remote peer. diff --git a/src/lib/ecore_con/efl_net_http_types.eot b/src/lib/ecore_con/efl_net_http_types.eot index 01a4cff5d3..63784f86e9 100644 --- a/src/lib/ecore_con/efl_net_http_types.eot +++ b/src/lib/ecore_con/efl_net_http_types.eot @@ -126,54 +126,54 @@ struct @beta Efl.Net.Http.Header { value: string; [[Header value]] } -var @beta Efl.Net.Http.Error.BAD_CONTENT_ENCODING: Eina.Error; [[HTTP error: bad content encoding]] -var @beta Efl.Net.Http.Error.BAD_DOWNLOAD_RESUME: Eina.Error; [[HTTP error: bad download resume]] -var @beta Efl.Net.Http.Error.BAD_FUNCTION_ARGUMENT: Eina.Error; [[HTTP error: bad function argument]] -var @beta Efl.Net.Http.Error.CHUNK_FAILED: Eina.Error; [[HTTP error: chunk failed]] -var @beta Efl.Net.Http.Error.CONV_FAILED: Eina.Error; [[HTTP error: conv failed]] -var @beta Efl.Net.Http.Error.CONV_REQD: Eina.Error; [[HTTP error: conv reqd]] -var @beta Efl.Net.Http.Error.FAILED_INIT: Eina.Error; [[HTTP error: failed init]] -var @beta Efl.Net.Http.Error.FILE_COULDNT_READ_FILE: Eina.Error; [[HTTP error: could not read file]] -var @beta Efl.Net.Http.Error.FILESIZE_EXCEEDED: Eina.Error; [[HTTP error: filesize exceeded]] -var @beta Efl.Net.Http.Error.FUNCTION_NOT_FOUND: Eina.Error; [[HTTP error: function not found]] -var @beta Efl.Net.Http.Error.GOT_NOTHING: Eina.Error; [[HTTP error: got nothing]] -var @beta Efl.Net.Http.Error.HTTP2: Eina.Error; [[HTTP error: http2]] -var @beta Efl.Net.Http.Error.HTTP2_STREAM: Eina.Error; [[HTTP error: http2 stream]] -var @beta Efl.Net.Http.Error.HTTP_POST_ERROR: Eina.Error; [[HTTP error: http post error]] -var @beta Efl.Net.Http.Error.HTTP_RETURNED_ERROR: Eina.Error; [[HTTP error: http returned error]] -var @beta Efl.Net.Http.Error.INTERFACE_FAILED: Eina.Error; [[HTTP error: interface failed]] -var @beta Efl.Net.Http.Error.LOGIN_DENIED: Eina.Error; [[HTTP error: login denied]] -var @beta Efl.Net.Http.Error.NO_CONNECTION_AVAILABLE: Eina.Error; [[HTTP error: no connection available]] -var @beta Efl.Net.Http.Error.NOT_BUILT_IN: Eina.Error; [[HTTP error: not built in]] -var @beta Efl.Net.Http.Error.OPERATION_TIMEDOUT: Eina.Error; [[HTTP error: operation timeout]] -var @beta Efl.Net.Http.Error.PARTIAL_FILE: Eina.Error; [[HTTP error: partial file]] -var @beta Efl.Net.Http.Error.PEER_FAILED_VERIFICATION: Eina.Error; [[HTTP error: peer failed verification]] -var @beta Efl.Net.Http.Error.RANGE_ERROR: Eina.Error; [[HTTP error: range error]] -var @beta Efl.Net.Http.Error.READ_ERROR: Eina.Error; [[HTTP error: read error]] -var @beta Efl.Net.Http.Error.RECV_ERROR: Eina.Error; [[HTTP error: receive error]] -var @beta Efl.Net.Http.Error.REMOTE_ACCESS_DENIED: Eina.Error; [[HTTP error: remote access denied]] -var @beta Efl.Net.Http.Error.REMOTE_DISK_FULL: Eina.Error; [[HTTP error: remote disk full]] -var @beta Efl.Net.Http.Error.REMOTE_FILE_EXISTS: Eina.Error; [[HTTP error: remote file exists]] -var @beta Efl.Net.Http.Error.REMOTE_FILE_NOT_FOUND: Eina.Error; [[HTTP error: remote file not found]] -var @beta Efl.Net.Http.Error.SEND_ERROR: Eina.Error; [[HTTP error: send error]] -var @beta Efl.Net.Http.Error.SEND_FAIL_REWIND: Eina.Error; [[HTTP error: send fail rewind]] -var @beta Efl.Net.Http.Error.SSL_CACERT: Eina.Error; [[HTTP error: SSL cacert]] -var @beta Efl.Net.Http.Error.SSL_CACERT_BADFILE: Eina.Error; [[HTTP error: SSL cacert bad file]] -var @beta Efl.Net.Http.Error.SSL_CERTPROBLEM: Eina.Error; [[HTTP error: SSL certproblem]] -var @beta Efl.Net.Http.Error.SSL_CIPHER: Eina.Error; [[HTTP error: SSL cipher]] -var @beta Efl.Net.Http.Error.SSL_CONNECT_ERROR: Eina.Error; [[HTTP error: SSL connect error]] -var @beta Efl.Net.Http.Error.SSL_CRL_BADFILE: Eina.Error; [[HTTP error: SSL crl bad file]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_INITFAILED: Eina.Error; [[HTTP error: SSL engine init failed]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_NOTFOUND: Eina.Error; [[HTTP error: SSL engine not found]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_SETFAILED: Eina.Error; [[HTTP error: SSL engine set failed]] -var @beta Efl.Net.Http.Error.SSL_INVALIDCERTSTATUS: Eina.Error; [[HTTP error: SSL invalid cert status]] -var @beta Efl.Net.Http.Error.SSL_ISSUER_ERROR: Eina.Error; [[HTTP error: SSL issuer error]] -var @beta Efl.Net.Http.Error.SSL_PINNEDPUBKEYNOTMATCH: Eina.Error; [[HTTP error: SSL pinned pub key does not match]] -var @beta Efl.Net.Http.Error.SSL_SHUTDOWN_FAILED: Eina.Error; [[HTTP error: SSL shutdown failed]] -var @beta Efl.Net.Http.Error.TOO_MANY_REDIRECTS: Eina.Error; [[HTTP error: too many redirects]] -var @beta Efl.Net.Http.Error.UNKNOWN_OPTION: Eina.Error; [[HTTP error: unknown option]] -var @beta Efl.Net.Http.Error.UNSUPPORTED_PROTOCOL: Eina.Error; [[HTTP error: unsupported protocol]] -var @beta Efl.Net.Http.Error.UPLOAD_FAILED: Eina.Error; [[HTTP error: upload failed]] -var @beta Efl.Net.Http.Error.URL_MALFORMAT: Eina.Error; [[HTTP error: URL mal-formatted]] -var @beta Efl.Net.Http.Error.USE_SSL_FAILED: Eina.Error; [[HTTP error: usage of SSL failed]] -var @beta Efl.Net.Http.Error.WRITE_ERROR: Eina.Error; [[HTTP error: write error]] +error @extern @beta Efl.Net.Http.Error.BAD_CONTENT_ENCODING = "XXX"; [[HTTP error: bad content encoding]] +error @extern @beta Efl.Net.Http.Error.BAD_DOWNLOAD_RESUME = "XXX"; [[HTTP error: bad download resume]] +error @extern @beta Efl.Net.Http.Error.BAD_FUNCTION_ARGUMENT = "XXX"; [[HTTP error: bad function argument]] +error @extern @beta Efl.Net.Http.Error.CHUNK_FAILED = "XXX"; [[HTTP error: chunk failed]] +error @extern @beta Efl.Net.Http.Error.CONV_FAILED = "XXX"; [[HTTP error: conv failed]] +error @extern @beta Efl.Net.Http.Error.CONV_REQD = "XXX"; [[HTTP error: conv reqd]] +error @extern @beta Efl.Net.Http.Error.FAILED_INIT = "XXX"; [[HTTP error: failed init]] +error @extern @beta Efl.Net.Http.Error.FILE_COULDNT_READ_FILE = "XXX"; [[HTTP error: could not read file]] +error @extern @beta Efl.Net.Http.Error.FILESIZE_EXCEEDED = "XXX"; [[HTTP error: filesize exceeded]] +error @extern @beta Efl.Net.Http.Error.FUNCTION_NOT_FOUND = "XXX"; [[HTTP error: function not found]] +error @extern @beta Efl.Net.Http.Error.GOT_NOTHING = "XXX"; [[HTTP error: got nothing]] +error @extern @beta Efl.Net.Http.Error.HTTP2 = "XXX"; [[HTTP error: http2]] +error @extern @beta Efl.Net.Http.Error.HTTP2_STREAM = "XXX"; [[HTTP error: http2 stream]] +error @extern @beta Efl.Net.Http.Error.HTTP_POST_ERROR = "XXX"; [[HTTP error: http post error]] +error @extern @beta Efl.Net.Http.Error.HTTP_RETURNED_ERROR = "XXX"; [[HTTP error: http returned error]] +error @extern @beta Efl.Net.Http.Error.INTERFACE_FAILED = "XXX"; [[HTTP error: interface failed]] +error @extern @beta Efl.Net.Http.Error.LOGIN_DENIED = "XXX"; [[HTTP error: login denied]] +error @extern @beta Efl.Net.Http.Error.NO_CONNECTION_AVAILABLE = "XXX"; [[HTTP error: no connection available]] +error @extern @beta Efl.Net.Http.Error.NOT_BUILT_IN = "XXX"; [[HTTP error: not built in]] +error @extern @beta Efl.Net.Http.Error.OPERATION_TIMEDOUT = "XXX"; [[HTTP error: operation timeout]] +error @extern @beta Efl.Net.Http.Error.PARTIAL_FILE = "XXX"; [[HTTP error: partial file]] +error @extern @beta Efl.Net.Http.Error.PEER_FAILED_VERIFICATION = "XXX"; [[HTTP error: peer failed verification]] +error @extern @beta Efl.Net.Http.Error.RANGE_ERROR = "XXX"; [[HTTP error: range error]] +error @extern @beta Efl.Net.Http.Error.READ_ERROR = "XXX"; [[HTTP error: read error]] +error @extern @beta Efl.Net.Http.Error.RECV_ERROR = "XXX"; [[HTTP error: receive error]] +error @extern @beta Efl.Net.Http.Error.REMOTE_ACCESS_DENIED = "XXX"; [[HTTP error: remote access denied]] +error @extern @beta Efl.Net.Http.Error.REMOTE_DISK_FULL = "XXX"; [[HTTP error: remote disk full]] +error @extern @beta Efl.Net.Http.Error.REMOTE_FILE_EXISTS = "XXX"; [[HTTP error: remote file exists]] +error @extern @beta Efl.Net.Http.Error.REMOTE_FILE_NOT_FOUND = "XXX"; [[HTTP error: remote file not found]] +error @extern @beta Efl.Net.Http.Error.SEND_ERROR = "XXX"; [[HTTP error: send error]] +error @extern @beta Efl.Net.Http.Error.SEND_FAIL_REWIND = "XXX"; [[HTTP error: send fail rewind]] +error @extern @beta Efl.Net.Http.Error.SSL_CACERT = "XXX"; [[HTTP error: SSL cacert]] +error @extern @beta Efl.Net.Http.Error.SSL_CACERT_BADFILE = "XXX"; [[HTTP error: SSL cacert bad file]] +error @extern @beta Efl.Net.Http.Error.SSL_CERTPROBLEM = "XXX"; [[HTTP error: SSL certproblem]] +error @extern @beta Efl.Net.Http.Error.SSL_CIPHER = "XXX"; [[HTTP error: SSL cipher]] +error @extern @beta Efl.Net.Http.Error.SSL_CONNECT_ERROR = "XXX"; [[HTTP error: SSL connect error]] +error @extern @beta Efl.Net.Http.Error.SSL_CRL_BADFILE = "XXX"; [[HTTP error: SSL crl bad file]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_INITFAILED = "XXX"; [[HTTP error: SSL engine init failed]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_NOTFOUND = "XXX"; [[HTTP error: SSL engine not found]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_SETFAILED = "XXX"; [[HTTP error: SSL engine set failed]] +error @extern @beta Efl.Net.Http.Error.SSL_INVALIDCERTSTATUS = "XXX"; [[HTTP error: SSL invalid cert status]] +error @extern @beta Efl.Net.Http.Error.SSL_ISSUER_ERROR = "XXX"; [[HTTP error: SSL issuer error]] +error @extern @beta Efl.Net.Http.Error.SSL_PINNEDPUBKEYNOTMATCH = "XXX"; [[HTTP error: SSL pinned pub key does not match]] +error @extern @beta Efl.Net.Http.Error.SSL_SHUTDOWN_FAILED = "XXX"; [[HTTP error: SSL shutdown failed]] +error @extern @beta Efl.Net.Http.Error.TOO_MANY_REDIRECTS = "XXX"; [[HTTP error: too many redirects]] +error @extern @beta Efl.Net.Http.Error.UNKNOWN_OPTION = "XXX"; [[HTTP error: unknown option]] +error @extern @beta Efl.Net.Http.Error.UNSUPPORTED_PROTOCOL = "XXX"; [[HTTP error: unsupported protocol]] +error @extern @beta Efl.Net.Http.Error.UPLOAD_FAILED = "XXX"; [[HTTP error: upload failed]] +error @extern @beta Efl.Net.Http.Error.URL_MALFORMAT = "XXX"; [[HTTP error: URL mal-formatted]] +error @extern @beta Efl.Net.Http.Error.USE_SSL_FAILED = "XXX"; [[HTTP error: usage of SSL failed]] +error @extern @beta Efl.Net.Http.Error.WRITE_ERROR = "XXX"; [[HTTP error: write error]] diff --git a/src/lib/ecore_con/efl_net_socket_ssl.eo b/src/lib/ecore_con/efl_net_socket_ssl.eo index 7bf9b4cba7..60a1fbb1ec 100644 --- a/src/lib/ecore_con/efl_net_socket_ssl.eo +++ b/src/lib/ecore_con/efl_net_socket_ssl.eo @@ -1,5 +1,5 @@ -var @beta Efl.Net.Socket_Ssl_Error.HANDSHAKE: Eina.Error; [[Failed SSL handshake]] -var @beta Efl.Net.Socket_Ssl_Error.CERTIFICATE_VERIFY_FAILED: Eina.Error; [[Failed to verify peer's certificate]] +error @beta Efl.Net.Socket_Ssl_Error.HANDSHAKE = "Failed SSL handshake"; [[Failed SSL handshake]] +error @beta Efl.Net.Socket_Ssl_Error.CERTIFICATE_VERIFY_FAILED = "Failed to verify peer's certificate"; [[Failed to verify peer's certificate]] class @beta Efl.Net.Socket_Ssl extends Efl.Loop_Consumer implements Efl.Net.Socket { [[A wrapper socket doing SSL (Secure Sockets Layer). diff --git a/src/lib/ecore_con/efl_net_types.eot b/src/lib/ecore_con/efl_net_types.eot index 48512fb105..36d8bba1ec 100644 --- a/src/lib/ecore_con/efl_net_types.eot +++ b/src/lib/ecore_con/efl_net_types.eot @@ -1,3 +1,3 @@ import eina_types; -var @beta Efl.Net.Error.COULDNT_RESOLVE_HOST: Eina.Error; [[Could not resolve the given host name]] +error @beta Efl.Net.Error.COULDNT_RESOLVE_HOST = "Couldn't resolve host name"; [[Could not resolve the given host name]] diff --git a/src/lib/ecore_con/meson.build b/src/lib/ecore_con/meson.build index eacf16f720..fc53d3210f 100644 --- a/src/lib/ecore_con/meson.build +++ b/src/lib/ecore_con/meson.build @@ -89,8 +89,9 @@ foreach eo_file : pub_eo_types_files install_dir : dir_package_include, command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), + '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-ghd', '@INPUT@']) + '-gchd', '@INPUT@']) endforeach eolian_include_directories += ['-I', meson.current_source_dir()] diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c index edcc185a33..a93ed061a6 100644 --- a/src/lib/edje/edje_legacy.c +++ b/src/lib/edje/edje_legacy.c @@ -1202,26 +1202,26 @@ edje_object_calc_force(Edje_Object *obj) EAPI void edje_object_play_set(Evas_Object *obj, Eina_Bool play) { - efl_player_play_set(obj, play); + efl_player_paused_set(obj, !play); } EAPI Eina_Bool edje_object_play_get(const Evas_Object *obj) { - return efl_player_play_get(obj); + return !efl_player_paused_get(obj); } EAPI void edje_object_transition_duration_factor_set(Evas_Object *obj, double scale) { if (scale <= 0.0) return; - efl_player_play_speed_set(obj, 1.0/scale); + efl_player_playback_speed_set(obj, 1.0/scale); } EAPI double edje_object_transition_duration_factor_get(const Evas_Object *obj) { - double speed = efl_player_play_speed_get(obj); + double speed = efl_player_playback_speed_get(obj); if (speed <= 0.0) speed = 1.0; return 1.0/speed; diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 4801432ebc..de2575c6a6 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -538,33 +538,31 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object } EOLIAN Eina_Bool -_efl_canvas_layout_efl_player_playable_get(const Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED) +_efl_canvas_layout_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED) { return EINA_TRUE; } -EOLIAN void -_efl_canvas_layout_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play) +EOLIAN Eina_Bool +_efl_canvas_layout_efl_player_paused_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool paused) { double t; Eina_List *l; Edje_Running_Program *runp; unsigned short i; - if (!ed) return; - if (ed->delete_me) return; - if (play) + if (!ed) return EINA_FALSE; + if (ed->delete_me) return EINA_FALSE; + paused = !!paused; + if (ed->paused == paused) return EINA_TRUE; + if (!paused) { - if (!ed->paused) return; - ed->paused = EINA_FALSE; t = ecore_time_get() - ed->paused_at; EINA_LIST_FOREACH(ed->actions, l, runp) runp->start_time += t; } else { - if (ed->paused) return; - ed->paused = EINA_TRUE; ed->paused_at = ecore_time_get(); } @@ -576,29 +574,28 @@ _efl_canvas_layout_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)) && (rp->typedata.swallow->swallowed_object)) - edje_object_play_set(rp->typedata.swallow->swallowed_object, play); + efl_player_paused_set(rp->typedata.swallow->swallowed_object, paused); } -} - -EOLIAN Eina_Bool -_efl_canvas_layout_efl_player_play_get(const Eo *obj EINA_UNUSED, Edje *ed) -{ - if (!ed) return EINA_FALSE; - if (ed->delete_me) return EINA_FALSE; - if (ed->paused) return EINA_FALSE; - return EINA_TRUE; } +EOLIAN Eina_Bool +_efl_canvas_layout_efl_player_paused_get(const Eo *obj EINA_UNUSED, Edje *ed) +{ + if (!ed) return EINA_FALSE; + if (ed->delete_me) return EINA_FALSE; + return ed->paused; +} + EOLIAN void -_efl_canvas_layout_efl_player_play_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed) +_efl_canvas_layout_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed) { if (speed <= 0.0) speed = 1.0; pd->duration_scale = 1.0/speed; } EOLIAN double -_efl_canvas_layout_efl_player_play_speed_get(const Eo *obj EINA_UNUSED, Edje *pd) +_efl_canvas_layout_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Edje *pd) { return 1.0/pd->duration_scale; } diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 63fbc4c562..f037f31c44 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -3,7 +3,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.Container, Efl.Part, Efl.Observer, Efl.Ui.I18n, Efl.Layout.Calc, Efl.Layout.Signal, Efl.Layout.Group, - Efl.Player, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, + Efl.Player, Efl.Playable, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class { [[Edje object class]] @@ -18,7 +18,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. If animations are disabled, transitions between states (as defined in EDC) are then instantaneous. This is conceptually similar - to setting the @Efl.Player.play_speed to an infinitely high + to setting the @Efl.Player.playback_speed to an infinitely high value. ]] get { @@ -126,8 +126,8 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. Efl.Container.content_count; Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]] Efl.Observer.update; - Efl.Player.playable { get; } - Efl.Player.play { get; set; } - Efl.Player.play_speed { get; set; } + Efl.Playable.playable { get; } + Efl.Player.paused { get; set; } + Efl.Player.playback_speed { get; set; } } } diff --git a/src/lib/edje/efl_canvas_layout_eo.legacy.h b/src/lib/edje/efl_canvas_layout_eo.legacy.h index 0155eb96b2..057bd77e93 100644 --- a/src/lib/edje/efl_canvas_layout_eo.legacy.h +++ b/src/lib/edje/efl_canvas_layout_eo.legacy.h @@ -22,7 +22,7 @@ typedef Eo Efl_Canvas_Layout; * * If animations are disabled, transitions between states (as defined in EDC) * are then instantaneous. This is conceptually similar to setting the - * @ref Efl.Player.play_speed to an infinitely high value. + * @ref Efl.Player.playback_speed to an infinitely high value. * * Start or stop animating this object. * @@ -41,7 +41,7 @@ EAPI void edje_object_animation_set(Efl_Canvas_Layout *obj, Eina_Bool on); * * If animations are disabled, transitions between states (as defined in EDC) * are then instantaneous. This is conceptually similar to setting the - * @ref Efl.Player.play_speed to an infinitely high value. + * @ref Efl.Player.playback_speed to an infinitely high value. * * Get the current state of animation, @c true by default. * diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index db6e21b9c4..b19e97c743 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -76,6 +76,44 @@ typedef struct _Efl_Text_Annotate_Annotation Efl_Text_Annotate_Annotation; #include /* Data types */ + +#ifdef EFL_BETA_API_SUPPORT +/** No error on load */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_NONE; + +/** A non-specific error occurred */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; + +/** File (or file path) does not exist */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; + +/** Permission denied to an existing file (or path) */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED; + +/** Allocation of resources failure prevented load */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + +/** File corrupt (but was detected as a known format) */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE; + +/** File is not a known format */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT; + +/** Reading operation has been cancelled during decoding */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CANCELLED; + +/** (Edje only) The file pointed to is incompatible, i.e., it doesn't + * match the library's current version's format. */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE; + +/** (Edje only) The group/collection set to load from was not found in the file */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION; + +/** (Edje only) The group/collection set to load from had recursive references + * on its components */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE; +#endif /* EFL_BETA_API_SUPPORT */ + #include "interfaces/efl_gfx_types.eot.h" #include "interfaces/efl_ui_types.eot.h" typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; @@ -94,6 +132,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_part.eo.h" #include "interfaces/efl_playable.eo.h" #include "interfaces/efl_player.eo.h" +#include "interfaces/efl_audio_control.eo.h" #include "interfaces/efl_text.eo.h" #include "interfaces/efl_text_types.eot.h" #include "interfaces/efl_ui_i18n.eo.h" diff --git a/src/lib/efl/interfaces/efl_audio_control.eo b/src/lib/efl/interfaces/efl_audio_control.eo new file mode 100644 index 0000000000..5b82b937ef --- /dev/null +++ b/src/lib/efl/interfaces/efl_audio_control.eo @@ -0,0 +1,33 @@ +interface @beta Efl.Audio_Control +{ + [[Player interface for audio related properties]] + methods { + @property volume { + [[Control the audio volume. + + Controls the audio volume of the stream being played. This has + nothing to do with the system volume. This volume will be + multiplied by the system volume. e.g.: if the current volume + level is 0.5, and the system volume is 50%, it will be + 0.5 * 0.5 = 0.25. + ]] + set { + } + get { + } + values { + volume: double; [[The volume level]] + } + } + @property mute { + [[This property controls the audio mute state.]] + set { + } + get { + } + values { + mute: bool; [[The mute state. $true or $false.]] + } + } + } +} diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c index d6f262d3e2..a35710f0f3 100644 --- a/src/lib/efl/interfaces/efl_file.c +++ b/src/lib/efl/interfaces/efl_file.c @@ -172,7 +172,11 @@ efl_file_simple_load(Eo *obj, const char *file, const char *key) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); efl_ref(obj); - EINA_SAFETY_ON_TRUE_GOTO(efl_file_set(obj, file), fail); + if (efl_file_set(obj, file)) + { + EINA_LOG_ERR("File set to '%s' on '%s' failed.", file, efl_debug_name_get(obj)); + goto fail; + } efl_file_key_set(obj, key); if (file) { diff --git a/src/lib/efl/interfaces/efl_gfx_arrangement.eo b/src/lib/efl/interfaces/efl_gfx_arrangement.eo index 02cda25495..00f3fe4281 100644 --- a/src/lib/efl/interfaces/efl_gfx_arrangement.eo +++ b/src/lib/efl/interfaces/efl_gfx_arrangement.eo @@ -28,7 +28,7 @@ interface @beta Efl.Gfx.Arrangement axis and 1.0 is at the end.]] } } - @property content_padding { + @property content_padding @beta { [[This property determines the space between a container's content items. It is different than the @Efl.Gfx.Hint.hint_margin property in that it is applied to each diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo b/src/lib/efl/interfaces/efl_gfx_image.eo index b9ccac41ea..b89c051f80 100644 --- a/src/lib/efl/interfaces/efl_gfx_image.eo +++ b/src/lib/efl/interfaces/efl_gfx_image.eo @@ -1,7 +1,7 @@ import efl_gfx_types; import eina_types; -enum @beta Efl.Gfx.Image_Content_Hint +enum Efl.Gfx.Image_Content_Hint { [[How an image's data is to be treated by EFL, for optimization.]] none = 0, [[No hint on the content (default).]] @@ -9,7 +9,7 @@ enum @beta Efl.Gfx.Image_Content_Hint static = 2 [[The content won't change over time.]] } -enum @beta Efl.Gfx.Image_Scale_Hint +enum Efl.Gfx.Image_Scale_Hint { /* FIXME: Legacy is in Emile, where it does not belong. */ [[How an image's data is to be treated by EFL, with regard to scaling cache.]] @@ -18,7 +18,7 @@ enum @beta Efl.Gfx.Image_Scale_Hint static = 2 [[Image will not be re-scaled over time, thus turning scaling cache ON for its data.]] } -enum @beta Efl.Gfx.Image_Scale_Method +enum Efl.Gfx.Image_Scale_Method { [[Enumeration that defines scaling methods to be used when rendering an image.]] none, [[Use the image's natural size.]] @@ -58,7 +58,7 @@ struct Efl.Gfx.Image_Stretch_Region length: uint; [[Length of the stretchable region in pixels.]] } -interface @beta Efl.Gfx.Image +interface Efl.Gfx.Image { [[This interface defines a set of common APIs which should be implemented by image objects. diff --git a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo index d7b0bbf238..8f6164760f 100644 --- a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo +++ b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo @@ -13,7 +13,7 @@ enum @beta Efl.Gfx.Image_Load_Controller_State } */ -interface @beta Efl.Gfx.Image_Load_Controller +interface Efl.Gfx.Image_Load_Controller { [[Common APIs for all loadable 2D images.]] @@ -164,8 +164,4 @@ interface @beta Efl.Gfx.Image_Load_Controller } } } - events { - load,done: void; [[Emitted after the image has been loaded.]] - load,error: Eina.Error; [[Emitted if an error happened during image loading.]] - } } diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index e0ec30a3ac..2a4e66841c 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -152,7 +152,7 @@ enum @beta Efl.Gfx.Vg_Composite_Method mask_difference } -enum @beta Efl.Gfx.Center_Fill_Mode +enum Efl.Gfx.Center_Fill_Mode { [[How an image's center region (the complement to the border region) should be rendered by EFL]] none = 0, [[Image's center region is $not to be rendered]] @@ -205,14 +205,14 @@ enum @beta Efl.Gfx.Color_Class_Layer { type @beta Efl.Font.Size: int; [[Efl font size type]] -var @beta Efl.Gfx.Image.Load_Error.NONE: Eina.Error; [[No error on load]] -var @beta Efl.Gfx.Image.Load_Error.GENERIC: Eina.Error; [[A non-specific error occurred]] -var @beta Efl.Gfx.Image.Load_Error.DOES_NOT_EXIST: Eina.Error; [[File (or file path) does not exist]] -var @beta Efl.Gfx.Image.Load_Error.PERMISSION_DENIED: Eina.Error; [[Permission denied to an existing file (or path)]] -var @beta Efl.Gfx.Image.Load_Error.RESOURCE_ALLOCATION_FAILED: Eina.Error; [[Allocation of resources failure prevented load]] -var @beta Efl.Gfx.Image.Load_Error.CORRUPT_FILE: Eina.Error; [[File corrupt (but was detected as a known format)]] -var @beta Efl.Gfx.Image.Load_Error.UNKNOWN_FORMAT: Eina.Error; [[File is not a known format]] -var @beta Efl.Gfx.Image.Load_Error.CANCELLED: Eina.Error; [[Reading operation has been cancelled during decoding]] -var @beta Efl.Gfx.Image.Load_Error.INCOMPATIBLE_FILE: Eina.Error; [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]] -var @beta Efl.Gfx.Image.Load_Error.UNKNOWN_COLLECTION: Eina.Error; [[(Edje only) The group/collection set to load from was not found in the file]] -var @beta Efl.Gfx.Image.Load_Error.RECURSIVE_REFERENCE: Eina.Error; [[(Edje only) The group/collection set to load from had recursive references on its components]] +error @extern @beta Efl.Gfx.Image.Load_Error.NONE = "XXX"; [[No error on load]] +error @extern @beta Efl.Gfx.Image.Load_Error.GENERIC = "XXX"; [[A non-specific error occurred]] +error @extern @beta Efl.Gfx.Image.Load_Error.DOES_NOT_EXIST = "XXX"; [[File (or file path) does not exist]] +error @extern @beta Efl.Gfx.Image.Load_Error.PERMISSION_DENIED = "XXX"; [[Permission denied to an existing file (or path)]] +error @extern @beta Efl.Gfx.Image.Load_Error.RESOURCE_ALLOCATION_FAILED = "XXX"; [[Allocation of resources failure prevented load]] +error @extern @beta Efl.Gfx.Image.Load_Error.CORRUPT_FILE = "XXX"; [[File corrupt (but was detected as a known format)]] +error @extern @beta Efl.Gfx.Image.Load_Error.UNKNOWN_FORMAT = "XXX"; [[File is not a known format]] +error @extern @beta Efl.Gfx.Image.Load_Error.CANCELLED = "XXX"; [[Reading operation has been cancelled during decoding]] +error @extern @beta Efl.Gfx.Image.Load_Error.INCOMPATIBLE_FILE = "XXX"; [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]] +error @extern @beta Efl.Gfx.Image.Load_Error.UNKNOWN_COLLECTION = "XXX"; [[(Edje only) The group/collection set to load from was not found in the file]] +error @extern @beta Efl.Gfx.Image.Load_Error.RECURSIVE_REFERENCE = "XXX"; [[(Edje only) The group/collection set to load from had recursive references on its components]] diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 36e962bc1e..ead730689f 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -19,6 +19,7 @@ #include "interfaces/efl_part.eo.c" #include "interfaces/efl_playable.eo.c" #include "interfaces/efl_player.eo.c" +#include "interfaces/efl_audio_control.eo.c" #include "interfaces/efl_text.eo.c" #include "interfaces/efl_text_font.eo.c" #include "interfaces/efl_text_style.eo.c" @@ -118,23 +119,20 @@ __efl_internal_init(void) static Eina_Value _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Eina_Value v) { - Efl_Ui_Factory_Item_Created_Event event = { NULL, NULL }; + Efl_Gfx_Entity *item; int len, i; - EINA_VALUE_ARRAY_FOREACH(&v, len, i, event.item) - { - event.model = efl_ui_view_model_get(event.item); - - efl_event_callback_call(factory, EFL_UI_FACTORY_EVENT_CREATED, &event); - } + EINA_VALUE_ARRAY_FOREACH(&v, len, i, item) + efl_event_callback_call(factory, EFL_UI_FACTORY_EVENT_ITEM_CREATED, item); return v; } -static Eina_Future * -_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) +EOLIAN static Eina_Future * +_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models) { - return efl_future_then(factory, efl_ui_factory_create(factory, models, parent), + EINA_SAFETY_ON_NULL_RETURN_VAL(factory, NULL); + return efl_future_then(factory, efl_ui_factory_create(factory, models), .success_type = EINA_VALUE_TYPE_ARRAY, .success = _efl_ui_view_factory_item_created); } diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index 5713df6dc4..477e9e10b5 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo @@ -1,4 +1,4 @@ -struct @beta Efl.Model_Property_Event { +struct Efl.Model_Property_Event { [[EFL model property event data structure]] changed_properties: array; [[List of changed properties]] invalidated_properties: array; [[Removed properties identified by name]] @@ -13,7 +13,7 @@ struct @beta Efl.Model_Children_Event { the parent, it will be available here.]] } -interface @beta Efl.Model +interface Efl.Model { [[Basic Model abstraction. @@ -178,8 +178,8 @@ interface @beta Efl.Model properties,changed: Efl.Model_Property_Event; [[Event dispatched when properties list is available.]] - child,added: Efl.Model_Children_Event; [[Event dispatched when new child is added.]] - child,removed: Efl.Model_Children_Event; [[Event dispatched when child is removed.]] + child,added @beta: Efl.Model_Children_Event; [[Event dispatched when new child is added.]] + child,removed @beta: Efl.Model_Children_Event; [[Event dispatched when child is removed.]] children,count,changed: void; [[Event dispatched when children count is finished.]] } } diff --git a/src/lib/efl/interfaces/efl_pack_layout.eo b/src/lib/efl/interfaces/efl_pack_layout.eo index c77e82dba5..89caa9cbce 100644 --- a/src/lib/efl/interfaces/efl_pack_layout.eo +++ b/src/lib/efl/interfaces/efl_pack_layout.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Pack_Layout +interface Efl.Pack_Layout { [[Low-level APIs for objects that can lay their children out. diff --git a/src/lib/efl/interfaces/efl_pack_table.eo b/src/lib/efl/interfaces/efl_pack_table.eo index 18adfb8225..2c9be6151c 100644 --- a/src/lib/efl/interfaces/efl_pack_table.eo +++ b/src/lib/efl/interfaces/efl_pack_table.eo @@ -1,7 +1,7 @@ -interface @beta Efl.Pack_Table extends Efl.Pack +interface Efl.Pack_Table extends Efl.Pack { [[Interface for 2D containers which arrange their elements on a table with rows and columns. - + Elements can be positioned on a specific row and column, or they can be simply added to the table using @Efl.Pack.pack and the container will chose where to put them. ]] diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 19c80f84ba..3157715bec 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -1,43 +1,57 @@ -interface @beta Efl.Player +interface Efl.Player { [[Efl media player interface]] + c_prefix: efl_player; methods { - start { - [[Start a playing playable object.]] - } - stop { - [[Stop playable object.]] - } - @property playable { - [[Whether or not the playable can be played.]] - get { - } - values { - play: bool; [[$true if the object have playable data, $false otherwise]] - } - } - @property play { + @property playing { [[Playback state of the media file. - This property sets the currently playback state of the - video. Using this function to play or pause the video - doesn't alter it's current position. + This property sets the playback state of the object. Re-setting the current + playback state has no effect. + + If set to $false, the object's @.playback_progress property is, by default, reset to $[0.0]. A + class may alter this behavior, and it will be stated in the documentation for a class + if such behavior changes should be expected. + + Applying the $false playing state also has the same effect as the player object reaching + the end of its playback, which may invoke additional behavior based on a class's + implementation. ]] set { + return: bool(false); [[If $true, the property change has succeeded.]] } get { } values { - play: bool; [[$true if playing, $false otherwise.]] + playing: bool; [[$true if playing, $false otherwise.]] } } - @property pos { + @property paused { + [[Pause state of the media file. + + This property sets the pause state of the media. Re-setting the current + pause state has no effect. + + If @.playing is set to $true, this property can be used to pause and resume + playback of the media without changing its @.playback_progress property. This property + cannot be changed if @.playing is $false. + ]] + set { + return: bool(false); [[If $true, the property change has succeeded.]] + } + get { + } + values { + paused: bool; [[$true if paused, $false otherwise.]] + } + } + @property playback_position { [[Position in the media file. This property sets the current position of the media file to $sec seconds since the beginning of the media file. This only works on seekable streams. Setting the - position doesn't change the playing state of the media file. + position doesn't change the @.playing or @.paused states of the media file. ]] set { } @@ -47,7 +61,7 @@ interface @beta Efl.Player sec: double; [[The position (in seconds).]] } } - @property progress { + @property playback_progress { [[How much of the file has been played. This function gets the progress in playing the file, the @@ -59,8 +73,8 @@ interface @beta Efl.Player progress: double; [[The progress within the [0, 1] range.]] } } - @property play_speed { - [[Control the play speed of the media file. + @property playback_speed { + [[Control the playback speed of the media file. This function control the speed with which the media file will be played. 1.0 represents the normal speed, 2 double speed, 0.5 @@ -74,48 +88,5 @@ interface @beta Efl.Player speed: double; [[The play speed in the [0, infinity) range.]] } } - @property volume { - [[Control the audio volume. - - Controls the audio volume of the stream being played. This has - nothing to do with the system volume. This volume will be - multiplied by the system volume. e.g.: if the current volume - level is 0.5, and the system volume is 50%, it will be - 0.5 * 0.5 = 0.25. - ]] - set { - } - get { - } - values { - volume: double; [[The volume level]] - } - } - @property mute { - [[This property controls the audio mute state.]] - set { - } - get { - } - values { - mute: bool; [[The mute state. $true or $false.]] - } - } - @property length { - [[Get the length of play for the media file.]] - get { - } - values { - length: double; [[The length of the stream in seconds.]] - } - } - @property seekable { - [[Get whether the media file is seekable.]] - get { - } - values { - seekable: bool; [[$true if seekable.]] - } - } } } diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index eded76f197..61d0ce961e 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -1,16 +1,18 @@ -struct @beta Efl.Ui.Factory_Item_Created_Event { +struct Efl.Ui.Factory_Item_Created_Event { [[EFL UI Factory event structure provided when an item was just created.]] model: Efl.Model; [[The model already set on the new item.]] item: Efl.Gfx.Entity; [[The item that was just created.]] } -interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind +interface Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind { [[Interface for factory-pattern object creation. This object represents a Factory in the factory pattern. Objects should be created via the method @Efl.Ui.View_Factory.create_with_event, which will in turn call the necessary APIs from this interface. Objects created this way should be removed using @.release. + + It is recommended to not create your own @Efl.Ui.Factory and use event handler as much as possible. ]] methods { create @protected { @@ -19,30 +21,24 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind Note: This is the function you need to implement for a custom factory, but if you want to use a factory, you should rely on @Efl.Ui.View_Factory.create_with_event.]] params { - models: iterator; [[Efl iterator providing the model to be associated to the new item. + models: iterator @move; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] - parent: Efl.Gfx.Entity; [[Efl canvas.]] } - return: future; [[Created UI object.]] + return: future @move @no_unused; [[Created UI object.]] } release { [[Release a UI object and disconnect from models.]] params { - ui_view: Efl.Gfx.Entity; [[Object to remove.]] - } - } - building @const { - [[This function is called during the creation of an UI object between the @Efl.Object.constructor and - @Efl.Object.finalize call. - - Note: If the @Efl.Ui.Factory does keep a cache of objects, this won't be called when objects are pulled out - of the cache.]] - params { - ui_view: Efl.Gfx.Entity; [[The UI object being created.]] + ui_views: iterator @move; [[Object to remove.]] } } } events { - created: Efl.Ui.Factory_Item_Created_Event; [[Event triggered when an item has been successfully created.]] + item,constructing: Efl.Gfx.Entity; [[Event triggered when an item is under construction (between the @Efl.Object.constructor and @Efl.Object.finalize call on the item). + Note: If the @Efl.Ui.Factory does keep a cache of objects, this won't be called when objects are pulled out of the cache.]] + item,building: Efl.Gfx.Entity; [[Event triggered when an item has processed @Efl.Object.finalize, but before all the factory are done building it. + Note: if the @Efl.Ui.Factory does keep a cache of object, this will be called when object are pulled out of the cache.]] + item,created: Efl.Gfx.Entity; [[Event triggered when an item has been successfully created by the factory and is about to be used by an @Efl.Ui.View.]] + item,releasing: Efl.Gfx.Entity; [[Event triggered when an item is being released by the @Efl.Ui.Factory. It must be assumed that after this call, the object can be recycle to another @Efl.Ui.View and there can be more than one call for the same item.]] } } diff --git a/src/lib/efl/interfaces/efl_ui_factory_bind.eo b/src/lib/efl/interfaces/efl_ui_factory_bind.eo index d26832453f..f924073954 100644 --- a/src/lib/efl/interfaces/efl_ui_factory_bind.eo +++ b/src/lib/efl/interfaces/efl_ui_factory_bind.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Factory_Bind +interface Efl.Ui.Factory_Bind { [[Efl UI Property interface. view object can have @Efl.Model and need to set cotent with those model stored data. @@ -14,6 +14,7 @@ interface @beta Efl.Ui.Factory_Bind key: string; [[Key string for bind model property data]] factory: Efl.Ui.Factory; [[@Efl.Ui.Factory for create and bind model property data]] } + return: Eina.Error; [[0 when it succeed, an error code otherwise.]] } } } diff --git a/src/lib/efl/interfaces/efl_ui_property_bind.eo b/src/lib/efl/interfaces/efl_ui_property_bind.eo index 31d66e0134..aafd772e58 100644 --- a/src/lib/efl/interfaces/efl_ui_property_bind.eo +++ b/src/lib/efl/interfaces/efl_ui_property_bind.eo @@ -6,7 +6,7 @@ struct Efl.Ui.Property_Event { changed_properties: array; [[List of changed properties]] } -interface @beta Efl.Ui.Property_Bind +interface Efl.Ui.Property_Bind { [[Efl UI Property_Bind interface. view object can have @Efl.Model to manage the data, diff --git a/src/lib/efl/interfaces/efl_ui_range_display.eo b/src/lib/efl/interfaces/efl_ui_range_display.eo index 5e67edb25d..a2d4432b7f 100644 --- a/src/lib/efl/interfaces/efl_ui_range_display.eo +++ b/src/lib/efl/interfaces/efl_ui_range_display.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Range_Display +interface Efl.Ui.Range_Display { [[Interface that contains properties regarding the displaying of a value within a range. diff --git a/src/lib/efl/interfaces/efl_ui_range_interactive.eo b/src/lib/efl/interfaces/efl_ui_range_interactive.eo index 7a37918e12..9237e9c5f1 100644 --- a/src/lib/efl/interfaces/efl_ui_range_interactive.eo +++ b/src/lib/efl/interfaces/efl_ui_range_interactive.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Range_Interactive extends Efl.Ui.Range_Display +interface Efl.Ui.Range_Interactive extends Efl.Ui.Range_Display { [[Interface that extends the normal displaying properties with usage properties. diff --git a/src/lib/efl/interfaces/efl_ui_scrollable.eo b/src/lib/efl/interfaces/efl_ui_scrollable.eo index 520cdd1d13..8baf832fa8 100644 --- a/src/lib/efl/interfaces/efl_ui_scrollable.eo +++ b/src/lib/efl/interfaces/efl_ui_scrollable.eo @@ -1,7 +1,7 @@ import eina_types; import efl_ui_layout_orientable; -interface @beta Efl.Ui.Scrollable +interface Efl.Ui.Scrollable { [[Efl UI scrollable interface]] event_prefix: efl_ui; diff --git a/src/lib/efl/interfaces/efl_ui_scrollbar.eo b/src/lib/efl/interfaces/efl_ui_scrollbar.eo index f5bffe984f..aeba2d9c2a 100644 --- a/src/lib/efl/interfaces/efl_ui_scrollbar.eo +++ b/src/lib/efl/interfaces/efl_ui_scrollbar.eo @@ -1,6 +1,6 @@ import efl_ui_layout_orientable; -enum @beta Efl.Ui.Scrollbar_Mode +enum Efl.Ui.Scrollbar_Mode { [[When should the scrollbar be shown.]] auto = 0, [[Visible if necessary.]] @@ -9,44 +9,53 @@ enum @beta Efl.Ui.Scrollbar_Mode last [[For internal use only.]] } -interface @beta Efl.Ui.Scrollbar +interface Efl.Ui.Scrollbar { - [[Interface used by widgets which can display scrollbars, enabling them to contain more content - than actually fits inside them.]] + [[Interface used by widgets which can display scrollbars, enabling them to hold more content + than actually visible through the viewport. + A scrollbar contains a draggable part (thumb) which allows the user to move the viewport + around the content. The size of the thumb relates to the size of the viewport compared to + the whole content. + ]] methods { @property bar_mode { - [[Scrollbar visibility policy]] + [[Scrollbar visibility mode, for each of the scrollbars.]] set { } get { } values { - hbar: Efl.Ui.Scrollbar_Mode; [[Horizontal scrollbar.]] - vbar: Efl.Ui.Scrollbar_Mode; [[Vertical scrollbar.]] + hbar: Efl.Ui.Scrollbar_Mode(Efl.Ui.Scrollbar_Mode.auto); [[Horizontal scrollbar mode.]] + vbar: Efl.Ui.Scrollbar_Mode(Efl.Ui.Scrollbar_Mode.auto); [[Vertical scrollbar mode.]] } } @property bar_size { - [[Scrollbar size. - It is calculated based on viewport size-content sizes. - ]] // TODO: This needs more details. What does 1.0 mean? + [[This returns the relative size the thumb should have, given the current size of the viewport and + the content. + $[0.0] means the viewport is much smaller than the content: the thumb will have its minimum size. + $[1.0] means the viewport has the same size as the content (or bigger): the thumb will have the same + size as the scrollbar and cannot move. + ]] get { } values { - width: double; [[Value between 0.0 and 1.0.]] - height: double; [[Value between 0.0 and 1.0.]] + width: double; [[Value between $[0.0] and $[1.0].]] + height: double; [[Value between $[0.0] and $[1.0].]] } } @property bar_position { - [[Scrollbar position. - It is calculated based on current position-maximum positions. + [[Position of the thumb (the draggable zone) inside the scrollbar. + It is calculated based on current position of the viewport inside the total content. ]] set { } get { } values { - posx: double; [[Value between 0.0 and 1.0.]] - posy: double; [[Value between 0.0 and 1.0.]] + posx: double; [[Value between $[0.0] (the left side of the thumb is touching the left edge of the widget) + and $[1.0] (the right side of the thumb is touching the right edge of the widget).]] + posy: double; [[Value between $[0.0] (the top side of the thumb is touching the top edge of the widget) + and $[1.0] (the bottom side of the thumb is touching the bottom edge of the widget).]] } } bar_visibility_update @protected @beta{ @@ -58,12 +67,12 @@ interface @beta Efl.Ui.Scrollbar } } events { - bar,pressed: Efl.Ui.Layout_Orientation; [[Called when bar is pressed.]] - bar,unpressed: Efl.Ui.Layout_Orientation; [[Called when bar is unpressed.]] - bar,dragged: Efl.Ui.Layout_Orientation; [[Called when bar is dragged.]] - bar,size,changed: void; [[Called when bar size is changed.]] - bar,pos,changed: void; [[Called when bar position is changed.]] - bar,show: Efl.Ui.Layout_Orientation; [[Callend when bar is shown.]] - bar,hide: Efl.Ui.Layout_Orientation; [[Called when bar is hidden.]] + bar,pressed: Efl.Ui.Layout_Orientation; [[Emitted when thumb is pressed.]] + bar,unpressed: Efl.Ui.Layout_Orientation; [[Emitted when thumb is unpressed.]] + bar,dragged: Efl.Ui.Layout_Orientation; [[Emitted when thumb is dragged.]] + bar,size,changed: void; [[Emitted when thumb size has changed.]] + bar,pos,changed: void; [[Emitted when thumb position has changed.]] + bar,show: Efl.Ui.Layout_Orientation; [[Emitted when scrollbar is shown.]] + bar,hide: Efl.Ui.Layout_Orientation; [[Emitted when scrollbar is hidden.]] } } diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo index bb1e4a44c3..728c25907c 100644 --- a/src/lib/efl/interfaces/efl_ui_view_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo @@ -12,7 +12,6 @@ class @beta Efl.Ui.View_Factory event onto.]] models: iterator; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] - parent: Efl.Gfx.Entity; [[Efl canvas]] } return: future; [[Created UI object]] } diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index f59d5bbb78..237142f326 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -42,6 +42,7 @@ pub_eo_files = [ 'efl_gfx_image_load_controller.eo', 'efl_part.eo', 'efl_player.eo', + 'efl_audio_control.eo', 'efl_text.eo', 'efl_text_font.eo', 'efl_text_style.eo', diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index e5b5b6b00b..060fdc93c1 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -137,6 +137,9 @@ extern "C" { extern EAPI double _efl_startup_time; +/** Successfully applied the requested style from the current theme. */ +extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; + // EO types. Defined for legacy-only builds as legacy uses typedef of EO types. #include "efl_ui.eot.h" #include "efl_ui_selection_types.eot.h" @@ -304,6 +307,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include +# include # include # include # include @@ -322,13 +327,14 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include -# include "efl_ui_list_view_types.eot.h" # include -# include # include - +# include +# include +# include # include # include diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot index f0b5e6ce44..eaa4ae41be 100644 --- a/src/lib/elementary/efl_ui.eot +++ b/src/lib/elementary/efl_ui.eot @@ -1,11 +1,19 @@ /* Efl.Ui enum and struct types */ import eina_types; -var Efl.Ui.Theme.Apply_Error.NONE: Eina.Error; [[Successfully applied the requested style from the current theme.]] -var Efl.Ui.Theme.Apply_Error.DEFAULT: Eina.Error; [[Successfully applied the default style. The widget may - look different from the rest of the UI if a custom theme - is in use, but it should be usable.]] -var Efl.Ui.Theme.Apply_Error.GENERIC: Eina.Error; [[Failed to apply theme. The widget may become unusable.]] +/* FIXME: find a better way to express this */ +error @extern Efl.Ui.Theme.Apply_Error.NONE = "Succcess"; [[Successfully applied the requested style from the current theme.]] + +error Efl.Ui.Theme.Apply_Error.DEFAULT = "Fallback to default style was enabled for this widget"; [[ + Successfully applied the default style. The widget may look different from + the rest of the UI if a custom theme is in use, but it should be usable. +]] +error Efl.Ui.Theme.Apply_Error.GENERIC = "An error occurred and no theme could be set for this widget"; [[ + Failed to apply theme. The widget may become unusable. +]] +error Efl.Ui.Theme.Apply_Error.VERSION = "The widget attempted to load a theme that is incompatible with the current EFL version"; [[ + The theme was applied. The widget may not function or look as expected. +]] enum Efl.Ui.Focus.Direction { @@ -91,5 +99,13 @@ enum @beta Efl.Ui.Widget_Orientation_Mode not change according to the window or screen orientation.]] } +enum @beta Efl.Ui.Select_Mode { + [[Type of multi selectable object.]] + single, [[Only single child is selected. If a child is selected, + previous selected child will be unselected.]] + multi, [[Allow multiple selection of children.]] + none [[No child can be selected at all.]] +} + /* Types for A11Y (internal/beta API) */ type @beta @extern Efl.Access.Action_Data: __undefined_type; [[Internal struct for accesssibility.]] diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c index 0edfff363d..0c5fc1bbd9 100644 --- a/src/lib/elementary/efl_ui_alert_popup.c +++ b/src/lib/elementary/efl_ui_alert_popup.c @@ -25,27 +25,34 @@ static const char BUTTON_SWALLOW_NAME[EFL_UI_ALERT_POPUP_BUTTON_COUNT][20] = "efl.button2", "efl.button3"}; +static const Elm_Layout_Part_Alias_Description _text_aliases[] = +{ + {"title", "efl.text.title"}, + {NULL, NULL} +}; + static Eina_Bool _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *part, const char *label) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); + if (eina_streq(part, "efl.text.title")) { Eina_Bool changed = eina_stringshare_replace(&pd->title_text, label); if (changed) { - efl_text_set(efl_part(efl_super(obj, MY_CLASS), "title"), label); + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); if (label) - elm_layout_signal_emit(obj, "efl,title,show", "efl"); + elm_layout_signal_emit(obj, "efl,title,visible,on", "efl"); else - elm_layout_signal_emit(obj, "efl,title,hide", "efl"); + elm_layout_signal_emit(obj, "efl,title,visible,off", "efl"); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); edje_object_message_signal_process(wd->resize_obj); efl_canvas_group_change(obj); } } - else - efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); return EINA_TRUE; } @@ -53,7 +60,9 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p const char * _efl_ui_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Alert_Popup_Data *pd, const char *part) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + if (eina_streq(part, "efl.text.title")) { if (pd->title_text) return pd->title_text; @@ -216,7 +225,7 @@ _efl_ui_alert_popup_button_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, Efl_Ui_Aler pd->button[EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE]); } - elm_layout_signal_emit(obj, "efl,buttons,show", "efl"); + elm_layout_signal_emit(obj, "efl,buttons,visible,on", "efl"); edje_object_message_signal_process(wd->resize_obj); } @@ -248,9 +257,10 @@ _efl_ui_alert_popup_efl_object_destructor(Eo *obj, Efl_Ui_Alert_Popup_Data *pd) } static Eina_Bool -_part_is_efl_ui_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part) +_part_is_efl_ui_alert_popup_part(const Eo *obj, const char *part) { - return (eina_streq(part, "title") || eina_streq(part, "efl.text.title")); + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) return EINA_FALSE; + return eina_streq(part, "efl.text.title"); } /* Efl.Part begin */ @@ -261,5 +271,8 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, Efl_Ui_Alert_ #include "efl_ui_alert_popup_part.eo.c" /* Efl.Part end */ +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_alert_popup) +#define EFL_UI_ALERT_POPUP_EXTRA_OPS \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(efl_ui_alert_popup) #include "efl_ui_alert_popup.eo.c" diff --git a/src/lib/elementary/efl_ui_alert_popup.eo b/src/lib/elementary/efl_ui_alert_popup.eo index 8a4e86e863..2669a553e8 100644 --- a/src/lib/elementary/efl_ui_alert_popup.eo +++ b/src/lib/elementary/efl_ui_alert_popup.eo @@ -1,16 +1,16 @@ -enum @beta Efl.Ui.Alert_Popup_Button { +enum Efl.Ui.Alert_Popup_Button { [[Defines the type of the alert button.]] positive = 0, [[Button having positive meaning. E.g. "Yes".]] negative, [[Button having negative meaning. E.g. "No".]] user [[Button having user-defined meaning. E.g. "More information".]] } -struct @beta Efl.Ui.Alert_Popup_Button_Clicked_Event { +struct Efl.Ui.Alert_Popup_Button_Clicked_Event { [[Information for @[Efl.Ui.Alert_Popup.button,clicked] event.]] button_type: Efl.Ui.Alert_Popup_Button; [[Clicked button type.]] } -class @beta Efl.Ui.Alert_Popup extends Efl.Ui.Popup +class Efl.Ui.Alert_Popup extends Efl.Ui.Popup { [[A variant of @Efl.Ui.Popup which uses a layout containing a content object and a variable number of buttons (up to 3 total). diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c index d5932d331f..614896dd2c 100644 --- a/src/lib/elementary/efl_ui_bg.c +++ b/src/lib/elementary/efl_ui_bg.c @@ -267,10 +267,10 @@ _efl_ui_bg_efl_object_finalize(Eo *obj, Efl_Ui_Bg_Data *sd) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_BG_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_bg.eo.c" diff --git a/src/lib/elementary/efl_ui_bg.eo b/src/lib/elementary/efl_ui_bg.eo index 6ce62e92e7..ffb695648f 100644 --- a/src/lib/elementary/efl_ui_bg.eo +++ b/src/lib/elementary/efl_ui_bg.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Bg extends Efl.Ui.Layout_Base +class Efl.Ui.Bg extends Efl.Ui.Layout_Base implements Efl.File, Efl.Gfx.Color composites Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { diff --git a/src/lib/elementary/efl_ui_box_flow.eo b/src/lib/elementary/efl_ui_box_flow.eo index 7e4f6f5552..982a13a553 100644 --- a/src/lib/elementary/efl_ui_box_flow.eo +++ b/src/lib/elementary/efl_ui_box_flow.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Box_Flow extends Efl.Ui.Box +class Efl.Ui.Box_Flow extends Efl.Ui.Box { [[A Flow Box is a customized type of @Efl.Ui.Box. It will fill along the axis selected with @Efl.Ui.Layout_Orientable.orientation (which defaults to Horizontal), until items will no diff --git a/src/lib/elementary/efl_ui_box_stack.eo b/src/lib/elementary/efl_ui_box_stack.eo index 060f470f35..688f0ef6b7 100644 --- a/src/lib/elementary/efl_ui_box_stack.eo +++ b/src/lib/elementary/efl_ui_box_stack.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Box_Stack extends Efl.Ui.Box +class Efl.Ui.Box_Stack extends Efl.Ui.Box { [[A custom layout engine for @Efl.Ui.Box that stacks items. diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index f71fb3e0ad..7c0a13e478 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -102,7 +102,7 @@ _efl_ui_button_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Button_Data *_pd if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); else - elm_layout_signal_emit(obj, "efl,anim,activate", "efl"); + elm_layout_signal_emit(obj, "efl,state,animation,activated", "efl"); return EINA_TRUE; } @@ -113,7 +113,7 @@ _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED) if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); else - elm_layout_signal_emit(obj, "efl,anim,activate", "efl"); + elm_layout_signal_emit(obj, "efl,state,animation,activated", "efl"); _activate(obj); return EINA_TRUE; } @@ -374,10 +374,10 @@ elm_button_autorepeat_get(const Evas_Object *obj) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_BUTTON_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(efl_ui_button) #include "efl_ui_button.eo.c" diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c index 09ec342845..7dbfc0aae9 100644 --- a/src/lib/elementary/efl_ui_caching_factory.c +++ b/src/lib/elementary/efl_ui_caching_factory.c @@ -21,6 +21,7 @@ struct _Efl_Ui_Caching_Factory_Data // end of the list objects are added and removed. Eina_List *cache; Eina_Hash *lookup; + Eina_Future *flush; struct { unsigned int memory; @@ -57,15 +58,29 @@ _efl_ui_caching_factory_remove(Efl_Ui_Caching_Factory_Data *pd, Eina_List *l, Ef static void _efl_ui_caching_factory_item_del(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, - Efl_Gfx_Entity *entity) + Eina_Iterator *entities) { - if (pd->klass) efl_del(entity); - else efl_ui_factory_release(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), entity); + if (!pd->klass) + { + efl_ui_factory_release(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), entities); + } + else + { + Efl_Gfx_Entity *entity; + + EINA_ITERATOR_FOREACH(entities, entity) + efl_del(entity); + eina_iterator_free(entities); + } } static void _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) { + Eina_Array scheduled; + + eina_array_step_set(&scheduled, sizeof (Eina_Array), 8); + while (pd->limit.items != 0 && pd->current.items > pd->limit.items) { @@ -75,7 +90,8 @@ _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) _efl_ui_caching_factory_remove(pd, eina_list_last(pd->cache), entity); if (pd->lookup) eina_hash_del(pd->lookup, efl_ui_widget_style_get(entity), entity); - _efl_ui_caching_factory_item_del(obj, pd, entity); + + eina_array_push(&scheduled, entity); } while (pd->limit.memory != 0 && @@ -87,8 +103,13 @@ _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) _efl_ui_caching_factory_remove(pd, eina_list_last(pd->cache), entity); if (pd->lookup) eina_hash_del(pd->lookup, efl_ui_widget_style_get(entity), entity); - _efl_ui_caching_factory_item_del(obj, pd, entity); + + eina_array_push(&scheduled, entity); } + + // We could improve this by doing some limited batch to reduce potential spike usage + _efl_ui_caching_factory_item_del(obj, pd, eina_array_iterator_new(&scheduled)); + eina_array_flush(&scheduled); } static Eina_Value @@ -125,7 +146,7 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v) // This is not ideal, we would want to gather all the request in one swoop here, // left for later improvement. f = efl_ui_factory_create(efl_super(r->factory, EFL_UI_CACHING_FACTORY_CLASS), - EINA_C_ARRAY_ITERATOR_NEW(models), r->parent); + EINA_C_ARRAY_ITERATOR_NEW(models)); f = efl_future_then(r->factory, f, .success = _efl_ui_caching_factory_uncap_then, .success_type = EINA_VALUE_TYPE_ARRAY); @@ -135,8 +156,8 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v) eina_hash_del(r->pd->lookup, style, w); _efl_ui_caching_factory_remove(r->pd, eina_list_data_find(r->pd->cache, w), w); - efl_parent_set(w, r->parent); efl_ui_view_model_set(w, model); + efl_event_callback_call(r->factory, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); return eina_value_object_init(w); } @@ -178,7 +199,7 @@ _efl_ui_caching_factory_group_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_ static Eina_Future * _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) + Eina_Iterator *models) { Efl_Ui_Caching_Factory_Request *r; Efl_Ui_Caching_Factory_Group_Request *gr; @@ -195,7 +216,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, if (!r) return efl_loop_future_rejected(obj, ENOMEM); r->pd = pd; - r->parent = efl_ref(parent); r->factory = efl_ref(obj); all = calloc(1, sizeof (Eina_Future *)); @@ -231,7 +251,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, { w = eina_list_data_get(pd->cache); _efl_ui_caching_factory_remove(pd, pd->cache, w); - efl_parent_set(w, parent); efl_ui_view_model_set(w, model); @@ -243,11 +262,14 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, // Now create object on the fly that are missing from the cache if (pd->klass) { + Efl_Ui_Widget *widget = efl_ui_widget_factory_widget_get(obj); + EINA_ITERATOR_FOREACH(models, model) { - w = efl_add(pd->klass, parent, - efl_ui_factory_building(obj, efl_added), - efl_ui_view_model_set(efl_added, model)); + w = efl_add(pd->klass, widget, + efl_ui_view_model_set(efl_added, model), + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); eina_value_array_append(&gr->done, w); } @@ -259,8 +281,7 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, return f; } - f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), - models, parent); + f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), models); return efl_future_then(obj, f, .success = _efl_ui_caching_factory_group_create_then, .success_type = EINA_VALUE_TYPE_ARRAY, @@ -343,62 +364,67 @@ _efl_ui_caching_factory_items_limit_get(const Eo *obj EINA_UNUSED, return pd->limit.items; } -static void -_efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, - Efl_Ui_Caching_Factory_Data *pd, - Efl_Gfx_Entity *ui_view) +static Eina_Value +_schedule_cache_flush(Eo *obj, void *data, const Eina_Value v) { - // Are we invalidated ? - if (pd->invalidated) - { - _efl_ui_caching_factory_item_del(obj, pd, ui_view); - return; - } - - // Change parent, disconnect the object and make it invisible - efl_parent_set(ui_view, obj); - efl_gfx_entity_visible_set(ui_view, EINA_FALSE); - efl_ui_view_model_set(ui_view, NULL); - - // Add to the cache - pd->cache = eina_list_prepend(pd->cache, ui_view); - pd->current.items++; - pd->current.memory += efl_class_memory_size_get(ui_view); - if (efl_isa(ui_view, EFL_CACHED_ITEM_INTERFACE)) - pd->current.memory += efl_cached_item_memory_size_get(ui_view); - - // Fill lookup - if (!pd->klass && efl_ui_widget_style_get(ui_view)) - { - if (!pd->lookup) pd->lookup = eina_hash_string_djb2_new(NULL); - eina_hash_direct_add(pd->lookup, efl_ui_widget_style_get(ui_view), ui_view); - } + Efl_Ui_Caching_Factory_Data *pd = data; // And check if the cache need some triming _efl_ui_caching_factory_flush(obj, pd); + + return v; } static void -_efl_ui_caching_factory_efl_object_invalidate(Eo *obj EINA_UNUSED, - Efl_Ui_Caching_Factory_Data *pd) +_schedule_done(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) { - // As all the objects in the cache have the factory as parent, there's no need to unparent them - pd->cache = eina_list_free(pd->cache); - eina_hash_free(pd->lookup); - pd->lookup = NULL; - pd->invalidated = EINA_TRUE; + Efl_Ui_Caching_Factory_Data *pd = data; + + pd->flush = NULL; } -static Efl_App * -_efl_ui_caching_factory_app_get(Eo *obj) +static void +_efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, + Efl_Ui_Caching_Factory_Data *pd, + Eina_Iterator *ui_views) { - Efl_Object *p; + Efl_Gfx_Entity *ui_view; - p = efl_parent_get(obj); - if (!p) return NULL; + // Are we invalidated ? + if (pd->invalidated) + { + _efl_ui_caching_factory_item_del(obj, pd, ui_views); + return; + } - // It is acceptable to just have a loop as parent and not an app - return efl_provider_find(obj, EFL_APP_CLASS); + EINA_ITERATOR_FOREACH(ui_views, ui_view) + { + // Change parent, disconnect the object and make it invisible + efl_gfx_entity_visible_set(ui_view, EINA_FALSE); + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); + + // Add to the cache + pd->cache = eina_list_prepend(pd->cache, ui_view); + pd->current.items++; + pd->current.memory += efl_class_memory_size_get(ui_view); + if (efl_isa(ui_view, EFL_CACHED_ITEM_INTERFACE)) + pd->current.memory += efl_cached_item_memory_size_get(ui_view); + + // Fill lookup + if (!pd->klass && efl_ui_widget_style_get(ui_view)) + { + if (!pd->lookup) pd->lookup = eina_hash_string_djb2_new(NULL); + eina_hash_direct_add(pd->lookup, efl_ui_widget_style_get(ui_view), ui_view); + } + } + eina_iterator_free(ui_views); + + // Schedule a cache flush if necessary + if (!pd->flush) + pd->flush = efl_future_then(obj, efl_loop_job(efl_loop_get(obj)), + .success = _schedule_cache_flush, + .free = _schedule_done, + .data = pd); } static void @@ -417,18 +443,42 @@ _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED) } static void -_efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, Efl_Object *parent) +_invalidate(void *data, const Efl_Event *event EINA_UNUSED) +{ + Efl_Ui_Caching_Factory_Data *pd = data; + + // As all the objects in the cache have the factory as parent, there's no need to unparent them + pd->cache = eina_list_free(pd->cache); + eina_hash_free(pd->lookup); + pd->lookup = NULL; + pd->invalidated = EINA_TRUE; +} + +static Efl_Object * +_efl_ui_caching_factory_efl_object_finalize(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) { Efl_App *a; - a = _efl_ui_caching_factory_app_get(obj); - if (a) efl_event_callback_del(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); + obj = efl_finalize(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS)); + if (!obj) return NULL; - efl_parent_set(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), parent); - - // We are fetching the parent again, just in case the update was denied - a = _efl_ui_caching_factory_app_get(obj); + a = efl_provider_find(obj, EFL_APP_CLASS); if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); + + // The order of the invalidate event is guaranteed to happen before any children is invalidated + // this is not the case for the children invalidate function, which can happen in random order. + efl_event_callback_add(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd); + + return obj; +} + +static void +_efl_ui_caching_factory_efl_object_invalidate(Eo *obj, + Efl_Ui_Caching_Factory_Data *pd) +{ + efl_event_callback_del(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd); + + efl_invalidate(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS)); } static Eina_Error diff --git a/src/lib/elementary/efl_ui_caching_factory.eo b/src/lib/elementary/efl_ui_caching_factory.eo index f0a5aae443..9907da7e05 100644 --- a/src/lib/elementary/efl_ui_caching_factory.eo +++ b/src/lib/elementary/efl_ui_caching_factory.eo @@ -41,6 +41,6 @@ class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory Efl.Ui.Property_Bind.property_bind; Efl.Ui.Widget_Factory.item_class { get; set; } Efl.Object.invalidate; - Efl.Object.parent { set; } + Efl.Object.finalize; } } diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index df53247259..15f528168a 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -79,14 +79,14 @@ _activate(Evas_Object *obj) // so that we can distinguish between state change by user or state change // by calling state_change() api. Keep both the signal for backward compatibility // and remove "elm,state,check,on" signal emission when we can break ABI. - // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,check,*" + // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected" if (elm_widget_is_legacy(obj)) { elm_layout_signal_emit(obj, "elm,activate,check,on", "elm"); } else { - elm_layout_signal_emit(obj, "efl,activate,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); } if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) @@ -98,14 +98,14 @@ _activate(Evas_Object *obj) // so that we can distinguish between state change by user or state change // by calling state_change() api. Keep both the signal for backward compatibility // and remove "elm,state,check,off" signal emission when we can break ABI. - // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,check,*" + // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected" if (elm_widget_is_legacy(obj)) { elm_layout_signal_emit(obj, "elm,activate,check,off", "elm"); } else { - elm_layout_signal_emit(obj, "efl,activate,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) @@ -113,7 +113,7 @@ _activate(Evas_Object *obj) } //This commit will update the theme with the correct signals // "elm,state,check,on" or "elm,state,check,off" for legacy - // "efl,state,check,on" or "efl,state,check,off" for eo-api + // "efl,state,selected" or "efl,state,unselected" for eo-api efl_ui_selectable_selected_set(obj, !efl_ui_selectable_selected_get(obj)); if (elm_widget_is_legacy(obj)) _check_legacy_event(obj); @@ -174,9 +174,9 @@ _efl_ui_check_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Check_Data *sd EINA_UNUS else { if (!efl_ui_selectable_selected_get(obj)) - elm_layout_signal_emit(obj, "efl,state,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); else - elm_layout_signal_emit(obj, "efl,state,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); } edje_object_message_signal_process(wd->resize_obj); @@ -310,9 +310,9 @@ _efl_ui_check_efl_ui_selectable_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, Ein else { if (value == 1) - elm_layout_signal_emit(obj, "efl,state,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); else - elm_layout_signal_emit(obj, "efl,state,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } edje_object_message_signal_process(wd->resize_obj); @@ -345,9 +345,9 @@ _efl_ui_check_efl_object_constructor(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED) else { efl_layout_signal_callback_add - (wd->resize_obj, "efl,action,check,on", "*", obj, _on_check_on, NULL); + (wd->resize_obj, "efl,action,select", "*", obj, _on_check_on, NULL); efl_layout_signal_callback_add - (wd->resize_obj, "efl,action,check,off", "*", obj, _on_check_off, NULL); + (wd->resize_obj, "efl,action,unselect", "*", obj, _on_check_off, NULL); efl_event_callback_add(obj, EFL_INPUT_EVENT_CLICKED, _clicked_cb, obj); } @@ -413,15 +413,15 @@ _efl_ui_check_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_CHECK_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_check.eo.c" diff --git a/src/lib/elementary/efl_ui_check.eo b/src/lib/elementary/efl_ui_check.eo index 021aa7f8e9..ca812a8e8d 100644 --- a/src/lib/elementary/efl_ui_check.eo +++ b/src/lib/elementary/efl_ui_check.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Check extends Efl.Ui.Layout_Base +class Efl.Ui.Check extends Efl.Ui.Layout_Base implements Efl.Access.Widget.Action, Efl.Text, Efl.Content, Efl.Input.Clickable, Efl.Ui.Selectable { diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index dde77ab9b0..0dac5b0a60 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -261,7 +261,7 @@ _efl_ui_collection_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA } EOLIAN static Eina_Iterator* -_efl_ui_collection_efl_ui_multi_selectable_selected_items_get(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { return eina_list_iterator_new(pd->selected); } @@ -621,8 +621,18 @@ _redirect_cb(void *data, const Efl_Event *ev) { Eo *obj = data; -#define REDIRECT_EVT(item_evt, item) \ - if (item_evt == ev->desc) efl_event_callback_call(obj, item, ev->object); +#define REDIRECT_EVT(Desc, Item_Desc) \ + if (Desc == ev->desc) \ + { \ + Efl_Ui_Item_Clickable_Clicked item_clicked; \ + Efl_Input_Clickable_Clicked *clicked = ev->info; \ + \ + item_clicked.clicked = *clicked; \ + item_clicked.item = ev->object; \ + \ + efl_event_callback_call(obj, Item_Desc, &item_clicked); \ + } + REDIRECT_EVT(EFL_INPUT_EVENT_PRESSED, EFL_UI_EVENT_ITEM_PRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_UNPRESSED, EFL_UI_EVENT_ITEM_UNPRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_LONGPRESSED, EFL_UI_EVENT_ITEM_LONGPRESSED); @@ -1079,13 +1089,13 @@ _selectable_range_apply(Eina_List *start, Eina_Bool flag) } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_select_all(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_all_select(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { _selectable_range_apply(pd->items, EINA_TRUE); } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_unselect_all(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_all_unselect(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { _selectable_range_apply(pd->items, EINA_FALSE); } @@ -1125,13 +1135,13 @@ _range_selection_find(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_select_range(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_TRUE); } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_unselect_range(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_FALSE); } diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index b6125f8560..a57e07b028 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -1,9 +1,10 @@ -class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements - Efl.Pack_Linear, Efl.Pack_Layout, +class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements + Efl.Pack_Linear, Efl.Ui.Layout_Orientable, Efl.Ui.Multi_Selectable, Efl.Ui.Focus.Manager_Sub, - Efl.Ui.Widget_Focus_Manager + Efl.Ui.Widget_Focus_Manager, + Efl.Ui.Item_Clickable composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, @@ -23,9 +24,8 @@ class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements If all items do not fit in the current widget size scrolling facilities are provided. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. ]] - event_prefix:efl_ui; methods { item_scroll { [[Brings the passed item into the viewport.]] @@ -49,7 +49,7 @@ class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements @in animation: bool; [[If you want to have an animated transition.]] } } - @property position_manager { + @property position_manager @beta { [[Position manager object that handles placement of items.]] values { position_manager : Efl.Ui.Position_Manager.Entity @move; [[Ownership is passed to the item container.]] @@ -82,20 +82,13 @@ class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Widget.focus_state_apply; Efl.Ui.Focus.Manager.move; Efl.Ui.Single_Selectable.last_selected { get; } - Efl.Ui.Multi_Selectable.selected_items_get; + Efl.Ui.Multi_Selectable.selected_iterator_new; Efl.Ui.Multi_Selectable.select_mode {get; set;} - Efl.Ui.Multi_Selectable.select_all; - Efl.Ui.Multi_Selectable.unselect_all; - Efl.Ui.Multi_Selectable.select_range; - Efl.Ui.Multi_Selectable.unselect_range; + Efl.Ui.Multi_Selectable.all_select; + Efl.Ui.Multi_Selectable.all_unselect; + Efl.Ui.Multi_Selectable.range_select; + Efl.Ui.Multi_Selectable.range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} } - events { - item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] - item,unpressed : Efl.Ui.Item; [[An $unpress event occurred over an item.]] - item,longpressed : Efl.Ui.Item; [[A $longpressed event occurred over an item.]] - item,clicked : Efl.Ui.Item; [[A $clicked event occurred over an item.]] - item,clicked,any : Efl.Ui.Item; [[A $clicked,any event occurred over an item.]] - } } diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c new file mode 100644 index 0000000000..608c31c059 --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -0,0 +1,2346 @@ +// Note: @1.23 Initial release has infrastructure to support more mode than homogeneous, but isn't exposed in the API nor supported. + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#define ELM_LAYOUT_PROTECTED +#define EFL_UI_SCROLL_MANAGER_PROTECTED +#define EFL_UI_SCROLLBAR_PROTECTED +#define EFL_UI_WIDGET_FOCUS_MANAGER_PROTECTED + +#include +#include +#include "elm_widget.h" +#include "elm_priv.h" + +#include "efl_ui_collection_view_focus_manager.eo.h" + +#ifndef VIEWPORT_ENABLE +# undef VIEWPORT_ENABLE +#endif + +typedef struct _Efl_Ui_Collection_View_Data Efl_Ui_Collection_View_Data; +typedef struct _Efl_Ui_Collection_Viewport Efl_Ui_Collection_Viewport; +typedef struct _Efl_Ui_Collection_View_Focus_Manager_Data Efl_Ui_Collection_View_Focus_Manager_Data; +typedef struct _Efl_Ui_Collection_Item Efl_Ui_Collection_Item; +typedef struct _Efl_Ui_Collection_Item_Lookup Efl_Ui_Collection_Item_Lookup; +typedef struct _Efl_Ui_Collection_Request Efl_Ui_Collection_Request; + +struct _Efl_Ui_Collection_Item +{ + Efl_Gfx_Entity *entity; + Efl_Model *model; +}; + +struct _Efl_Ui_Collection_Item_Lookup +{ + EINA_RBTREE; + + uint64_t index; + Efl_Ui_Collection_Item item; +}; + +struct _Efl_Ui_Collection_Viewport +{ + Efl_Ui_Collection_Item *items; + + uint64_t offset; + uint16_t count; +}; + +struct _Efl_Ui_Collection_Request +{ + Eina_Future *f; + + uint64_t offset; + uint64_t length; + + Eina_Bool model_requested : 1; + Eina_Bool model_fetched : 1; + Eina_Bool need_entity : 1; + Eina_Bool entity_requested : 1; +}; + +struct _Efl_Ui_Collection_View_Data +{ + Efl_Ui_Factory *factory; + Efl_Ui_Position_Manager_Entity *manager; + Efl_Ui_Scroll_Manager *scroller; + Efl_Ui_Pan *pan; + Efl_Gfx_Entity *sizer; + Efl_Model *model; + Efl_Model *multi_selectable_async_model; + +#ifdef VIEWPORT_ENABLE + Efl_Ui_Collection_Viewport *viewport[3]; +#endif + Eina_Rbtree *cache; + + Eina_List *requests; // Array of Efl_Ui_Collection_Request in progress + + uint64_t start_id; + uint64_t end_id; + + Eina_Size2D content_min_size; + + Efl_Ui_Layout_Orientation direction; + Efl_Ui_Select_Mode mode; + + struct { + Eina_Bool w : 1; + Eina_Bool h : 1; + } match_content; + + Efl_Ui_Position_Manager_Request_Range current_range; +}; + +struct _Efl_Ui_Collection_View_Focus_Manager_Data +{ + Efl_Ui_Collection_View *collection; +}; + +static const char *COLLECTION_VIEW_MANAGED = "_collection_view.managed"; +static const char *COLLECTION_VIEW_MANAGED_YES = "yes"; + +#define MY_CLASS EFL_UI_COLLECTION_VIEW_CLASS + +#define MY_DATA_GET(obj, pd) \ + Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS); + +static void _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request); +static void _idle_cb(void *data, const Efl_Event *event); + +static int +_cache_tree_lookup(const Eina_Rbtree *node, const void *key, + int length EINA_UNUSED, void *data EINA_UNUSED) +{ + const Efl_Ui_Collection_Item_Lookup *n = (Efl_Ui_Collection_Item_Lookup *)node; + const uint64_t *index = key; + + if (n->index > *index) + return 1; + if (n->index < *index) + return -1; + return 0; +} + +static Eina_Rbtree_Direction +_cache_tree_cmp(const Eina_Rbtree *left, const Eina_Rbtree *right, void *data EINA_UNUSED) +{ + Efl_Ui_Collection_Item_Lookup *l = (Efl_Ui_Collection_Item_Lookup *)left; + Efl_Ui_Collection_Item_Lookup *r = (Efl_Ui_Collection_Item_Lookup *)right; + + return l->index < r->index ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT; +} + +static Eina_Value +_undo_item_selected_then(Eo *item, void *data EINA_UNUSED, Eina_Error err) +{ + Eina_Value *get; + Eina_Bool item_selected = efl_ui_selectable_selected_get(item); + Eina_Bool model_selected = EINA_FALSE; + + get = efl_model_property_get(efl_ui_view_model_get(item), "self.selected"); + eina_value_bool_get(get, &model_selected); + eina_value_free(get); + + if ((!!model_selected) != (!!item_selected)) + efl_ui_selectable_selected_set(item, model_selected); + + return eina_value_error_init(err); +} + +static void +_selected_item_cb(void *data EINA_UNUSED, const Efl_Event *ev) +{ + // Link back property to model, maybe just trigger event on the item should be enough + Eina_Value *get; + Eina_Bool item_selected = efl_ui_selectable_selected_get(ev->object); + Eina_Bool model_selected = EINA_FALSE; + Eina_Value set = eina_value_bool_init(!!item_selected); + + get = efl_model_property_get(efl_ui_view_model_get(ev->object), "self.selected"); + eina_value_bool_get(get, &model_selected); + eina_value_free(get); + + if ((!!model_selected) != (!!item_selected)) + { + Eina_Future *f; + + f = efl_model_property_set(efl_ui_view_model_get(ev->object), "self.selected", &set); + + // In case the mode is preventing the change, we need to update the UI back. So handle error case + efl_future_then(ev->object, f, + .error = _undo_item_selected_then); + } + + eina_value_flush(&set); +} + +static void +_redirect_item_cb(void *data, const Efl_Event *ev) +{ + Eo *obj = data; + +#define REDIRECT_EVT(Desc, Item_Desc) \ + if (Desc == ev->desc) \ + { \ + Efl_Ui_Item_Clickable_Clicked item_clicked; \ + Efl_Input_Clickable_Clicked *clicked = ev->info; \ + \ + item_clicked.clicked = *clicked; \ + item_clicked.item = ev->object; \ + \ + efl_event_callback_call(obj, Item_Desc, &item_clicked); \ + } + REDIRECT_EVT(EFL_INPUT_EVENT_PRESSED, EFL_UI_EVENT_ITEM_PRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_UNPRESSED, EFL_UI_EVENT_ITEM_UNPRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_LONGPRESSED, EFL_UI_EVENT_ITEM_LONGPRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_CLICKED_ANY, EFL_UI_EVENT_ITEM_CLICKED_ANY); + REDIRECT_EVT(EFL_INPUT_EVENT_CLICKED, EFL_UI_EVENT_ITEM_CLICKED); +#undef REDIRECT_EVT +} + +EFL_CALLBACKS_ARRAY_DEFINE(active_item_cbs, + { EFL_UI_EVENT_SELECTED_CHANGED, _selected_item_cb }, + { EFL_INPUT_EVENT_PRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_UNPRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_LONGPRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_CLICKED, _redirect_item_cb }, + { EFL_INPUT_EVENT_CLICKED_ANY, _redirect_item_cb }); + +static void +_entity_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Factory *factory, + Efl_Ui_Collection_Item *item, Eina_Array *scheduled_release) +{ + Efl_Gfx_Entity *entities[1]; + + entities[0] = item->entity; + if (!entities[0]) return ; + + efl_event_callback_array_del(entities[0], active_item_cbs(), obj); + efl_replace(&item->entity, NULL); + efl_event_callback_call(obj, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED, entities[0]); + if (!scheduled_release) + { + efl_ui_factory_release(factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); + } + else + { + eina_array_push(scheduled_release, entities[0]); + } +} + +static void +_item_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Factory *factory, + Efl_Ui_Collection_Item *item, Eina_Array *scheduled_release) +{ + efl_replace(&item->model, NULL); + + _entity_cleanup(obj, factory, item, scheduled_release); +} + +static void +_cache_item_free(Eina_Rbtree *node, void *data) +{ + Efl_Ui_Collection_Item_Lookup *n = (void*) node; + MY_DATA_GET(data, pd); + + _item_cleanup(data, pd->factory, &n->item, NULL); + free(n); +} + +static void +_cache_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd) +{ + eina_rbtree_delete(pd->cache, _cache_item_free, obj); + pd->cache = NULL; +} + +static void +_all_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd) +{ + Efl_Ui_Collection_Request *request; + Eina_List *l, *ll; +#ifdef VIEWPORT_ENABLE + unsigned int i; +#endif + + _cache_cleanup(obj, pd); +#ifdef VIEWPORT_ENABLE + for (i = 0; i < 3; i++) + { + unsigned int j; + + if (!pd->viewport[i]) continue; + + for (j = 0; j < pd->viewport[i]->count; j++) + _item_cleanup(obj, pd->factory, &(pd->viewport[i]->items[j])); + } +#endif + + EINA_LIST_FOREACH_SAFE(pd->requests, l, ll, request) + eina_future_cancel(request->f); +} + +static inline Eina_Bool +_size_from_model(Efl_Model *model, Eina_Size2D *r, const char *width, const char *height) +{ + Eina_Value *vw, *vh; + Eina_Bool success = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); + + vw = efl_model_property_get(model, width); + vh = efl_model_property_get(model, height); + + if (eina_value_type_get(vw) == EINA_VALUE_TYPE_ERROR || + eina_value_type_get(vh) == EINA_VALUE_TYPE_ERROR) + goto on_error; + + if (!eina_value_int_convert(vw, &(r->w))) r->w = 0; + if (!eina_value_int_convert(vh, &(r->h))) r->h = 0; + + success = EINA_TRUE; + + on_error: + eina_value_free(vw); + eina_value_free(vh); + + return success; +} + +static inline void +_size_to_model(Efl_Model *model, Eina_Size2D state) +{ + Eina_Value vw, vh; + + vw = eina_value_int_init(state.w); + vh = eina_value_int_init(state.h); + + efl_model_property_set(model, "self.width", &vw); + efl_model_property_set(model, "self.height", &vh); + + eina_value_flush(&vw); + eina_value_flush(&vh); +} + +#define ITEM_BASE_SIZE_FROM_MODEL(Model, Size) _size_from_model(Model, &Size, "item.width", "item.height") +#define ITEM_SIZE_FROM_MODEL(Model, Size) _size_from_model(Model, &Size, "self.width", "self.height") + +static Eina_List * +_request_add(Eina_List *requests, Efl_Ui_Collection_Request **request, + uint64_t index, Eina_Bool need_entity) +{ + if (!(*request)) goto create; + + if ((*request)->offset + (*request)->length == index) + { + if (need_entity) (*request)->need_entity = EINA_TRUE; + (*request)->length += 1; + return requests; + } + + requests = eina_list_append(requests, *request); + + create: + *request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!(*request)) return requests; + (*request)->offset = index; + (*request)->length = 1; + // At this point, we rely on the model caching ability to avoid recreating model + (*request)->model_requested = EINA_TRUE; + (*request)->need_entity = !!need_entity; + + return requests; +} + +static Eina_Value +_model_fetched_cb(Eo *obj, void *data, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Ui_Collection_Request *request = data; + Efl_Model *child; + unsigned int i, len; + Eina_Bool request_entity = EINA_FALSE; + + request->model_fetched = EINA_TRUE; + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + Efl_Ui_Collection_Item_Lookup *insert; + Eina_Size2D item_size; +#ifdef VIEWPORT_ENABLE + unsigned int v; + + for (v = 0; v < 3; ++v) + { + if (!pd->viewport[v]) continue; + + if ((pd->viewport[v]->offset <= request->offset + i) && + (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) + { + uint64_t index = request->offset + i - pd->viewport[v]->offset; + + efl_replace(&pd->viewport[v]->items[index].model, child); + child = NULL; + break; + } + } +#endif + + // When requesting a model, it should not be in the cache prior to the request + if (!child) continue; + + uint64_t search_index = request->offset + i; + + insert = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (insert) + { + if (!insert->item.entity && request->need_entity) + { + //drop the old model here, overwrite with model + view + efl_replace(&insert->item.model, child); + } + else + ERR("Inserting a model that was already fetched, dropping new model %lu", search_index); + } + else + { + insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup)); + if (!insert) continue; + insert->index = request->offset + i; + insert->item.model = efl_ref(child); + pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL); + } + + if (!ITEM_SIZE_FROM_MODEL(insert->item.model, item_size)) + request_entity = EINA_TRUE; + } + + if (request_entity) + { + request->need_entity = EINA_TRUE; + _entity_request(obj, request); + } + + return v; +} + +static void +_model_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + MY_DATA_GET(o, pd); + Efl_Ui_Collection_Request *request = data; + + if (request->need_entity) + { + if (!request->entity_requested) + _entity_request(o, request); + } + else + { + pd->requests = eina_list_remove(pd->requests, request); + free(request); + } +} + +static Eina_Value +_entity_fetch_cb(Eo *obj, void *data EINA_UNUSED, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Model *child; + Eina_Future *r; + Eina_Array tmp; + unsigned int i, len; + + eina_array_step_set(&tmp, sizeof (Eina_Array), 4); + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + eina_array_push(&tmp, child); + } + + r = efl_ui_view_factory_create_with_event(pd->factory, eina_array_iterator_new(&tmp)); + + eina_array_flush(&tmp); + + return eina_future_as_value(r); +} + +static inline Eina_Bool +_entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity) +{ + Eina_Size2D item_size; + + if (efl_key_data_get(entity, "efl.ui.widget.factory.size_set")) + { + return EINA_FALSE; + } + + if (ITEM_SIZE_FROM_MODEL(model, item_size)) + { + efl_gfx_hint_size_min_set(entity, item_size); + efl_canvas_group_need_recalculate_set(entity, EINA_FALSE); + if (efl_isa(entity, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(entity, EINA_TRUE); + return EINA_FALSE; + } + + efl_canvas_group_calculate(entity); + item_size = efl_gfx_hint_size_combined_min_get(entity); + efl_canvas_group_need_recalculate_set(entity, EINA_FALSE); + + _size_to_model(model, item_size); + return EINA_TRUE; +} + +static Eina_Value +_entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Ui_Collection_Request *request = data; + Efl_Gfx_Entity *child; + unsigned int i, len; + uint64_t updated_size_start_id = 0, updated_entity_start_id = 0; + Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + Efl_Ui_Collection_Item_Lookup *lookup; + uint64_t search_index; + //unsigned int v; + + efl_key_data_set(child, COLLECTION_VIEW_MANAGED, COLLECTION_VIEW_MANAGED_YES); + /* fix eventing in scroller by ensuring collection items are in the scroller hierarchy */ + efl_ui_item_container_set(child, obj); + efl_ui_widget_sub_object_add(obj, child); + efl_canvas_group_member_add(pd->pan, child); + efl_gfx_entity_visible_set(child, EINA_FALSE); + +#ifdef VIEWPORT_ENABLE + for (v = 0; v < 3; ++v) + { + if (!pd->viewport[v]) continue; + + if ((pd->viewport[v]->offset <= request->offset + i) && + (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) + { + uint64_t index = request->offset + i - pd->viewport[v]->offset; + + if (pd->viewport[v]->items[index].entity) + { + ERR("Entity already existing for id %d", i); + efl_unref(pd->viewport[v]->items[index].entity); + efl_del(pd->viewport[v]->items[index].entity); + pd->viewport[v]->items[index].entity = NULL; + } + + efl_replace(&pd->viewport[v]->items[index].entity, child); + if (_entity_propagate(pd->viewport[v]->items[index].model, child)) + { + if (!updated_size) + { + updated_size = EINA_TRUE; + updated_size_start_id = index; + } + } + else + { + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + index - 1); + updated_size = EINA_FALSE; + } + } + child = NULL; + break; + } + } +#endif + + // When requesting an entity, the model should already be in the cache + if (!child) continue; + + search_index = request->offset + i; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + + if (!lookup) + { + Efl_Gfx_Entity *entities[1] = { child }; + efl_ui_factory_release(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); + continue; + } + if (lookup->item.entity) + { + ERR("Entity already existing for id %lu", search_index); + _entity_cleanup(obj, pd->factory, &lookup->item, NULL); + } + + lookup->item.entity = efl_ref(child); + efl_event_callback_array_add(child, active_item_cbs(), obj); + efl_event_callback_call(obj, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, child); + + if (!updated_entity) + { + updated_entity = EINA_TRUE; + updated_entity_start_id = search_index; + } + + if (_entity_propagate(lookup->item.model, child)) + { + if (!updated_size) + { + updated_size = EINA_TRUE; + updated_size_start_id = search_index; + } + } + else + { + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + search_index - 1); + updated_size = EINA_FALSE; + } + }} + ; + + // Currently position manager will flush its entire size cache on update, so only do + // it when necessary to improve performance. + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + i - 1); + updated_size = EINA_FALSE; + } + + // Notify the position manager that new entity are ready to display + if (updated_entity) + { + efl_ui_position_manager_entity_entities_ready(pd->manager, + updated_entity_start_id, + i - 1); + + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); + efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); + } + return v; +} + +static void +_entity_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + MY_DATA_GET(o, pd); + Efl_Ui_Collection_Request *request = data; + + pd->requests = eina_list_remove(pd->requests, request); + free(request); +} + +static Eina_List * +_cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, + Efl_Ui_Collection_View_Data *pd, + uint64_t search_index, + Efl_Ui_Position_Manager_Size_Batch_Entity *target, + Eina_Size2D item_base) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Efl_Model *model; + Eina_Size2D item_size = item_base; + + if (!pd->cache) goto not_found; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (!lookup) goto not_found; + + // In the cache we should always have model, so no need to check for it + model = lookup->item.model; + + // If we do not know the size + if (!ITEM_SIZE_FROM_MODEL(model, item_size)) + { + if (lookup->item.entity) + { + ERR("Got a model '%s' and an item '%s', but no size. Recalculating.", + efl_debug_name_get(model), efl_debug_name_get(lookup->item.entity)); + _entity_propagate(model, lookup->item.entity); + if (!ITEM_SIZE_FROM_MODEL(model, item_size)) + { + CRI("No size for itme '%s' after recalculating. This is bad.", + efl_debug_name_get(lookup->item.entity)); + } + } + else if (!ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size)) + { + INF("No base size yet available. Making things up."); + item_size.w = 1; + item_size.h = 1; + } + } + + target->size = item_size; + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + return requests; + + not_found: + requests = _request_add(requests, request, search_index, EINA_FALSE); + + target->size = item_size; + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + return requests; +} + +static Eina_List * +_cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, + Efl_Ui_Collection_View_Data *pd, + uint64_t search_index, + Efl_Ui_Position_Manager_Object_Batch_Entity *target) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + + if (!pd->cache) goto not_found; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (!lookup) goto not_found; + if (!lookup->item.entity) goto not_found; + + if (target) target->entity = lookup->item.entity; + goto finish; + + not_found: + requests = _request_add(requests, request, search_index, EINA_TRUE); + + if (target) target->entity = NULL; + finish: + if (!target) return requests; + + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + + return requests; +} + +static void +_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request) +{ + if (request->model_requested && (!request->model_fetched)) return; + request->f = efl_future_then(obj, request->f, + .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _entity_fetch_cb); + request->f = efl_future_then(obj, request->f, + .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _entity_fetched_cb, + .data = request, + .free = _entity_free_cb); + request->entity_requested = EINA_TRUE; +} + +static inline void +_entity_inflight_request(Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_Request *request, + Efl_Ui_Collection_Request *inflight) +{ + if (request->need_entity == EINA_FALSE) return ; + if (inflight->entity_requested) return ; + + _entity_request(obj, inflight); +} + +static Eina_List * +_batch_request_flush(Eina_List *requests, + Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_View_Data *pd) +{ + Efl_Ui_Collection_Request *request; + Eina_List *ll, *next_list_item; + + EINA_LIST_FOREACH_SAFE(requests, ll, next_list_item, request) + { + // Check request intersection with all pending request + Efl_Ui_Collection_Request *inflight; + Efl_Model *model; + Eina_List *l; + + EINA_LIST_FOREACH(pd->requests, l, inflight) + { + uint64_t istart = inflight->offset; + uint64_t iend = inflight->offset + inflight->length; + uint64_t rstart = request->offset; + uint64_t rend = request->offset + request->length; + + // Way before + if (rend < istart) continue; + // Way after + if (rstart >= iend) continue; + + // request included in current inflight request + if (rstart >= istart && rend <= iend) + { + _entity_inflight_request(obj, request, inflight); + + // In this case no need to start a request + requests = eina_list_remove_list(requests, ll); + free(request); + request = NULL; + break; + } + + // request overflow left and right + if (rstart < istart && iend < rend) + { + // Remove the center portion of the request by emitting a new one + Efl_Ui_Collection_Request *rn; + + rn = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!rn) break; + + rn->offset = iend; + rn->length = rend - iend; + rn->model_requested = request->model_requested; + rn->need_entity = request->need_entity; + + requests = eina_list_append(requests, rn); + + request->length = istart - rstart; + _entity_inflight_request(obj, request, inflight); + continue; + } + + // request overflow left + if (rstart < istart && rend > istart && rend <= iend) + { + request->length = istart - rstart; + _entity_inflight_request(obj, request, inflight); + continue; + } + + // request overflow right + if (rstart >= istart && rstart < iend && iend <= rend) + { + request->offset = iend; + request->length = rend - iend; + _entity_inflight_request(obj, request, inflight); + continue; + } + } + + if (!request) continue; + + model = pd->model; + // Are we ready yet + if (!model) + { + requests = eina_list_remove_list(requests, ll); + free(request); + continue; + } + // Is the request inside the limit of the model? + if (request->offset >= efl_model_children_count_get(model)) + { + requests = eina_list_remove_list(requests, ll); + free(request); + continue; + } + // Is its limit outside the model limit? + if (request->offset + request->length >= efl_model_children_count_get(model)) + { + request->length = efl_model_children_count_get(model) - request->offset; + } + + // We now have a request, time to trigger a fetch + // We assume here that we are always fetching the model (model_requested must be true) + if (!request->model_requested) + { + CRI("Someone forgot to set model_requested for %lu to %lu.", + request->offset, request->offset + request->length); + request->model_requested = EINA_TRUE; + } + request->f = efl_model_children_slice_get(model, request->offset, request->length); + request->f = efl_future_then(obj, request->f, + .success = _model_fetched_cb, + .data = request, + .free = _model_free_cb); + + eina_list_move_list(&pd->requests, &requests, ll); + } + return NULL; +} + +static Efl_Ui_Position_Manager_Size_Batch_Result +_batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_Rw_Slice memory) +{ + MY_DATA_GET(data, pd); + Efl_Ui_Position_Manager_Size_Batch_Entity *sizes; + Efl_Ui_Collection_Request *request = NULL; + Efl_Ui_Position_Manager_Size_Batch_Result result = {0}; + Efl_Model *parent; + Eina_List *requests = NULL; + Eina_Size2D item_base = {0}; + unsigned int limit; + unsigned int idx = 0; + + // get the approximate value from the tree node + parent = pd->model; + + sizes = memory.mem; + //count = efl_model_children_count_get(parent); + limit = conf.range.end_id - conf.range.start_id; + ITEM_BASE_SIZE_FROM_MODEL(parent, item_base); + + // Look in the temporary cache now for the beginning of the buffer +#ifdef VIEWPORT_ENABLE + if (pd->viewport[0] && ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset)) + { + while ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset && idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } + } + + // Then look in our buffer view if the needed information can be found there + for (i = 0; i < 3; ++i) + { + if (!pd->viewport[i]) continue; + + while (idx < limit && + (pd->viewport[i]->offset <= conf.range.start_id + idx) && + (conf.range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) + { + uint64_t offset = conf.range.start_id + idx - pd->viewport[i]->offset; + Efl_Model *model = pd->viewport[i]->items[offset].model; + Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; + Eina_Bool entity_request = EINA_FALSE; + + if (model) + { + Eina_Size2D item_size; + Eina_Bool found = EINA_FALSE; + + if (ITEM_SIZE_FROM_MODEL(model, item_size)) + found = EINA_TRUE; + if (!found && entity) + { + item_size = efl_gfx_hint_size_combined_min_get(entity); + //if the size is 0 here, then we are running into trouble, + //fetch size from the parent model, where some fallback is defined + if (item_size.h == 0 && item_size.w == 0) + { + item_size = item_base; + found = EINA_TRUE; + } + else + { + _size_to_model(model, item_size); + found = EINA_TRUE; + } + + } + + if (found) + { + sizes[idx].size = item_size; + sizes[idx].element_depth = 0; + sizes[idx].depth_leader = EINA_FALSE; + goto done; + } + + // We will need an entity to calculate this size + entity_request = EINA_TRUE; + } + // No data, add to the requests + requests = _request_add(requests, &request, conf.range.start_id + idx, entity_request); + + sizes[idx].size = item_base; + sizes[idx].element_depth = 0; + sizes[idx].depth_leader = EINA_FALSE; + + done: + idx++; + } + } + + // Look in the temporary cache now for the end of the buffer + while (idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } +#endif + + /* if (conf.cache_request) */ + /* { */ + /* printf("CACHING SIZE CALL\n"); */ + /* while (idx < limit) */ + /* { */ + /* sizes[idx].depth_leader = EINA_FALSE; */ + /* sizes[idx].element_depth = 0; */ + /* sizes[idx].size = pd->last_base; */ + /* idx++; */ + /* } */ + /* fprintf(stderr, "read with no fetch\n"); */ + /* } */ + /* else */ + { + while (idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } + + + // Done, but flush request first + if (request) requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + } + + // Get the amount of filled item + result.filled_items = limit; + + return result; +} + +static Efl_Ui_Position_Manager_Object_Batch_Result +_batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_Rw_Slice memory) +{ + MY_DATA_GET(data, pd); + Efl_Ui_Position_Manager_Object_Batch_Entity *entities; + Efl_Ui_Collection_Request *request = NULL; + Efl_Ui_Position_Manager_Object_Batch_Result result = {0}; + Eina_List *requests = NULL; +#ifdef VIEWPORT_ENABLE + Efl_Model *parent; +#endif + unsigned int limit; + unsigned int idx = 0; + + //parent = pd->model; + + entities = memory.mem; + //count = efl_model_children_count_get(parent); + limit = range.end_id - range.start_id;; + + // Look in the temporary cache now for the beginning of the buffer +#ifdef VIEWPORT_ENABLE + if (pd->viewport[0] && ((uint64_t)(range.start_id + idx) < pd->viewport[0]->offset)) + { + while (idx < limit && (uint64_t)(range.start_id + idx) < pd->viewport[0]->offset) + { + uint64_t search_index = range.start_id + idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, &entities[idx]); + + idx++; + } + } + + // Then look in our buffer view if the needed information can be found there + for (i = 0; i < 3; ++i) + { + if (!pd->viewport[i]) continue; + + while (idx < limit && + (pd->viewport[i]->offset <= range.start_id + idx) && + (range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) + { + uint64_t offset = range.start_id + idx - pd->viewport[i]->offset; + Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; + + if (!entity) + { + // No data, add to the requests + requests = _request_add(requests, &request, range.start_id + idx, EINA_TRUE); + + entities[idx].entity = NULL; + entities[idx].depth_leader = EINA_FALSE; + entities[idx].element_depth = 0; + } + else + { + entities[idx].entity = entity; + entities[idx].depth_leader = EINA_FALSE; + entities[idx].element_depth = 0; + } + + idx++; + } + } +#endif + + // Look in the temporary cache now for the end of the buffer + while (idx < limit) + { + uint64_t search_index = range.start_id + idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, &entities[idx]); + + idx++; + } + // Done, but flush request first + if (request) + { + requests = eina_list_append(requests, request); + } + + requests = _batch_request_flush(requests, data, pd); + + // Get the amount of filled item + result.filled_items = limit; + + return result; +} + + +#if 0 +static void +_batch_free_cb(void *data) +{ + efl_unref(data); +} +#endif + +static void +flush_min_size(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + Eina_Size2D tmp = pd->content_min_size; + + if (!pd->match_content.w) + tmp.w = -1; + + if (!pd->match_content.h) + tmp.h = -1; + + efl_gfx_hint_size_restricted_min_set(obj, tmp); +} + +static void +_manager_content_size_changed_cb(void *data, const Efl_Event *ev) +{ + Eina_Size2D *size = ev->info; + MY_DATA_GET(data, pd); + + efl_gfx_entity_size_set(pd->sizer, *size); +} + +static void +_manager_content_min_size_changed_cb(void *data, const Efl_Event *ev) +{ + Eina_Size2D *size = ev->info; + MY_DATA_GET(data, pd); + + pd->content_min_size = *size; + + flush_min_size(data, pd); +} + +#ifdef VIEWPORT_ENABLE +static Eina_List * +_viewport_walk_fill(Eina_List *requests, + Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Collection_Viewport *viewport) +{ + Efl_Ui_Collection_Request *current = NULL; + unsigned int j; + + for (j = 0; j < viewport->count; j++) + { + Efl_Ui_Collection_Item_Lookup *lookup; + uint64_t index = viewport->offset + j; + + if (viewport->items[j].model) goto check_entity; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &index, + sizeof (index), _cache_tree_lookup, + NULL); + + if (lookup) + { + efl_replace(&viewport->items[j].model, lookup->item.model); + efl_replace(&viewport->items[j].entity, lookup->item.entity); + efl_replace(&lookup->item.entity, NULL); // Necessary to avoid premature release + + pd->cache = eina_rbtree_inline_remove(pd->cache, EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _cache_item_free(EINA_RBTREE_GET(lookup), obj); + } + + check_entity: + if (viewport->items[j].entity) continue ; + requests = _request_add(requests, ¤t, index, EINA_TRUE); + } + + // We do break request per viewport, just in case we generate to big batch at once + if (current) requests = eina_list_append(requests, current); + + return requests; +} + +#endif + +// An RbTree has the nice property of sorting content. The smaller than the root being in +// son[1] and the greater than the root in son[0]. Using this we can efficiently walk the +// tree once to take note of all the item that need cleaning. +static void +_mark_lesser(Efl_Ui_Collection_Item_Lookup *root, Eina_Array *mark, const unsigned int lower) +{ + if (!root) return ; + + if (root->index < lower) + { + eina_array_push(mark, root); + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[1], mark, lower); + } + else + { + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[0], mark, lower); + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[1], mark, lower); + } +} + +static void +_mark_ge(Efl_Ui_Collection_Item_Lookup *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->index >= upper) + { + eina_array_push(mark, root); + _mark_ge((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_ge((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_ge((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } +} + +// we walk the tree twice, once for everything below the limit and once for everything above +// then we do free each item individually. +static void +_idle_cb(void *data, const Efl_Event *event EINA_UNUSED) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Eina_Array mark; + Eina_Array scheduled_release; + MY_DATA_GET(data, pd); + const unsigned int length = pd->current_range.end_id - pd->current_range.start_id; + const unsigned int lower_end = MAX((long)pd->current_range.start_id - (long)length/2, 0); + const unsigned int upper_end = pd->current_range.end_id + length/2; + Eina_Array_Iterator iterator; + unsigned int i; + + eina_array_step_set(&mark, sizeof (Eina_Array), 16); + eina_array_step_set(&scheduled_release, sizeof (Eina_Array), 16); + + _mark_lesser((void*) pd->cache, &mark, lower_end); + _mark_ge((void*) pd->cache, &mark, upper_end); + + EINA_ARRAY_ITER_NEXT(&mark, i, lookup, iterator) + { + pd->cache = (void*) eina_rbtree_inline_remove(pd->cache, + EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _item_cleanup(data, pd->factory, &lookup->item, &scheduled_release); + free(lookup); + } + eina_array_flush(&mark); + + efl_ui_factory_release(pd->factory, eina_array_iterator_new(&scheduled_release)); + eina_array_flush(&scheduled_release); + + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, data); +} + +#ifndef VIEWPORT_ENABLE +static void +_manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev) +{ + Efl_Ui_Position_Manager_Range_Update *event = ev->info; + unsigned int count; + unsigned int lower_end; + unsigned int upper_end; + long length; + Efl_Ui_Collection_Request *request = NULL; + Eina_List *requests = NULL; + unsigned int idx; + MY_DATA_GET(data, pd); + + pd->current_range.start_id = event->start_id; + pd->current_range.end_id = event->end_id; + + count = efl_model_children_count_get(efl_ui_view_model_get(data)); + + length = pd->current_range.end_id - pd->current_range.start_id; + lower_end = MAX((long)pd->current_range.start_id - (length / 2), 0); + upper_end = MIN(pd->current_range.end_id + (length / 2), count); + + idx = lower_end; + while (idx < upper_end) + { + uint64_t search_index = idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, NULL); + + idx++; + } + // Done, but flush request first + if (request) requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); +} +#endif + +#ifdef VIEWPORT_ENABLE +static void +_manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev) +{ + Efl_Ui_Position_Manager_Range_Update *event = ev->info; + MY_DATA_GET(data, pd); + Eina_List *requests = NULL; + long baseid; + unsigned int delta, marginup, margindown; + uint64_t upperlimit_offset, lowerlimit_offset; + unsigned int i; + + pd->start_id = event->start_id; + pd->end_id = event->end_id; + + delta = pd->end_id - pd->start_id; + + // First time setting up the viewport, so trigger request as we see fit + if (!pd->viewport[0]) + { + baseid = pd->start_id - delta; + + for (i = 0; i < 3; i++) + { + pd->viewport[i] = calloc(1, sizeof (Efl_Ui_Collection_Viewport)); + if (!pd->viewport[i]) continue; + + pd->viewport[i]->offset = MAX(baseid + delta * i, 0); + pd->viewport[i]->count = delta; + pd->viewport[i]->items = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!pd->viewport[i]->items) continue ; + + requests = _viewport_walk_fill(requests, data, pd, pd->viewport[i]); + } + + goto flush_requests; + } + + // Compute limit offset + upperlimit_offset = delta * 3 + pd->viewport[0]->offset; + lowerlimit_offset = 0; + + // Adjust the viewport for size or to much offset change in two step + + // Trying to resize first if there size is in bigger/smaller than 25% of the original size + margindown = delta * 75 / 100; + marginup = delta * 125 / 100; + if (margindown < pd->viewport[0]->count && + pd->viewport[0]->count < marginup) + { + // Trying to do the resize in an optimized way is complex, let's do it simple + Efl_Ui_Collection_Item *items[3]; + unsigned int j = 0, t = 1; + + for (i = 0; i < 3; i++) + { + unsigned int m; + + items[i] = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!items[i]) continue; + + for (m = 0; m < delta && t < 3; m++) + { + items[i][m] = pd->viewport[t]->items[j]; + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Preserve last updated index to later build a request + if (t == 3) + { + upperlimit_offset = pd->viewport[0]->offset + i * delta + m; + + t = 4; // So that we never come back here again + } + } + + // For now destroy leftover object, could be cached + for (i = t; i < 3; i++) + { + for (; j < pd->viewport[i]->count; j++) + { + _item_cleanup(pd->factory, &pd->viewport[i]->items[j]); + } + j = 0; + } + + // And now define viewport back + for (i = 0; i < 3; i++) + { + free(pd->viewport[i]->items); + pd->viewport[i]->items = items[i]; + pd->viewport[i]->count = delta; + pd->viewport[i]->offset = pd->viewport[0]->offset + delta * i; + } + } + + // We decided that resizing was unecessary + delta = pd->viewport[0]->count; + + // Try to keep the visual viewport in between half of the first and last viewport + + // start_id is in the first half of the first viewport, assume upward move + // start_id + delta is in the second half of the last viewport, assume upward move + if (pd->viewport[0]->offset + delta / 2 < pd->start_id || + pd->start_id + delta > pd->viewport[2]->offset + delta / 2) + { + // We could optimize this to actually just move viewport around in most cases + Efl_Ui_Collection_Item *items[3]; + unsigned int j = 0, t = 0; + uint64_t target, current; + + // Case where are at the top + if (pd->start_id < delta && pd->viewport[0]->offset == 0) goto build_request; + + // Trying to adjust the offset to maintain it in the center viewport +/- delta/2 + baseid = (pd->start_id < delta) ? 0 : pd->start_id - delta; + + // Lookup for starting point + lowerlimit_offset = pd->viewport[0]->offset; + target = baseid; + + // cleanup before target + for (current = pd->viewport[t]->offset; current < target; current++) + { + _item_cleanup(pd->factory, &pd->viewport[t]->items[j]); + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Allocation and copy + for (i = 0; i < 3; i++) + { + unsigned int m; + + items[i] = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!items[i]) continue; + + for (m = 0; m < delta && t < 3; m++, target++) + { + if (target < pd->viewport[t]->offset) continue ; + items[i][m] = pd->viewport[t]->items[j]; + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Preserve last updated index to later build a request + if (t == 3) + { + if (upperlimit_offset > pd->viewport[0]->offset + i * delta + m) + { + upperlimit_offset = pd->viewport[0]->offset + i * delta + m; + } + + t = 4; // So that we never come back here again + } + } + + // For now destroy leftover object, could be cached + for (i = t; i < 3; i++) + { + for (; j < pd->viewport[i]->count; j++) + { + _item_cleanup(pd->factory, &pd->viewport[i]->items[j]); + } + j = 0; + } + + // And now define viewport back + for (i = 0; i < 3; i++) + { + free(pd->viewport[i]->items); + pd->viewport[i]->items = items[i]; + pd->viewport[i]->offset = baseid + delta * i; + } + } + + build_request: + // Check if the first viewport has all the lower part of it filled with objects + if (pd->viewport[0]->offset < lowerlimit_offset) + { + Efl_Ui_Collection_Request *request; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (request) return ; + + request->offset = lowerlimit_offset; + // This length work over multiple viewport as they are contiguous + request->length = lowerlimit_offset - pd->viewport[0]->offset; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } + + // Check if the last viewport has all the upper part of it filler with objects + if (pd->viewport[2]->offset + pd->viewport[2]->count > upperlimit_offset) + { + Efl_Ui_Collection_Request *request; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (request) return ; + + request->offset = upperlimit_offset; + // This length work over multiple viewport as they are contiguous + request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } + + flush_requests: + requests = _batch_request_flush(requests, data, pd); +} +#endif + +EFL_CALLBACKS_ARRAY_DEFINE(manager_cbs, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, _manager_content_size_changed_cb }, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, _manager_content_min_size_changed_cb }, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_VISIBLE_RANGE_CHANGED, _manager_content_visible_range_changed_cb } +) + +static void +_item_scroll_internal(Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd, + uint64_t index, + double align EINA_UNUSED, + Eina_Bool anim) +{ + Eina_Rect ipos, view; + Eina_Position2D vpos; + + if (!pd->scroller) return; + + ipos = efl_ui_position_manager_entity_position_single_item(pd->manager, index); + view = efl_ui_scrollable_viewport_geometry_get(pd->scroller); + vpos = efl_ui_scrollable_content_pos_get(pd->scroller); + + ipos.x = ipos.x + vpos.x - view.x; + ipos.y = ipos.y + vpos.y - view.y; + + //FIXME scrollable needs some sort of align, the docs do not even garantee to completly move in the element + efl_ui_scrollable_scroll(pd->scroller, ipos, anim); +} + +// Exported function + +EOLIAN static void +_efl_ui_collection_view_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Factory *factory) +{ + if (pd->factory) efl_ui_property_bind(pd->factory, "selected", NULL); + efl_replace(&pd->factory, factory); + if (pd->factory) efl_ui_property_bind(pd->factory, "selected", "self.selected"); +} + +EOLIAN static Efl_Ui_Factory * +_efl_ui_collection_view_factory_get(const Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd) +{ + return pd->factory; +} + +static void +_unref_cb(void *data) +{ + Eo *obj = data; + + efl_unref(obj); +} + +EOLIAN static void +_efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Position_Manager_Entity *manager) +{ + Efl_Model *model; + unsigned int count; + + if (manager) + EINA_SAFETY_ON_FALSE_RETURN(efl_isa(manager, EFL_UI_POSITION_MANAGER_ENTITY_INTERFACE)); + + if (pd->manager) + { + efl_event_callback_array_del(pd->manager, manager_cbs(), obj); + efl_del(pd->manager); + } + pd->manager = manager; + if (!pd->manager) return; + + // Start watching change on model from here on + model = pd->model; + count = model ? efl_model_children_count_get(model) : 0; + + efl_parent_set(pd->manager, obj); + efl_event_callback_array_add(pd->manager, manager_cbs(), obj); + switch(efl_ui_position_manager_entity_version(pd->manager, 1)) + { + case 1: + efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, + efl_ref(obj), _batch_entity_cb, _unref_cb, + efl_ref(obj), _batch_size_cb, _unref_cb, + count); + break; + } + + if (efl_finalized_get(obj)) + efl_ui_position_manager_entity_viewport_set(pd->manager, efl_ui_scrollable_viewport_geometry_get(obj)); + efl_ui_layout_orientation_set(pd->manager, pd->direction); +} + +EOLIAN static Efl_Ui_Position_Manager_Entity * +_efl_ui_collection_view_position_manager_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd) +{ + return pd->manager; +} + +static void +_efl_model_count_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +{ + // We are not triggering efl_ui_position_manager_entity_data_access_set as it is can + // only be slow, we rely on child added/removed instead (If we were to not rely on + // child added/removed we could maybe use count changed) +} + +static void +_efl_model_properties_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +{ + // We could here watch if the global base size item change and notify of a global change + // But I can not find a proper way to do it for the object that are not visible, which + // is kind of the point... +} + +static void +_cache_cleanup_above(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd, unsigned int index) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Eina_Array scheduled_release; + Eina_Array mark; + Eina_Array_Iterator iterator; + unsigned int i; + + eina_array_step_set(&mark, sizeof (Eina_Array), 16); + eina_array_step_set(&scheduled_release, sizeof (Eina_Array), 16); + + _mark_ge((void*) pd->cache, &mark, index); + + EINA_ARRAY_ITER_NEXT(&mark, i, lookup, iterator) + { + pd->cache = (void*) eina_rbtree_inline_remove(pd->cache, + EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _item_cleanup(obj, pd->factory, &lookup->item, &scheduled_release); + free(lookup); + } + eina_array_flush(&mark); + + efl_ui_factory_release(pd->factory, eina_array_iterator_new(&scheduled_release)); + eina_array_flush(&scheduled_release); +} + +static void +_efl_model_child_added(void *data, const Efl_Event *event) +{ + // At the moment model only append child, but let's try to handle it theorically correct + Efl_Model_Children_Event *ev = event->info; + MY_DATA_GET(data, pd); +#ifdef VIEWPORT_ENABLE + Eina_List *requests = NULL; + unsigned int i; +#endif + + _cache_cleanup_above(data, pd, ev->index); + + // Check if we really have something to do +#ifdef VIEWPORT_ENABLE + if (!pd->viewport[0]) goto notify_manager; + + // Insert the child in the viewport if necessary + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + unsigned int o; + unsigned int j; + + if (ev->index < pd->viewport[i]->offset) + { + pd->viewport[i]->offset++; + continue; + } + if (pd->viewport[i]->offset + pd->viewport[i]->count < ev->index) + { + continue; + } + + for (j = 2; j > i; j--) + { + _item_cleanup(pd->factory, &pd->viewport[j]->items[pd->viewport[j]->count - 1]); + memmove(&pd->viewport[j]->items[1], + &pd->viewport[j]->items[0], + (pd->viewport[j]->count - 1) * sizeof (Efl_Ui_Collection_Item)); + pd->viewport[j]->items[0] = pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1]; + pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1].entity = NULL; + pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1].model = NULL; + } + o = ev->index - pd->viewport[i]->offset; + memmove(&pd->viewport[j]->items[o], + &pd->viewport[j]->items[o + 1], + (pd->viewport[j]->count - 1 - o) * sizeof (Efl_Ui_Collection_Item)); + pd->viewport[j]->items[o].entity = NULL; + pd->viewport[j]->items[o].model = efl_ref(ev->child); + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) break; + request->offset = ev->index; + request->length = 1; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + + break; + } + + notify_manager: +#endif + // FIXME this function must be called with an entity + efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL); +} + +static void +_efl_model_child_removed(void *data, const Efl_Event *event) +{ + Efl_Model_Children_Event *ev = event->info; + MY_DATA_GET(data, pd); + Eina_List *requests = NULL; + Efl_Ui_Collection_Request *request = NULL; +#ifdef VIEWPORT_ENABLE + Eina_List *requests = NULL; + unsigned int i; +#endif + unsigned int upper_end; + long length; + unsigned int count; + + // FIXME: later optimization, instead of reloading everyone, we could actually track index and self + // update would be more efficient, but it is also more tricky + _cache_cleanup_above(data, pd, ev->index); + + count = efl_model_children_count_get(event->object); + length = pd->current_range.end_id - pd->current_range.start_id; + upper_end = MIN(pd->current_range.end_id + (length / 2), count); + + // Check if we really have something to do +#ifdef VIEWPORT_ENABLE + if (!pd->viewport[0]) goto notify_manager; + + // Insert the child in the viewport if necessary + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + unsigned int o; + + if (ev->index < pd->viewport[i]->offset) + { + pd->viewport[i]->offset--; + continue; + } + if (pd->viewport[i]->offset + pd->viewport[i]->count < ev->index) + { + continue; + } + + o = ev->index - pd->viewport[i]->offset; + _item_cleanup(pd->factory, &pd->viewport[i]->items[o]); + for (; i < 3; i++) + { + memmove(&pd->viewport[i]->items[o], + &pd->viewport[i]->items[o + 1], + (pd->viewport[i]->count - 1 - o) * sizeof (Efl_Ui_Collection_Item)); + if (i + 1 < 3) + { + pd->viewport[i]->items[pd->viewport[i]->count - 1] = pd->viewport[i + 1]->items[0]; + } + else + { + pd->viewport[i]->items[pd->viewport[i]->count - 1].entity = NULL; + pd->viewport[i]->items[pd->viewport[i]->count - 1].model = NULL; + } + o = 0; + } + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) break; + request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1; + request->length = 1; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + + break; + } + + notify_manager: +#endif + requests = _request_add(requests, &request, ev->index, EINA_TRUE); + request->length = upper_end - ev->index; + + if (request->length > 0) + { + requests = eina_list_append(requests, request); + requests = _batch_request_flush(requests, data, pd); + } + + efl_ui_position_manager_entity_item_removed(pd->manager, ev->index, NULL); +} + +EFL_CALLBACKS_ARRAY_DEFINE(model_cbs, + { EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _efl_model_count_changed }, + { EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed }, + { EFL_MODEL_EVENT_CHILD_ADDED, _efl_model_child_added }, + { EFL_MODEL_EVENT_CHILD_REMOVED, _efl_model_child_removed }) + +static void +_efl_ui_collection_view_model_changed(void *data, const Efl_Event *event) +{ + Efl_Model_Changed_Event *ev = event->info; + Eina_List *requests = NULL; + MY_DATA_GET(data, pd); + Eina_Iterator *it; + const char *property; + Efl_Model *model = NULL; + unsigned int count; + Efl_Model *mselect = NULL; + Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE; + + if (ev->previous) efl_event_callback_array_del(ev->previous, model_cbs(), data); + if (ev->current) efl_event_callback_array_add(ev->current, model_cbs(), data); + + // Cleanup all object, pending request and refetch everything + _all_cleanup(data, pd); + + efl_replace(&pd->model, NULL); + + if (!ev->current) + { + if (pd->multi_selectable_async_model) + { + efl_event_callback_forwarder_del(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + efl_composite_detach(data, pd->multi_selectable_async_model); + efl_replace(&pd->multi_selectable_async_model, NULL); + } + return ; + } + + it = efl_model_properties_get(ev->current); + EINA_ITERATOR_FOREACH(it, property) + { + // Check if the model provide selection + if (eina_streq(property, "child.selected")) + selection = EINA_TRUE; + // Check if the model provide sizing logic + else if (eina_streq(property, _efl_model_property_itemw) || + eina_streq(property, _efl_model_property_itemh)) + sizing = EINA_TRUE; + } + eina_iterator_free(it); + + if (selection) + { + // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC + mselect = ev->current; + while (mselect && + !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE) && + efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS)) + mselect = efl_ui_view_model_get(mselect); + + if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE)) + { + mselect = NULL; + selection = EINA_FALSE; + } + } + + // Try to build the minimal chain of necessary model for collection view + model = ev->current; + + // Build and connect the selection model properly + if (!mselect) + { + mselect = model = efl_add(EFL_UI_SELECT_MODEL_CLASS, data, + efl_ui_view_model_set(efl_added, model)); + } + if (pd->multi_selectable_async_model) + { + efl_event_callback_forwarder_del(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + efl_composite_detach(data, pd->multi_selectable_async_model); + } + efl_replace(&pd->multi_selectable_async_model, mselect); + efl_composite_attach(data, pd->multi_selectable_async_model); + efl_event_callback_forwarder_add(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + + if (!sizing) model = efl_add(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data, + efl_ui_view_model_set(efl_added, model)); + + count = efl_model_children_count_get(model); + +#ifdef VIEWPORT_ENABLE + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + + if (!pd->viewport[i]) continue ; + if (pd->viewport[i]->count == 0) continue ; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) continue ; + + request->offset = pd->viewport[i]->offset; + request->length = pd->viewport[i]->count; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } +#endif + requests = _batch_request_flush(requests, data, pd); + + pd->model = model; + efl_ui_position_manager_entity_item_size_changed(pd->manager, 0, count - 1); + switch(efl_ui_position_manager_entity_version(pd->manager, 1)) + { + case 1: + efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, + efl_ref(data), _batch_entity_cb, _unref_cb, + efl_ref(data), _batch_size_cb, _unref_cb, + count); + break; + } + + +} + +static void +_pan_viewport_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + MY_DATA_GET(data, pd); + Eina_Rect rect = efl_ui_scrollable_viewport_geometry_get(data); + + efl_ui_position_manager_entity_viewport_set(pd->manager, rect); +} + +static void +_pan_position_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + MY_DATA_GET(data, pd); + Eina_Position2D pos = efl_ui_pan_position_get(pd->pan); + Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan); + Eina_Vector2 rpos = {0.0, 0.0}; + + if (max.x > 0.0) + rpos.x = (double)pos.x/(double)max.x; + if (max.y > 0.0) + rpos.y = (double)pos.y/(double)max.y; + + efl_ui_position_manager_entity_scroll_position_set(pd->manager, rpos.x, rpos.y); +} + +EFL_CALLBACKS_ARRAY_DEFINE(pan_events_cb, + {EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, _pan_position_changed_cb}, + {EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _pan_viewport_changed_cb}, + {EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _pan_viewport_changed_cb}, +) + +EOLIAN static Efl_Object * +_efl_ui_collection_view_efl_object_constructor(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + pd->direction = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; + obj = efl_constructor(efl_super(obj, EFL_UI_COLLECTION_VIEW_CLASS)); + + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "collection"); + + efl_wref_add(efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj)), &pd->sizer); + efl_gfx_color_set(pd->sizer, 0, 0, 0, 0); + + efl_wref_add(efl_add(EFL_UI_PAN_CLASS, obj), &pd->pan); + efl_content_set(pd->pan, pd->sizer); + efl_event_callback_array_add(pd->pan, pan_events_cb(), obj); + + efl_wref_add(efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj), &pd->scroller); + efl_composite_attach(obj, pd->scroller); + efl_ui_mirrored_set(pd->scroller, efl_ui_mirrored_get(obj)); + efl_ui_scroll_manager_pan_set(pd->scroller, pd->pan); + + efl_ui_scroll_connector_bind(obj, pd->scroller); + + efl_event_callback_add(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, + _efl_ui_collection_view_model_changed, obj); + + return obj; +} + +EOLIAN static void +_efl_ui_collection_view_efl_object_invalidate(Eo *obj, + Efl_Ui_Collection_View_Data *pd) +{ + efl_ui_collection_view_position_manager_set(obj, NULL); + efl_event_callback_del(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, + _efl_ui_collection_view_model_changed, obj); + + _all_cleanup(obj, pd); + + efl_invalidate(efl_super(obj, EFL_UI_COLLECTION_VIEW_CLASS)); +} + +EOLIAN static void +_efl_ui_collection_view_efl_ui_layout_orientable_orientation_set(Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Layout_Orientation dir) +{ + if (pd->direction == dir) return; + + pd->direction = dir; + if (pd->manager) efl_ui_layout_orientation_set(pd->manager, dir); +} + +EOLIAN static Efl_Ui_Layout_Orientation +_efl_ui_collection_view_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd) +{ + return pd->direction; +} + +EOLIAN static Eina_Error +_efl_ui_collection_view_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + Eina_Error res; + + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC); + res = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); + if (res == EFL_UI_THEME_APPLY_ERROR_GENERIC) return res; + efl_ui_mirrored_set(pd->scroller, efl_ui_mirrored_get(obj)); + efl_content_set(efl_part(wd->resize_obj, "efl.content"), pd->pan); + + return res; +} + +EOLIAN static void +_efl_ui_collection_view_efl_ui_scrollable_match_content_set(Eo *obj, Efl_Ui_Collection_View_Data *pd, Eina_Bool w, Eina_Bool h) +{ + if (pd->match_content.w == w && pd->match_content.h == h) + return; + + pd->match_content.w = w; + pd->match_content.h = h; + + efl_ui_scrollable_match_content_set(pd->scroller, w, h); + flush_min_size(obj, pd); +} + +EOLIAN static Efl_Ui_Focus_Manager * +_efl_ui_collection_view_efl_ui_widget_focus_manager_focus_manager_create(Eo *obj, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) +{ + Efl_Ui_Collection_View_Focus_Manager_Data *mpd; + Eo *manager = efl_add(EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS, obj, + efl_ui_focus_manager_root_set(efl_added, root)); + + mpd = efl_data_scope_get(manager, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS); + mpd->collection = obj; + + return manager; +} + +EOLIAN static Efl_Ui_Focus_Object * +_efl_ui_collection_view_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_View_Data *pd, Efl_Ui_Focus_Direction direction) +{ + Eo *new_obj, *focus; + Eina_Size2D step; + + new_obj = efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction); + focus = efl_ui_focus_manager_focus_get(obj); + step = efl_gfx_hint_size_combined_min_get(focus); + if (!new_obj) + { + Eina_Rect pos = efl_gfx_entity_geometry_get(focus); + Eina_Rect view = efl_ui_scrollable_viewport_geometry_get(pd->scroller); + Eina_Position2D vpos = efl_ui_scrollable_content_pos_get(pd->scroller); + + pos.x = pos.x + vpos.x - view.x; + pos.y = pos.y + vpos.y - view.y; + Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan); + + if (direction == EFL_UI_FOCUS_DIRECTION_RIGHT) + { + if (pos.x < max.x) + { + pos.x = MIN(max.x, pos.x + step.w); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_LEFT) + { + if (pos.x > 0) + { + pos.x = MAX(0, pos.x - step.w); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_UP) + { + if (pos.y > 0) + { + pos.y = MAX(0, pos.y - step.h); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_DOWN) + { + if (pos.y < max.y) + { + pos.y = MAX(0, pos.y + step.h); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + } + else + { + Efl_Model *model; + Eina_Value *vindex; + uint64_t index; + + model = efl_ui_view_model_get(new_obj); + vindex = efl_model_property_get(model, "child.index"); + if (eina_value_uint64_convert(vindex, &index)) + _item_scroll_internal(obj, pd, index, .0, EINA_TRUE); + eina_value_free(vindex); + } + + return new_obj; +} + +EOLIAN static Eina_Bool +_efl_ui_collection_view_efl_ui_widget_focus_state_apply(Eo *obj, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED) +{ + return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); +} + +#include "efl_ui_collection_view.eo.c" + +#define ITEM_IS_OUTSIDE_VISIBLE(id) id < cpd->start_id || id > cpd->end_id + +static Efl_Ui_Item * +_find_item(Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Eo *focused_element) +{ + if (!focused_element) return NULL; + + while (focused_element && + efl_key_data_get(focused_element, COLLECTION_VIEW_MANAGED) != COLLECTION_VIEW_MANAGED_YES) + { + focused_element = efl_ui_widget_parent_get(focused_element); + } + + return focused_element; +} + +static inline void +_assert_item_available(Eo *item, int new_id, Efl_Ui_Collection_View_Data *pd) +{ + efl_gfx_entity_visible_set(item, EINA_TRUE); + efl_gfx_entity_geometry_set(item, efl_ui_position_manager_entity_position_single_item(pd->manager, new_id)); +} +EOLIAN static void +_efl_ui_collection_view_focus_manager_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_Ui_Collection_View_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *focus) +{ + MY_DATA_GET(pd->collection, cpd); + Efl_Ui_Item *item = NULL; + uint64_t item_id; + + if (focus == efl_ui_focus_manager_root_get(obj)) + { + // Find last item + item_id = efl_model_children_count_get(cpd->model) - 1; + } + else + { + Efl_Model *model; + Eina_Value *vindex; + + item = _find_item(obj, cpd, focus); + if (!item) return ; + + model = efl_ui_view_model_get(item); + vindex = efl_model_property_get(model, "child.index"); + if (!eina_value_uint64_convert(vindex, &item_id)) return; + eina_value_free(vindex); + } + + // If this is NULL then we are before finalize, we cannot serve any sane value here + if (!cpd->manager) return ; + + if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) + { + _assert_item_available(item, item_id, cpd); + } + efl_ui_focus_manager_focus_set(efl_super(obj, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS), focus); +} + +static int +_id_from_item(Efl_Ui_Item *item, uint64_t *index) +{ + Eina_Value *vindex; + Efl_Model *model; + + model = efl_ui_view_model_get(item); + + vindex = efl_model_property_get(model, "child.index"); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_uint64_convert(vindex, index), EINA_FALSE); + eina_value_free(vindex); + return EINA_TRUE; +} + +EOLIAN static Efl_Ui_Focus_Object * +_efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_Ui_Collection_View_Focus_Manager_Data *pd, Efl_Ui_Focus_Direction direction, Efl_Ui_Focus_Object *child, Eina_Bool logical) +{ + MY_DATA_GET(pd->collection, cpd); + Efl_Ui_Item *new_item, *item; + uint64_t item_id; + + if (!child) + child = efl_ui_focus_manager_focus_get(obj); + + item = _find_item(obj, cpd, child); + + //if this is NULL then we are before finalize, we cannot serve any sane value here + if (!cpd->manager) return NULL; + if (!item) return NULL; + + if (!_id_from_item(item, &item_id)) + return NULL; + + if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) + { + int new_id; + + new_id = efl_ui_position_manager_entity_relative_item(cpd->manager, + item_id, + direction); + if (new_id == -1) + { + new_item = NULL; + } + else + { + Efl_Ui_Collection_Item_Lookup *lookup; +#ifdef VIEWPORT_ENABLE + unsigned int i; + + for (i = 0; i < 3; i++) + { + if (!cpd->viewport[i]) continue; + + if (!((cpd->viewport[i]->offset <= (unsigned int) new_id) && + ((unsigned int) new_id < cpd->viewport[i]->offset + cpd->viewport[i]->count))) + continue; + + new_item = cpd->viewport[i]->items[new_id - cpd->viewport[i]->offset].entity; + // We shouldn't get in a case where the available item is NULL + if (!new_item) break; // Just in case + _assert_item_available(new_item, new_id, cpd); + } +#else + uint64_t search_index = new_id; + lookup = (void*) eina_rbtree_inline_lookup(cpd->cache, &search_index, + sizeof (new_id), _cache_tree_lookup, + NULL); + if (lookup) + { + _assert_item_available(lookup->item.entity, new_id, cpd); + new_item = lookup->item.entity; + } + else + { + ERR("This item cannot get focus right now. It should be visible first."); + new_item = NULL; + } +#endif + } + } + else + { + new_item = efl_ui_focus_manager_request_move(efl_super(obj, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS), direction, child, logical); + } + + return new_item; +} + +#include "efl_ui_collection_view_focus_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo new file mode 100644 index 0000000000..9278cd04c7 --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -0,0 +1,62 @@ +class Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements + Efl.Ui.Layout_Orientable, + Efl.Ui.Selectable, + Efl.Ui.Multi_Selectable_Async, + Efl.Ui.Focus.Manager_Sub, + Efl.Ui.Widget_Focus_Manager, + Efl.Ui.Item_Clickable + composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, Efl.Ui.Multi_Selectable_Async +{ + [[This widget displays a list of items in an arrangement controlled by an external @.position_manager + object. By using different @.position_manager objects this widget can show unidimensional lists or + two-dimensional grids of items, for example. + + This class is intended to act as a base for widgets like List_View or @Efl.Ui.Grid_View, + which hide this complexity from the user. + + Items are generated by the @Efl.Ui.Factory defined with .factory.set to match the content of the + @Efl.Model defined with @Efl.Ui.View.model.set. They are dynamically created/destroyed to only have + the one that are necessary to display all the one that are to far out of the viewport will not be + created to lighten the usage for very large list. + + The direction of the arrangement can be controlled through @Efl.Ui.Layout_Orientable.orientation. + + If all items do not fit in the current widget size scrolling facilities are provided. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + methods { + @property factory { + [[Define the factory used to create all the items.]] + get {} + set {} + values { + factory: Efl.Ui.Factory; [[The factory.]] + } + } + @property position_manager @beta { + [[Position manager object that handles placement of items.]] + values { + position_manager : Efl.Ui.Position_Manager.Entity @move; [[The objects ownership is passed to the item container.]] + } + } + } + implements { + Efl.Object.constructor; + Efl.Object.invalidate; + + Efl.Ui.Layout_Orientable.orientation { get; set; } + + Efl.Ui.Widget.theme_apply; + + Efl.Ui.Scrollable.match_content { set; } + Efl.Ui.Widget_Focus_Manager.focus_manager_create; + Efl.Ui.Focus.Manager.move; + Efl.Ui.Widget.focus_state_apply; + } + events { + item,realized : Efl.Ui.Item; [[Event triggered when an @Efl.Ui.Item has been provided by the @Efl.Ui.Factory and is about to be used.]] + item,unrealized : Efl.Ui.Item; [[Event triggered when the @Efl.Ui.Collection_View is about to give an @Efl.Ui.Item back to the @Efl.Ui.Factory.]] + } +} diff --git a/src/lib/elementary/efl_ui_collection_view_focus_manager.eo b/src/lib/elementary/efl_ui_collection_view_focus_manager.eo new file mode 100644 index 0000000000..bd4e27727b --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view_focus_manager.eo @@ -0,0 +1,7 @@ +class @beta Efl.Ui.Collection_View_Focus_Manager extends Efl.Ui.Focus.Manager_Calc { + [[Internal class which implements collection specific behaviour, cannot be used outside of collection]] + implements { + Efl.Ui.Focus.Manager.manager_focus { set; } + Efl.Ui.Focus.Manager.request_move; + } +} diff --git a/src/lib/elementary/efl_ui_datepicker.eo b/src/lib/elementary/efl_ui_datepicker.eo index 11df7c45cc..08e841ad99 100644 --- a/src/lib/elementary/efl_ui_datepicker.eo +++ b/src/lib/elementary/efl_ui_datepicker.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Datepicker extends Efl.Ui.Layout_Base +class Efl.Ui.Datepicker extends Efl.Ui.Layout_Base { [[Datepicker widget diff --git a/src/lib/elementary/efl_ui_default_item.eo b/src/lib/elementary/efl_ui_default_item.eo index b11c20ab41..7196a23c32 100644 --- a/src/lib/elementary/efl_ui_default_item.eo +++ b/src/lib/elementary/efl_ui_default_item.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Ui.Default_Item extends Efl.Ui.Item implements +abstract Efl.Ui.Default_Item extends Efl.Ui.Item implements Efl.Text, Efl.Text_Markup, Efl.Ui.L10n, diff --git a/src/lib/elementary/efl_ui_format.eo b/src/lib/elementary/efl_ui_format.eo index baa8613946..7723639b62 100644 --- a/src/lib/elementary/efl_ui_format.eo +++ b/src/lib/elementary/efl_ui_format.eo @@ -1,6 +1,6 @@ import eina_types; -function @beta Efl.Ui.Format_Func +function Efl.Ui.Format_Func { [[A function taking an @Eina.Value and producing its textual representation. See @Efl.Ui.Format.format_func. @@ -12,7 +12,7 @@ function @beta Efl.Ui.Format_Func return: bool; [[Whether the conversion succeeded or not.]] }; -struct @beta Efl.Ui.Format_Value +struct Efl.Ui.Format_Value { [[A value which should always be displayed as a specific text string. See @Efl.Ui.Format.format_values. @@ -21,7 +21,7 @@ struct @beta Efl.Ui.Format_Value text: string; [[Text string to replace it.]] } -enum @beta Efl.Ui.Format_String_Type +enum Efl.Ui.Format_String_Type { [[Type of formatting string.]] simple, [[This is the simplest formatting mechanism, working pretty much like $printf. @@ -35,10 +35,10 @@ enum @beta Efl.Ui.Format_String_Type ]] } -mixin @beta Efl.Ui.Format requires Efl.Object +mixin Efl.Ui.Format requires Efl.Object { [[Helper mixin that simplifies converting numerical values to text. - + A number of widgets represent a numerical value but display a text representation. For example, an @Efl.Ui.Progressbar can hold the number 0.75 but display the string "75%", or an @Efl.Ui.Spin can hold numbers 1 to 7, but display the strings "Monday" thru "Sunday". diff --git a/src/lib/elementary/efl_ui_grid.eo b/src/lib/elementary/efl_ui_grid.eo index 708d96f1c0..0b8be563df 100644 --- a/src/lib/elementary/efl_ui_grid.eo +++ b/src/lib/elementary/efl_ui_grid.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Grid extends Efl.Ui.Collection +class Efl.Ui.Grid extends Efl.Ui.Collection { [[A scrollable grid of @Efl.Ui.Item objects, typically @Efl.Ui.Grid_Default_Item objects. @@ -8,7 +8,7 @@ class @beta Efl.Ui.Grid extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. @Efl.Ui.Grid supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_grid_default_item.eo b/src/lib/elementary/efl_ui_grid_default_item.eo index 86000405cc..d2b0501265 100644 --- a/src/lib/elementary/efl_ui_grid_default_item.eo +++ b/src/lib/elementary/efl_ui_grid_default_item.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Grid_Default_Item extends Efl.Ui.Default_Item +class Efl.Ui.Grid_Default_Item extends Efl.Ui.Default_Item { [[Default Item class to be used inside @Efl.Ui.Grid containers. The $icon part is in the middle, the $extra part overlaps it on its upper-right corner. diff --git a/src/lib/elementary/efl_ui_grid_view.c b/src/lib/elementary/efl_ui_grid_view.c new file mode 100644 index 0000000000..4c5ac044b7 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.c @@ -0,0 +1,26 @@ +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif + +#define ELM_LAYOUT_PROTECTED +#define EFL_UI_SCROLL_MANAGER_PROTECTED +#define EFL_UI_SCROLLBAR_PROTECTED + +#include + +#define MY_CLASS EFL_UI_GRID_VIEW_CLASS +#define MY_CLASS_PFX efl_ui_grid_view + +#define MY_CLASS_NAME "Efl.Ui.Grid_View" + +EOLIAN static Eo * +_efl_ui_grid_view_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) +{ + obj = efl_constructor(efl_super(obj, MY_CLASS)); + + efl_ui_collection_view_position_manager_set(obj, efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS)); + + return obj; +} + +#include "efl_ui_grid_view.eo.c" diff --git a/src/lib/elementary/efl_ui_grid_view.eo b/src/lib/elementary/efl_ui_grid_view.eo new file mode 100644 index 0000000000..18e513e8c9 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.eo @@ -0,0 +1,17 @@ +class @beta Efl.Ui.Grid_View extends Efl.Ui.Collection_View +{ + [[A scrollable grid of @Efl.Ui.Item objects, typically @Efl.Ui.Grid_Default_Item objects. + + Items are added asynchronously by an @Efl.Ui.Factory from the definition of an @Efl.Model. + + The orientation (vertical or horizontal) of the grid can be set with + @Efl.Ui.Layout_Orientable.orientation. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + data: null; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 9cde2f803b..f732d44add 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -141,7 +141,7 @@ _efl_ui_image_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); return ECORE_CALLBACK_RENEW; } @@ -871,6 +871,9 @@ _efl_ui_image_efl_object_constructor(Eo *obj, Efl_Ui_Image_Data *pd) pd->scale_type = EFL_GFX_IMAGE_SCALE_METHOD_FIT; pd->self = obj; + /* legacy elm_image starts paused */ + pd->paused = elm_widget_is_legacy(obj); + pd->playback_speed = 1; return obj; } @@ -930,8 +933,11 @@ _efl_ui_image_efl_file_load(Eo *obj, Efl_Ui_Image_Data *sd) if (sd->anim) { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); - sd->play = EINA_FALSE; + sd->paused = elm_widget_is_legacy(obj); sd->anim = EINA_FALSE; + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; } if (file && _efl_ui_image_is_remote(file)) @@ -967,8 +973,11 @@ _efl_ui_image_efl_file_unload(Eo *obj, Efl_Ui_Image_Data *sd) if (sd->anim) { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); - sd->play = EINA_FALSE; + sd->paused = elm_widget_is_legacy(obj); sd->anim = EINA_FALSE; + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; } if (sd->prev_img) @@ -1716,32 +1725,32 @@ _efl_ui_image_efl_ui_draggable_drag_target_get(const Eo *obj EINA_UNUSED, Efl_Ui EAPI Eina_Bool elm_image_animated_available_get(const Evas_Object *obj) { - return efl_player_playable_get(obj); + return efl_playable_get(obj); } EOLIAN static Eina_Bool -_efl_ui_image_efl_player_playable_get(const Eo *obj, Efl_Ui_Image_Data *sd) +_efl_ui_image_efl_playable_playable_get(const Eo *obj, Efl_Ui_Image_Data *sd) { if (sd->edje) return EINA_TRUE; return evas_object_image_animated_get(elm_image_object_get(obj)); } -static void +static Eina_Bool _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool anim) { anim = !!anim; - if (sd->anim == anim) return; - - sd->anim = anim; + if (sd->anim == anim) return EINA_TRUE; if (sd->edje) { edje_object_animation_set(sd->img, anim); - return; + sd->anim = anim; + return EINA_TRUE; } sd->img = elm_image_object_get(obj); - if (!evas_object_image_animated_get(sd->img)) return; + if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE; + sd->anim = anim; if (anim) { @@ -1751,13 +1760,18 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an evas_object_image_animated_frame_duration_get (sd->img, sd->cur_frame, 0); evas_object_image_animated_frame_set(sd->img, sd->cur_frame); + if (!sd->paused)//legacy + sd->anim_timer = ecore_timer_add + (sd->frame_duration / sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { sd->frame_count = -1; sd->cur_frame = -1; sd->frame_duration = -1; + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } + return EINA_TRUE; } static Eina_Bool @@ -1784,34 +1798,104 @@ elm_image_animated_get(const Evas_Object *obj) return _efl_ui_image_animated_get_internal(obj, sd); } -static void -_efl_ui_image_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play) +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool playing) { - if (!sd->anim) return; - if (sd->play == play) return; - sd->play = play; + return _efl_ui_image_animated_set_internal(obj, sd, playing); +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) +{ + return _efl_ui_image_animated_get_internal(obj, sd); +} + +EOLIAN static void +_efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor) +{ + EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); + EINA_SAFETY_ON_TRUE_RETURN(EINA_DBL_EQ(factor, 0.0)); + if (EINA_DBL_EQ(sd->playback_speed, factor)) return; + sd->playback_speed = factor; + if (sd->edje) + efl_player_playback_speed_set(sd->img, factor); + else if (sd->anim_timer) + { + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); + ecore_timer_reset(sd->anim_timer); + } +} + +EOLIAN static double +_efl_ui_image_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + return sd->playback_speed; +} + +EOLIAN static void +_efl_ui_image_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double sec) +{ + EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0); + if (sd->edje) + efl_player_playback_position_set(sd->img, sec); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + { + /* validate total animation time */ + EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec); + sd->cur_frame = lround(sec / sd->frame_duration); + } +} + +EOLIAN static double +_efl_ui_image_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + if (sd->edje) + efl_player_playback_position_get(sd->img); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return sd->cur_frame * sd->frame_duration; + return 0.0; +} + +EOLIAN static double +_efl_ui_image_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + if (sd->edje) + efl_player_playback_progress_get(sd->img); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + return 0.0; +} + +static Eina_Bool +_efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + if (!sd->anim) return EINA_FALSE; + if (sd->paused == paused) return EINA_TRUE; + sd->paused = paused; if (sd->edje) { - edje_object_play_set(sd->img, play); - return; + edje_object_play_set(sd->img, !paused); + return EINA_TRUE; } - if (play) + if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } + return EINA_TRUE; } static Eina_Bool -_efl_ui_image_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +_efl_ui_image_animated_paused_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) { if (sd->edje) - return edje_object_play_get(sd->img); - return sd->play; + return !edje_object_play_get(sd->img); + return sd->paused; } EAPI void @@ -1819,7 +1903,7 @@ elm_image_animated_play_set(Elm_Image *obj, Eina_Bool play) { Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS); if (!sd) return; - _efl_ui_image_animated_play_set_internal(obj, sd, play); + _efl_ui_image_animated_paused_set_internal(obj, sd, !play); } EAPI Eina_Bool @@ -1827,21 +1911,19 @@ elm_image_animated_play_get(const Elm_Image *obj) { Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS); if (!sd) return EINA_FALSE; - return _efl_ui_image_animated_play_get_internal(obj, sd); -} - -EOLIAN static void -_efl_ui_image_efl_player_play_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play) -{ - if (play && !_efl_ui_image_animated_get_internal(obj, sd)) - _efl_ui_image_animated_set_internal(obj, sd, play); - _efl_ui_image_animated_play_set_internal(obj, sd, play); + return _efl_ui_image_animated_paused_get_internal(obj, sd); } EOLIAN static Eina_Bool -_efl_ui_image_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Data *sd) +_efl_ui_image_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) { - return _efl_ui_image_animated_play_get_internal(obj, sd); + return _efl_ui_image_animated_paused_set_internal(obj, sd, paused); +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_paused_get(const Eo *obj, Efl_Ui_Image_Data *sd) +{ + return _efl_ui_image_animated_paused_get_internal(obj, sd); } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 80bb886f6d..f4a8dbcb32 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -16,8 +16,8 @@ struct @beta Efl.Ui.Image_Error open_error: bool; [[$true if the error happened when opening the file, $false otherwise]] } -class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.Draggable, - Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Gfx.View, +class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.Draggable, + Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Playable, Efl.Gfx.View, Efl.Access.Component, Efl.Access.Widget.Action, Efl.Gfx.Color, Efl.Gfx.Image_Orientable, Efl.Layout.Calc, Efl.Layout.Group, Efl.Layout.Signal, @@ -97,8 +97,12 @@ class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, E Efl.Gfx.Image.scale_hint { get; set; } Efl.Gfx.Image.content_hint { get; set; } Efl.Gfx.Image.image_load_error { get; } - Efl.Player.playable { get; } - Efl.Player.play { get; set; } + Efl.Playable.playable { get; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } + Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get; } + Efl.Player.playback_speed { get; set; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c index 4d0c139e8b..f8034040aa 100644 --- a/src/lib/elementary/efl_ui_image_factory.c +++ b/src/lib/elementary/efl_ui_image_factory.c @@ -15,12 +15,23 @@ typedef struct _Efl_Ui_Image_Factory_Data Eina_Stringshare *property; } Efl_Ui_Image_Factory_Data; +static void +_efl_ui_image_factory_building(void *data, const Efl_Event *ev) +{ + Efl_Ui_Image_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = ev->info; + + efl_ui_property_bind(ui_view, "filename", pd->property); +} + EOLIAN static Eo * _efl_ui_image_factory_efl_object_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd) { obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_ui_widget_factory_item_class_set(obj, EFL_UI_IMAGE_CLASS); + efl_event_callback_add(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_image_factory_building, pd); + pd->property = NULL; return obj; @@ -35,34 +46,12 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa efl_destructor(efl_super(obj, MY_CLASS)); } -static Eina_Value -_efl_ui_image_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value) -{ - Efl_Ui_Image_Factory_Data *pd = data; - Efl_Gfx_Entity *entity; - int len, i; - - EINA_VALUE_ARRAY_FOREACH(&value, len, i, entity) - efl_ui_property_bind(entity, "filename", pd->property); - - return value; -} - EOLIAN static Eina_Future * -_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) +_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models) { - Eina_Future *f; - - if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); - f = efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); - - return efl_future_then(obj, f, - .success_type = EINA_VALUE_TYPE_ARRAY, - .success = _efl_ui_image_factory_bind, - .data = pd); + return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models); } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 44836ab05b..910854ee16 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -276,7 +276,7 @@ _grid_load(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,start", "efl"); + "efl,state,busy,started", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); @@ -294,7 +294,7 @@ _grid_load(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,stop", "efl"); + "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOADED_DETAIL, NULL); @@ -498,7 +498,7 @@ _grid_clear(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,stop", "efl"); + "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); @@ -536,7 +536,7 @@ _tile_preloaded_cb(void *data, "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,stop", + (wd->resize_obj, "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call @@ -745,7 +745,7 @@ _main_img_preloaded_cb(void *data, (wd->resize_obj, "elm,state,busy,stop", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,stop", "efl"); + (wd->resize_obj, "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOADED_DETAIL, NULL); @@ -1550,9 +1550,9 @@ _efl_ui_image_zoomable_bar_show_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); } } @@ -1573,9 +1573,9 @@ _efl_ui_image_zoomable_bar_hide_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); } } @@ -1658,7 +1658,7 @@ _efl_ui_image_zoomable_edje_object_attach(Eo *obj) (obj, "drag,page", "efl.dragable.vbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_add - (obj, "efl,vbar,press", "efl", + (obj, "efl,vertical_bar,press", "efl", obj, _efl_ui_image_zoomable_vbar_press_cb, NULL); efl_layout_signal_callback_add (obj, "efl,vbar,unpress", "efl", @@ -1682,7 +1682,7 @@ _efl_ui_image_zoomable_edje_object_attach(Eo *obj) (obj, "drag,page", "efl.dragable.hbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_add - (obj, "efl,hbar,press", "efl", + (obj, "efl,horizontal_bar,press", "efl", obj, _efl_ui_image_zoomable_hbar_press_cb, NULL); efl_layout_signal_callback_add (obj, "efl,hbar,unpress", "efl", @@ -1769,7 +1769,7 @@ _efl_ui_image_zoomable_edje_object_detach(Evas_Object *obj) (obj, "drag,page", "efl.dragable.vbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_del - (obj, "efl,vbar,press", "efl", + (obj, "efl,vertical_bar,press", "efl", obj, _efl_ui_image_zoomable_vbar_press_cb, NULL); efl_layout_signal_callback_del (obj, "efl,vbar,unpress", "efl", @@ -1793,7 +1793,7 @@ _efl_ui_image_zoomable_edje_object_detach(Evas_Object *obj) (obj, "drag,page", "efl.dragable.hbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_del - (obj, "efl,hbar,press", "efl", + (obj, "efl,horizontal_bar,press", "efl", obj, _efl_ui_image_zoomable_hbar_press_cb, NULL); efl_layout_signal_callback_del (obj, "efl,hbar,unpress", "efl", @@ -1938,12 +1938,13 @@ _efl_ui_image_zoomable_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Image_Z } EOLIAN static Eo * -_efl_ui_image_zoomable_efl_object_constructor(Eo *obj, Efl_Ui_Image_Zoomable_Data *_pd EINA_UNUSED) +_efl_ui_image_zoomable_efl_object_constructor(Eo *obj, Efl_Ui_Image_Zoomable_Data *pd) { obj = efl_constructor(efl_super(obj, MY_CLASS)); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_IMAGE); legacy_object_focus_handle(obj); + pd->playback_speed = 1; return obj; } @@ -2053,7 +2054,7 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, (wd->resize_obj, "elm,state,busy,start", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,start", "efl"); + (wd->resize_obj, "efl,state,busy,started", "efl"); efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); } @@ -2138,7 +2139,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret (wd->resize_obj, "elm,state,busy,start", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,start", "efl"); + (wd->resize_obj, "efl,state,busy,started", "efl"); efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); } @@ -3003,7 +3004,7 @@ _efl_ui_image_zoomable_gesture_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Ima } EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_player_playable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +_efl_ui_image_zoomable_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) { if (sd->edje) return EINA_TRUE; return evas_object_image_animated_get(sd->img); @@ -3017,39 +3018,6 @@ _efl_ui_image_zoomable_animated_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_I return sd->anim; } -static void -_efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim) -{ - anim = !!anim; - if (sd->anim == anim) return; - - sd->anim = anim; - - if (sd->edje) - { - edje_object_animation_set(sd->edje, anim); - return; - } - - if (!evas_object_image_animated_get(sd->img)) return; - - if (anim) - { - sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); - sd->cur_frame = 1; - sd->frame_duration = - evas_object_image_animated_frame_duration_get - (sd->img, sd->cur_frame, 0); - evas_object_image_animated_frame_set(sd->img, sd->cur_frame); - } - else - { - sd->frame_count = -1; - sd->cur_frame = -1; - sd->frame_duration = -1; - } -} - static Eina_Bool _efl_ui_image_zoomable_animate_cb(void *data) { @@ -3067,55 +3035,152 @@ _efl_ui_image_zoomable_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); return ECORE_CALLBACK_RENEW; } -static void -_efl_ui_image_zoomable_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play) +static Eina_Bool +_efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim) { - if (!sd->anim) return; - if (sd->play == play) return; - sd->play = play; + anim = !!anim; + if (sd->anim == anim) return EINA_TRUE; + if (sd->edje) { - edje_object_play_set(sd->edje, play); - return; + sd->anim = anim; + edje_object_animation_set(sd->edje, anim); + return EINA_TRUE; } - if (play) + + if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE; + sd->anim = anim; + if (anim) + { + sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); + sd->cur_frame = 1; + sd->frame_duration = + evas_object_image_animated_frame_duration_get + (sd->img, sd->cur_frame, 0); + evas_object_image_animated_frame_set(sd->img, sd->cur_frame); + if (!sd->paused)//legacy + sd->anim_timer = ecore_timer_add + (sd->frame_duration / sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); + } + else + { + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); + } + return EINA_TRUE; +} + +static Eina_Bool +_efl_ui_image_zoomable_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + if (!sd->anim) return EINA_FALSE; + if (sd->paused == paused) return EINA_TRUE; + sd->paused = paused; + if (sd->edje) + { + edje_object_play_set(sd->edje, !paused); + return EINA_TRUE; + } + if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); } else { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } -} - -EOLIAN static void -_efl_ui_image_zoomable_efl_player_play_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play) -{ - evas_object_image_preload(sd->img, EINA_FALSE); - if (play && !_efl_ui_image_zoomable_animated_get_internal(obj, sd)) - _efl_ui_image_zoomable_animated_set_internal(obj, sd, play); - - _efl_ui_image_zoomable_animated_play_set_internal(obj, sd, play); -} - -static Eina_Bool -_efl_ui_image_zoomable_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) -{ - if (sd->edje) - return edje_object_play_get(sd->edje); - return sd->play; + return EINA_TRUE; } EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd) +_efl_ui_image_zoomable_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playing) { - return _efl_ui_image_zoomable_animated_play_get_internal(obj, sd); + return _efl_ui_image_zoomable_animated_set_internal(obj, sd, playing); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused) +{ + return _efl_ui_image_zoomable_animated_paused_set_internal(obj, sd, paused); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd) +{ + return _efl_ui_image_zoomable_animated_get_internal(obj, sd); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + return !edje_object_play_get(sd->edje); + return sd->paused; +} + +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double factor) +{ + EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); + EINA_SAFETY_ON_TRUE_RETURN(EINA_DBL_EQ(factor, 0.0)); + if (EINA_DBL_EQ(sd->playback_speed, factor)) return; + sd->playback_speed = factor; + if (sd->edje) + efl_player_playback_speed_set(sd->edje, factor); + else if (sd->anim_timer) + { + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); + ecore_timer_reset(sd->anim_timer); + } +} + +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + return sd->playback_speed; +} + +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double sec) +{ + EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0); + if (sd->edje) + efl_player_playback_position_set(sd->edje, sec); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + { + /* validate total animation time */ + EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec); + sd->cur_frame = lround(sec / sd->frame_duration); + } +} + +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + efl_player_playback_position_get(sd->edje); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return sd->cur_frame * sd->frame_duration; + return 0.0; +} + +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + efl_player_playback_progress_get(sd->edje); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + return 0.0; } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 4b48388dd1..d5443b54f8 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -2,7 +2,7 @@ struct @extern Elm.Photocam.Error; [[Photocam error information.]] struct @extern Elm.Photocam.Progress; [[Photocam progress information.]] -class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom +class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar { [[Elementary Image Zoomable class]] @@ -43,8 +43,12 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Gfx.View.view_size { get; } Efl.Gfx.Image.image_size { get; } Efl.Ui.Image.icon { set; get; } - Efl.Player.playable { get; } - Efl.Player.play { get; set; } + Efl.Playable.playable { get; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } + Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get; } + Efl.Player.playback_speed { get; set; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h index d8b95ebaba..e892c1f63c 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_private.h +++ b/src/lib/elementary/efl_ui_image_zoomable_private.h @@ -125,6 +125,7 @@ struct _Efl_Ui_Image_Zoomable_Data Ecore_Timer *anim_timer; double frame_duration; + double playback_speed; int cur_frame; int frame_count; @@ -140,7 +141,6 @@ struct _Efl_Ui_Image_Zoomable_Data Eina_Bool on_hold : 1; Eina_Bool paused : 1; Eina_Bool orientation_changed : 1; - Eina_Bool play : 1; Eina_Bool anim : 1; Eina_Bool freeze_want : 1; Eina_Bool show_item: 1; diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 1b0c4f1a46..3dce9c3837 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -208,9 +208,34 @@ _efl_ui_item_item_parent_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd) return pd->parent; } +EOLIAN static void +_efl_ui_item_calc_locked_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Eina_Bool locked) +{ + pd->locked = !!locked; +} + +EOLIAN static Eina_Bool +_efl_ui_item_calc_locked_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd) +{ + return pd->locked; +} + +EOLIAN static void +_efl_ui_item_efl_canvas_group_group_need_recalculate_set(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED, Eina_Bool value) +{ + // Prevent recalc when the item are stored in the cache + // As due to async behavior, we can still have text updated from future that just finished after + // we have left the releasing stage of factories. This is the simplest way to prevent those later + // update. + if (pd->locked) return; + efl_canvas_group_need_recalculate_set(efl_super(obj, EFL_UI_ITEM_CLASS), value); +} + ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_item, Efl_Ui_Item_Data) #include "efl_ui_item.eo.c" #include "efl_ui_selectable.eo.c" #include "efl_ui_multi_selectable.eo.c" #include "efl_ui_single_selectable.eo.c" +#include "efl_ui_item_clickable.eo.c" + diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo index 148a112be3..9f05b1ea1f 100644 --- a/src/lib/elementary/efl_ui_item.eo +++ b/src/lib/elementary/efl_ui_item.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Efl.Input.Clickable +abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Efl.Input.Clickable { [[Selectable Item abstraction. @@ -54,6 +54,17 @@ abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectab parent : Efl.Ui.Item; } } + @property calc_locked { + [[If the item has its calc locked it will not trigger @Efl.Canvas.Group.group_need_recalculate.set done. + + This is done automatically by @Efl.Ui.Widget_Factory, but you can use this information to meaningfully set the hint when items are not @.calc_locked. + ]] + set {} + get {} + values { + locked: bool; [[If set to $true, no more @Efl.Canvas.Group.group_need_recalculate.set]] + } + } } implements { Efl.Object.constructor; @@ -61,5 +72,6 @@ abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectab Efl.Object.destructor; Efl.Ui.Selectable.selected {get; set;} Efl.Ui.Widget.widget_input_event_handler; + Efl.Canvas.Group.group_need_recalculate { set; } } } diff --git a/src/lib/elementary/efl_ui_item_clickable.eo b/src/lib/elementary/efl_ui_item_clickable.eo new file mode 100644 index 0000000000..5f92a5fbce --- /dev/null +++ b/src/lib/elementary/efl_ui_item_clickable.eo @@ -0,0 +1,19 @@ +import efl_input_clickable; + +struct Efl.Ui.Item_Clickable_Clicked { + clicked: Efl.Input.Clickable_Clicked; + item: Efl.Ui.Item; +} + +interface Efl.Ui.Item_Clickable +{ + [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] + event_prefix: efl_ui; + events { + item,pressed : Efl.Ui.Item_Clickable_Clicked; [[A $press event occurred over an item.]] + item,unpressed : Efl.Ui.Item_Clickable_Clicked; [[An $unpress event occurred over an item.]] + item,longpressed : Efl.Ui.Item_Clickable_Clicked; [[A $longpressed event occurred over an item.]] + item,clicked : Efl.Ui.Item_Clickable_Clicked; [[A $clicked event occurred over an item.]] + item,clicked,any : Efl.Ui.Item_Clickable_Clicked; [[A $clicked,any event occurred over an item.]] + } +} \ No newline at end of file diff --git a/src/lib/elementary/efl_ui_item_private.h b/src/lib/elementary/efl_ui_item_private.h index cd8300b6a2..5c1ef268bf 100644 --- a/src/lib/elementary/efl_ui_item_private.h +++ b/src/lib/elementary/efl_ui_item_private.h @@ -11,6 +11,7 @@ typedef struct _Efl_Ui_Item_Data // Boolean Data Eina_Bool selected : 1; /* State for item selected */ + Eina_Bool locked : 1; } Efl_Ui_Item_Data; diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index bcc947ba22..98f76e1749 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -70,6 +70,13 @@ static const char *_efl_ui_layout_swallow_parts[] = { NULL }; +typedef struct _Deferred_Version_Signal +{ + Eina_Stringshare *old_sig; + Eina_Stringshare *new_sig; + unsigned int version_threshold; +} Deferred_Version_Signal; + typedef struct _Efl_Ui_Layout_Factory_Tracking Efl_Ui_Layout_Factory_Tracking; struct _Efl_Ui_Layout_Factory_Tracking @@ -222,25 +229,45 @@ _efl_ui_layout_subobjs_calc_set(Eo *obj, Eina_Bool set) sd->calc_subobjs = !!set; } +static void +_defer_version_signal(Efl_Ui_Layout_Data *sd, Eina_Stringshare *old_sig, Eina_Stringshare *new_sig, unsigned int version_threshold) +{ + Deferred_Version_Signal dvs; + if (!sd->deferred_signals) + sd->deferred_signals = eina_inarray_new(sizeof(Deferred_Version_Signal), 5); + EINA_SAFETY_ON_NULL_RETURN(sd->deferred_signals); + dvs.old_sig = old_sig; + dvs.new_sig = new_sig; + dvs.version_threshold = version_threshold; + eina_inarray_push(sd->deferred_signals, &dvs); +} + /* common content cases for layout objects: icon and text */ static inline void -_signals_emit(Eo *obj, +_signals_emit(Efl_Ui_Layout_Data *sd, const char *type, Eina_Bool set) { char buf[1024]; - if (elm_widget_is_legacy(obj)) + if (elm_widget_is_legacy(sd->obj)) { snprintf(buf, sizeof(buf), "elm,state,%s,%s", type, set ? "visible" : "hidden"); - efl_layout_signal_emit(obj, buf, "elm"); + efl_layout_signal_emit(sd->obj, buf, "elm"); } else { - snprintf(buf, sizeof(buf), "efl,state,%s,%s", type, - set ? "set" : "unset"); - efl_layout_signal_emit(obj, buf, "efl"); + char buf2[1024]; + char *use = buf; + if (sd->version >= 123) // efl,state,(content|text),(set|unset) -> efl,(content|text),(set|unset) + use = buf2; + snprintf(buf, sizeof(buf), "efl,state,%s,%s", type, set ? "set" : "unset"); + snprintf(buf2, sizeof(buf2), "efl,%s,%s", type, set ? "set" : "unset"); + if (efl_finalized_get(sd->obj)) + efl_layout_signal_emit(sd->obj, use, "efl"); + else + _defer_version_signal(sd, eina_stringshare_add(buf), eina_stringshare_add(buf2), 123); } } @@ -291,7 +318,7 @@ _icon_signal_emit(Efl_Ui_Layout_Data *sd, type = sub_d->part; } - _signals_emit(sd->obj, type, visible); + _signals_emit(sd, type, visible); /* themes might need immediate action here */ efl_layout_signal_process(sd->obj, EINA_FALSE); @@ -339,7 +366,7 @@ _text_signal_emit(Efl_Ui_Layout_Data *sd, type = sub_d->part; } - _signals_emit(sd->obj, type, visible); + _signals_emit(sd, type, visible); /* TODO: is this right? It was like that, but IMO it should be removed: */ @@ -492,12 +519,13 @@ _efl_ui_layout_base_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Layout_Data *_pd } static Eina_Error -_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd) +_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_Data **widget_data) { Eina_Error ret = EFL_UI_THEME_APPLY_ERROR_GENERIC; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC); + *widget_data = wd; /* function already prints error messages, if any */ if (!sd->file_set) { @@ -521,11 +549,14 @@ EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) { Eina_Error theme_apply_ret, theme_apply_internal_ret; + Elm_Widget_Smart_Data *wd = NULL; + char buf[64]; + static unsigned int version = 0; theme_apply_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC; - theme_apply_internal_ret = _efl_ui_layout_theme_internal(obj, sd); + theme_apply_internal_ret = _efl_ui_layout_theme_internal(obj, sd, &wd); if (theme_apply_internal_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC; @@ -537,6 +568,67 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(0, 0)); if (elm_widget_is_legacy(obj)) efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(0, 0)); + else + { + const char *version = edje_object_data_get(wd->resize_obj, "version"); + if (!version) + { + ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + return EFL_UI_THEME_APPLY_ERROR_VERSION; + } + else + { + errno = 0; + sd->version = strtoul(version, NULL, 10); + if (errno) + { + ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + sd->version = 0; + return EFL_UI_THEME_APPLY_ERROR_VERSION; + } + } + } + if (sd->deferred_signals) + { + do + { + Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals); + + if (sd->version < dvs->version_threshold) + efl_layout_signal_emit(sd->obj, dvs->old_sig, "efl"); + else + efl_layout_signal_emit(sd->obj, dvs->new_sig, "efl"); + eina_stringshare_del(dvs->old_sig); + eina_stringshare_del(dvs->new_sig); + } while (eina_inarray_count(sd->deferred_signals)); + ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free); + } + if (!version) + { + snprintf(buf, sizeof(buf), "%d%d", EFL_VERSION_MAJOR, EFL_VERSION_MINOR); + errno = 0; + version = strtoul(buf, NULL, 10); + if (errno) + { + ERR("something broke in theme parsing, this system is probably busted"); + version = 0; + } + } + if (version && (!_running_in_tree)) + { + if (sd->version < version) + WRN("Widget(%p) with type '%s' is providing a potentially old version in its theme: found %u, should be %u", obj, + efl_class_name_get(efl_class_get(obj)), sd->version, version); + else if (sd->version > version) + { + CRI("Widget(%p) with type '%s' is attempting to use a theme that is too new: found %u, should be %u", obj, + efl_class_name_get(efl_class_get(obj)), sd->version, version); + CRI("\tTheme file: %s\tTheme group: %s", efl_file_get(obj), efl_file_key_get(obj)); + return EFL_UI_THEME_APPLY_ERROR_VERSION; + } + } return EFL_UI_THEME_APPLY_ERROR_NONE; } @@ -655,14 +747,14 @@ _elm_layout_part_aliasing_eval(const Evas_Object *obj, *part = efl_ui_default_text; else *part = efl_ui_default_content; + return EINA_TRUE; } - return EINA_TRUE; } if (is_text) - aliases = elm_layout_text_aliases_get(obj); + aliases = efl_ui_layout_text_aliases_get(obj); else - aliases = elm_layout_content_aliases_get(obj); + aliases = efl_ui_layout_content_aliases_get(obj); while (aliases && aliases->alias && aliases->real_part) { @@ -853,6 +945,17 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd) sd->connect.signals = NULL; eina_hash_free(sd->connect.factories); sd->connect.factories = NULL; + if (sd->deferred_signals) + { + do + { + Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals); + + eina_stringshare_del(dvs->old_sig); + eina_stringshare_del(dvs->new_sig); + } while (eina_inarray_count(sd->deferred_signals)); + ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free); + } /* let's make our Edje object the *last* to be processed, since it * may (smart) parent other sub objects here */ @@ -2193,14 +2296,14 @@ _content_created(Eo *obj, void *data, const Eina_Value value) { Efl_Ui_Layout_Factory_Request *request = data; Efl_Gfx_Entity *content = NULL; - Efl_Gfx_Entity *old_content; + Efl_Gfx_Entity *old_content[1]; int len, i; EINA_VALUE_ARRAY_FOREACH(&value, len, i, content) { // Recycle old content - old_content = efl_content_get(efl_part(obj, request->key)); - if (old_content) efl_ui_factory_release(request->factory, old_content); + old_content[0] = efl_content_get(efl_part(obj, request->key)); + if (old_content[0]) efl_ui_factory_release(request->factory, EINA_C_ARRAY_ITERATOR_NEW(old_content)); // Set new content efl_content_set(efl_part(obj, request->key), content); @@ -2238,9 +2341,7 @@ _efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_F request->tracking = tracking; models[0] = efl_ui_view_model_get(pd->obj); - f = efl_ui_view_factory_create_with_event(tracking->factory, - EINA_C_ARRAY_ITERATOR_NEW(models), - pd->obj); + f = efl_ui_view_factory_create_with_event(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(models)); f = efl_future_then(pd->obj, f, .success = _content_created, .success_type = EINA_VALUE_TYPE_ARRAY, @@ -2366,7 +2467,7 @@ _efl_ui_layout_base_model_register(Eo *obj, Efl_Ui_Layout_Data *pd, EINA_ITERATOR_FOREACH(it, tuple) { Efl_Ui_Layout_Factory_Tracking *factory; - Efl_Gfx_Entity *content; + Efl_Gfx_Entity *content[1]; key = tuple->key; factory = tuple->data; @@ -2375,11 +2476,11 @@ _efl_ui_layout_base_model_register(Eo *obj, Efl_Ui_Layout_Data *pd, if (factory->in_flight) eina_future_cancel(factory->in_flight); // Cleanup content - content = efl_content_get(efl_part(obj, key)); + content[0] = efl_content_get(efl_part(obj, key)); efl_content_unset(efl_part(obj, key)); // And recycle it - if (content) efl_ui_factory_release(factory->factory, content); + if (content[0]) efl_ui_factory_release(factory->factory, EINA_C_ARRAY_ITERATOR_NEW(content)); } eina_iterator_free(it); @@ -2479,16 +2580,16 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da return 0; } -EOLIAN static void +EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *key, Efl_Ui_Factory *factory) { - EINA_SAFETY_ON_NULL_RETURN(key); + EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY); Efl_Ui_Layout_Factory_Tracking *tracking; Eina_Stringshare *ss_key; if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE)) - return; + return EFL_PROPERTY_ERROR_INVALID_KEY; // Check if there is a model and register it _efl_ui_layout_base_model_watch(obj, pd); @@ -2502,12 +2603,12 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui tracking = eina_hash_find(pd->connect.factories, ss_key); if (tracking) { - Efl_Gfx_Entity *old; + Efl_Gfx_Entity *old[1]; // Unset and recycle - old = efl_content_get(efl_part(obj, ss_key)); + old[0] = efl_content_get(efl_part(obj, ss_key)); efl_content_unset(efl_part(obj, ss_key)); - if (old) efl_ui_factory_release(tracking->factory, old); + if (old[0]) efl_ui_factory_release(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(old)); // Stop in flight request if (tracking->in_flight) eina_future_cancel(tracking->in_flight); @@ -2518,7 +2619,7 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui else { tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking)); - if (!tracking) return ; + if (!tracking) return ENOMEM; tracking->key = ss_key; @@ -2529,6 +2630,8 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui tracking->factory = efl_ref(factory); _efl_ui_layout_view_model_content_update(pd, tracking, ss_key); + + return EINA_ERROR_NO_ERROR; } EOLIAN void @@ -2849,18 +2952,18 @@ _efl_ui_layout_base_theme_rotation_apply(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UN /* Internal EO APIs and hidden overrides */ -EFL_FUNC_BODY_CONST(elm_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) -EFL_FUNC_BODY_CONST(elm_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) +EFL_FUNC_BODY_CONST(efl_ui_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) +EFL_FUNC_BODY_CONST(efl_ui_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_LAYOUT_BASE_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_layout_base), \ ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_layout_base), \ ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout_base), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_base_efl_object_dbg_info_get) diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index 0ebbb4e1cd..f8ff7a9e39 100644 --- a/src/lib/elementary/efl_ui_layout.eo +++ b/src/lib/elementary/efl_ui_layout.eo @@ -2,7 +2,7 @@ import efl_ui; class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File { - [[Elementary layout class + [[EFL layout widget class. When loading layouts from a file, use the @Efl.File.key property to specify the group that the data belongs to, in case it's an EET file diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index 4f4624744a..aa616c777a 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -5,7 +5,19 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, Efl.Layout.Calc, Efl.Layout.Signal, Efl.Layout.Group { - [[Elementary layout abstract + [[EFL layout widget abstract. + + A "layout" in the context of EFL is an object which interfaces with the internal layout engine. + Layouts are created using the EDC language, and any widget which implements this abstract must + have a corresponding theme group to load in order to graphically display anything. + + Theme groups for EFL widgets must be versioned. This means having a "version" $[data.item] key in + the theme group for the widget. If the loaded theme group for a widget has version info which + is lower than the currently-running EFL version, a warning will be printed to notify the user that + new features may be available. If the loaded theme group for a widget has no version info, an + error will be generated. If the loaded theme group for a widget has a version that is newer than + the currently-running EFL version, a critical error will be printed to notify the user that + the theme may not be compatible. @since 1.22 ]] diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c index 58c8235b9e..b6032e70e9 100644 --- a/src/lib/elementary/efl_ui_layout_factory.c +++ b/src/lib/elementary/efl_ui_layout_factory.c @@ -44,6 +44,22 @@ _factory_bind(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, vo return EINA_TRUE; } +static void +_efl_ui_layout_factory_building(void *data, const Efl_Event *event) +{ + Efl_Ui_Layout_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = event->info; + + if (pd->klass || pd->group || pd->style) + efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style); + + eina_hash_foreach(pd->bind.properties, _property_bind, ui_view); + eina_hash_foreach(pd->bind.factories, _factory_bind, ui_view); + + efl_gfx_hint_weight_set(ui_view, EFL_GFX_HINT_EXPAND, 0); + efl_gfx_hint_fill_set(ui_view, EINA_TRUE, EINA_TRUE); +} + EOLIAN static Eo * _efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Data *pd) { @@ -54,6 +70,8 @@ _efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Dat pd->bind.properties = eina_hash_stringshared_new(EINA_FREE_CB(eina_stringshare_del)); pd->bind.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref)); + efl_event_callback_add(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_layout_factory_building, pd); + return obj; } @@ -70,49 +88,7 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data efl_destructor(efl_super(obj, MY_CLASS)); } -static Eina_Value -_efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value) -{ - Efl_Ui_Layout_Factory_Data *pd = data; - Efl_Gfx_Entity *layout; - int len, i; - - EINA_VALUE_ARRAY_FOREACH(&value, len, i, layout) - { - eina_hash_foreach(pd->bind.properties, _property_bind, layout); - eina_hash_foreach(pd->bind.factories, _factory_bind, layout); - - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - } - - return value; -} - -static void -_efl_ui_layout_factory_efl_ui_factory_building(const Eo *obj, Efl_Ui_Layout_Factory_Data *pd, Efl_Gfx_Entity *ui_view) -{ - if (pd->klass || pd->group || pd->style) - efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style); - - efl_ui_factory_building(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), ui_view); -} - -EOLIAN static Eina_Future * -_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) -{ - Eina_Future *f; - - f = efl_ui_factory_create(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), models, parent); - - return efl_future_then(obj, f, - .success_type = EINA_VALUE_TYPE_ARRAY, - .success = _efl_ui_layout_factory_bind, - .data = pd); -} - -EOLIAN static void +EOLIAN static Eina_Error _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, const char *key, Efl_Ui_Factory *factory) { @@ -123,7 +99,7 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl if (factory == NULL) { eina_hash_del(pd->bind.factories, ss_key, NULL); - return; + return EINA_ERROR_NO_ERROR; } f_old = eina_hash_set(pd->bind.factories, ss_key, efl_ref(factory)); @@ -132,6 +108,8 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl efl_unref(f_old); eina_stringshare_del(ss_key); } + + return EINA_ERROR_NO_ERROR; } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_layout_factory.eo b/src/lib/elementary/efl_ui_layout_factory.eo index d6d473e655..ac15fcc73d 100644 --- a/src/lib/elementary/efl_ui_layout_factory.eo +++ b/src/lib/elementary/efl_ui_layout_factory.eo @@ -15,8 +15,6 @@ class @beta Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.Ui.Factory.create; - Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; Efl.Ui.Factory_Bind.factory_bind; } diff --git a/src/lib/elementary/efl_ui_layout_pack.c b/src/lib/elementary/efl_ui_layout_pack.c index 0e2743db01..b043ffa112 100644 --- a/src/lib/elementary/efl_ui_layout_pack.c +++ b/src/lib/elementary/efl_ui_layout_pack.c @@ -269,7 +269,7 @@ _efl_ui_layout_part_table_efl_pack_unpack(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Tab EOLIAN static Eina_Bool _efl_ui_layout_part_table_efl_pack_pack(Eo *obj, Efl_Ui_Layout_Table_Data *pd, Efl_Gfx_Entity *subobj) { - int last_col, last_row; + int last_col = 0, last_row = 0; int req_cols, req_rows; Eina_Iterator *iter; Eo *pack, *element; diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index 4af260c190..37173c2e0e 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.List extends Efl.Ui.Collection +class Efl.Ui.List extends Efl.Ui.Collection { [[A scrollable list of @Efl.Ui.Item objects, typically @Efl.Ui.List_Default_Item objects. @@ -8,7 +8,7 @@ class @beta Efl.Ui.List extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. @Efl.Ui.List supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top or left side of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_list_default_item.eo b/src/lib/elementary/efl_ui_list_default_item.eo index 7e8e3cb3b0..0a251d931a 100644 --- a/src/lib/elementary/efl_ui_list_default_item.eo +++ b/src/lib/elementary/efl_ui_list_default_item.eo @@ -1,5 +1,5 @@ -class @beta Efl.Ui.List_Default_Item extends Efl.Ui.Default_Item +class Efl.Ui.List_Default_Item extends Efl.Ui.Default_Item { [[Default Item class to be used inside @Efl.Ui.List containers. It displays the three parts in horizontal order: $icon, $text and $extra. diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index e74e15c792..efc3dfe50e 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c @@ -1,1041 +1,22 @@ #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif -#define EFL_ACCESS_OBJECT_PROTECTED -#define EFL_ACCESS_SELECTION_PROTECTED -#define EFL_UI_SCROLL_MANAGER_PROTECTED -#define EFL_UI_SCROLLBAR_PROTECTED -#define EFL_UI_FOCUS_COMPOSITION_PROTECTED -#define EFL_UI_WIDGET_FOCUS_MANAGER_PROTECTED -#include "elm_priv.h" -#include "efl_ui_list_view_private.h" -#include "efl_ui_list_view_precise_layouter.eo.h" +#include -#include +#define MY_CLASS EFL_UI_LIST_VIEW_CLASS +#define MY_CLASS_PFX efl_ui_list_view -#define MY_CLASS EFL_UI_LIST_VIEW_CLASS #define MY_CLASS_NAME "Efl.Ui.List_View" -#define MY_PAN_CLASS EFL_UI_LIST_VIEW_PAN_CLASS - -#define SIG_CHILD_ADDED "child,added" -#define SIG_CHILD_REMOVED "child,removed" -#define SELECTED_PROP "selected" - -static const Evas_Smart_Cb_Description _smart_callbacks[] = { - {SIG_CHILD_ADDED, ""}, - {SIG_CHILD_REMOVED, ""}, - {NULL, NULL} -}; - -void _efl_ui_list_view_custom_layout(Efl_Ui_List_View *); -void _efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item*, Eina_Bool); - -static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); -static Eina_Bool _key_action_select(Evas_Object *obj, const char *params); -static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params); - -static const Elm_Action key_actions[] = { - {"move", _key_action_move}, - {"select", _key_action_select}, - {"escape", _key_action_escape}, - {NULL, NULL} -}; - -EOLIAN static void -_efl_ui_list_view_pan_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); - evas_object_smart_changed(psd->wobj); -} - - -EOLIAN static void -_efl_ui_list_view_pan_efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd, Eina_Position2D pos) -{ - if ((pos.x == psd->gmt.x) && (pos.y == psd->gmt.y)) return; - - psd->gmt.x = pos.x; - psd->gmt.y = pos.y; - - efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos); - evas_object_smart_changed(psd->wobj); -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - return psd->gmt.pos; -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_max_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - EFL_UI_LIST_VIEW_DATA_GET(psd->wobj, pd); - Eina_Rect vgmt = {}; - Eina_Size2D min = {}; - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->scrl_mgr); - min = efl_ui_list_view_model_min_size_get(psd->wobj); - - min.w = min.w - vgmt.w; - if (min.w < 0) min.w = 0; - min.h = min.h - vgmt.h; - if (min.h < 0) min.h = 0; - - return EINA_POSITION2D(min.w, min.h); -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_min_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd EINA_UNUSED) -{ - return EINA_POSITION2D(0, 0); -} - -EOLIAN static Eina_Size2D -_efl_ui_list_view_pan_efl_ui_pan_content_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - Eina_Size2D min = {}; - min = efl_ui_list_view_model_min_size_get(psd->wobj); - - return min; -} - -EOLIAN static void -_efl_ui_list_view_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Pan_Data *psd EINA_UNUSED) -{ - efl_destructor(efl_super(obj, MY_PAN_CLASS)); -} - -#include "efl_ui_list_view_pan.eo.c" - -static Eina_Bool -_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) -{ - Eina_Iterator *properties; - const char *property; - Eina_Bool ret = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE); - - properties = efl_model_properties_get(model); - EINA_ITERATOR_FOREACH(properties, property) - { - if (property == propfind || - !strcmp(property, propfind)) - { - ret = EINA_TRUE; - break; - } - } - eina_iterator_free(properties); - - return ret; -} - -static void -_list_element_focused(void *data EINA_UNUSED, const Efl_Event *ev) -{ - Eina_Rect geom; - Eina_Position2D pos; - Efl_Ui_Focus_Object *focused = efl_ui_focus_manager_focus_get(ev->object); - - if (!focused) return; - - EFL_UI_LIST_VIEW_DATA_GET(ev->object, pd); - geom = efl_ui_focus_object_focus_geometry_get(focused); - pos = efl_ui_scrollable_content_pos_get(pd->scrl_mgr); - - geom.x += pos.x; - geom.y += pos.y; - efl_ui_scrollable_scroll(pd->scrl_mgr, geom, EINA_TRUE); -} - -static void -_on_item_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Evas_Event_Mouse_Down *ev = event_info; - Efl_Ui_List_View_Layout_Item *item = data; - Eina_Value *v; - Eina_Bool select; - - if (ev->button != 1) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - - v = efl_model_property_get(item->children, SELECTED_PROP); - if (!eina_value_get(v, &select)) - { - WRN("Could not get the select value"); - eina_value_free(v); - return; - } - _efl_ui_list_view_item_select_set(item, !select); - eina_value_free(v); -} - -EOLIAN static void -_efl_ui_list_view_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Elm_Object_Select_Mode mode) -{ - if (pd->select_mode == mode) - return; - - pd->select_mode = mode; -} - -EOLIAN static Elm_Object_Select_Mode -_efl_ui_list_view_select_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->select_mode; -} - -EOLIAN static void -_efl_ui_list_view_default_style_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Eina_Stringshare *style) -{ - eina_stringshare_replace(&pd->style, style); -} - -EOLIAN static Eina_Stringshare * -_efl_ui_list_view_default_style_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->style; -} - -EOLIAN static void -_efl_ui_list_view_homogeneous_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Eina_Bool homogeneous) -{ - pd->homogeneous = homogeneous; -} - -EOLIAN static Eina_Bool -_efl_ui_list_view_homogeneous_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->homogeneous; -} - -EOLIAN static void -_efl_ui_list_view_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Position2D pos) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) - return; - - efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); - evas_object_smart_changed(pd->obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Size2D size) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h)) - return; - - efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size); - - evas_object_smart_changed(pd->obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - if (!pd->model) - return; - - efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array); - -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, Evas_Object *member) -{ - efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member); -} - -//Scrollable Implement -static void -_efl_ui_list_view_bar_read_and_update(Eo *obj) -{ - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - double vx, vy; - - edje_object_part_drag_value_get - (wd->resize_obj, "efl.dragable.vbar", NULL, &vy); - edje_object_part_drag_value_get - (wd->resize_obj, "efl.dragable.hbar", &vx, NULL); - - efl_ui_scrollbar_bar_position_set(pd->scrl_mgr, vx, vy); - - efl_canvas_group_change(pd->pan_obj); -} - -static void -_efl_ui_list_view_reload_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - efl_ui_scrollbar_bar_visibility_update(pd->scrl_mgr); -} - -static void -_efl_ui_list_view_vbar_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); - - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAGGED, &type); -} - -static void -_efl_ui_list_view_vbar_press_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESSED, &type); -} - -static void -_efl_ui_list_view_vbar_unpress_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESSED, &type); -} - -static void -_efl_ui_list_view_edje_drag_start_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - _efl_ui_list_view_bar_read_and_update(data); - - pd->scrl_freeze = efl_ui_scrollable_scroll_freeze_get(pd->scrl_mgr); - efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, EINA_TRUE); - efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_STARTED, NULL); -} - -static void -_efl_ui_list_view_edje_drag_stop_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - _efl_ui_list_view_bar_read_and_update(data); - - efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, pd->scrl_freeze); - efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_FINISHED, NULL); -} - -static void -_efl_ui_list_view_edje_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); -} - -static void -_efl_ui_list_view_hbar_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); - - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAGGED, &type); -} - -static void -_efl_ui_list_view_hbar_press_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESSED, &type); -} - -static void -_efl_ui_list_view_hbar_unpress_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESSED, &type); -} - -static void -_efl_ui_list_view_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Eo *obj = data; - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - double width = 0.0, height = 0.0; - - efl_ui_scrollbar_bar_size_get(pd->scrl_mgr, &width, &height); - - edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.hbar", width, 1.0); - edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.vbar", 1.0, height); -} - -static void -_efl_ui_list_view_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Eo *obj = data; - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - double posx = 0.0, posy = 0.0; - - efl_ui_scrollbar_bar_position_get(pd->scrl_mgr, &posx, &posy); - - edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.hbar", posx, 0.0); - edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.vbar", 0.0, posy); -} - -static void -_efl_ui_list_view_bar_show_cb(void *data, const Efl_Event *event) -{ - Eo *obj = data; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); - - if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); - else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); -} - -static void -_efl_ui_list_view_bar_hide_cb(void *data, const Efl_Event *event) -{ - Eo *obj = data; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); - - if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); - else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); -} - -static Eina_Bool -_efl_ui_list_view_efl_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_add(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - -static Eina_Bool -_efl_ui_list_view_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_del(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - -static void -_efl_ui_list_view_edje_object_attach(Eo *obj) -{ - efl_layout_signal_callback_add - (obj, "reload", "efl", - obj, _efl_ui_list_view_reload_cb, NULL); - //Vertical bar - efl_layout_signal_callback_add - (obj, "drag", "efl.dragable.vbar", - obj, _efl_ui_list_view_vbar_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,set", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,start", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,stop", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,step", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,page", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,vbar,press", "efl", - obj, _efl_ui_list_view_vbar_press_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,vbar,unpress", "efl", - obj, _efl_ui_list_view_vbar_unpress_cb, NULL); - - //Horizontal bar - efl_layout_signal_callback_add - (obj, "drag", "efl.dragable.hbar", - obj, _efl_ui_list_view_hbar_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,set", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,start", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,stop", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,step", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,page", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,hbar,press", "efl", - obj, _efl_ui_list_view_hbar_press_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,hbar,unpress", "efl", - obj, _efl_ui_list_view_hbar_unpress_cb, NULL); -} - -static void -_efl_ui_list_view_edje_object_detach(Evas_Object *obj) -{ - efl_layout_signal_callback_del - (obj, "reload", "efl", - obj, _efl_ui_list_view_reload_cb, NULL); - //Vertical bar - efl_layout_signal_callback_del - (obj, "drag", "efl.dragable.vbar", - obj, _efl_ui_list_view_vbar_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,set", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,start", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,stop", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,step", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,page", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,vbar,press", "efl", - obj, _efl_ui_list_view_vbar_press_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,vbar,unpress", "efl", - obj, _efl_ui_list_view_vbar_unpress_cb, NULL); - - //Horizontal bar - efl_layout_signal_callback_del - (obj, "drag", "efl.dragable.hbar", - obj, _efl_ui_list_view_hbar_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,set", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,start", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,stop", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,step", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,page", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,hbar,press", "efl", - obj, _efl_ui_list_view_hbar_press_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,hbar,unpress", "efl", - obj, _efl_ui_list_view_hbar_unpress_cb, NULL); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Efl_Ui_List_View_Pan_Data *pan_data; - Eina_Size2D min = {}; - Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; - Evas_Object *o; - - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - efl_canvas_group_add(efl_super(obj, MY_CLASS)); - - elm_widget_can_focus_set(obj, EINA_TRUE); - - if (!elm_layout_theme_set(obj, "list_view", "base", elm_widget_style_get(obj))) - CRI("Failed to set layout!"); - - pd->scrl_mgr = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj, - efl_ui_mirrored_set(efl_added, efl_ui_mirrored_get(obj))); - efl_composite_attach(obj, pd->scrl_mgr); - pd->pan_obj = efl_add(MY_PAN_CLASS, obj); - pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS); - pan_data->wobj = obj; - - efl_ui_scroll_manager_pan_set(pd->scrl_mgr, pd->pan_obj); - efl_ui_scrollable_bounce_enabled_set(pd->scrl_mgr, bounce, bounce); - - edje_object_part_swallow(wd->resize_obj, "efl.content", pd->pan_obj); - edje_object_freeze(wd->resize_obj); - o = (Evas_Object *)edje_object_part_object_get(wd->resize_obj, "efl.dragable.vbar"); - edje_object_thaw(wd->resize_obj); - efl_gfx_stack_raise_to_top((Eo *)o); - - efl_gfx_entity_visible_set(pd->pan_obj, EINA_TRUE); - efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED); - - edje_object_size_min_calc(wd->resize_obj, &min.w, &min.h); - efl_gfx_hint_size_restricted_min_set(obj, min); - - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED, - _efl_ui_list_view_bar_size_changed_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED, - _efl_ui_list_view_bar_pos_changed_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW, - _efl_ui_list_view_bar_show_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE, - _efl_ui_list_view_bar_hide_cb, obj); - - _efl_ui_list_view_edje_object_attach(obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_del(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - efl_ui_list_view_relayout_model_set(pd->relayout, NULL); - - ELM_SAFE_FREE(pd->pan_obj, efl_del); - efl_canvas_group_del(efl_super(obj, MY_CLASS)); -} - -EOLIAN static Efl_Ui_Focus_Manager* -_efl_ui_list_view_efl_ui_widget_focus_manager_focus_manager_create(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) -{ - if (!pd->manager) - pd->manager = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, obj, - efl_ui_focus_manager_root_set(efl_added, root)); - - return pd->manager; -} - -EOLIAN static Eo * -_efl_ui_list_view_efl_object_finalize(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - if (!pd->factory) - { - pd->factory = efl_new(EFL_UI_LAYOUT_FACTORY_CLASS); - efl_ui_layout_factory_theme_config(pd->factory, "list_item", NULL, "default"); - } - - if(!pd->relayout) - { - pd->relayout = efl_new(EFL_UI_LIST_VIEW_PRECISE_LAYOUTER_CLASS); - efl_ui_list_view_relayout_model_set(pd->relayout, pd->model); - } - return obj; -} - -EOLIAN static Eo * -_efl_ui_list_view_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Data *pd) +static Eo * +_efl_ui_list_view_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) { obj = efl_constructor(efl_super(obj, MY_CLASS)); - pd->obj = obj; - efl_canvas_object_type_set(obj, MY_CLASS_NAME); - evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); - efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST); - pd->seg_array = efl_ui_list_view_seg_array_setup(32); - - efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, _list_element_focused, NULL); - - efl_ui_focus_composition_logical_mode_set(obj, EINA_TRUE); - - pd->style = eina_stringshare_add(elm_widget_style_get(obj)); - - pd->factory = NULL; - pd->min.w = 0; - pd->min.h = 0; + efl_ui_collection_view_position_manager_set(obj, efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS)); return obj; } -EOLIAN static void -_efl_ui_list_view_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - efl_event_callback_del(obj, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, - _list_element_focused, NULL); - - _efl_ui_list_view_edje_object_detach(obj); - - efl_replace(&pd->model, NULL); - efl_replace(&pd->relayout, NULL); - efl_replace(&pd->factory, NULL); - - efl_ui_list_view_seg_array_free(pd->seg_array); - - eina_stringshare_del(pd->style); - efl_destructor(efl_super(obj, MY_CLASS)); -} - -EOLIAN static void -_efl_ui_list_view_layout_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Efl_Ui_Factory *factory) -{ - efl_replace(&pd->factory, factory); -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Efl_Model *model) -{ - if (!efl_replace(&pd->model, model)) - return; - - efl_ui_list_view_seg_array_flush(pd->seg_array); - - if (pd->relayout) - efl_ui_list_view_relayout_model_set(pd->relayout, pd->model); - - evas_object_smart_changed(pd->obj); -} - -EOLIAN static Efl_Model * -_efl_ui_list_view_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->model; -} - -EOLIAN int -_efl_ui_list_view_efl_access_selection_selected_children_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return eina_list_count(pd->selected_items); -} - -EOLIAN Eo* -_efl_ui_list_view_efl_access_selection_selected_child_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, int child_index) -{ - if(child_index < (int) eina_list_count(pd->selected_items)) - { - Efl_Ui_List_View_Layout_Item* items = eina_list_nth(pd->selected_items, child_index); - return items[child_index].layout; - } - else - return NULL; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_all_children_select(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED) -{ - return EINA_TRUE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_access_selection_clear(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED) -{ - return EINA_TRUE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_move(Evas_Object *obj EINA_UNUSED, const char *params EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_select(Evas_Object *obj EINA_UNUSED, const char *params EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED) -{ - efl_ui_focus_manager_reset_history(obj); - return EINA_TRUE; -} - -void -_efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item *item, Eina_Bool selected) -{ - Eina_Stringshare *sprop; - assert(item != NULL); - assert(item->children != NULL); - - selected = !!selected; - - sprop = eina_stringshare_add(SELECTED_PROP); - - if (_efl_model_properties_has(item->children, sprop)) - { - Eina_Value v; - eina_value_setup(&v, EINA_VALUE_TYPE_BOOL); - eina_value_set(&v, selected); - efl_model_property_set(item->children, sprop, &v); - eina_value_flush(&v); - } - eina_stringshare_del(sprop); -} - -static Eina_Value -_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) -{ - Efl_Ui_List_View_Data *pd = data; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) - goto on_error; - - efl_ui_list_view_seg_array_insert_value(pd->seg_array, pd->slice.start, v); - - pd->seg_array_first = pd->slice.start; - pd->slice.start = pd->slice.count = 0; - pd->slice.future = NULL; - - efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array); - on_error: - return v; -} - -/* EFL UI LIST MODEL INTERFACE */ -EOLIAN static Eina_Size2D -_efl_ui_list_view_efl_ui_list_view_model_min_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->min; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_min_size_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Size2D min) -{ - Eina_Size2D sz; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - pd->min.w = min.w; - pd->min.h = min.h; - - efl_gfx_hint_size_min_set(wd->resize_obj, EINA_SIZE2D(pd->min.w, pd->min.h)); - sz = pd->min; - efl_event_callback_call(pd->pan_obj, EFL_UI_PAN_EVENT_PAN_CONTENT_SIZE_CHANGED, &sz); -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_focus_composition_prepare(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Eina_List *order = efl_ui_list_view_relayout_elements_get(pd->relayout); - efl_ui_focus_composition_elements_set(obj, order); -} - -EOLIAN Eina_List* -_efl_ui_list_view_efl_access_object_access_children_get(const Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Eina_List *ret = NULL, *ret2 = NULL; - - ret = efl_ui_list_view_relayout_elements_get(pd->relayout); - ret2 = efl_access_object_access_children_get(efl_super(obj, EFL_UI_LIST_VIEW_CLASS)); - - return eina_list_merge(ret, ret2); -} - -EOLIAN static Eina_Bool -_efl_ui_list_view_efl_ui_widget_focus_state_apply(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED) -{ - return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); -} - -typedef struct _Efl_Ui_List_Vuew_Layout_Item_Tracking Efl_Ui_List_View_Layout_Item_Tracking; -struct _Efl_Ui_List_Vuew_Layout_Item_Tracking -{ - Efl_Ui_List_View_Layout_Item *item; - Efl_Ui_List_View_Data *pd; -}; - -static Eina_Value -_content_created(Eo *obj, void *data, const Eina_Value value) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking = data; - Efl_Ui_List_View_Layout_Item *item = tracking->item; - Efl_Ui_List_View_Item_Event evt; - - if (eina_value_array_count(&value) != 1) return eina_value_error_init(EINVAL); - eina_value_array_get(&value, 0, &item->layout); - - efl_canvas_group_member_add(tracking->pd->pan_obj, item->layout); - evas_object_event_callback_add(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); - - if (_elm_config->atspi_mode) - { - efl_access_added(item->layout); - efl_access_children_changed_added_signal_emit(obj, item->layout); - } - - evt.child = item->children; - evt.layout = item->layout; - evt.index = efl_ui_list_view_item_index_get(item); - efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, &evt); - - tracking->item->layout_request = NULL; - efl_ui_list_view_relayout_content_created(tracking->pd->relayout, item); - - efl_ui_focus_composition_dirty(obj); - evas_object_show(item->layout); - - return value; -} - -static void -_clean_request(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking = data; - - tracking->item->layout_request = NULL; - free(tracking); -} - -EOLIAN static Efl_Ui_List_View_Layout_Item * -_efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking; - Efl_Model *childrens[1]; - EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item); - - if (!item->children) return item; - - if (item->layout_request) eina_future_cancel(item->layout_request); - - tracking = calloc(1, sizeof (Efl_Ui_List_View_Layout_Item_Tracking)); - if (!tracking) return item; - - tracking->item = item; - tracking->pd = pd; - childrens[0] = item->children; - - item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, - EINA_C_ARRAY_ITERATOR_NEW(childrens), - obj); - item->layout_request = efl_future_then(obj, item->layout_request, - .success = _content_created, - .success_type = EINA_VALUE_TYPE_ARRAY, - .data = tracking, - .free = _clean_request); - - return item; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_unrealize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Item_Event evt; - EINA_SAFETY_ON_NULL_RETURN(item); - - if (!item->layout) - return; - - // First check if the item has been fully realized - if (item->layout_request) - { - eina_future_cancel(item->layout_request); - return ; - } - - evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); - if (elm_object_focus_allow_get(item->layout)) - { - if (efl_ui_focus_object_focus_get(item->layout)) - efl_ui_focus_object_focus_set(item->layout, EINA_FALSE); - efl_ui_focus_manager_calc_unregister(obj, item->layout); - } - evas_object_hide(item->layout); - evas_object_move(item->layout, -9999, -9999); - - evt.child = item->children; - evt.layout = item->layout; - evt.index = efl_ui_list_view_item_index_get(item); - efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, &evt); - - efl_canvas_group_member_remove(obj, pd->pan_obj); - efl_ui_factory_release(pd->factory, item->layout); - item->layout = NULL; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_load_range_set(Eo* obj, Efl_Ui_List_View_Data* pd, int first, int count) -{ - if (pd->slice.future) return ; - - pd->slice.start = first; - pd->slice.count = count; - - if (efl_model_children_count_get(pd->model)) - { - Eina_Future *f = efl_model_children_slice_get(pd->model, first, count); - f = eina_future_then(f, _children_slice_then, pd, NULL); - pd->slice.future = efl_future_then(obj, f); - } -} - -EOLIAN static int -_efl_ui_list_view_efl_ui_list_view_model_model_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return efl_model_children_count_get(pd->model); -} - -ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_list_view, Efl_Ui_List_View_Data) - -/* Internal EO APIs and hidden overrides */ - -#define EFL_UI_LIST_VIEW_EXTRA_OPS \ - EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_list_view) - #include "efl_ui_list_view.eo.c" -#include "efl_ui_list_view_relayout.eo.c" -#include "efl_ui_list_view_model.eo.c" diff --git a/src/lib/elementary/efl_ui_list_view.eo b/src/lib/elementary/efl_ui_list_view.eo index d552ce4793..c4de87da5a 100644 --- a/src/lib/elementary/efl_ui_list_view.eo +++ b/src/lib/elementary/efl_ui_list_view.eo @@ -1,97 +1,17 @@ -import elm_general; - -struct @beta Efl.Ui.List_View_Item_Event +class @beta Efl.Ui.List_View extends Efl.Ui.Collection_View { - [[Information related to item events.]] // TODO: This needs to be filled in. - layout: Efl.Ui.Layout; [[TBD]] - child: Efl.Model; [[TBD]] - index: int; [[TBD]] -} -class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements - Efl.Access.Widget.Action, Efl.Access.Selection, - Efl.Ui.Focus.Composition, Efl.Ui.Focus.Manager_Sub, - Efl.Ui.Container_Selectable, Efl.Ui.List_View_Model, - Efl.Ui.Widget_Focus_Manager - composites - Efl.Ui.Scrollable, Efl.Ui.Scrollbar -{ - methods { - @property homogeneous { - [[When in homogeneous mode, all items have the same height and width. - Otherwise, each item's size is respected. - ]] - get { - } - set { - } - values { - homogeneous: bool; [[Homogeneous mode setting. Default is $false.]] - } - } - @property select_mode { - [[Listview select mode.]] - get {} - set {} - values { - mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode.]] - } - } - @property default_style { - [[TBD]] // TODO: This needs to be filled in. Does not seem to be in use. - values { - style: stringshare; [[TBD]] - } - } - @property layout_factory { - [[Listview layout factory set.]] - set {} - values { - factory: Efl.Ui.Factory; [[The factory.]] - } - } - } - events { - item,realized : Efl.Ui.List_View_Item_Event; - item,unrealized : Efl.Ui.List_View_Item_Event; - item,focused : Efl.Ui.List_View_Item_Event; - item,unfocused : Efl.Ui.List_View_Item_Event; - item,highlighted : Efl.Ui.List_View_Item_Event; - item,unhighlighted : Efl.Ui.List_View_Item_Event; - } + [[A scrollable list of @Efl.Ui.Item objects, typically @Efl.Ui.List_Default_Item objects. + Items are added asynchronously by an @Efl.Ui.Factory from the definition of an @Efl.Model. + + The orientation (vertical or horizontal) of the list can be set with + @Efl.Ui.Layout_Orientable.orientation. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + data: null; implements { Efl.Object.constructor; - Efl.Object.finalize; - Efl.Object.destructor; - Efl.Gfx.Entity.position { set; } - Efl.Gfx.Entity.size { set; } - // Smart obj - Efl.Canvas.Group.group_member_add; - Efl.Canvas.Group.group_calculate; - - Efl.Ui.List_View_Model.load_range { set;} - Efl.Ui.List_View_Model.realize; - Efl.Ui.List_View_Model.unrealize; - Efl.Ui.List_View_Model.model_size { get; } - Efl.Ui.List_View_Model.min_size { get; set; } - - // Widget - Efl.Ui.Widget_Focus_Manager.focus_manager_create; - Efl.Ui.Widget.widget_input_event_handler; - Efl.Ui.Widget.focus_state_apply; - Efl.Ui.Focus.Composition.prepare; - Efl.Ui.View.model { get; set; } - - Efl.Layout.Signal.signal_callback_add; - Efl.Layout.Signal.signal_callback_del; - Efl.Access.Object.access_children { get; } - Efl.Access.Selection.selected_children_count { get; } - Efl.Access.Selection.selected_child { get; } - Efl.Access.Selection.selected_child_deselect; - Efl.Access.Selection.child_select; - Efl.Access.Selection.child_deselect; - Efl.Access.Selection.is_child_selected; - Efl.Access.Selection.all_children_select; - Efl.Access.Selection.access_selection_clear; } } diff --git a/src/lib/elementary/efl_ui_list_view_model.eo b/src/lib/elementary/efl_ui_list_view_model.eo deleted file mode 100644 index cf4780ed5f..0000000000 --- a/src/lib/elementary/efl_ui_list_view_model.eo +++ /dev/null @@ -1,41 +0,0 @@ -import efl_ui_list_view_types; - -interface @beta Efl.Ui.List_View_Model -{ - methods { - @property load_range { - set {} - values { - first: int; - count: int; - } - } - realize { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - return: ptr(Efl.Ui.List_View_Layout_Item); - } - unrealize { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - } - @property model_size { - get {} - values { - s: int; - } - } - @property min_size { - [[Minimal content size.]] - set {} - get {} - values { - min: Eina.Size2D; - } - } - - - } -} diff --git a/src/lib/elementary/efl_ui_list_view_pan.eo b/src/lib/elementary/efl_ui_list_view_pan.eo deleted file mode 100644 index 1bd72a8300..0000000000 --- a/src/lib/elementary/efl_ui_list_view_pan.eo +++ /dev/null @@ -1,12 +0,0 @@ -class @beta Efl.Ui.List_View_Pan extends Efl.Ui.Pan -{ - [[Elementary Efl_Ui_List_View pan class]] - implements { - Efl.Object.destructor; - Efl.Ui.Pan.content_size { get; } - Efl.Ui.Pan.pan_position { get; set; } - Efl.Ui.Pan.pan_position_min { get; } - Efl.Ui.Pan.pan_position_max { get; } - Efl.Canvas.Group.group_calculate; - } -} diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.c b/src/lib/elementary/efl_ui_list_view_precise_layouter.c deleted file mode 100644 index a7ee6ec102..0000000000 --- a/src/lib/elementary/efl_ui_list_view_precise_layouter.c +++ /dev/null @@ -1,728 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include - -#include - -#include "elm_priv.h" -#include "efl_ui_list_view_relayout.eo.h" -#include "efl_ui_list_view_seg_array.h" - -#define MY_CLASS EFL_UI_LIST_VIEW_PRECISE_LAYOUTER_CLASS - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Data -{ - Efl_Model* model; - Efl_Ui_List_View_Model *modeler; - Ecore_Job *calc_job; - Efl_Ui_List_View_Seg_Array *seg_array; - - Eina_Size2D min; - - unsigned int calc_progress; - - int count_total; - - Eina_Bool initialized : 1; - Eina_Bool recalc : 1; - Eina_Bool resize : 1; -} Efl_Ui_List_View_Precise_Layouter_Data; - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Node_Data -{ - Eina_Size2D min; - Eina_Size2D size; - - Eina_Bool realized; -} Efl_Ui_List_View_Precise_Layouter_Node_Data; - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Callback_Data -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - Efl_Ui_List_View_Layout_Item *item; -} Efl_Ui_List_View_Precise_Layouter_Callback_Data; - -#include "efl_ui_list_view_precise_layouter.eo.h" - -static void _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *); -static Eina_Bool _initilize(Eo *, Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Model*, Efl_Ui_List_View_Seg_Array*); -static void _finalize(Eo *, Efl_Ui_List_View_Precise_Layouter_Data*); -static void _node_realize(Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Seg_Array_Node*); -static void _node_unrealize(Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Seg_Array_Node*); - -static void -_item_size_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item) -{ - int boxx, boxy, boxw, boxh, boxl, boxr, boxt, boxb, pad[4]; - double align[2]; - Eina_Bool fill[2]; - Eina_Size2D max; - - efl_gfx_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]); - evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh); - efl_gfx_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); - efl_gfx_hint_align_get(item->layout, &align[0], &align[1]); - efl_gfx_hint_fill_get(item->layout, &fill[0], &fill[1]); - max = efl_gfx_hint_size_combined_max_get(item->layout); - - // box outer margin - boxw -= boxl + boxr; - boxh -= boxt + boxb; - boxx += boxl; - boxy += boxt; - - if (EINA_DBL_EQ(align[0], -1)) - { - align[0] = 0.5; - fill[0] = EINA_TRUE; - } - else if (align[0] < 0) - { - align[0] = 0; - } - if (EINA_DBL_EQ(align[1], -1)) - { - align[1] = 0.5; - fill[1] = EINA_TRUE; - } - else if (align[1] < 0) - { - align[1] = 0; - } - - if (align[0] > 1) align[0] = 1; - if (align[1] > 1) align[1] = 1; - - if (max.w <= 0) max.w = INT_MAX; - if (max.h <= 0) max.h = INT_MAX; - if (max.w < item->min.w) max.w = item->min.w; - if (max.h < item->min.h) max.h = item->min.h; - - // horizontally - if (max.w < INT_MAX) - { - item->size.w = MIN(MAX(item->min.w - pad[0] - pad[1], max.w), boxw); - item->pos.x = boxx + pad[0]; - } - else if (fill[0]) - { - // fill x - item->size.w = boxw - pad[0] - pad[1]; - item->pos.x = boxx + pad[0]; - } - else - { - item->size.w = item->min.w - pad[0] - pad[1]; - item->pos.x = boxx + ((boxw - item->size.w) * align[0]) + pad[0]; - } - - // vertically - if (max.h < INT_MAX) - { - item->size.h = MIN(MAX(item->min.h - pad[2] - pad[3], max.h), boxh); - item->pos.y = boxy + pad[2]; - } - else if (fill[1]) - { - // fill y - item->size.h = item->min.h - pad[2] - pad[3]; - item->pos.y = boxy + pad[2]; - } - else - { - item->size.h = item->min.h - pad[2] - pad[3]; - item->pos.y = boxy + ((item->min.h - item->size.h) * align[1]) + pad[2]; - } -} - -static Eina_Size2D -_item_min_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item) -{ - Efl_Ui_List_View_Seg_Array_Node *itemnode = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Efl_Ui_List_View_Layout_Item *layout_item; - int i, pad[4]; - - Eina_Size2D min = efl_gfx_hint_size_combined_min_get(item->layout); - - efl_gfx_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]); - min.w += pad[0] + pad[1]; - min.h += pad[2] + pad[3]; - - if (item->min.h == min.h && item->min.w == min.w) - return min; - - EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode, min); - EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode->layout_data, min); - nodedata = itemnode->layout_data; - - pd->min.h += min.h - item->min.h; - nodedata->min.h += min.h - item->min.h; - - if (nodedata->min.w <= min.w) - nodedata->min.w = min.w; - else if (nodedata->min.w == item->min.w) - { - nodedata->min.w = 0; - for (i = 0; i != itemnode->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i]; - if (nodedata->min.w < layout_item->min.w) - nodedata->min.w = layout_item->min.w; - - if (item->min.w == layout_item->min.w) - break; - } - } - - if (pd->min.w <= min.w) - pd->min.w = min.w; - else if (pd->min.w == item->min.w) - { - Efl_Ui_List_View_Seg_Array_Node *node2; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - pd->min.w = min.w; - - EINA_ACCESSOR_FOREACH(nodes, i, node2) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata2 = node2->layout_data; - if (pd->min.w < nodedata2->min.w) - pd->min.w = nodedata2->min.w; - - if (item->min.w == nodedata2->min.w) - break; - } - eina_accessor_free(nodes); - } - - item->min.w = min.w; - item->min.h = min.h; - return item->min; -} - -static void -_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data = data; - Efl_Ui_List_View_Precise_Layouter_Data *pd = cb_data->pd; - Efl_Ui_List_View_Layout_Item *item = cb_data->item;; - Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - - _item_min_calc(pd, item); - if (!nodedata->realized) - { - free(evas_object_event_callback_del(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change)); - efl_ui_list_view_model_unrealize(pd->modeler, item); - } -} - -static void -_on_modeler_resize(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - pd->resize = EINA_TRUE; -} - -typedef struct _Request Request; -struct _Request -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - unsigned int index; -}; - -static Eina_Value -_children_get(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) -{ - Request *r = data; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) - goto on_error; - - efl_ui_list_view_seg_array_insert_value(r->pd->seg_array, r->index, v); - r->pd->recalc = EINA_TRUE; - evas_object_smart_changed(r->pd->modeler); - - on_error: - free(r); - return v; -} - -static void -_child_added_cb(void *data, const Efl_Event *event) -{ - Efl_Model_Children_Event* evt = event->info; - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - Eina_Future *f; - Request *r; - - r = calloc(1, sizeof (Request)); - if (!r) return; - - r->index = evt->index; - r->pd = pd; - - f = efl_model_children_slice_get(pd->model, evt->index, 1); - f = eina_future_then(f, _children_get, r, NULL); -} - -static void -_child_removed_cb(void *data, const Efl_Event *event) -{ - Efl_Model_Children_Event* evt = event->info; - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - Efl_Ui_List_View_Layout_Item *layout_item, *litem; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Efl_Ui_List_View_Seg_Array_Node *itemnode; - int i; - - litem = efl_ui_list_view_seg_array_remove(pd->seg_array, evt->index); - if (!litem) return; - - itemnode = litem->tree_node; - nodedata = itemnode->layout_data; - - free(evas_object_event_callback_del(litem->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change)); - - pd->min.h -= litem->min.h; - nodedata->min.h -= litem->min.h; - - if (nodedata->min.w == litem->min.w) - nodedata->min.w = 0; - - for (i = 0; i != itemnode->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i]; - if (nodedata->min.w < layout_item->min.w) - nodedata->min.w = layout_item->min.w; - - if (litem->min.w == layout_item->min.w) - { - nodedata->min.w = layout_item->min.w; - break; - } - } - - if (pd->min.w == litem->min.w) - { - Efl_Ui_List_View_Seg_Array_Node *node2; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - pd->min.w = 0; - - EINA_ACCESSOR_FOREACH(nodes, i, node2) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata2 = node2->layout_data; - if (pd->min.w < nodedata2->min.w) - pd->min.w = nodedata2->min.w; - - if (litem->min.w == nodedata2->min.w) - break; - } - eina_accessor_free(nodes); - } - efl_ui_list_view_model_unrealize(pd->modeler, litem); - - free(litem); - pd->recalc = EINA_TRUE; - evas_object_smart_changed(pd->modeler); -} - -static void -_child_count_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - pd->count_total = efl_model_children_count_get(pd->model); - if (pd->count_total) - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _child_count_changed_cb, pd); -} - -static Eina_Bool -_initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Model *modeler, Efl_Ui_List_View_Seg_Array *seg_array) -{ - if(pd->initialized) - return EINA_TRUE; - - efl_replace(&pd->modeler, modeler); - - if(!pd->model || !pd->modeler) - return EINA_FALSE; - - pd->recalc = EINA_TRUE; - pd->initialized = EINA_TRUE; - - pd->seg_array = seg_array; - - efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd); - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd); - - evas_object_event_callback_add(modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); - pd->min.w = 0; - pd->min.h = 0; - - return EINA_TRUE; -} - -static void -_finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - int i = 0; - - if (pd->model) - { - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd); - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd); - pd->count_total = 0; - } - - if (pd->seg_array) - { - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, node) - { - _node_unrealize(pd, node); - free(node->layout_data); - } - - eina_accessor_free(nodes); - } - - pd->min.w = 0; - pd->min.h = 0; - - if (pd->modeler) - { - evas_object_event_callback_del_full(pd->modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); - efl_ui_list_view_model_min_size_set(pd->modeler, pd->min); - } - - pd->seg_array = NULL; - efl_replace(&pd->modeler, NULL); - - pd->initialized = EINA_FALSE; - pd->recalc = EINA_TRUE; -} - -static void -_node_realize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node) -{ - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - int i; - - EINA_SAFETY_ON_NULL_RETURN(nodedata); - if (nodedata->realized) - return; - - nodedata->realized = EINA_TRUE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - efl_ui_list_view_model_realize(pd->modeler, layout_item); - } -} - -static void -_node_unrealize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node) -{ - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - int i; - - EINA_SAFETY_ON_NULL_RETURN(nodedata); - if (!nodedata->realized) - return; - - nodedata->realized = EINA_FALSE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - if (layout_item->layout) - { - cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change); - free(cb_data); - efl_ui_list_view_model_unrealize(pd->modeler, layout_item); - } - } -} - -static void -_calc_range(Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - Evas_Coord ch, ny; - Eina_Rect vgmt; - Eina_Position2D spos; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - int i; - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->modeler); - spos = efl_ui_scrollable_content_pos_get(pd->modeler); - - ny = spos.y - (vgmt.h / 2); - if (ny < 0) spos.y = 0; - else spos.y = ny; - vgmt.h *= 2; - - ch = 0; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, node) - { - nodedata = node->layout_data; - if (!nodedata || !nodedata->min.h) - continue; - - if ((ch > spos.y || nodedata->min.h + ch > spos.y) && (ch < (spos.y + vgmt.h) || nodedata->min.h + ch < spos.y + vgmt.h)) - _node_realize(pd, node); - else - _node_unrealize(pd, node); - - ch += nodedata->min.h; - } - eina_accessor_free(nodes); -} - -static void -_calc_size_job(void *data) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - Efl_Ui_List_View_Seg_Array_Node *node; - Efl_Ui_List_View_Layout_Item *layout_item; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Eo *obj = data; - int i; - double start_time = ecore_time_get(); - - EINA_SAFETY_ON_NULL_RETURN(data); - pd = efl_data_scope_get(obj, MY_CLASS); - if (EINA_UNLIKELY(!pd)) return; - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - while (eina_accessor_data_get(nodes, pd->calc_progress, (void **)&node)) - { - pd->calc_progress++; - if (!node->layout_data) - node->layout_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Node_Data)); - - nodedata = node->layout_data; - if (pd->calc_progress == 1) - nodedata->realized = EINA_TRUE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - EINA_SAFETY_ON_NULL_RETURN(layout_item); - - // cache size of new items - if ((layout_item->min.w == 0) && (layout_item->min.h == 0) && (!layout_item->layout)) - efl_ui_list_view_model_realize(pd->modeler, layout_item); - } - - if ( (ecore_time_get() - start_time ) > 0.01 ) - { - ecore_job_del(pd->calc_job); - pd->calc_job = ecore_job_add(_calc_size_job, obj); - eina_accessor_free(nodes); - return; - } - } - eina_accessor_free(nodes); - pd->calc_progress = 0; - pd->calc_job = NULL; - pd->recalc = EINA_FALSE; -} - -EOLIAN static Efl_Object * -_efl_ui_list_view_precise_layouter_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - obj = efl_constructor(efl_super(obj, MY_CLASS)); - pd->initialized = EINA_FALSE; - - return obj; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_content_created(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data; - EINA_SAFETY_ON_NULL_RETURN(item); - EINA_SAFETY_ON_NULL_RETURN(item->layout); - Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - - Eina_Size2D min = _item_min_calc(pd, item); - - if (min.w && min.h && !nodedata->realized) - { - efl_ui_list_view_model_unrealize(pd->modeler, item); - return; - } - - cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data)); - if (!cb_data) return; - cb_data->pd = pd; - cb_data->item = item; - evas_object_event_callback_add(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data); - - _item_size_calc(pd, item); -} - -EOLIAN static Eina_List * -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Eina_List *elements_order = NULL; - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Seg_Array_Node *items_node; - int i, j = 0; - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, items_node) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data; - if (!nodedata || !nodedata->realized) - continue; - - for (j = 0; j != items_node->length;++j) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; - if (layout_item->layout) - elements_order = eina_list_append(elements_order, layout_item->layout); - } - } - - eina_accessor_free(nodes); - return elements_order; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_model_set(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Model *model) -{ - _finalize(obj, pd); - - efl_replace(&pd->model, model); - - if (pd->model) - { - pd->count_total = efl_model_children_count_get(pd->model); - if (pd->count_total && pd->modeler) - efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all - else - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _child_count_changed_cb, pd); - } -} - -static void -_efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Eina_Rect vgmt; - Eina_Position2D spos; - double cur_pos = 0; - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Seg_Array_Node *items_node; - int i, j = 0; - int boxx, boxy, boxw, boxh, extra = 0, rounding = 0; - int boxl = 0, boxr = 0, boxt = 0, boxb = 0; - - _calc_range(pd); - - evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh); - efl_gfx_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); - - // box outer margin - boxw -= boxl + boxr; - boxh -= boxt + boxb; - boxx += boxl; - boxy += boxt; - - // available space. if <0 we overflow - extra = boxh - pd->min.h; - if (extra < 0) extra = 0; - - efl_ui_list_view_model_min_size_set(pd->modeler, pd->min); - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->modeler); - spos = efl_ui_scrollable_content_pos_get(pd->modeler); - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, items_node) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data; - if (!items_node->layout_data) - continue; - - if (!nodedata->realized) - { - cur_pos += nodedata->min.h; - continue; - } - - for (j = 0; j != items_node->length;++j) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; - double x, y, w, h; - double weight_x, weight_y; - if (!(layout_item->min.w && layout_item->min.h)) - continue; - - // extra rounding up (compensate cumulative error) - if ((i == (pd->count_total - 1)) && (cur_pos - floor(cur_pos) >= 0.5)) - rounding = 1; - - if (layout_item->layout) - { - if (pd->resize) - _item_size_calc(pd, layout_item); - - efl_gfx_hint_weight_get(layout_item->layout, &weight_x, &weight_y); - } - else - { - cur_pos += layout_item->size.h; - continue; - } - - x = layout_item->pos.x; - y = layout_item->pos.y + cur_pos; - w = layout_item->size.w; - h = layout_item->size.h + rounding + weight_y * extra; - cur_pos += h; - - if (w < pd->min.w) w = pd->min.w; - if (w > vgmt.w) w = vgmt.w; - - evas_object_geometry_set(layout_item->layout, (x + 0 - spos.x), (y + 0 - spos.y), w, h); - } - } - eina_accessor_free(nodes); - - pd->resize = EINA_FALSE; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_layout_do - (Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd - , Efl_Ui_List_View_Model *modeler, int first EINA_UNUSED, Efl_Ui_List_View_Seg_Array *seg_array) -{ - if (!_initilize(obj, pd, modeler, seg_array) || !pd->seg_array) - return; - - if (!pd->calc_job && pd->recalc && efl_ui_list_view_seg_array_count(seg_array) > 0) - { - // cache size of new items - pd->calc_progress = 0; - pd->calc_job = ecore_job_add(_calc_size_job, obj); - return; - } - - _efl_ui_list_view_relayout_layout_do(pd); -} - -#include "efl_ui_list_view_precise_layouter.eo.c" diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo b/src/lib/elementary/efl_ui_list_view_precise_layouter.eo deleted file mode 100644 index 0a83c0a08b..0000000000 --- a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo +++ /dev/null @@ -1,10 +0,0 @@ -class @beta Efl.Ui.List_View_Precise_Layouter extends Efl.Object implements Efl.Ui.List_View_Relayout -{ - implements { - Efl.Object.constructor; - Efl.Ui.List_View_Relayout.layout_do; - Efl.Ui.List_View_Relayout.content_created; - Efl.Ui.List_View_Relayout.model { set; } - Efl.Ui.List_View_Relayout.elements { get; } - } -} diff --git a/src/lib/elementary/efl_ui_list_view_private.h b/src/lib/elementary/efl_ui_list_view_private.h deleted file mode 100644 index 2443cf4438..0000000000 --- a/src/lib/elementary/efl_ui_list_view_private.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef EFL_UI_LIST_VIEW_PRIVATE_H -#define EFL_UI_LIST_VIEW_PRIVATE_H - -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "efl_ui_list_view_relayout.eo.h" -#include "efl_ui_list_view_pan.eo.h" -#include "elm_priv.h" - -typedef struct _Efl_Ui_List_View_Data Efl_Ui_List_View_Data; -int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item *item); - -#include "efl_ui_list_view_seg_array.h" - -struct _Efl_Ui_List_View_Data -{ - Eo *obj; - Eo *scrl_mgr; - Efl_Ui_List_View_Pan *pan_obj; - Efl_Model *model; - - Eina_Stringshare *style; - - struct { - Eina_Future *future; - - int start; - int count; - } slice; - - Efl_Ui_Layout_Factory *factory; - Eina_List *selected_items; - - Efl_Ui_Focus_Manager *manager; - Efl_Ui_List_View_Relayout *relayout; - Efl_Ui_List_View_Seg_Array *seg_array; - int seg_array_first; - - Elm_Object_Select_Mode select_mode; - Eina_Size2D min; - - Eina_Bool homogeneous : 1; - Eina_Bool scrl_freeze : 1; -}; - -typedef struct _Efl_Ui_List_View_Pan_Data Efl_Ui_List_View_Pan_Data; - -struct _Efl_Ui_List_View_Pan_Data -{ - Eo *wobj; - Eina_Rect gmt; -}; - -#define EFL_UI_LIST_VIEW_DATA_GET(o, ptr) \ - Efl_Ui_List_View_Data * ptr = efl_data_scope_get(o, EFL_UI_LIST_VIEW_CLASS) - -#define EFL_UI_LIST_VIEW_DATA_GET_OR_RETURN(o, ptr) \ - EFL_UI_LIST_VIEW_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ - } - -#define EFL_UI_LIST_VIEW_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - EFL_UI_LIST_VIEW_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ - } - -#endif diff --git a/src/lib/elementary/efl_ui_list_view_relayout.eo b/src/lib/elementary/efl_ui_list_view_relayout.eo deleted file mode 100644 index 07b5dc65bb..0000000000 --- a/src/lib/elementary/efl_ui_list_view_relayout.eo +++ /dev/null @@ -1,30 +0,0 @@ -interface @beta Efl.Ui.List_View_Relayout -{ - methods { - layout_do { - params { - modeler: Efl.Ui.List_View_Model; - first: int; - children: ptr(Efl_Ui_List_View_Seg_Array); - } - } - content_created { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - } - @property model { - [[Model that is/will be ]] - set {} - values { - model: Efl.Model; [[Efl model]] - } - } - @property elements { - get {} - values { - elements: list; [[The order to use]] - } - } - } -} diff --git a/src/lib/elementary/efl_ui_list_view_seg_array.c b/src/lib/elementary/efl_ui_list_view_seg_array.c deleted file mode 100644 index 50f33b340b..0000000000 --- a/src/lib/elementary/efl_ui_list_view_seg_array.c +++ /dev/null @@ -1,477 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include "elm_priv.h" -#include - -#include "efl_ui_list_view_private.h" -#include "efl_ui_list_view_seg_array.h" - -static int -_search_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED) -{ - Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree; - int index = *(int*)key; - if(index < node->first) - { - return 1; - } - else if(index < node->first + node->length) - { - return 0; - } - else - { - return -1; - } -} - -static int -_insert_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED) -{ - Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree; - int index = *(int*)key; - if(index < node->first) - { - return 1; - } - else if(index < node->first + node->max) - { - return 0; - } - else - { - return -1; - } -} - -static Eina_Rbtree_Direction -_rbtree_compare(Efl_Ui_List_View_Seg_Array_Node const* left, - Efl_Ui_List_View_Seg_Array_Node const* right, void* data EINA_UNUSED) -{ - if(left->first < right->first) - return EINA_RBTREE_LEFT; - else - return EINA_RBTREE_RIGHT; -} - -static void -_free_node(Efl_Ui_List_View_Seg_Array_Node* node, void* data EINA_UNUSED) -{ - int i = 0; - - while (i < node->length) - { - Efl_Ui_List_View_Layout_Item* item = node->pointers[i]; - efl_unref(item->children); - free(item); - ++i; - } - - free(node); -} - -static Efl_Ui_List_View_Seg_Array_Node* -_alloc_node(Efl_Ui_List_View_Seg_Array* pd, int first) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*)); - if (!node) return NULL; - node->first = first; - node->max = pd->step_size; - pd->root = (void*)eina_rbtree_inline_insert(EINA_RBTREE_GET(pd->root), EINA_RBTREE_GET(node), - EINA_RBTREE_CMP_NODE_CB(&_rbtree_compare), NULL); - pd->node_count++; - return node; -} - -static Efl_Ui_List_View_Layout_Item* -_create_item_partial(Efl_Model* model) -{ - Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item)); - if (!item) return NULL; - item->children = efl_ref(model); - return item; -} - -static Efl_Ui_List_View_Layout_Item* -_create_item(Efl_Model* model, Efl_Ui_List_View_Seg_Array_Node* node, unsigned int index) -{ - Efl_Ui_List_View_Layout_Item* item = _create_item_partial(model); - item->index_offset = index - node->first; - item->tree_node = node; - return item; -} - -static void -_efl_ui_list_view_seg_array_insert_at_node(Efl_Ui_List_View_Seg_Array* pd, int index, - Efl_Ui_List_View_Layout_Item* item, Efl_Ui_List_View_Seg_Array_Node* node) -{ - Eina_Iterator* iterator; - int pos; - - if(node && node->length != node->max && (index - node->first) <= node->length) - { - pos = index - node->first; - item->tree_node = node; - item->index_offset = pos; - if(pos < node->length) - { - assert(node->length != node->max); - - memmove(&node->pointers[pos], &node->pointers[pos+1], sizeof(node->pointers[pos])*(node->length - pos)); - node->pointers[pos] = item; - node->length++; - } - else - { - assert(pos == node->length); - - assert(node->length != node->max); - node->pointers[pos] = item; - node->length++; - } - } - else - { - node = _alloc_node(pd, index); - node->pointers[0] = item; - node->length++; - item->index_offset = 0; - item->tree_node = node; - } - - node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - iterator = eina_rbtree_iterator_infix((void*)node); - while(eina_iterator_next(iterator, (void**)&node)) - { - node->first++; - } - - eina_iterator_free(iterator); -} - -static void -_efl_ui_list_view_seg_array_insert_object(Efl_Ui_List_View_Seg_Array *pd, unsigned int index, Efl_Model *children) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if (!node) - { - node = _alloc_node(pd, index); - } - - assert(node->length < node->max); - node->pointers[node->length] = _create_item(children, node, index); - node->length++; - pd->count++; -} - -typedef struct _Efl_Ui_List_View_Segarray_Eina_Accessor -{ - Eina_Accessor vtable; - Efl_Ui_List_View_Seg_Array* seg_array; -} Efl_Ui_List_View_Segarray_Eina_Accessor; - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_get_at(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, - int idx, void** data) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(acc->seg_array->root), - &idx, sizeof(idx), &_search_lookup_cb, NULL); - if (node && (node->first <= idx && node->first + node->length > idx)) - { - int i = idx - node->first; - Efl_Ui_List_View_Layout_Item* item = node->pointers[i]; - *data = item; - return EINA_TRUE; - } - return EINA_FALSE; -} - -static void* -_efl_ui_list_view_seg_array_accessor_get_container(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return NULL; -} - -static void -_efl_ui_list_view_seg_array_accessor_free(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - free(acc); -} - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_lock(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_unlock(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Accessor* -_efl_ui_list_view_seg_array_accessor_clone(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return &acc->vtable; -} - -static void -_efl_ui_list_view_seg_array_accessor_setup(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array) -{ - EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR); - acc->vtable.version = EINA_ACCESSOR_VERSION; - acc->vtable.get_at = FUNC_ACCESSOR_GET_AT(_efl_ui_list_view_seg_array_accessor_get_at); - acc->vtable.get_container = FUNC_ACCESSOR_GET_CONTAINER(_efl_ui_list_view_seg_array_accessor_get_container); - acc->vtable.free = FUNC_ACCESSOR_FREE(_efl_ui_list_view_seg_array_accessor_free); - acc->vtable.lock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_accessor_lock); - acc->vtable.unlock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_accessor_unlock); - acc->vtable.clone = FUNC_ACCESSOR_CLONE(_efl_ui_list_view_seg_array_accessor_clone); - acc->seg_array = seg_array; -} - -typedef struct _Efl_Ui_List_View_Segarray_Node_Accessor -{ - Eina_Accessor vtable; - Efl_Ui_List_View_Seg_Array* seg_array; - Eina_Iterator* pre_iterator; - Efl_Ui_List_View_Seg_Array_Node* current_node; - int current_index; -} Efl_Ui_List_View_Segarray_Node_Accessor; - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_get_at(Efl_Ui_List_View_Segarray_Node_Accessor* acc, - int idx, void** data) -{ - if(idx == acc->current_index && acc->current_node) - { - (*data) = acc->current_node; - } - else - { - if(acc->current_index >= idx || !acc->current_node) - { - eina_iterator_free(acc->pre_iterator); - acc->pre_iterator = NULL; - acc->current_node = NULL; - acc->current_index = -1; - } - - if(!acc->pre_iterator) - acc->pre_iterator = eina_rbtree_iterator_infix((void*)acc->seg_array->root); - - for(;acc->current_index != idx;++acc->current_index) - { - if(!eina_iterator_next(acc->pre_iterator, (void**)&acc->current_node)) - { - --acc->current_index; - return EINA_FALSE; - } - } - (*data) = acc->current_node; - return EINA_TRUE; - } - return EINA_FALSE; -} - -static void* -_efl_ui_list_view_seg_array_node_accessor_get_container(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return NULL; -} - -static void -_efl_ui_list_view_seg_array_node_accessor_free(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - if (acc->pre_iterator) - eina_iterator_free(acc->pre_iterator); - free(acc); -} - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_lock(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_unlock(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Accessor* -_efl_ui_list_view_seg_array_node_accessor_clone(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return &acc->vtable; -} - -static void -_efl_ui_list_view_seg_array_node_accessor_setup(Efl_Ui_List_View_Segarray_Node_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array) -{ - EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR); - acc->vtable.version = EINA_ACCESSOR_VERSION; - acc->vtable.get_at = FUNC_ACCESSOR_GET_AT(_efl_ui_list_view_seg_array_node_accessor_get_at); - acc->vtable.get_container = FUNC_ACCESSOR_GET_CONTAINER(_efl_ui_list_view_seg_array_node_accessor_get_container); - acc->vtable.free = FUNC_ACCESSOR_FREE(_efl_ui_list_view_seg_array_node_accessor_free); - acc->vtable.lock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_node_accessor_lock); - acc->vtable.unlock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_node_accessor_unlock); - acc->vtable.clone = FUNC_ACCESSOR_CLONE(_efl_ui_list_view_seg_array_node_accessor_clone); - acc->seg_array = seg_array; - acc->pre_iterator = NULL; - acc->current_index = -1; - acc->current_node = NULL; -} - -/* External Functions */ - -Efl_Ui_List_View_Seg_Array * -efl_ui_list_view_seg_array_setup(int size) -{ - Efl_Ui_List_View_Seg_Array *pd = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array)); - if (!pd) return NULL; - pd->step_size = size; - - return pd; -} - -void -efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *pd) -{ - if (pd->root) - eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL); - - pd->root = NULL; - free(pd); -} - -void -efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *pd) -{ - if (pd->root) - eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL); - - pd->root = NULL; - pd->node_count = 0; - pd->count = 0; -} - -int -efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* pd) -{ - return pd->count; -} - -void -efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* pd, int index, Efl_Model* model) -{ - Efl_Ui_List_View_Seg_Array_Node* node, *next; - Efl_Ui_List_View_Layout_Item* item; - - item = _create_item_partial(model); - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if(node) - { - next = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - if(next && next->first <= index) - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, next); - else - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, node); - } - else - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, NULL); -} - -void -efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *pd, int first, Eina_Value v) -{ - Efl_Model *children; - unsigned int i, len; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_OBJECT) - { - children = eina_value_object_get(&v); - _efl_ui_list_view_seg_array_insert_object(pd, first, children); - } - else if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ARRAY) - { - EINA_VALUE_ARRAY_FOREACH(&v, len, i, children) - { - unsigned int idx = first + i; - - _efl_ui_list_view_seg_array_insert_object(pd, idx, children); - } - } - else - { - printf("Unknow type !\n"); - } -} - - -Efl_Ui_List_View_Layout_Item* -efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *pd, int index) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - Efl_Ui_List_View_Layout_Item *item, *rt; - Eina_Iterator* iterator; - int offset; - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if (!node) return NULL; - - offset = index - node->first; - if (offset >= node->length) return NULL; - - rt = node->pointers[offset]; - pd->count--; - node->length--; - - while (offset < node->length) - { - node->pointers[offset] = node->pointers[offset+1]; - item = node->pointers[offset]; - --item->index_offset; - ++offset; - } - - node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - iterator = eina_rbtree_iterator_infix((void*)node); - while(eina_iterator_next(iterator, (void**)&node)) - node->first--; - - return rt; -} - -Eina_Accessor* -efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* pd) -{ - Efl_Ui_List_View_Segarray_Eina_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Eina_Accessor)); - _efl_ui_list_view_seg_array_accessor_setup(acc, pd); - return &acc->vtable; -} - -Eina_Accessor* -efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* pd) -{ - Efl_Ui_List_View_Segarray_Node_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Node_Accessor)); - _efl_ui_list_view_seg_array_node_accessor_setup(acc, pd); - return &acc->vtable; -} - -int -efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item) -{ - Efl_Ui_List_View_Seg_Array_Node* node = item->tree_node; - return item->index_offset + node->first; -} diff --git a/src/lib/elementary/efl_ui_list_view_seg_array.h b/src/lib/elementary/efl_ui_list_view_seg_array.h deleted file mode 100644 index adbfc28441..0000000000 --- a/src/lib/elementary/efl_ui_list_view_seg_array.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef EFL_UI_LIST_VIEW_SEG_ARRAY_H -#define EFL_UI_LIST_VIEW_SEG_ARRAY_H - -typedef struct _Efl_Ui_List_View_SegArray_Node -{ - EINA_RBTREE; - - int length; - int max; - int first; - - void* layout_data; - - Efl_Ui_List_View_Layout_Item* pointers[0]; -} Efl_Ui_List_View_Seg_Array_Node; - -typedef struct _Efl_Ui_List_View_Seg_Array -{ - Efl_Ui_List_View_Seg_Array_Node *root; - - int step_size; - int node_count; - int count; -} Efl_Ui_List_View_Seg_Array; - - -Efl_Ui_List_View_Seg_Array * efl_ui_list_view_seg_array_setup(int size); -void efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *seg_array); -void efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *seg_array); -int efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* seg_array); -int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item); - - -void efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* seg_array, int index, Efl_Model* model); -void efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *seg_array, int first, Eina_Value value); -Efl_Ui_List_View_Layout_Item* efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *seg_array, int index); - -Eina_Accessor* efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array); -Eina_Accessor* efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array); - - -#endif diff --git a/src/lib/elementary/efl_ui_list_view_types.eot b/src/lib/elementary/efl_ui_list_view_types.eot deleted file mode 100644 index 49aca5d33d..0000000000 --- a/src/lib/elementary/efl_ui_list_view_types.eot +++ /dev/null @@ -1,12 +0,0 @@ -struct @beta @free(free) Efl.Ui.List_View_Layout_Item { - layout: Efl.Ui.Layout; - layout_request: future; - children: Efl.Model; - index_offset: int; - tree_node: void_ptr; - min: Eina.Size2D; - size: Eina.Size2D; - pos: Eina.Position2D; -} - -struct @beta Efl_Ui_List_View_Seg_Array; [[TBD]] diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index 9b581357a1..ea8e376ad2 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -1,10 +1,4 @@ -enum @beta Efl.Ui.Select_Mode { - [[Type of multi selectable object.]] - single, [[Only single child is selected. If a child is selected, - previous selected child will be unselected.]] - multi, [[Allow multiple selection of children.]] - none [[No child can be selected at all.]] -} +import efl_ui; interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable { @@ -23,11 +17,11 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable mode: Efl.Ui.Select_Mode; [[Type of selection of children]] } } - selected_items_get { + selected_iterator_new { [[Get the selected items in a iterator. The iterator sequence will be decided by selection.]] return: iterator @move @no_unused; [[User has to free the iterator after usage.]] } - select_range { + range_select @beta { [[Select a range of @Efl.Ui.Selectable. This will select the range of selectables from a to b or from b to a depending on which one comes first. @@ -40,7 +34,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable b : Efl.Ui.Selectable; [[The other side of the range.]] } } - unselect_range { + range_unselect @beta { [[Unselect a range of @Efl.Ui.Selectable. This will unselect the range of selectables from a to b or from b to a depending on which one comes first. @@ -53,10 +47,10 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable b : Efl.Ui.Selectable; [[The other side of the range.]] } } - select_all { + all_select { [[Select all @Efl.Ui.Selectable]] } - unselect_all { + all_unselect { [[Unselect all @Efl.Ui.Selectable]] } diff --git a/src/lib/elementary/efl_ui_multi_selectable_async.eo b/src/lib/elementary/efl_ui_multi_selectable_async.eo new file mode 100644 index 0000000000..3a09682358 --- /dev/null +++ b/src/lib/elementary/efl_ui_multi_selectable_async.eo @@ -0,0 +1,63 @@ +import efl_ui; + +interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable +{ + [[Interface for getting access to a range of selected items for widgets that provide them asynchronously. + + The implementor of this interface provides the possibility to select multiple @Efl.Ui.Selectable. + If not, only @Efl.Ui.Single_Selectable should be implemented. + A widget can only provide either this interface or @Efl.Ui.Multi_Selectable, but not both.]] + methods + { + @property select_mode { + [[The mode type for children selection.]] + set {} + get {} + values { + mode: Efl.Ui.Select_Mode; [[Type of selection of children]] + } + } + selected_iterator_new { + [[Gets an iterator of all the selected child of this model. + ]] + return: iterator @move @no_unused; [[The iterator gives indices of selected children. + It is valid until any change is made on the model.]] + } + unselected_iterator_new { + [[Gets an iterator of all the child of this model that are not selected. + ]] + return: iterator @move @no_unused; [[The iterator gives indices of unselected children. + It is valid until any change is made on the model.]] + } + range_select @beta { + [[Select a range of @Efl.Ui.Selectable. + + This will select the range of selectables from $a to $b or from $b to $a depending on which one comes first. + If $a or $b are not in the range the widget, an error is returned, and no change is applied. + Both of the passed values will also be selected. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + range_unselect @beta { + [[Unselect a range of @Efl.Ui.Selectable. + + This will unselect the range of selectables from $a to $b or from $b to $a depending on which one comes first. + If $a or $b are not in the range of the widget, an error is returned, and no change is applied. + Both of the passed values will also be unselected. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + all_select { + [[Select all @Efl.Ui.Selectable]] + } + all_unselect { + [[Unselect all @Efl.Ui.Selectable]] + } + } +} diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index 3b6db20f40..ea1c9fe06a 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -695,11 +695,11 @@ _efl_ui_panes_part_split_ratio_min_set(Eo *obj, void *_pd EINA_UNUSED, double ra /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_panes) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_panes) #define EFL_UI_PANES_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_panes) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_panes) #include "efl_ui_panes.eo.c" #include "efl_ui_panes_eo.legacy.c" diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c index b4d1226465..edf71073aa 100644 --- a/src/lib/elementary/efl_ui_popup.c +++ b/src/lib/elementary/efl_ui_popup.c @@ -554,7 +554,7 @@ _efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd) evas_object_smart_member_add(pd->backwall, obj); evas_object_stack_below(pd->backwall, wd->resize_obj); - edje_object_signal_callback_add(pd->backwall, "efl,action,clicked", "*", + edje_object_signal_callback_add(pd->backwall, "efl,action,click", "*", _backwall_clicked_cb, obj); pd->align = EFL_UI_POPUP_ALIGN_CENTER; diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo index 619f7d7549..bcb4d62101 100644 --- a/src/lib/elementary/efl_ui_popup.eo +++ b/src/lib/elementary/efl_ui_popup.eo @@ -1,5 +1,5 @@ parse efl_gfx_hint; -enum @beta Efl.Ui.Popup_Align { +enum Efl.Ui.Popup_Align { [[This is the alignment method for positioning Popup widgets.]] none = 0, [[Popup not aligned.]] center, [[Popup is aligned to the center of its anchor object.]] @@ -9,7 +9,7 @@ enum @beta Efl.Ui.Popup_Align { bottom [[Popup's bottom is aligned to the bottom of its anchor object.]] } -class @beta Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer, +class Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer, Efl.Ui.Widget_Scrollable_Content { [[A styled container widget which overlays a window's contents. diff --git a/src/lib/elementary/efl_ui_popup_part_backwall.eo b/src/lib/elementary/efl_ui_popup_part_backwall.eo index 7cb01544b9..1bb24c0968 100644 --- a/src/lib/elementary/efl_ui_popup_part_backwall.eo +++ b/src/lib/elementary/efl_ui_popup_part_backwall.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Popup_Part_Backwall extends Efl.Ui.Layout_Part implements Efl.File +class Efl.Ui.Popup_Part_Backwall extends Efl.Ui.Layout_Part implements Efl.File { [[A Popup backwall is the background object for an @Efl.Ui.Popup widget. It can be returned from a given Popup widget by using the @Efl.Part API to fetch the "backwall" part. diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c index cee6730137..d22d42cb10 100644 --- a/src/lib/elementary/efl_ui_position_manager_list.c +++ b/src/lib/elementary/efl_ui_position_manager_list.c @@ -36,6 +36,14 @@ typedef struct { * Every other walk of the items is at max the maximum number of items you get into the maximum distance between the average item size and a actaul item size. */ +static void +cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) +{ + if (pd->size_cache) + free(pd->size_cache); + pd->size_cache = NULL; +} + static void cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) { @@ -82,19 +90,15 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) } pd->size_cache[i + 1] = pd->size_cache[i] + step; pd->maximum_min_size = MAX(pd->maximum_min_size, min); + /* no point iterating further if size calc can't be done yet */ + //if ((!i) && (!pd->maximum_min_size)) break; } pd->average_item_size = pd->size_cache[pd->size]/pd->size; + if ((!pd->average_item_size) && (!pd->maximum_min_size)) + cache_invalidate(obj, pd); } -static void -cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) -{ - if (pd->size_cache) - free(pd->size_cache); - pd->size_cache = NULL; -} - -static inline int +static int cache_access(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int idx) { EINA_SAFETY_ON_FALSE_RETURN_VAL(idx <= pd->size, 0); @@ -105,7 +109,12 @@ static void recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) { Eina_Size2D min_size = EINA_SIZE2D(-1, -1); + Eina_Size2D pabs_size = pd->abs_size; + int pmin_size = pd->maximum_min_size; + cache_require(obj, pd); + /* deferred */ + if (!pd->size_cache) return; pd->abs_size = pd->viewport.size; @@ -116,8 +125,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) else pd->abs_size.w = MAX(cache_access(obj, pd, pd->size), pd->abs_size.w); } - - efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size); + if ((pabs_size.w != pd->abs_size.w) || (pabs_size.h != pd->abs_size.h)) + efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size); if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) { @@ -127,8 +136,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) { min_size.h = pd->maximum_min_size; } - - efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size); + if ((pd->maximum_min_size > 0) && (pd->maximum_min_size != pmin_size)) + efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size); } static inline Vis_Segment diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 4ea4b26482..61c6ece78b 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -780,10 +780,10 @@ ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_progressbar) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_progressbar) #define EFL_UI_PROGRESSBAR_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_progressbar), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_progressbar), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_progressbar) #include "efl_ui_progressbar.eo.c" diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index a7106a3643..e631cb81f3 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -170,8 +170,8 @@ _efl_ui_radio_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd EINA_UNUS } else { - if (efl_ui_selectable_selected_get(obj)) elm_layout_signal_emit(obj, "efl,state,radio,on", "efl"); - else elm_layout_signal_emit(obj, "efl,state,radio,off", "efl"); + if (efl_ui_selectable_selected_get(obj)) elm_layout_signal_emit(obj, "efl,state,selected", "efl"); + else elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } edje_object_message_signal_process(wd->resize_obj); @@ -306,10 +306,10 @@ _efl_ui_radio_efl_access_object_state_set_get(const Eo *obj, Efl_Ui_Radio_Data * /* Internal EO APIs and hidden overrides */ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_radio, Efl_Ui_Radio_Data) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_RADIO_EXTRA_OPS \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_radio.eo.c" #include "efl_ui_radio_group.eo.c" diff --git a/src/lib/elementary/efl_ui_radio.eo b/src/lib/elementary/efl_ui_radio.eo index be595031b9..19206f501f 100644 --- a/src/lib/elementary/efl_ui_radio.eo +++ b/src/lib/elementary/efl_ui_radio.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action +class Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action { [[Elementary radio button class. diff --git a/src/lib/elementary/efl_ui_radio_group.eo b/src/lib/elementary/efl_ui_radio_group.eo index 5651e237a6..31cad9fd10 100644 --- a/src/lib/elementary/efl_ui_radio_group.eo +++ b/src/lib/elementary/efl_ui_radio_group.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Radio_Group extends Efl.Ui.Single_Selectable +interface Efl.Ui.Radio_Group extends Efl.Ui.Single_Selectable { [[Interface for manually handling a group of @Efl.Ui.Radio buttons. diff --git a/src/lib/elementary/efl_ui_radio_group_impl.eo b/src/lib/elementary/efl_ui_radio_group_impl.eo index 7de7899248..f35e5623e6 100644 --- a/src/lib/elementary/efl_ui_radio_group_impl.eo +++ b/src/lib/elementary/efl_ui_radio_group_impl.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group +class Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group { [[Object with the default implementation for @Efl.Ui.Radio_Group. ]] diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c index cf23773536..dec7e5dd28 100644 --- a/src/lib/elementary/efl_ui_scroll_util.c +++ b/src/lib/elementary/efl_ui_scroll_util.c @@ -227,9 +227,9 @@ _scroll_connector_bar_show_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); } static void @@ -240,9 +240,9 @@ _scroll_connector_bar_hide_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); } void @@ -269,7 +269,7 @@ efl_ui_scroll_connector_bind(Eo *obj, Eo *manager) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.vbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_add(obj, "efl,vbar,press", "efl", + efl_layout_signal_callback_add(obj, "efl,vertical_bar,press", "efl", ctx, _scroll_connector_vbar_press_cb, NULL); efl_layout_signal_callback_add(obj, "efl,vbar,unpress", "efl", ctx, _scroll_connector_vbar_unpress_cb, NULL); @@ -285,7 +285,7 @@ efl_ui_scroll_connector_bind(Eo *obj, Eo *manager) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.hbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_add(obj, "efl,hbar,press", "efl", + efl_layout_signal_callback_add(obj, "efl,horizontal_bar,press", "efl", ctx, _scroll_connector_hbar_press_cb, NULL); efl_layout_signal_callback_add(obj, "efl,hbar,unpress", "efl", ctx, _scroll_connector_hbar_unpress_cb, NULL); @@ -325,7 +325,7 @@ efl_ui_scroll_connector_unbind(Eo *obj) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.vbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_del(obj, "efl,vbar,press", "efl", + efl_layout_signal_callback_del(obj, "efl,vertical_bar,press", "efl", ctx, _scroll_connector_vbar_press_cb, NULL); efl_layout_signal_callback_del(obj, "efl,vbar,unpress", "efl", ctx, _scroll_connector_vbar_unpress_cb, NULL); @@ -342,7 +342,7 @@ efl_ui_scroll_connector_unbind(Eo *obj) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.hbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_del(obj, "efl,hbar,press", "efl", + efl_layout_signal_callback_del(obj, "efl,horizontal_bar,press", "efl", ctx, _scroll_connector_hbar_press_cb, NULL); efl_layout_signal_callback_del(obj, "efl,hbar,unpress", "efl", ctx, _scroll_connector_hbar_unpress_cb, NULL); diff --git a/src/lib/elementary/efl_ui_scroller.eo b/src/lib/elementary/efl_ui_scroller.eo index 43fcc4f26e..2331bcfa39 100644 --- a/src/lib/elementary/efl_ui_scroller.eo +++ b/src/lib/elementary/efl_ui_scroller.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Scroller extends Efl.Ui.Layout_Base implements +class Efl.Ui.Scroller extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, Efl.Content diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index e862b569e0..c05d720667 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -2,6 +2,10 @@ # include #endif +// Note: we do not rely on reflection here to implement select as it require to asynchronously acces +// children. Could be done differently by implementing the children select in the parent instead of +// in the children. For later optimization. + #include #include "elm_priv.h" @@ -13,15 +17,30 @@ typedef struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model_Data; struct _Efl_Ui_Select_Model_Data { Efl_Ui_Select_Model_Data *parent; - unsigned long last; - Eina_Bool single_selection : 1; + Eina_Future *pending_selection_event; + + Efl_Ui_Select_Model *fallback_model; + Efl_Ui_Select_Model *last_model; + + Efl_Ui_Select_Mode selection; + Eina_Bool none : 1; }; +static void +_efl_ui_select_model_child_removed(void *data, const Efl_Event *event) +{ + Efl_Ui_Select_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + + if (ev->child == pd->last_model) + efl_replace(&pd->last_model, NULL); +} + static Eo* _efl_ui_select_model_efl_object_constructor(Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED) + Efl_Ui_Select_Model_Data *pd) { Eo *parent; @@ -29,7 +48,8 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); - pd->last = -1; + efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_select_model_child_removed, pd); + pd->none = EINA_TRUE; parent = efl_parent_get(obj); if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS)) @@ -38,10 +58,61 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, return obj; } +static void +_efl_ui_select_model_efl_object_invalidate(Eo *obj, + Efl_Ui_Select_Model_Data *pd) +{ + efl_replace(&pd->fallback_model, NULL); + efl_replace(&pd->last_model, NULL); + pd->none = EINA_TRUE; + + efl_invalidate(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS)); +} + +static void +_efl_ui_select_model_fallback(Efl_Ui_Select_Model_Data *pd) +{ + Eina_Value selected; + + if (!pd->parent) return; + if (!pd->parent->none) return; + if (!pd->parent->fallback_model) return; + // I think it only make sense to trigger the fallback on single mode + if (pd->parent->selection != EFL_UI_SELECT_MODE_SINGLE) return; + + selected = eina_value_bool_init(EINA_TRUE); + efl_model_property_set(pd->parent->fallback_model, "self.selected", &selected); + eina_value_flush(&selected); +} + +static Eina_Value +_select_notification_cb(Eo *o, void *data EINA_UNUSED, const Eina_Value v) +{ + Efl_Ui_Select_Model_Data *pd = efl_data_scope_get(o, EFL_UI_SELECT_MODEL_CLASS); + + efl_event_callback_call(o, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, NULL); + + pd->pending_selection_event = NULL; + + return v; +} + +static void +_efl_ui_select_model_selection_notification(Eo *parent, Efl_Ui_Select_Model_Data *pd) +{ + if (!pd) return; + if (pd->pending_selection_event) return; + + pd->pending_selection_event = efl_future_then(parent, + efl_loop_job(efl_loop_get(parent)), + .success = _select_notification_cb); +} + static Eina_Value _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) { Efl_Ui_Select_Model_Data *pd; + Eo *parent; Eina_Value *selected = NULL; Eina_Bool selflag = EINA_FALSE; @@ -50,7 +121,8 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) selected = efl_model_property_get(child, "selected"); - pd = efl_data_scope_get(efl_parent_get(child), EFL_UI_SELECT_MODEL_CLASS); + parent = efl_parent_get(child); + pd = efl_data_scope_get(parent, EFL_UI_SELECT_MODEL_CLASS); if (!pd) goto on_error; eina_value_bool_get(selected, &selflag); @@ -58,22 +130,25 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) { // select case pd->none = EINA_FALSE; - pd->last = efl_composite_model_index_get(child); + efl_replace(&pd->last_model, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else { // unselect case - unsigned long last; - - last = efl_composite_model_index_get(child); - if (pd->last == last) + // There should only be one model which represent the same data at all in memory + if (pd->last_model == child) // direct comparison of pointer is ok { - pd->last = 0; + efl_replace(&pd->last_model, NULL); pd->none = EINA_TRUE; + + // Just in case we need to refill the fallback + _efl_ui_select_model_fallback(pd); } efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_UNSELECTED, child); } + _efl_ui_select_model_selection_notification(parent, pd); + efl_model_properties_changed(child, "self.selected"); on_error: eina_value_free(selected); @@ -239,7 +314,7 @@ _untangle_free(void *data, static Eina_Iterator * _efl_ui_select_model_efl_model_properties_get(const Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED) + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_UI_SELECT_MODEL_CLASS, @@ -250,22 +325,23 @@ _efl_ui_select_model_efl_model_properties_get(const Eo *obj, static Eina_Future * _efl_ui_select_model_efl_model_property_set(Eo *obj, - Efl_Ui_Select_Model_Data *pd, - const char *property, Eina_Value *value) + Efl_Ui_Select_Model_Data *pd, + const char *property, Eina_Value *value) { Eina_Value vf = EINA_VALUE_EMPTY; if (eina_streq("single_selection", property)) { - Eina_Bool single_selection = pd->single_selection; + Eina_Bool single_selection = pd->selection == EFL_UI_SELECT_MODE_SINGLE; + Eina_Bool new_selection; Eina_Bool changed; - vf = eina_value_bool_init(single_selection); - eina_value_convert(value, &vf); - eina_value_bool_get(&vf, &single_selection); + if (!eina_value_bool_get(value, &new_selection)) + return efl_loop_future_rejected(obj, EINVAL); - changed = (!pd->single_selection != !single_selection); - pd->single_selection = !!single_selection; + changed = (!!new_selection != !!single_selection); + if (new_selection) pd->selection = EFL_UI_SELECT_MODE_SINGLE; + else pd->selection = EFL_UI_SELECT_MODE_MULTI; if (changed) efl_model_properties_changed(obj, "single_selection"); @@ -276,6 +352,9 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, { unsigned long l = 0; + if (pd->selection == EFL_UI_SELECT_MODE_NONE) + return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY); + if (!eina_value_ulong_convert(value, &l)) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE); @@ -293,6 +372,9 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, Eina_Value *prev; Eina_Future *chain; + if (pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE); + prev = efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected"); success = eina_value_bool_get(prev, &prevflag); success &= eina_value_bool_convert(value, &newflag); @@ -303,7 +385,7 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, if (newflag == prevflag) return efl_loop_future_resolved(obj, eina_value_bool_init(newflag)); - single_selection = pd->parent->single_selection; + single_selection = !!(pd->parent->selection == EFL_UI_SELECT_MODE_SINGLE); // First store the new value in the boolean model we inherit from chain = efl_model_property_set(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), @@ -317,11 +399,13 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, // there is nothing special to do, just normal commit change will do. if (!newflag) { - unsigned int i; + if (pd->parent->last_model == obj && !newflag) + { + efl_replace(&pd->last_model, NULL); + pd->parent->none = EINA_TRUE; - i = efl_composite_model_index_get(obj); - if (pd->parent->last == i && !newflag) - pd->parent->none = EINA_TRUE; + _efl_ui_select_model_fallback(pd); + } } else { @@ -330,7 +414,7 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, // In this case we need to first unselect the previously selected one // and then commit the change to this one. - selected = pd->parent->last; + selected = efl_composite_model_index_get(pd->parent->last_model); // There was, need to unselect the previous one along setting the new value parent = efl_parent_get(obj); @@ -362,46 +446,253 @@ static Eina_Value * _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_Data *pd, const char *property) { if (eina_streq("single_selection", property)) - return eina_value_bool_new(pd->single_selection); + return eina_value_bool_new(pd->selection == EFL_UI_SELECT_MODE_SINGLE); // Last selected child if (eina_streq("child.selected", property)) { if (pd->none) return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE); - else - return eina_value_ulong_new(pd->last); + else if (pd->last_model) + return eina_value_ulong_new(efl_composite_model_index_get(pd->last_model)); + else // Nothing selected yet, try again later + return eina_value_error_new(EAGAIN); } // Redirect to are we ourself selected if (pd->parent && eina_streq("self.selected", property)) { + if (pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return eina_value_bool_new(EINA_FALSE); return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected"); } return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), property); } -static void -_efl_ui_select_model_single_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd, Eina_Bool enable) -{ - pd->single_selection = enable; -} - -static Eina_Bool -_efl_ui_select_model_single_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd) -{ - return pd->single_selection; -} - static Eina_Iterator * -_efl_ui_select_model_selected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +_efl_ui_select_model_efl_ui_multi_selectable_async_selected_iterator_new(Eo *obj, + Efl_Ui_Select_Model_Data *pd) { + if (pd->parent && pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return eina_list_iterator_new(NULL); // Quick hack to get a valid empty iterator return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_TRUE); } static Eina_Iterator * -_efl_ui_select_model_unselected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +_efl_ui_select_model_efl_ui_multi_selectable_async_unselected_iterator_new(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_FALSE); } +static Efl_Ui_Selectable * +_efl_ui_select_model_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->last_model; +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd, + Efl_Ui_Select_Mode mode) +{ + switch (mode) + { + case EFL_UI_SELECT_MODE_SINGLE: + mode = EFL_UI_SELECT_MODE_SINGLE; + if (pd->selection == EFL_UI_SELECT_MODE_MULTI) + efl_ui_multi_selectable_async_all_unselect(obj); + break; + case EFL_UI_SELECT_MODE_NONE: + if (pd->selection == EFL_UI_SELECT_MODE_MULTI) + efl_ui_multi_selectable_async_all_unselect(obj); + else if (pd->last_model) + { + Eina_Value unselect = eina_value_bool_init(EINA_FALSE); + + efl_model_property_set(pd->last_model, "self.selected", &unselect); + eina_value_flush(&unselect); + } + break; + case EFL_UI_SELECT_MODE_MULTI: + break; + default: + ERR("Unknown select mode passed to %s: %i.", efl_debug_name_get(obj), mode); + return; + } + + pd->selection = mode; + efl_model_properties_changed(obj, "single_selection", "child.selected"); +} + +static Efl_Ui_Select_Mode +_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->selection; +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_all_select(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + unsigned long count, i; + + // Not the fastest way to implement it, but will reuse more code and be easier as a v1. + // It also make it not very async which could be noticable. + count = efl_model_children_count_get(obj); + + for (i = 0; i < count; i++) + { + Eina_Value p = eina_value_ulong_init(i); + + efl_model_property_set(obj, "child.selected", &p); + + eina_value_flush(&p); + } +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_all_unselect(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + uint64_t count = efl_model_children_count_get(obj); + + efl_ui_multi_selectable_async_range_unselect(obj, 0, count - 1); +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_range_select(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + uint64_t a, uint64_t b) +{ + unsigned long count, i; + + // Not the fastest way to implement it, but will reuse more code and be easier as a v1. + // It also make it not very async which could be noticable. + count = MIN(efl_model_children_count_get(obj), b + 1); + + for (i = a; i < count; i++) + { + Eina_Value p = eina_value_ulong_init(i); + + efl_model_property_set(obj, "child.selected", &p); + + eina_value_flush(&p); + } +} + +static Eina_Value +_children_unselect_then(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) +{ + Eo *target; + Eina_Value unselect; + unsigned int i, len; + + unselect = eina_value_bool_init(EINA_FALSE); + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, target) + { + efl_model_property_set(target, "self.selected", &unselect); + } + + eina_value_flush(&unselect); + + return v; +} + +#define BATCH_MAX 100 + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_range_unselect(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + uint64_t a, uint64_t b) +{ + unsigned int count, batch, i; + + count = MIN(efl_model_children_count_get(obj), b + 1); + + // Fetch group request of children in batches not to big to allow for throttling + // In the callback edit said object property to be unselected + i = a; + batch = 0; + + while (i < count) + { + Eina_Future *f; + + batch = MIN(i + BATCH_MAX, count); + batch -= i; + + f = efl_model_children_slice_get(obj, i, batch); + efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _children_unselect_then); + + i += batch; + } +} + +static void +_efl_ui_select_model_efl_ui_single_selectable_fallback_selection_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd, + Efl_Ui_Selectable *fallback) +{ + Eina_Value *index; + + if (!efl_isa(fallback, EFL_UI_SELECT_MODEL_CLASS)) + { + ERR("Class of object '%s' does not provide the necessary interface for Efl.Ui.Select_Model.fallback.", efl_debug_name_get(fallback)); + return; + } + if (efl_parent_get(fallback) != obj) + { + ERR("Provided object '%s' for fallback isn't a child of '%s'.", + efl_debug_name_get(fallback), efl_debug_name_get(obj)); + return; + } + + efl_replace(&pd->fallback_model, fallback); + + if (!pd->none) return ; + + // When we provide a fallback, we should use it! + index = efl_model_property_get(fallback, EFL_COMPOSITE_MODEL_CHILD_INDEX); + efl_model_property_set(obj, "child.selected", index); + eina_value_free(index); +} + +static Efl_Ui_Selectable * +_efl_ui_select_model_efl_ui_single_selectable_fallback_selection_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->fallback_model; +} + +static void +_efl_ui_select_model_efl_ui_selectable_selected_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + Eina_Bool selected) +{ + Eina_Value set = eina_value_bool_init(selected); + + efl_model_property_set(obj, "self.selected", &set); + + eina_value_flush(&set); +} + +static Eina_Bool +_efl_ui_select_model_efl_ui_selectable_selected_get(const Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + Eina_Value *selected; + Eina_Bool r = EINA_FALSE; + + selected = efl_model_property_get(obj, "self.selected"); + eina_value_bool_convert(selected, &r); + eina_value_free(selected); + + return r; +} + #include "efl_ui_select_model.eo.c" +#include "efl_ui_multi_selectable_async.eo.c" diff --git a/src/lib/elementary/efl_ui_select_model.eo b/src/lib/elementary/efl_ui_select_model.eo index 39624da903..7fa0f8411a 100644 --- a/src/lib/elementary/efl_ui_select_model.eo +++ b/src/lib/elementary/efl_ui_select_model.eo @@ -1,33 +1,23 @@ class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model + implements Efl.Ui.Multi_Selectable_Async, + Efl.Ui.Selectable { [[Efl ui select model class]] - methods { - selected_get { - [[Gets an iterator of all the selected child of this model. - ]] - return: iterator; [[The iterator gives indices of selected children. - It is valid until any change is made on the model.]] - } - unselected_get { - [[Gets an iterator of all the child of this model that are not selected. - ]] - return: iterator; [[The iterator gives indices of unselected children. - It is valid until any change is made on the model.]] - } - @property single_selection { - [[Defines if we support only one exclusive selection at a time when set to $true. - - If disable with $false, it will have the behavior of a multi select mode. - ]] - values { - enable: bool; [[$true will enable the exclusive mode.]] - } - } - } implements { Efl.Object.constructor; + Efl.Object.invalidate; Efl.Model.property { get; set; } Efl.Model.properties { get; } + Efl.Ui.Single_Selectable.last_selected { get; } + Efl.Ui.Multi_Selectable_Async.selected_iterator_new; + Efl.Ui.Multi_Selectable_Async.unselected_iterator_new; + Efl.Ui.Multi_Selectable_Async.select_mode {get; set;} + Efl.Ui.Multi_Selectable_Async.all_select; + Efl.Ui.Multi_Selectable_Async.all_unselect; + Efl.Ui.Multi_Selectable_Async.range_select; + Efl.Ui.Multi_Selectable_Async.range_unselect; + Efl.Ui.Single_Selectable.fallback_selection {get; set;} + Efl.Ui.Selectable.selected {get; set;} } events { /* FIXME: The object is emitted in the event_info. This is redundant. */ diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c index 38b1766b9c..3d8e311580 100644 --- a/src/lib/elementary/efl_ui_selection_manager.c +++ b/src/lib/elementary/efl_ui_selection_manager.c @@ -1483,7 +1483,7 @@ _x11_efl_sel_manager_drag_start(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Da /* TODO BUG: should increase dnd-awareness, in case it's drop target as well. See _x11_drag_mouse_up() */ ecore_x_dnd_aware_set(xwin, EINA_TRUE); ecore_x_dnd_callback_pos_update_set(_x11_drag_move, seat_sel); - ecore_x_dnd_self_begin(xwin, (unsigned char *)&sel, sizeof(Sel_Manager_Selection)); + ecore_x_dnd_self_begin(xwin, (unsigned char *)sel, sizeof(Sel_Manager_Selection)); actx = _x11_dnd_action_rev_map(seat_sel->drag_action); ecore_x_dnd_source_action_set(actx); ecore_x_pointer_grab(xwin); diff --git a/src/lib/elementary/efl_ui_slider.eo b/src/lib/elementary/efl_ui_slider.eo index efaf179071..77d4f26f1d 100644 --- a/src/lib/elementary/efl_ui_slider.eo +++ b/src/lib/elementary/efl_ui_slider.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Layout_Orientable, +class Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Layout_Orientable, Efl.Access.Value, Efl.Access.Widget.Action { diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo index 9f55338ee2..b7e965fff4 100644 --- a/src/lib/elementary/efl_ui_spin.eo +++ b/src/lib/elementary/efl_ui_spin.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, +class Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, Efl.Ui.Format, Efl.Access.Value, Efl.Access.Widget.Action { [[A Spin. diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index 627c6fdefa..9be21373a1 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -167,8 +167,8 @@ _entry_hide(Evas_Object *obj) { Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS); - efl_layout_signal_emit(obj, "efl,state,button,active", "efl"); - efl_layout_signal_emit(obj, "efl,state,entry,inactive", "efl"); + efl_layout_signal_emit(obj, "efl,button,visible,on", "efl"); + efl_layout_signal_emit(obj, "efl,entry,visible,off", "efl"); if (sd->entry_visible && !evas_focus_state_get(evas_object_evas_get(obj))) sd->entry_reactivate = EINA_TRUE; @@ -343,7 +343,7 @@ _entry_show_cb(void *data, elm_object_focus_set(obj, EINA_TRUE); elm_entry_select_all(obj); sd->entry_visible = EINA_TRUE; - efl_layout_signal_emit(data, "efl,state,button,inactive", "efl"); + efl_layout_signal_emit(data, "efl,button,visible,off", "efl"); } static void @@ -378,7 +378,7 @@ _toggle_entry(Evas_Object *obj) efl_event_callback_add(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _entry_focus_changed_cb, obj); sd->entry_visible = EINA_TRUE; - efl_layout_signal_emit(obj, "efl,state,entry,active", "efl"); + efl_layout_signal_emit(obj, "efl,entry,visible,on", "efl"); { Eina_List *items = NULL; @@ -542,13 +542,13 @@ _access_increment_decrement_info_say(Evas_Object *obj, if (is_incremented) { elm_object_signal_emit - (sd->inc_button, "efl,action,anim,activate", "efl"); + (sd->inc_button, "efl,state,animation,activated", "efl"); eina_strbuf_append(buf, E_("incremented")); } else { elm_object_signal_emit - (sd->dec_button, "efl,action,anim,activate", "efl"); + (sd->dec_button, "efl,state,animation,activated", "efl"); eina_strbuf_append(buf, E_("decremented")); } diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo index a8b2778b58..d8e09d91d3 100644 --- a/src/lib/elementary/efl_ui_spin_button.eo +++ b/src/lib/elementary/efl_ui_spin_button.eo @@ -1,6 +1,6 @@ -class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin - implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable, Efl.Ui.Range_Interactive, - Efl.Access.Widget.Action +class Efl.Ui.Spin_Button extends Efl.Ui.Spin + implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable, Efl.Ui.Range_Interactive, + Efl.Access.Widget.Action { [[A Button Spin. @@ -42,7 +42,7 @@ class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin circulate: bool(false); [[$true to enable circulate or $false to disable it.]] } } - @property direct_text_input { + @property direct_text_input @beta { [[Control whether the spin can be directly edited by the user. Spin objects can have editing disabled, in which case they can only diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c index 18756c0d5f..e93c82080f 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c @@ -23,7 +23,7 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) { Eina_Array *array = eina_array_new(2); Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group); - if (efl_player_play_get(pd->hide)) + if (efl_player_playing_get(pd->hide)) { //we are currently in animation, sync the geometry of the targets eina_array_push(array, efl_animation_player_target_get(pd->hide)); @@ -66,7 +66,7 @@ _running_cb(void *data, const Efl_Event *ev EINA_UNUSED) EINA_SAFETY_ON_NULL_RETURN(pd); //calculate absolut position, multiply pos with 2.0 because duration is only 0.5) - absolut_position = pd->from + (pd->to - pd->from)*(efl_player_pos_get(pd->show)*2.0); + absolut_position = pd->from + (pd->to - pd->from)*(efl_player_playback_position_get(pd->show)*2.0); efl_event_callback_call(data, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position); } @@ -132,7 +132,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp pd->show = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj); efl_animation_player_animation_set(pd->show, show_anim); - efl_player_play_set(pd->show, EINA_FALSE); + efl_player_playing_set(pd->show, EINA_FALSE); efl_event_callback_array_add(pd->show, _anim_show_event_cb(), obj); //Default Hide Animation @@ -143,7 +143,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp pd->hide = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj); efl_animation_player_animation_set(pd->hide, hide_anim); - efl_player_play_set(pd->hide, EINA_FALSE); + efl_player_playing_set(pd->hide, EINA_FALSE); efl_event_callback_array_add(pd->hide, _anim_hide_event_cb(), obj); for (int i = 0; i < efl_content_count(spotlight) ; ++i) { @@ -176,9 +176,9 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EIN static void _setup_anim(Efl_Animation_Player *player, Efl_Gfx_Entity *entity) { - efl_player_stop(player); + efl_player_playing_set(player, EINA_FALSE); efl_animation_player_target_set(player, entity); - efl_player_start(player); + efl_player_playing_set(player, EINA_TRUE); } static Eina_Bool @@ -256,7 +256,7 @@ _reset_player(Efl_Animation_Player *player, Eina_Bool vis) Efl_Gfx_Entity *obj; obj = efl_animation_player_target_get(player); - efl_player_stop(player); + efl_player_playing_set(player, EINA_FALSE); efl_animation_player_target_set(player, NULL); efl_gfx_entity_visible_set(obj, vis); } diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 7b29f3e41e..a57ca7e4f9 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -4082,7 +4082,7 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) /* Internal EO APIs and hidden overrides */ -//ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +//EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #include "efl_ui_text.eo.c" diff --git a/src/lib/elementary/efl_ui_timepicker.c b/src/lib/elementary/efl_ui_timepicker.c index 2fc578dd61..335e26230e 100644 --- a/src/lib/elementary/efl_ui_timepicker.c +++ b/src/lib/elementary/efl_ui_timepicker.c @@ -173,16 +173,16 @@ _fields_init(Eo *obj) //TODO: monitoring locale change and update field location. if (field == 0) { - elm_object_signal_emit(obj, "efl,state,colon,visible,field1", "efl"); - elm_object_signal_emit(obj, "efl,state,colon,invisible,field0", "efl"); + elm_object_signal_emit(obj, "efl,colon_field1,visible,on", "efl"); + elm_object_signal_emit(obj, "efl,colon_field0,visible,off", "efl"); } else { - elm_object_signal_emit(obj, "efl,state,colon,visible,field0", "efl"); - elm_object_signal_emit(obj, "efl,state,colon,invisible,field1", "efl"); + elm_object_signal_emit(obj, "efl,colon_field0,visible,on", "efl"); + elm_object_signal_emit(obj, "efl,colon_field1,visible,off", "efl"); } - elm_layout_signal_emit(obj, "efl,state,ampm,visible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); edje_object_message_signal_process(elm_layout_edje_get(obj)); efl_content_set(efl_part(obj, buf), pd->ampm); } @@ -251,9 +251,9 @@ _efl_ui_timepicker_is_24hour_set(Eo *obj, Efl_Ui_Timepicker_Data *pd, Eina_Bool pd->is_24hour = is_24hour; if (pd->is_24hour == EINA_TRUE) - elm_layout_signal_emit(obj, "efl,state,ampm,invisible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,off", "efl"); else - elm_layout_signal_emit(obj, "efl,state,ampm,visible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); _field_value_update(obj); } diff --git a/src/lib/elementary/efl_ui_timepicker.eo b/src/lib/elementary/efl_ui_timepicker.eo index d8bea2159c..0021384834 100644 --- a/src/lib/elementary/efl_ui_timepicker.eo +++ b/src/lib/elementary/efl_ui_timepicker.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Timepicker extends Efl.Ui.Layout_Base +class Efl.Ui.Timepicker extends Efl.Ui.Layout_Base { [[Timepicker widget diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index dc3696a9af..172e9122cc 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -95,7 +95,7 @@ _key_action_move(Evas_Object *obj, const char *params) static Eina_Bool _key_action_play(Evas_Object *obj, const char *params EINA_UNUSED) { - if (efl_player_play_get(obj)) + if (!efl_player_paused_get(obj)) elm_video_pause(obj); else elm_video_play(obj); @@ -327,22 +327,17 @@ _efl_ui_video_emotion_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) return sd->emotion; } -EOLIAN static void -_efl_ui_video_efl_player_start(Eo *obj, Efl_Ui_Video_Data *sd EINA_UNUSED) +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_paused_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool paused) { - efl_player_pos_set(obj, 0.0); - efl_player_play_set(obj, EINA_TRUE); -} + paused = !!paused; + /* can't pause if we're stopped */ + if (sd->stop) return EINA_FALSE; + if (emotion_object_play_get(sd->emotion) == !paused) return EINA_TRUE; -EOLIAN static void -_efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play) -{ - if (emotion_object_play_get(sd->emotion) == !!play) return; - - if (play) + if (!paused) { ELM_SAFE_FREE(sd->timer, ecore_timer_del); - sd->stop = EINA_FALSE; emotion_object_play_set(sd->emotion, EINA_TRUE); if(elm_widget_is_legacy(obj)) @@ -363,18 +358,30 @@ _efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play else elm_layout_signal_emit(obj, "efl,video,pause", "efl"); } + return EINA_TRUE; } /* FIXME: stop should go into hibernate state directly. */ -EOLIAN static void -_efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd) +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_playing_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool playing) { - if (!emotion_object_play_get(sd->emotion) && sd->stop) return; - + playing = !!playing; + if (playing && emotion_object_play_get(sd->emotion)) return EINA_TRUE; + if ((!playing) && sd->stop) return EINA_TRUE; ELM_SAFE_FREE(sd->timer, ecore_timer_del); + sd->stop = !playing; + if (playing) + { + emotion_object_play_set(sd->emotion, EINA_TRUE); - sd->stop = EINA_TRUE; + if(elm_widget_is_legacy(obj)) + elm_layout_signal_emit(obj, "elm,video,play", "elm"); + else + elm_layout_signal_emit(obj, "efl,video,play", "efl"); + return EINA_TRUE; + } + efl_player_playback_position_set(obj, 0.0); emotion_object_play_set(sd->emotion, EINA_FALSE); if(elm_widget_is_legacy(obj)) @@ -383,14 +390,22 @@ _efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd) elm_layout_signal_emit(obj, "efl,video,stop", "efl"); emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE); + return EINA_TRUE; } EOLIAN static Eina_Bool -_efl_ui_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) +_efl_ui_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) { return emotion_object_play_get(sd->emotion); } +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) +{ + /* pause is when !playing and !stopped */ + return !emotion_object_play_get(sd->emotion) && !sd->stop; +} + EOLIAN static const char* _efl_ui_video_title_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) { @@ -474,73 +489,76 @@ elm_video_file_get(Eo *obj, const char **filename) EAPI void elm_video_audio_level_set(Evas_Object *obj, double volume) { - efl_player_volume_set(obj, volume); + efl_audio_control_volume_set(obj, volume); } EAPI double elm_video_audio_level_get(const Evas_Object *obj) { - return efl_player_volume_get(obj); + return efl_audio_control_volume_get(obj); } EAPI void elm_video_audio_mute_set(Evas_Object *obj, Eina_Bool mute) { - efl_player_mute_set(obj, mute); + efl_audio_control_mute_set(obj, mute); } EAPI Eina_Bool elm_video_audio_mute_get(const Evas_Object *obj) { - return efl_player_mute_get(obj); + return efl_audio_control_mute_get(obj); } EAPI double elm_video_play_length_get(const Evas_Object *obj) { - return efl_player_length_get(obj); + return efl_playable_length_get(obj); } EAPI Eina_Bool elm_video_is_seekable_get(const Evas_Object *obj) { - return efl_player_seekable_get(obj); + return efl_playable_seekable_get(obj); } EAPI void elm_video_play_position_set(Evas_Object *obj, double position) { - efl_player_pos_set(obj, position); + efl_player_playback_position_set(obj, position); } EAPI double elm_video_play_position_get(const Evas_Object *obj) { - return efl_player_pos_get(obj); + return efl_player_playback_position_get(obj); } EAPI Eina_Bool elm_video_is_playing_get(Evas_Object *obj) { - return efl_player_play_get(obj); + return efl_player_playing_get(obj) && !efl_player_paused_get(obj); } EAPI void elm_video_play(Evas_Object *obj) { - efl_player_play_set(obj, EINA_TRUE); + if (efl_player_playing_get(obj)) + efl_player_paused_set(obj, EINA_FALSE); + else + efl_player_playing_set(obj, EINA_TRUE); } EAPI void elm_video_stop(Evas_Object *obj) { - efl_player_stop(obj); + efl_player_playing_set(obj, EINA_FALSE); } EAPI void elm_video_pause(Evas_Object *obj) { - efl_player_play_set(obj, EINA_FALSE); + efl_player_paused_set(obj, EINA_TRUE); } #include "efl_ui_video_legacy_eo.c" diff --git a/src/lib/elementary/efl_ui_video.eo b/src/lib/elementary/efl_ui_video.eo index 5fc841a3b3..d585a0c634 100644 --- a/src/lib/elementary/efl_ui_video.eo +++ b/src/lib/elementary/efl_ui_video.eo @@ -43,8 +43,7 @@ class @beta Efl.Ui.Video extends Efl.Ui.Layout_Base Efl.Canvas.Group.group_calculate; Efl.Ui.Widget.widget_input_event_handler; Efl.Access.Widget.Action.elm_actions { get; } - Efl.Player.start; - Efl.Player.stop; - Efl.Player.play { get; set; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } } } diff --git a/src/lib/elementary/efl_ui_view_model.eo b/src/lib/elementary/efl_ui_view_model.eo index a5caaa8d1c..ebc25dd342 100644 --- a/src/lib/elementary/efl_ui_view_model.eo +++ b/src/lib/elementary/efl_ui_view_model.eo @@ -17,7 +17,7 @@ function @beta EflUiViewModelPropertySet { return: future; [[The value that was finally set.]] }; -class @beta Efl.Ui.View_Model extends Efl.Composite_Model +class Efl.Ui.View_Model extends Efl.Composite_Model { [[Efl model providing helpers for custom properties used when linking a model to a view and you need to generate/adapt values for display. @@ -60,7 +60,7 @@ class @beta Efl.Ui.View_Model extends Efl.Composite_Model } return: Eina.Error; } - property_logic_add { + property_logic_add @beta { [[Add callbacks that will be triggered when someone ask for the specified property name when getting or setting a property. @@ -79,7 +79,7 @@ class @beta Efl.Ui.View_Model extends Efl.Composite_Model } return: Eina.Error; } - property_logic_del { + property_logic_del @beta { [[Delete previously added callbacks that were triggered when someone asked for the specified property name when getting or setting a property. diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 6835688c52..d98ee78fa1 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -5816,8 +5816,6 @@ _efl_ui_property_bind_get(Eo *obj, Efl_Ui_Widget_Data *pd, Efl_Ui_Property_Bound value = efl_model_property_get(pd->properties.model, prop->property); target = prop->part ? efl_part(obj, prop->part) : obj; - fprintf(stderr, "setting: %s for %s from %s\n", - eina_value_to_string(value), prop->property, efl_debug_name_get(pd->properties.model)); err = efl_property_reflection_set(target, prop->key, eina_value_reference_copy(value)); eina_value_free(value); diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index ffb02753d9..13160af8e1 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -32,8 +32,12 @@ struct _Efl_Ui_Widget_Factory_Data { const Efl_Class *klass; + Efl_Ui_Widget *parenting_widget; + Eina_Hash *parts; + Eina_Stringshare *default_property; + Eina_Stringshare *style; }; @@ -41,9 +45,29 @@ struct _Efl_Ui_Widget_Factory_Request { Efl_Ui_Widget_Factory_Data *pd; Efl_Ui_Factory *factory; - Eo *parent; }; +static Efl_Object * +_efl_ui_widget_factory_efl_object_finalize(Eo *obj, Efl_Ui_Widget_Factory_Data *pd) +{ + pd->parenting_widget = efl_provider_find(obj, EFL_UI_WIDGET_CLASS); + if (!pd->parenting_widget) + { + ERR("Widget_Factory requires a Widget as parent."); + return NULL; + } + + return efl_finalize(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS)); +} + +Efl_Ui_Win * +efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory) +{ + Efl_Ui_Widget_Factory_Data *pd = efl_data_scope_get(factory, EFL_UI_WIDGET_FACTORY_CLASS); + + return pd->parenting_widget; +} + static void _efl_ui_widget_factory_item_class_set(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, const Efl_Class *klass) @@ -69,16 +93,56 @@ _efl_ui_widget_factory_item_class_get(const Eo *obj EINA_UNUSED, } static void -_efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd, Efl_Gfx_Entity *ui_view) +_efl_ui_widget_factory_constructing(void *data EINA_UNUSED, const Efl_Event *ev) { + Efl_Gfx_Entity *ui_view = ev->info; const Efl_Model *model; - Eina_Value *property, *width, *height; + Eina_Value *width, *height; + + model = efl_ui_view_model_get(ui_view); + + // Enable recalculate in case we do not know the size of the item + efl_canvas_group_need_recalculate_set(ui_view, EINA_TRUE); + + // Fetch min size from model if available to avoid recalculcating it + width = efl_model_property_get(model, "self.width"); + height = efl_model_property_get(model, "self.height"); + if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR && + eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR) + { + Eina_Size2D s; + + if (!eina_value_int_convert(width, &s.w)) s.w = 0; + if (!eina_value_int_convert(height, &s.h)) s.h = 0; + + efl_gfx_hint_size_min_set(ui_view, s); + efl_canvas_group_need_recalculate_set(ui_view, EINA_FALSE); + if (efl_isa(ui_view, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(ui_view, EINA_TRUE); + } + eina_value_free(width); + eina_value_free(height); + + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", (void*)EINA_TRUE); +} + + +static void +_efl_ui_widget_factory_building(void *data, const Efl_Event *ev) +{ + Efl_Gfx_Entity *ui_view = ev->info; + Efl_Ui_Widget_Factory_Data *pd = data; + const Efl_Model *model; + Eina_Value *property; Efl_Ui_Bind_Part_Data *bpd; Eina_Iterator *it; char *style; model = efl_ui_view_model_get(ui_view); + // Check property size only if not checked yet + if (!efl_key_data_get(ui_view, "efl.ui.widget.factory.size_check")) + _efl_ui_widget_factory_constructing(data, ev); + // Bind all property before the object is finalize it = eina_hash_iterator_data_new(pd->parts); EINA_ITERATOR_FOREACH(it, bpd) @@ -93,22 +157,6 @@ _efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Ef } eina_iterator_free(it); - // Fetch min size from model if available to avoid recalculcating it - width = efl_model_property_get(model, "self.width"); - height = efl_model_property_get(model, "self.height"); - if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR && - eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR) - { - Eina_Size2D s; - - if (!eina_value_int_convert(width, &s.w)) s.w = 0; - if (!eina_value_int_convert(height, &s.h)) s.h = 0; - - efl_gfx_hint_size_min_set(ui_view, s); - } - eina_value_free(width); - eina_value_free(height); - // As we have already waited for the property to be ready, we should get the right style now if (!pd->style) return ; @@ -120,18 +168,72 @@ _efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Ef free(style); eina_value_free(property); + + efl_key_data_set(ui_view, "efl.ui.widget.factory.cached", NULL); +} + +static void +_efl_ui_widget_factory_releasing(void *data, const Efl_Event *ev) +{ + Efl_Ui_Widget_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = ev->info; + Efl_Ui_Bind_Part_Data *bpd; + Eina_Iterator *it; + + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_set", NULL); + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", NULL); + if (efl_isa(ui_view, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(ui_view, EINA_TRUE); + + // Bind default property + if (pd->default_property) efl_ui_property_bind(ui_view, NULL, pd->default_property); + + // Bind all property before the object is finalize + it = eina_hash_iterator_data_new(pd->parts); + EINA_ITERATOR_FOREACH(it, bpd) + { + Efl_Ui_Property_Bind_Data *bppd; + Eina_List *l; + + EINA_LIST_FOREACH(bpd->properties, l, bppd) + efl_ui_property_bind(efl_part(ui_view, bpd->part), + bppd->part_property, NULL); + } + eina_iterator_free(it); + + efl_ui_view_model_set(ui_view, NULL); + + // Prevent any recalc to happen when an object is in the cache or during shutdown of the object + efl_canvas_group_need_recalculate_set(ui_view, EINA_FALSE); +} + +EFL_CALLBACKS_ARRAY_DEFINE(item_callbacks, + { EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _efl_ui_widget_factory_constructing }, + { EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_widget_factory_building }, + { EFL_UI_FACTORY_EVENT_ITEM_RELEASING, _efl_ui_widget_factory_releasing }) + +static Eo * +_efl_ui_widget_factory_efl_object_constructor(Efl_Ui_Widget_Factory *obj, + Efl_Ui_Widget_Factory_Data *pd) +{ + obj = efl_constructor(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS)); + + efl_event_callback_array_add(obj, item_callbacks(), pd); + + return obj; } static Efl_Ui_Widget * _efl_ui_widget_create(const Efl_Ui_Factory *factory, - const Efl_Class *klass, Eo *parent, + const Efl_Class *klass, + Efl_Ui_Widget *parent, Efl_Model *model) { Efl_Ui_Widget *w; w = efl_add(klass, parent, efl_ui_view_model_set(efl_added, model), - efl_ui_factory_building(factory, efl_added)); + efl_event_callback_call((Efl_Ui_Factory *) factory, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); + efl_event_callback_call((Efl_Ui_Factory *) factory, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); return w; } @@ -141,7 +243,7 @@ _efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v EIN Efl_Ui_Widget_Factory_Request *r = data; Efl_Ui_Widget *w; - w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model); + w = _efl_ui_widget_create(r->factory, r->pd->klass, r->pd->parenting_widget, model); if (!w) return eina_value_error_init(ENOMEM); return eina_value_object_init(w); } @@ -158,13 +260,12 @@ _efl_ui_widget_factory_create_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_ Efl_Ui_Widget_Factory_Request *r = data; efl_unref(r->factory); - efl_unref(r->parent); free(r); } static Eina_Future * _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) + Eina_Iterator *models) { Efl_Ui_Widget_Factory_Request *r; Eina_Future **f; @@ -183,7 +284,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data EINA_ITERATOR_FOREACH(models, model) { - w = _efl_ui_widget_create(obj, pd->klass, parent, model); + w = _efl_ui_widget_create(obj, pd->klass, pd->parenting_widget, model); if (!w) return efl_loop_future_rejected(obj, ENOMEM); eina_value_array_append(&r, w); @@ -197,7 +298,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data if (!r) return efl_loop_future_rejected(obj, ENOMEM); r->pd = pd; - r->parent = efl_ref(parent); r->factory = efl_ref(obj); f = calloc(count + 1, sizeof (Eina_Future *)); @@ -221,7 +321,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data .free = _efl_ui_widget_factory_create_cleanup); alloc_array_error: - efl_unref(r->parent); efl_unref(r->factory); free(r); eina_iterator_free(models); @@ -229,12 +328,21 @@ alloc_array_error: } static void -_efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED, +_efl_ui_widget_factory_efl_ui_factory_release(Eo *obj, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, - Efl_Gfx_Entity *ui_view) + Eina_Iterator *ui_views) { - // We do not cache or track this item, just get rid of them asap - efl_del(ui_view); + Efl_Gfx_Entity *ui_view; + + EINA_ITERATOR_FOREACH(ui_views, ui_view) + { + // There might be multiple call to releasing on the same object as every factory in the + // inheritance chain can decide to keep it for a time + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); + // We do not cache or track this item, just get rid of them asap + efl_del(ui_view); + } + eina_iterator_free(ui_views); } Eina_Stringshare *_property_style_ss = NULL; @@ -298,10 +406,16 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE if (!pd->pd) { - EINA_LOG_ERR("Trying to bind part property without specifying which part"); + ERR("Trying to bind part property without specifying which part"); return ENOENT; } + if (!key) + { + eina_stringshare_replace(&pd->pd->default_property, property); + return 0; + } + if (!pd->pd->parts) pd->pd->parts = eina_hash_stringshared_new(NULL); @@ -329,5 +443,15 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE return 0; } +static Eina_Error +_efl_ui_widget_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, + Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, + const char *key EINA_UNUSED, + Efl_Ui_Factory *factory EINA_UNUSED) +{ + ERR("Efl.Ui.Widget_Factory doesn't support efl.ui.factory_bind.\n"); + return EINA_ERROR_NOT_IMPLEMENTED; +} + #include "efl_ui_property_bind_part.eo.c" #include "efl_ui_widget_factory.eo.c" diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo index fdf537c1a7..47367b395c 100644 --- a/src/lib/elementary/efl_ui_widget_factory.eo +++ b/src/lib/elementary/efl_ui_widget_factory.eo @@ -1,10 +1,9 @@ -class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory, Efl.Part +class Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory, Efl.Part { [[Efl Ui Factory that provides @Efl.Ui.Widget. This factory is designed to build @Efl.Ui.Widget and optionally set their @Efl.Ui.Widget.style if it was connected with @Efl.Ui.Property_Bind.property_bind "$style". - ]] methods { @property item_class { @@ -18,11 +17,13 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa } implements { + Efl.Object.constructor; Efl.Ui.Factory.create; Efl.Ui.Factory.release; - Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; + Efl.Ui.Factory_Bind.factory_bind; Efl.Part.part_get; + Efl.Object.finalize; } constructors { .item_class @optional; diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h index 7c775f0868..de625b28b4 100644 --- a/src/lib/elementary/efl_ui_widget_image.h +++ b/src/lib/elementary/efl_ui_widget_image.h @@ -56,6 +56,7 @@ struct _Efl_Ui_Image_Data double scale; double frame_duration; + double playback_speed; double align_x, align_y; Eina_Size2D load_size; @@ -96,7 +97,7 @@ struct _Efl_Ui_Image_Data Eina_Bool edit : 1; Eina_Bool edje : 1; Eina_Bool anim : 1; - Eina_Bool play : 1; + Eina_Bool paused : 1; Eina_Bool async_enable : 1; Eina_Bool scale_up : 1; Eina_Bool scale_down : 1; diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 68ab6bfd0c..72a9239a26 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -1160,14 +1160,14 @@ _elm_win_focus_highlight_visible_set(Efl_Ui_Win_Data *sd, if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(fobj, "elm,action,focus,show", "elm"); else - edje_object_signal_emit(fobj, "efl,action,focus,show", "efl"); + edje_object_signal_emit(fobj, "efl,focus,visible,on", "efl"); } else { if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(fobj, "elm,action,focus,hide", "elm"); else - edje_object_signal_emit(fobj, "efl,action,focus,hide", "efl"); + edje_object_signal_emit(fobj, "efl,focus,visible,off", "efl"); } } @@ -1226,7 +1226,7 @@ _elm_win_focus_highlight_simple_setup(Efl_Ui_Win_Data *sd, if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(obj, "elm,state,anim,stop", "elm"); else - edje_object_signal_emit(obj, "efl,state,anim,stop", "efl"); + edje_object_signal_emit(obj, "efl,state,animating,stopped", "efl"); } static void @@ -4074,7 +4074,7 @@ _elm_win_focus_highlight_init(Efl_Ui_Win_Data *sd) else { edje_object_signal_callback_add(sd->focus_highlight.fobj, - "efl,action,focus,hide,end", "*", + "efl,focus,visible,off,done", "*", _elm_win_focus_highlight_hide, NULL); edje_object_signal_callback_add(sd->focus_highlight.fobj, "efl,action,focus,anim,end", "*", @@ -5960,6 +5960,9 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) if (!efl_parent_get(obj)) efl_allow_parent_unref_set(obj, EINA_TRUE); + if (!elm_widget_is_legacy(obj)) + pd->type = EFL_UI_WIN_TYPE_BASIC; + return obj; } diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index 30ae151ac6..bec6fdbf51 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -443,7 +443,7 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W [[If the object is not window object, returns $unknown.]] } values { - type: Efl.Ui.Win_Type(Efl.Ui.Win_Type.unknown); [[Window type]] + type: Efl.Ui.Win_Type(Efl.Ui.Win_Type.basic); [[Window type]] } } @property accel_preference @beta { diff --git a/src/lib/elementary/elm_actionslider.c b/src/lib/elementary/elm_actionslider.c index 05036fea8e..4537cd9255 100644 --- a/src/lib/elementary/elm_actionslider.c +++ b/src/lib/elementary/elm_actionslider.c @@ -636,10 +636,10 @@ ELM_PART_OVERRIDE_TEXT_GET(elm_actionslider, ELM_ACTIONSLIDER, Elm_Actionslider_ /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_ACTIONSLIDER_EXTRA_OPS \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(elm_actionslider) #include "elm_actionslider_eo.c" diff --git a/src/lib/elementary/elm_bubble.c b/src/lib/elementary/elm_bubble.c index df395831a4..06ebba6d43 100644 --- a/src/lib/elementary/elm_bubble.c +++ b/src/lib/elementary/elm_bubble.c @@ -223,12 +223,12 @@ ELM_PART_OVERRIDE_TEXT_SET(elm_bubble, ELM_BUBBLE, Elm_Bubble_Data) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_BUBBLE_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(elm_bubble) #include "elm_bubble_eo.c" diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index bbc6b9f668..fc9b0d54b9 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -994,7 +994,7 @@ _elm_config_profile_dir_get(const char *prof, if (!is_user) goto not_user; - if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + if ((!_running_in_tree) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof); // See elm_config_profile_dir_free: always use strdup+free @@ -1004,7 +1004,7 @@ _elm_config_profile_dir_get(const char *prof, return NULL; not_user: - if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + if ((!_running_in_tree) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof); // See elm_config_profile_dir_free: always use strdup+free @@ -1389,7 +1389,7 @@ _elm_config_profiles_list(Eina_Bool hide_profiles) const char *dir; size_t len = 0; - if (_use_build_config) + if (_running_in_tree) { len = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); if (len) len = strlen(buf); @@ -1477,7 +1477,7 @@ _profile_fetch_from_conf(void) Eet_File *ef = NULL; int len = 0, i; - if (_use_build_config) goto end; + if (_running_in_tree) goto end; // if env var - use profile without question s = _getenv_once("ELM_PROFILE"); if (s) @@ -1769,7 +1769,7 @@ _config_load(void) efl_provider_register(efl_main_loop_get(), EFL_CONFIG_INTERFACE, _efl_config_obj); efl_provider_register(efl_main_loop_get(), EFL_CONFIG_GLOBAL_CLASS, _efl_config_obj); efl_del_intercept_set(_efl_config_obj, _efl_config_obj_del); - if (!_use_build_config) + if (!_running_in_tree) { _elm_config = _config_user_load(); if (_elm_config) @@ -2127,7 +2127,7 @@ _elm_config_profile_save(const char *profile) Eet_File *ef; size_t len; - if (_use_build_config || ((s = _getenv_once("ELM_PROFILE_NOSAVE")) && atoi(s))) + if (_running_in_tree || ((s = _getenv_once("ELM_PROFILE_NOSAVE")) && atoi(s))) return EINA_TRUE; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); @@ -3083,7 +3083,7 @@ elm_config_profile_exists(const char *profile) if (!profile) return EINA_FALSE; - if (_use_build_config) + if (_running_in_tree) { if (!bs_data_path_get(buf, sizeof(buf), "elementary/config", profile)) return EINA_FALSE; return ecore_file_exists(buf); @@ -4193,7 +4193,7 @@ elm_config_all_flush(void) int ok = 0; size_t len; - if (_use_build_config) return; + if (_running_in_tree) return; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/"); if (len + 1 >= sizeof(buf)) return; @@ -4300,7 +4300,7 @@ _elm_config_sub_shutdown(void) ELM_SAFE_FREE(_monitor_file_created_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_file_modified_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_directory_created_handler, ecore_event_handler_del); - _use_build_config = EINA_FALSE; + _running_in_tree = EINA_FALSE; } static Eina_Bool @@ -4392,7 +4392,7 @@ _elm_config_sub_init(void) char buf[PATH_MAX]; int ok = 0; - if (_use_build_config) + if (_running_in_tree) ok = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); else { diff --git a/src/lib/elementary/elm_conform.c b/src/lib/elementary/elm_conform.c index 55c6bc8488..38521427a3 100644 --- a/src/lib/elementary/elm_conform.c +++ b/src/lib/elementary/elm_conform.c @@ -1025,10 +1025,10 @@ _elm_conformant_class_constructor(Efl_Class *klass) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_CONFORMANT_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_conformant) #include "elm_conformant_eo.c" diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index c186bdebc3..28fcd55542 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -6265,14 +6265,14 @@ ELM_PART_CONTENT_DEFAULT_GET(elm_entry, "icon") /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_ENTRY_EXTRA_OPS \ ELM_PART_CONTENT_DEFAULT_OPS(elm_entry), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_entry), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_CALC_OPS(elm_entry) #include "elm_entry_eo.c" diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c index 17691a0fcf..0a46903d99 100644 --- a/src/lib/elementary/elm_hover.c +++ b/src/lib/elementary/elm_hover.c @@ -872,12 +872,12 @@ ELM_PART_OVERRIDE_CONTENT_UNSET(elm_hover, ELM_HOVER, Elm_Hover_Data) /* Internal EO APIs and hidden overrides */ -// ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) is overridden with an if() -// ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) somehow doesn't compile!? +// EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) is overridden with an if() +// EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) somehow doesn't compile!? #define ELM_HOVER_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_hover), \ EFL_CANVAS_GROUP_CALC_OPS(elm_hover), \ - _ELM_LAYOUT_ALIASES_OPS(elm_hover, content) + _EFL_UI_LAYOUT_ALIASES_OPS(elm_hover, content) #include "elm_hover_eo.c" diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index dfc81efbba..cd9803a518 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -31,6 +31,8 @@ #include "elm_gengrid_eo.h" #include "elm_widget_gengrid.h" +#include "efl_ui.eot.c" + #define SEMI_BROKEN_QUICKLAUNCH 1 #ifdef __CYGWIN__ @@ -39,7 +41,7 @@ # define LIBEXT ".so" #endif -Eina_Bool _use_build_config; +Eina_Bool _running_in_tree; static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; @@ -405,16 +407,14 @@ _sys_lang_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA } EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE = 0; -EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_DEFAULT = 0; -EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_GENERIC = 0; static void _efl_ui_theme_apply_error_init(void) { if (EFL_UI_THEME_APPLY_ERROR_DEFAULT) return; /* NONE should always be 0 */ - EFL_UI_THEME_APPLY_ERROR_DEFAULT = eina_error_msg_static_register("Fallback to default style was enabled for this widget"); - EFL_UI_THEME_APPLY_ERROR_GENERIC = eina_error_msg_static_register("An error occurred and no theme could be set for this widget"); + EFL_UI_THEME_APPLY_ERROR_DEFAULT; + EFL_UI_THEME_APPLY_ERROR_GENERIC; } // This is necessary to keep backward compatibility @@ -786,7 +786,7 @@ elm_quicklaunch_init(int argc EINA_UNUSED, { _elm_ql_init_count++; if (_elm_ql_init_count > 1) return _elm_ql_init_count; - _use_build_config = !!getenv("EFL_RUN_IN_TREE"); + _running_in_tree = !!getenv("EFL_RUN_IN_TREE"); EINA_SAFETY_ON_FALSE_GOTO(eina_init(), fail_eina); _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE); EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log); @@ -829,7 +829,7 @@ elm_quicklaunch_init(int argc EINA_UNUSED, LOCALE_DIR); if (pfx) { - if (_use_build_config) + if (_running_in_tree) _elm_data_dir = eina_stringshare_add(PACKAGE_BUILD_DIR "/data/elementary"); else _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx)); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index b94322c004..8cb7ee5c64 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -165,6 +165,7 @@ # include "efl_ui_focus_parent_provider_standard.eo.h" # include "efl_ui_selection_manager.eo.h" # include "efl_datetime_manager.eo.h" + extern const char *_efl_model_property_itemw; extern const char *_efl_model_property_itemh; extern const char *_efl_model_property_selfw; @@ -892,6 +893,8 @@ extern const char SIG_LAYOUT_UNFOCUSED[]; extern Eina_Stringshare *_property_style_ss; +Efl_Ui_Win *efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory); + extern Eina_Bool _config_profile_lock; extern Eina_FreeQ *postponed_fq; @@ -916,7 +919,7 @@ _elm_dgettext(const char *string) # endif -extern Eina_Bool _use_build_config; +extern Eina_Bool _running_in_tree; /* Used by the paste handler */ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry); @@ -932,29 +935,29 @@ void *_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const void efl_ui_win_inlined_parent_set(Eo *obj, Efl_Canvas_Object *parent); /* Internal EO APIs */ -const Elm_Layout_Part_Alias_Description *elm_layout_content_aliases_get(const Eo *obj); -const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *obj); +const Elm_Layout_Part_Alias_Description *efl_ui_layout_content_aliases_get(const Eo *obj); +const Elm_Layout_Part_Alias_Description *efl_ui_layout_text_aliases_get(const Eo *obj); void efl_ui_slider_val_fetch(Evas_Object *obj, Eina_Bool user_event); void efl_ui_slider_val_set(Evas_Object *obj); void efl_ui_slider_down_knob(Evas_Object *obj, double button_x, double button_y); void efl_ui_slider_move_knob(Evas_Object *obj, double button_x, double button_y); //void elm_layout_sizing_eval_eoapi(Eo *obj); -# define _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, _typ) \ +# define _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, _typ) \ static const Elm_Layout_Part_Alias_Description * \ _##_pfx##_##_typ##_aliases_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) \ { \ return _##_typ##_aliases; \ } -# define _ELM_LAYOUT_ALIASES_OPS(_pfx, _typ) \ - EFL_OBJECT_OP_FUNC(elm_layout_##_typ##_aliases_get, _##_pfx##_##_typ##_aliases_get) +# define _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, _typ) \ + EFL_OBJECT_OP_FUNC(efl_ui_layout_##_typ##_aliases_get, _##_pfx##_##_typ##_aliases_get) -# define ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(_pfx) _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, content) -# define ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(_pfx) _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, text) +# define EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(_pfx) _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, content) +# define EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(_pfx) _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, text) -# define ELM_LAYOUT_CONTENT_ALIASES_OPS(_pfx) _ELM_LAYOUT_ALIASES_OPS(_pfx, content) -# define ELM_LAYOUT_TEXT_ALIASES_OPS(_pfx) _ELM_LAYOUT_ALIASES_OPS(_pfx, text) +# define EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(_pfx) _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, content) +# define EFL_UI_LAYOUT_TEXT_ALIASES_OPS(_pfx) _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, text) # define EFL_CANVAS_GROUP_CALC_OPS(_pfx) \ EFL_OBJECT_OP_FUNC(efl_canvas_group_calculate, _##_pfx##_efl_canvas_group_group_calculate) diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index cc09ed14b7..85426386e2 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -1726,9 +1726,9 @@ void _elm_slider_efl_ui_format_apply_formatted_value(Eo *obj EINA_UNUSED, Elm_Sl /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(elm_slider) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(elm_slider) #define ELM_SLIDER_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(elm_slider) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(elm_slider) #include "elm_slider_eo.c" diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 7afc2d218b..ab8ea9a215 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -300,6 +300,9 @@ #include "elm_object_item.h" #include "efl_ui.eot.h" typedef Eo Efl_Ui_Focus_Manager; + +extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; + #define _EFL_UI_FOCUS_MANAGER_EO_CLASS_TYPE #include "efl_ui_focus_object.eo.h" #include "efl_ui_focus_manager.eo.h" diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h index 0997ccbb0d..299fdc11a6 100644 --- a/src/lib/elementary/elm_widget_layout.h +++ b/src/lib/elementary/elm_widget_layout.h @@ -53,6 +53,7 @@ typedef struct _Efl_Ui_Layout_Data Eina_List *subs; /**< List of Elm_Layout_Sub_Object_Data structs, to hold the actual sub objects such as text, content and the children of box and table. */ Eina_List *edje_signals; /**< The list of edje signal callbacks. */ Eina_List *parts_cursors; /**< The list of cursor names of layout parts. This is a list of Elm_Layout_Sub_Object_Cursor struct. */ + Eina_Inarray *deferred_signals; /**< signals which were generated during construction */ struct { Eina_Hash *properties; /**< The list of properties connected to layout parts. */ @@ -63,6 +64,7 @@ typedef struct _Efl_Ui_Layout_Data } connect; unsigned int finger_size_multiplier_x, finger_size_multiplier_y; /**< multipliers for finger_size during group_calc */ + unsigned int version; /**< version number specified in the widget's theme */ Eina_Bool frozen; /**< Layout freeze state */ Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */ diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index bb3b134b7f..9471531acf 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -112,8 +112,6 @@ pub_eo_files = [ 'efl_ui_layout_part_bg.eo', 'efl_ui_layout_part_legacy.eo', 'efl_ui_list_view.eo', - 'efl_ui_list_view_model.eo', - 'efl_ui_list_view_pan.eo', 'efl_ui_item.eo', 'efl_ui_default_item.eo', 'efl_ui_group_item.eo', @@ -174,17 +172,22 @@ pub_eo_files = [ 'efl_ui_relative_layout.eo', 'efl_ui_action_connector.eo', 'efl_ui_format.eo', + 'efl_ui_item_clickable.eo', 'efl_ui_collection.eo', 'efl_ui_position_manager_entity.eo', 'efl_ui_position_manager_list.eo', 'efl_ui_position_manager_grid.eo', 'efl_ui_selectable.eo', 'efl_ui_multi_selectable.eo', + 'efl_ui_multi_selectable_async.eo', 'efl_ui_single_selectable.eo', 'efl_ui_position_manager_data_access_v1.eo', 'efl_ui_tab_bar_default_item.eo', 'efl_ui_select_model.eo', 'efl_ui_view_model.eo', + 'efl_ui_collection_view.eo', + 'efl_ui_collection_view_focus_manager.eo', + 'efl_ui_grid_view.eo', ] foreach eo_file : pub_eo_files @@ -205,7 +208,6 @@ endforeach pub_eo_types_files = [ 'elm_general.eot', 'efl_ui.eot', - 'efl_ui_list_view_types.eot', 'efl_ui_selection_types.eot', 'efl_ui_dnd_types.eot' ] @@ -219,8 +221,9 @@ foreach eo_file : pub_eo_types_files install_dir : dir_package_include, command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), + '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-ghd', '@INPUT@']) + '-gchd', '@INPUT@']) endforeach priv_eo_files = [ @@ -232,8 +235,6 @@ priv_eo_files = [ 'efl_ui_state_model.eo', 'efl_ui_selection_manager.eo', 'efl_datetime_manager.eo', - 'efl_ui_list_view_precise_layouter.eo', - 'efl_ui_list_view_relayout.eo', 'efl_ui_size_model.eo', 'efl_ui_homogeneous_model.eo', 'efl_ui_exact_model.eo', @@ -353,8 +354,6 @@ elementary_headers_unstable = [ 'elm_widget_toolbar.h', 'efl_ui_video_private.h', 'efl_ui_item_private.h', - 'efl_ui_list_view_private.h', - 'efl_ui_list_view_seg_array.h', 'elm_widget_web.h', 'efl_ui_clock.h', 'elm_code.h', @@ -902,8 +901,7 @@ elementary_src = [ 'efl_ui_grid_default_item.c', 'efl_ui_grid.c', 'efl_ui_list_view.c', - 'efl_ui_list_view_precise_layouter.c', - 'efl_ui_list_view_seg_array.c', + 'efl_ui_grid_view.c', 'efl_ui_layout_factory.c', 'efl_ui_scroller.c', 'efl_ui_scroll_manager.c', @@ -945,6 +943,7 @@ elementary_src = [ 'efl_ui_tab_bar_default_item.c', 'efl_ui_select_model.c', 'efl_ui_view_model.c', + 'efl_ui_collection_view.c', ] elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 8ee9607f0e..162e0fcc27 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -1,5 +1,6 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group - implements Efl.File, Efl.Player, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller + implements Efl.File, Efl.Audio_Control, Efl.Player, Efl.Playable, + Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { [[Efl canvas video class]] methods { @@ -10,7 +11,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group emotion object. Please don't use this function, consider using - @Efl.Player.mute instead. + @Efl.Audio_Control.mute instead. ]] set { } @@ -56,13 +57,14 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.File.unload; Efl.File.file { set; } Efl.File.loaded { get; } - Efl.Player.play { get; set; } - Efl.Player.pos { get; set; } - Efl.Player.progress { get; } - Efl.Player.volume { get; set; } - Efl.Player.mute { get; set; } - Efl.Player.length { get; } - Efl.Player.seekable { get; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } + Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get; } + Efl.Audio_Control.volume { get; set; } + Efl.Audio_Control.mute { get; set; } + Efl.Playable.length { get; } + Efl.Playable.seekable { get; } Efl.Gfx.Image_Load_Controller.load_size { get; } Efl.Gfx.Image.ratio { get; } Efl.Gfx.Image.smooth_scale { get; set; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index a7a8fa8905..9a86bfd689 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -116,6 +116,7 @@ struct _Efl_Canvas_Video_Data Eina_Bool open : 1; Eina_Bool play : 1; + Eina_Bool pause : 1; Eina_Bool remember_play : 1; Eina_Bool seek : 1; Eina_Bool seeking : 1; @@ -645,48 +646,93 @@ emotion_object_keep_aspect_get(const Evas_Object *obj) EAPI void emotion_object_play_set(Evas_Object *obj, Eina_Bool play) { - efl_player_play_set(obj, play); + /* avoid calling playback_position_set(0) for legacy */ + if (play) + efl_player_playing_set(obj, EINA_TRUE); + efl_player_paused_set(obj, !play); } -EOLIAN static void -_efl_canvas_video_efl_player_play_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play) +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_playing_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play) { + play = !!play; DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play); - if (!sd->engine_instance) return; + if (!sd->engine_instance) return EINA_FALSE; + /* always unset pause if playing is false */ + if (!play) sd->pause = EINA_FALSE; if (!sd->open) { sd->remember_play = play; - return; + return EINA_TRUE; } - if (play == sd->play) return; + if (play == sd->play) return EINA_TRUE; sd->play = play; sd->remember_play = play; if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); - if (sd->play) emotion_engine_instance_play(sd->engine_instance, sd->pos); - else emotion_engine_instance_stop(sd->engine_instance); + if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0); + else + { + emotion_engine_instance_stop(sd->engine_instance); + efl_player_playback_position_set(obj, 0.0); + } + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_paused_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + DBG("paused=" FMT_UCHAR ", was=" FMT_UCHAR, paused, sd->pause); + if (!sd->engine_instance) return EINA_FALSE; + if (!sd->open) + { + /* queue pause */ + if (sd->remember_play) + sd->pause = paused; + return sd->remember_play; + } + if (!sd->play) return EINA_FALSE; + if (paused == sd->pause) return EINA_TRUE; + sd->pause = paused; + if (sd->pause) + emotion_engine_instance_stop(sd->engine_instance); + else + { + if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); + emotion_engine_instance_play(sd->engine_instance, sd->pos); + } + return EINA_TRUE; } EAPI Eina_Bool emotion_object_play_get(const Evas_Object *obj) { - return efl_player_play_get(obj); + return efl_player_playing_get(obj) && !efl_player_paused_get(obj); } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return sd->play; } +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +{ + if (!sd->engine_instance) return EINA_FALSE; + if (!sd->play) return EINA_FALSE; + return sd->pause; +} + EAPI void emotion_object_position_set(Evas_Object *obj, double sec) { - efl_player_pos_set(obj, sec); + efl_player_playback_position_set(obj, sec); } EOLIAN static void -_efl_canvas_video_efl_player_pos_set(Eo *obj, Efl_Canvas_Video_Data *sd, double sec) +_efl_canvas_video_efl_player_playback_position_set(Eo *obj, Efl_Canvas_Video_Data *sd, double sec) { DBG("sec=%f", sec); if (!sd->engine_instance) return; @@ -707,11 +753,11 @@ _efl_canvas_video_efl_player_pos_set(Eo *obj, Efl_Canvas_Video_Data *sd, double EAPI double emotion_object_position_get(const Evas_Object *obj) { - return efl_player_pos_get(obj); + return efl_player_playback_position_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_pos_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; sd->pos = emotion_engine_instance_pos_get(sd->engine_instance); @@ -731,7 +777,7 @@ emotion_object_buffer_size_get(const Evas_Object *obj) EAPI Eina_Bool emotion_object_seekable_get(const Evas_Object *obj) { - return efl_player_seekable_get(obj); + return efl_playable_seekable_get(obj); } EAPI Eina_Bool @@ -757,7 +803,7 @@ emotion_object_audio_handled_get(const Evas_Object *obj) EAPI double emotion_object_play_length_get(const Evas_Object *obj) { - return efl_player_length_get(obj); + return efl_playable_length_get(obj); } EAPI void @@ -830,11 +876,11 @@ emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev) EAPI void emotion_object_audio_volume_set(Evas_Object *obj, double vol) { - efl_player_volume_set(obj, vol); + efl_audio_control_volume_set(obj, vol); } EOLIAN static void -_efl_canvas_video_efl_player_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, double vol) +_efl_canvas_video_efl_audio_control_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, double vol) { DBG("vol=%f", vol); if (!sd->engine_instance) return; @@ -844,11 +890,11 @@ _efl_canvas_video_efl_player_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Da EAPI double emotion_object_audio_volume_get(const Evas_Object *obj) { - return efl_player_volume_get(obj); + return efl_audio_control_volume_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_audio_control_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; return emotion_engine_instance_audio_channel_volume_get(sd->engine_instance); @@ -857,11 +903,11 @@ _efl_canvas_video_efl_player_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vi EAPI void emotion_object_audio_mute_set(Evas_Object *obj, Eina_Bool mute) { - efl_player_mute_set(obj, mute); + efl_audio_control_mute_set(obj, mute); } EOLIAN static void -_efl_canvas_video_efl_player_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool mute) +_efl_canvas_video_efl_audio_control_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool mute) { DBG("mute=" FMT_UCHAR, mute); if (!sd->engine_instance) return; @@ -871,11 +917,11 @@ _efl_canvas_video_efl_player_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data EAPI Eina_Bool emotion_object_audio_mute_get(const Evas_Object *obj) { - return efl_player_mute_get(obj); + return efl_audio_control_mute_get(obj); } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_mute_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_audio_control_mute_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return emotion_engine_instance_audio_channel_mute_get(sd->engine_instance); @@ -1161,17 +1207,17 @@ emotion_object_progress_info_get(const Evas_Object *obj) EAPI double emotion_object_progress_status_get(const Evas_Object *obj) { - return efl_player_progress_get(obj); + return efl_player_playback_progress_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { return sd->progress.stat; } EOLIAN static double -_efl_canvas_video_efl_player_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; sd->len = emotion_engine_instance_len_get(sd->engine_instance); @@ -1179,7 +1225,7 @@ _efl_canvas_video_efl_player_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vi } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_seekable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_playable_seekable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return emotion_engine_instance_seekable(sd->engine_instance); @@ -1632,7 +1678,12 @@ _emotion_open_done(Evas_Object *obj) if (!EINA_DBL_EQ(sd->remember_jump, 0.0)) emotion_object_position_set(obj, sd->remember_jump); if (sd->remember_play != sd->play) - emotion_object_play_set(obj, sd->remember_play); + { + if (sd->pause) + sd->play = sd->remember_play; + else + emotion_object_play_set(obj, sd->remember_play); + } efl_event_callback_call(obj, EFL_CANVAS_VIDEO_EVENT_OPEN_DONE, NULL); evas_object_smart_callback_call(obj, "open_done", NULL); } diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index ed6444ce73..33e571c491 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -34,7 +34,7 @@ extern "C" { #include /** - * @page eolian_main Eolian (BETA) + * @page eolian_main Eolian * * @date 2014 (created) * @@ -82,8 +82,6 @@ extern "C" { * @{ */ -#ifdef EFL_BETA_API_SUPPORT - /* The maximum format version supported by this version of Eolian */ #define EOLIAN_FILE_FORMAT_VERSION 1 @@ -164,11 +162,11 @@ typedef struct _Eolian_Event Eolian_Event; */ typedef struct _Eolian_Expression Eolian_Expression; -/* Variable information +/* Constant information * * @ingroup Eolian */ -typedef struct _Eolian_Variable Eolian_Variable; +typedef struct _Eolian_Constant Eolian_Constant; /* Error information * @@ -220,7 +218,7 @@ typedef enum EOLIAN_OBJECT_STRUCT_FIELD, EOLIAN_OBJECT_ENUM_FIELD, EOLIAN_OBJECT_TYPE, - EOLIAN_OBJECT_VARIABLE, + EOLIAN_OBJECT_CONSTANT, EOLIAN_OBJECT_EXPRESSION, EOLIAN_OBJECT_FUNCTION, EOLIAN_OBJECT_FUNCTION_PARAMETER, @@ -284,7 +282,9 @@ typedef enum EOLIAN_TYPE_REGULAR, EOLIAN_TYPE_CLASS, EOLIAN_TYPE_ERROR, +#ifdef EFL_BETA_API_SUPPORT EOLIAN_TYPE_UNDEFINED +#endif } Eolian_Type_Type; typedef enum @@ -336,7 +336,7 @@ typedef enum EOLIAN_TYPE_BUILTIN_ARRAY, EOLIAN_TYPE_BUILTIN_FUTURE, EOLIAN_TYPE_BUILTIN_ITERATOR, - EOLIAN_TYPE_BUILTIN_HASH, + EOLIAN_TYPE_BUILTIN_HASH, /* FIXME: beta */ EOLIAN_TYPE_BUILTIN_LIST, EOLIAN_TYPE_BUILTIN_ANY_VALUE, @@ -348,7 +348,9 @@ typedef enum EOLIAN_TYPE_BUILTIN_STRINGSHARE, EOLIAN_TYPE_BUILTIN_STRBUF, +#ifdef EOLIAN_BETA_API_SUPPORT EOLIAN_TYPE_BUILTIN_VOID_PTR +#endif } Eolian_Type_Builtin_Type; typedef enum @@ -388,13 +390,6 @@ typedef enum | EOLIAN_MASK_NULL } Eolian_Expression_Mask; -typedef enum -{ - EOLIAN_VAR_UNKNOWN = 0, - EOLIAN_VAR_CONSTANT, - EOLIAN_VAR_GLOBAL -} Eolian_Variable_Type; - typedef union { char c; @@ -699,7 +694,7 @@ EAPI const char *eolian_object_name_get(const Eolian_Object *obj); * This is the full name, but for C. It is typically derived from the * regular full name, with namespaces flattened to underscores, but * some things may be explicitly renamed. Only classes, types (both - * declarations and instances) and variables have C names, as others + * declarations and instances) and constants have C names, as others * are never referred to by name directly in C. * * @see eolian_object_unit_get @@ -1018,7 +1013,7 @@ EAPI unsigned short eolian_unit_version_get(const Eolian_Unit *unit); * @brief Get an object in a unit by name. * * Only objects declared directly within the file can be retrieved, i.e. - * classes, typedecls and variables. + * classes, typedecls and constants. * * @param[in] unit The unit. * @param[in] name The fully namespaced object name. @@ -1032,7 +1027,7 @@ EAPI const Eolian_Object *eolian_unit_object_by_name_get(const Eolian_Unit *unit * * The order is not necessarily the declaration order. Only objects declared * directly within the file can be retrieved, i.e. classes, typedecls and - * variables. + * constants. * * @param[in] unit The unit. * @@ -1060,24 +1055,14 @@ EAPI const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); /* - * @brief Get a global variable in a unit by name. + * @brief Get a constant in a unit by name. * * @param[in] unit The unit. - * @param[in] name the name of the variable + * @param[in] name the name of the constant * * @ingroup Eolian */ -EAPI const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); - -/* - * @brief Get a constant variable in a unit by name. - * - * @param[in] unit The unit. - * @param[in] name the name of the variable - * - * @ingroup Eolian - */ -EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); +EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); /* * @brief Get an error declaration in a unit by name. @@ -1090,7 +1075,7 @@ EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit * EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name); /* - * @brief Get an iterator to all constant variables in the Eolian database. + * @brief Get an iterator to all constants in the Eolian database. * * @return the iterator or NULL * @@ -1100,17 +1085,6 @@ EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, */ EAPI Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); -/* - * @brief Get an iterator to all global variables in the Eolian database. - * - * @return the iterator or NULL - * - * Thanks to internal caching, this is an O(1) operation. - * - * @ingroup Eolian - */ -EAPI Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); - /* * @brief Get an iterator to all error declarations in the Eolian database. * @@ -1203,7 +1177,7 @@ eolian_state_object_by_name_get(const Eolian_State *state, const char *name) * * The list follows declaration order in the file. Only objects declared * directly within the file can be retrieved, i.e. classes, typedecls and - * variables. + * constants. * * @param[in] state The state. * @param[in] file_name The file name. @@ -1261,19 +1235,6 @@ eolian_state_classes_get(const Eolian_State *state) return eolian_unit_classes_get(EOLIAN_UNIT(state)); } -/* - * @brief A helper function to get a global in a state by name. - * - * @see eolian_unit_global_by_name_get - * - * @ingroup Eolian - */ -static inline const Eolian_Variable * -eolian_state_global_by_name_get(const Eolian_State *state, const char *name) -{ - return eolian_unit_global_by_name_get(EOLIAN_UNIT(state), name); -} - /* * @brief A helper function to get a constant in a state by name. * @@ -1281,7 +1242,7 @@ eolian_state_global_by_name_get(const Eolian_State *state, const char *name) * * @ingroup Eolian */ -static inline const Eolian_Variable * +static inline const Eolian_Constant * eolian_state_constant_by_name_get(const Eolian_State *state, const char *name) { return eolian_unit_constant_by_name_get(EOLIAN_UNIT(state), name); @@ -1301,19 +1262,7 @@ eolian_state_error_by_name_get(const Eolian_State *state, const char *name) } /* - * @brief Get an iterator to all global variables contained in a file. - * - * @param[in] state The state. - * @param[in] file_name The file name. - * - * Thanks to internal caching, this is an O(1) operation. - * - * @ingroup Eolian - */ -EAPI Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); - -/* - * @brief Get an iterator to all constant variables contained in a file. + * @brief Get an iterator to all constants contained in a file. * * @param[in] state The state. * @param[in] file_name The file name. @@ -1338,19 +1287,6 @@ EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state */ EAPI Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name); -/* - * @brief A helper function to get all globals in a state. - * - * @see eolian_unit_globals_get - * - * @ingroup Eolian - */ -static inline Eina_Iterator * -eolian_state_globals_get(const Eolian_State *state) -{ - return eolian_unit_globals_get(EOLIAN_UNIT(state)); -} - /* * @brief A helper function to get all constants in a state. * @@ -1564,14 +1500,14 @@ EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); EAPI const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass); /* - * @brief Returns the eo prefix of a class + * @brief Returns the C function prefix of a class * * @param[in] klass the class * @return the eo prefix * * @ingroup Eolian */ -EAPI Eina_Stringshare* eolian_class_eo_prefix_get(const Eolian_Class *klass); +EAPI Eina_Stringshare* eolian_class_c_prefix_get(const Eolian_Class *klass); /* * @brief Returns the event prefix of a class @@ -1767,16 +1703,6 @@ eolian_function_is_beta(const Eolian_Function *function_id) */ EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass); -/* - * @brief Get whether a function is a function pointer. - * - * @param[in] function_id Id of the function - * @return EINA_TRUE and EINA_FALSE respectively - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id); - /* * @brief Returns an iterator to the parameter handles for a method/ctor/dtor. * @@ -2678,17 +2604,6 @@ EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(co */ EAPI const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); -/* - * @brief Get the legacy prefix of enum field names. When not specified, - * enum name is used. - * - * @param[in] tp the type declaration. - * @return the legacy prefix or NULL. - * - * @ingroup Eolian - */ -EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp); - /* * @brief Get the documentation of a struct/alias type. * @@ -2932,18 +2847,6 @@ EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); */ EAPI const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp); -/* - * @brief Get whether the given type is owned. - * - * This is true when a parameter, return or whatever is marked as @owned. - * - * @param[in] tp the type. - * @return EINA_TRUE when the type is marked owned, EINA_FALSE otherwise. - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); - /* * @brief Get whether the given type is moved with its parent type. * @@ -2969,16 +2872,6 @@ EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp); */ EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); -/* - * @brief Get whether the given type is a reference. - * - * @param[in] tp the type. - * @return EINA_TRUE when the type is marked ref, EINA_FALSE otherwise. - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); - /* * @brief Get the full C type name of the given type. * @@ -3182,116 +3075,106 @@ EAPI const Eolian_Expression *eolian_expression_unary_expression_get(const Eolia EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr); /* - * @brief Get the type of a variable (global, constant) + * @brief Get the documentation of a constant. * - * @param[in] var the variable. - * @return an Eolian_Type_Type. - * - * @ingroup Eolian - */ -EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); - -/* - * @brief Get the documentation of a variable. - * - * @param[in] var the variable. + * @param[in] var the constant. * @return the documentation or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); +EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); /* - * @brief Get the base type of a variable. + * @brief Get the base type of a constant. * - * @param[in] var the variable. + * @param[in] var the constant. * @return the base type or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); +EAPI const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); /* - * @brief Get the value of a variable. + * @brief Get the value of a constant. * - * @param[in] var the variable. + * @param[in] var the constant. * @return the value or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); +EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); /* - * @brief A helper function to get the full name of a variable. + * @brief A helper function to get the full name of a constant. * * @see eolian_object_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_name_get(const Eolian_Variable *tp) +eolian_constant_name_get(const Eolian_Constant *tp) { return eolian_object_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the C name of a variable. + * @brief A helper function to get the C name of a constant. * * @see eolian_object_c_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_c_name_get(const Eolian_Variable *tp) +eolian_constant_c_name_get(const Eolian_Constant *tp) { return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the short name of a variable. + * @brief A helper function to get the short name of a constant. * * @see eolian_object_short_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_short_name_get(const Eolian_Variable *tp) +eolian_constant_short_name_get(const Eolian_Constant *tp) { return eolian_object_short_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the namespaces of a variable. + * @brief A helper function to get the namespaces of a constant. * * @see eolian_object_namespaces_get * * @ingroup Eolian */ static inline Eina_Iterator * -eolian_variable_namespaces_get(const Eolian_Variable *tp) +eolian_constant_namespaces_get(const Eolian_Constant *tp) { return eolian_object_namespaces_get(EOLIAN_OBJECT(tp)); } /* - * @brief Check if a variable is extern. + * @brief Check if a constant is extern. * - * @param[in] var the variable. + * @param[in] var the constant. * @return EINA_TRUE if it's extern, EINA_FALSE otherwise. * * @ingroup Eolian */ -EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); +EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); /* - * @brief Get whether a variable is beta. + * @brief Get whether a constant is beta. * * @see eolian_object_is_beta * * @ingroup Eolian */ static inline Eina_Bool -eolian_variable_is_beta(const Eolian_Variable *var) +eolian_constant_is_beta(const Eolian_Constant *var) { return eolian_object_is_beta(EOLIAN_OBJECT(var)); } @@ -3515,7 +3398,30 @@ EAPI char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok); */ EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2); -#endif +#ifdef EFL_BETA_API_SUPPORT + +/* + * @brief Get the legacy prefix of enum field names. When not specified, + * enum name is used. (BETA) + * + * @param[in] tp the type declaration. + * @return the legacy prefix or NULL. + * + * @ingroup Eolian + */ +EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp); + +/* + * @brief Get whether the given type is a reference. + * + * @param[in] tp the type. + * @return EINA_TRUE when the type is marked ref, EINA_FALSE otherwise. + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); + +#endif /* EFL_BETA_API_SUPPORT */ /** * @} diff --git a/src/lib/eolian/database_check.c b/src/lib/eolian/database_check.c index 4e448cea7a..0626512076 100644 --- a/src/lib/eolian/database_check.c +++ b/src/lib/eolian/database_check.c @@ -47,7 +47,7 @@ _check_expr_cb(const Eolian_Object *obj, void *data) switch (obj->type) { case EOLIAN_OBJECT_TYPEDECL: - case EOLIAN_OBJECT_VARIABLE: + case EOLIAN_OBJECT_CONSTANT: _add_dep(depset, obj->unit); default: break; @@ -195,7 +195,7 @@ _check_typedecl(const Eolian_Typedecl *tp, Eina_Hash *depset, Eina_Hash *chash) } static void -_check_variable(const Eolian_Variable *v, Eina_Hash *depset, Eina_Hash *chash) +_check_constant(const Eolian_Constant *v, Eina_Hash *depset, Eina_Hash *chash) { if (_check_cycle(chash, &v->base)) return; @@ -230,8 +230,8 @@ _check_unit(const Eolian_Unit *unit) case EOLIAN_OBJECT_TYPEDECL: _check_typedecl((const Eolian_Typedecl *)obj, depset, chash); break; - case EOLIAN_OBJECT_VARIABLE: - _check_variable((const Eolian_Variable *)obj, depset, chash); + case EOLIAN_OBJECT_CONSTANT: + _check_constant((const Eolian_Constant *)obj, depset, chash); break; default: continue; diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c index 07e781db7a..74cff1b06b 100644 --- a/src/lib/eolian/database_class_api.c +++ b/src/lib/eolian/database_class_api.c @@ -21,7 +21,7 @@ eolian_class_documentation_get(const Eolian_Class *cl) } EAPI Eina_Stringshare* -eolian_class_eo_prefix_get(const Eolian_Class *cl) +eolian_class_c_prefix_get(const Eolian_Class *cl) { EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); return cl->c_prefix; diff --git a/src/lib/eolian/database_expr.c b/src/lib/eolian/database_expr.c index c2b6030db1..978f281a8f 100644 --- a/src/lib/eolian/database_expr.c +++ b/src/lib/eolian/database_expr.c @@ -512,7 +512,7 @@ eval_exp(const Eolian_Unit *unit, Eolian_Expression *expr, return eval_exp(NULL, expr->expr, mask, out, cb, data); } - const Eolian_Variable *var = eolian_unit_constant_by_name_get + const Eolian_Constant *var = eolian_unit_constant_by_name_get (unit, expr->value.s); Eolian_Expression *exp = NULL; diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 59a149337f..675d5471d4 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -231,13 +231,6 @@ eolian_type_error_get(const Eolian_Type *tp) return tp->error; } -EAPI Eina_Bool -eolian_type_is_owned(const Eolian_Type *tp) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE); - return tp->owned; -} - EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp) { diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index d0bf40d17a..87d51ac2e1 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -1488,7 +1488,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl, } static Eina_Bool -_validate_variable(Validate_State *vals, Eolian_Variable *var) +_validate_constant(Validate_State *vals, Eolian_Constant *var) { if (var->base.validated) return EINA_TRUE; @@ -1498,7 +1498,7 @@ _validate_variable(Validate_State *vals, Eolian_Variable *var) if (!_validate_type(vals, var->base_type)) return _reset_stable(vals, was_stable, EINA_FALSE); - if (var->value && !_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) + if (!_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) return _reset_stable(vals, was_stable, EINA_FALSE); if (!_validate_doc(var->doc)) @@ -1516,10 +1516,10 @@ _typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, } static Eina_Bool -_var_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, - Eolian_Variable *var, Cb_Ret *sc) +_constant_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, + Eolian_Constant *var, Cb_Ret *sc) { - return (sc->succ = _validate_variable(sc->vals, var)); + return (sc->succ = _validate_constant(sc->vals, var)); } Eina_Bool @@ -1597,11 +1597,7 @@ database_validate(const Eolian_Unit *src) if (!rt.succ) return EINA_FALSE; - eina_hash_foreach(src->globals, (Eina_Hash_Foreach)_var_map_cb, &rt); - if (!rt.succ) - return EINA_FALSE; - - eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_var_map_cb, &rt); + eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_constant_map_cb, &rt); if (!rt.succ) return EINA_FALSE; diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c index 4007091848..a714bd6344 100644 --- a/src/lib/eolian/database_var.c +++ b/src/lib/eolian/database_var.c @@ -6,7 +6,7 @@ #include "eo_lexer.h" void -database_var_del(Eolian_Variable *var) +database_constant_del(Eolian_Constant *var) { if (!var || eolian_object_unref(&var->base)) return; eina_stringshare_del(var->base.file); @@ -19,28 +19,11 @@ database_var_del(Eolian_Variable *var) free(var); } -static void -database_var_global_add(Eolian_Unit *unit, Eolian_Variable *var) -{ - EOLIAN_OBJECT_ADD(unit, var->base.name, var, globals); - eina_hash_set(unit->state->staging.globals_f, var->base.file, eina_list_append - ((Eina_List*)eina_hash_find(unit->state->staging.globals_f, var->base.file), var)); -} - -static void -database_var_constant_add(Eolian_Unit *unit, Eolian_Variable *var) +void +database_constant_add(Eolian_Unit *unit, Eolian_Constant *var) { EOLIAN_OBJECT_ADD(unit, var->base.name, var, constants); eina_hash_set(unit->state->staging.constants_f, var->base.file, eina_list_append ((Eina_List*)eina_hash_find(unit->state->staging.constants_f, var->base.file), var)); -} - -void -database_var_add(Eolian_Unit *unit, Eolian_Variable *var) -{ - if (var->type == EOLIAN_VAR_GLOBAL) - database_var_global_add(unit, var); - else - database_var_constant_add(unit, var); database_object_add(unit, &var->base); } diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c index 099237a8ba..b6f2d1f1bc 100644 --- a/src/lib/eolian/database_var_api.c +++ b/src/lib/eolian/database_var_api.c @@ -5,36 +5,29 @@ #include #include "eolian_database.h" -EAPI Eolian_Variable_Type -eolian_variable_type_get(const Eolian_Variable *var) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(var, EOLIAN_VAR_UNKNOWN); - return var->type; -} - EAPI const Eolian_Documentation * -eolian_variable_documentation_get(const Eolian_Variable *var) +eolian_constant_documentation_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->doc; } EAPI const Eolian_Type * -eolian_variable_base_type_get(const Eolian_Variable *var) +eolian_constant_type_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->base_type; } EAPI const Eolian_Expression * -eolian_variable_value_get(const Eolian_Variable *var) +eolian_constant_value_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->value; } EAPI Eina_Bool -eolian_variable_is_extern(const Eolian_Variable *var) +eolian_constant_is_extern(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, EINA_FALSE); return var->is_extern; diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index 809e7fae5d..165c8340f2 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -1056,8 +1056,8 @@ _node_free(Eolian_Object *obj) case EOLIAN_OBJECT_TYPE: database_type_del((Eolian_Type *)obj); break; - case EOLIAN_OBJECT_VARIABLE: - database_var_del((Eolian_Variable *)obj); + case EOLIAN_OBJECT_CONSTANT: + database_constant_del((Eolian_Constant *)obj); break; case EOLIAN_OBJECT_EXPRESSION: database_expr_del((Eolian_Expression *)obj); diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 3b2bf734ac..706acb028e 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -31,7 +31,7 @@ enum Tokens KW(data), KW(destructor), KW(error), KW(event_prefix), KW(events), KW(extends), \ KW(free), KW(get), KW(implements), KW(import), KW(interface), \ KW(keys), KW(legacy), KW(methods), KW(mixin), KW(params), \ - KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(var), KW(requires), \ + KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(requires), \ \ KWAT(auto), KWAT(beta), KWAT(by_ref), KWAT(c_name), KWAT(const), \ KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \ @@ -264,16 +264,16 @@ eo_lexer_typedecl_release(Eo_Lexer *ls, Eolian_Typedecl *tp) return (Eolian_Typedecl *)eo_lexer_node_release(ls, (Eolian_Object *)tp); } -static inline Eolian_Variable * -eo_lexer_variable_new(Eo_Lexer *ls) +static inline Eolian_Constant * +eo_lexer_constant_new(Eo_Lexer *ls) { - return (Eolian_Variable *)eo_lexer_node_new(ls, sizeof(Eolian_Variable)); + return (Eolian_Constant *)eo_lexer_node_new(ls, sizeof(Eolian_Constant)); } -static inline Eolian_Variable * -eo_lexer_variable_release(Eo_Lexer *ls, Eolian_Variable *var) +static inline Eolian_Constant * +eo_lexer_constant_release(Eo_Lexer *ls, Eolian_Constant *var) { - return (Eolian_Variable *)eo_lexer_node_release(ls, (Eolian_Object *)var); + return (Eolian_Constant *)eo_lexer_node_release(ls, (Eolian_Object *)var); } static inline Eolian_Expression * diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 879cc0af3a..d30d285a2c 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -125,7 +125,7 @@ _eolian_decl_get(Eo_Lexer *ls, const char *name) obj = eina_hash_find(ls->state->staging.unit.objects, name); if (obj && ((obj->type == EOLIAN_OBJECT_CLASS) || (obj->type == EOLIAN_OBJECT_TYPEDECL) || - (obj->type == EOLIAN_OBJECT_VARIABLE))) + (obj->type == EOLIAN_OBJECT_CONSTANT))) return obj; return NULL; @@ -152,8 +152,8 @@ _eolian_decl_name_get(Eolian_Object *obj) break; } goto end; - case EOLIAN_OBJECT_VARIABLE: - return "variable"; + case EOLIAN_OBJECT_CONSTANT: + return "constant"; default: break; } @@ -517,7 +517,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, FILL_BASE(fdef->base, ls, fline, fcol, STRUCT_FIELD); fdef->type = eo_lexer_type_release(ls, tp); fdef->base.name = eina_stringshare_ref(fname); - Eina_Bool has_owned = EINA_FALSE, has_by_ref = EINA_FALSE; + Eina_Bool has_move = EINA_FALSE, has_by_ref = EINA_FALSE; for (;;) switch (ls->t.kw) { case KW_at_by_ref: @@ -526,8 +526,8 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - fdef->type->owned = fdef->move = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + fdef->move = EINA_TRUE; eo_lexer_get(ls); break; default: @@ -773,14 +773,14 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr) def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); /* view-only types are not allowed to own the contents */ if (tpid == KW_array || tpid == KW_hash || tpid == KW_list || tpid == KW_future) - if ((def->base_type->owned = def->base_type->move = ls->t.kw == KW_at_move)) + if ((def->base_type->move = ls->t.kw == KW_at_move)) eo_lexer_get(ls); if (tpid == KW_hash) { check_next(ls, ','); def->base_type->next_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); - if ((def->base_type->next_type->owned = def->base_type->next_type->move = ls->t.kw == KW_at_move)) + if ((def->base_type->next_type->move = ls->t.kw == KW_at_move)) eo_lexer_get(ls); } check_match(ls, '>', '<', bline, bcol); @@ -879,10 +879,10 @@ tags_done: return def; } -static Eolian_Variable * -parse_variable(Eo_Lexer *ls, Eina_Bool global) +static Eolian_Constant * +parse_constant(Eo_Lexer *ls) { - Eolian_Variable *def = eo_lexer_variable_new(ls); + Eolian_Constant *def = eo_lexer_constant_new(ls); Eina_Strbuf *buf; eo_lexer_get(ls); Eina_Stringshare *cname = NULL; @@ -908,11 +908,10 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global) goto tags_done; } tags_done: - def->type = global ? EOLIAN_VAR_GLOBAL : EOLIAN_VAR_CONSTANT; buf = eina_strbuf_new(); eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf); eo_lexer_context_push(ls); - FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE); + FILL_BASE(def->base, ls, ls->line_number, ls->column, CONSTANT); parse_name(ls, buf); def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); if (cname) @@ -932,17 +931,12 @@ tags_done: check_next(ls, ':'); def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); /* constants are required to have a value */ - if (!global) - check(ls, '='); - /* globals can optionally have a value */ - if (ls->t.token == '=') - { - ls->expr_mode = EINA_TRUE; - eo_lexer_get(ls); - def->value = parse_expr(ls); - ls->expr_mode = EINA_FALSE; - eo_lexer_expr_release_ref(ls, def->value); - } + check(ls, '='); + ls->expr_mode = EINA_TRUE; + eo_lexer_get(ls); + def->value = parse_expr(ls); + ls->expr_mode = EINA_FALSE; + eo_lexer_expr_release_ref(ls, def->value); check_next(ls, ';'); FILL_DOC(ls, def, doc); eo_lexer_dtor_pop(ls); @@ -1020,7 +1014,7 @@ typedef struct _Eo_Ret_Def Eolian_Documentation *doc; Eolian_Expression *default_ret_val; Eina_Bool no_unused: 1; - Eina_Bool owned: 1; + Eina_Bool move: 1; Eina_Bool by_ref: 1; } Eo_Ret_Def; @@ -1037,7 +1031,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, ret->doc = NULL; ret->default_ret_val = NULL; ret->no_unused = EINA_FALSE; - ret->owned = EINA_FALSE; + ret->move = EINA_FALSE; ret->by_ref = EINA_FALSE; if (allow_def && (ls->t.token == '(')) { @@ -1048,7 +1042,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, ls->expr_mode = EINA_FALSE; check_match(ls, ')', '(', line, col); } - Eina_Bool has_no_unused = EINA_FALSE, has_owned = EINA_FALSE, + Eina_Bool has_no_unused = EINA_FALSE, has_move = EINA_FALSE, has_by_ref = EINA_FALSE; if (!is_funcptr) for (;;) switch (ls->t.kw) { @@ -1058,8 +1052,8 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - ret->owned = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + ret->move = EINA_TRUE; eo_lexer_get(ls); break; case KW_at_by_ref: @@ -1080,7 +1074,7 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, Eina_Bool is_vals, const Eolian_Function *func) { Eina_Bool has_optional = EINA_FALSE, - has_owned = EINA_FALSE, + has_move = EINA_FALSE, has_by_ref = EINA_FALSE; Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter)); par->param_dir = EOLIAN_IN_PARAM; @@ -1136,8 +1130,8 @@ type_done: eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - par->type->owned = par->move = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + par->move = EINA_TRUE; eo_lexer_get(ls); break; case KW_at_by_ref: @@ -1258,7 +1252,7 @@ parse_accessor: prop->get_ret_val = ret.default_ret_val; prop->get_return_no_unused = ret.no_unused; prop->get_return_by_ref = ret.by_ref; - prop->get_return_move = prop->get_ret_type->owned = ret.owned; + prop->get_return_move = ret.move; } else { @@ -1267,7 +1261,7 @@ parse_accessor: prop->set_ret_val = ret.default_ret_val; prop->set_return_no_unused = ret.no_unused; prop->set_return_by_ref = ret.by_ref; - prop->set_return_move = prop->set_ret_type->owned = ret.owned; + prop->set_return_move = ret.move; } break; case KW_keys: @@ -1579,7 +1573,7 @@ body: meth->get_ret_val = ret.default_ret_val; meth->get_return_no_unused = ret.no_unused; meth->get_return_by_ref = ret.by_ref; - meth->get_return_move = meth->get_ret_type->owned = ret.owned; + meth->get_return_move = ret.move; break; case KW_params: CASE_LOCK(ls, params, "params definition") @@ -2401,10 +2395,8 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot) break; } case KW_const: - case KW_var: { - database_var_add(ls->unit, eo_lexer_variable_release(ls, - parse_variable(ls, ls->t.kw == KW_var))); + database_constant_add(ls->unit, eo_lexer_constant_release(ls, parse_constant(ls))); break; } case KW_error: diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 9aa6b8f87b..09eb904992 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -491,7 +491,8 @@ database_doc_token_ref_resolve(const Eolian_Doc_Token *tok, { case EOLIAN_OBJECT_CLASS: case EOLIAN_OBJECT_TYPEDECL: - case EOLIAN_OBJECT_VARIABLE: + case EOLIAN_OBJECT_CONSTANT: + case EOLIAN_OBJECT_ERROR: /* we only allow certain types to be referenced */ return tp; default: @@ -588,8 +589,7 @@ database_unit_init(Eolian_State *state, Eolian_Unit *unit, const char *file) unit->children = eina_hash_stringshared_new(NULL); unit->classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del)); - unit->globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); - unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); + unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_constant_del)); unit->errors = eina_hash_stringshared_new(EINA_FREE_CB(database_error_del)); unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); @@ -606,7 +606,6 @@ _unit_contents_del(Eolian_Unit *unit) eina_stringshare_del(unit->file); eina_hash_free(unit->children); eina_hash_free(unit->classes); - eina_hash_free(unit->globals); eina_hash_free(unit->constants); eina_hash_free(unit->errors); eina_hash_free(unit->aliases); @@ -659,7 +658,6 @@ _state_area_init(Eolian_State *state, Eolian_State_Area *a) a->aliases_f = eina_hash_stringshared_new(NULL); a->structs_f = eina_hash_stringshared_new(NULL); a->enums_f = eina_hash_stringshared_new(NULL); - a->globals_f = eina_hash_stringshared_new(NULL); a->constants_f = eina_hash_stringshared_new(NULL); a->errors_f = eina_hash_stringshared_new(NULL); a->objects_f = eina_hash_stringshared_new(NULL); @@ -686,7 +684,6 @@ _state_area_contents_del(Eolian_State_Area *a) _hashlist_free(a->aliases_f); _hashlist_free(a->structs_f); _hashlist_free(a->enums_f); - _hashlist_free(a->globals_f); _hashlist_free(a->constants_f); _hashlist_free(a->errors_f); _hashlist_free(a->objects_f); @@ -905,7 +902,6 @@ _state_clean(Eolian_State *state) Eolian_Unit *stu = &st->unit; eina_hash_free_buckets(stu->classes); - eina_hash_free_buckets(stu->globals); eina_hash_free_buckets(stu->constants); eina_hash_free_buckets(stu->aliases); eina_hash_free_buckets(stu->structs); @@ -920,7 +916,6 @@ _state_clean(Eolian_State *state) _hashlist_free_buckets(st->aliases_f); _hashlist_free_buckets(st->structs_f); _hashlist_free_buckets(st->enums_f); - _hashlist_free_buckets(st->globals_f); _hashlist_free_buckets(st->constants_f); _hashlist_free_buckets(st->objects_f); } @@ -1009,7 +1004,6 @@ static void _merge_unit(Eolian_Unit *dest, Eolian_Unit *src) { eina_hash_foreach(src->classes, _merge_unit_cb, dest->classes); - eina_hash_foreach(src->globals, _merge_unit_cb, dest->globals); eina_hash_foreach(src->constants, _merge_unit_cb, dest->constants); eina_hash_foreach(src->aliases, _merge_unit_cb, dest->aliases); eina_hash_foreach(src->structs, _merge_unit_cb, dest->structs); @@ -1072,7 +1066,6 @@ _merge_staging(Eolian_State *state) EOLIAN_STAGING_MERGE_LIST(aliases); EOLIAN_STAGING_MERGE_LIST(structs); EOLIAN_STAGING_MERGE_LIST(enums); - EOLIAN_STAGING_MERGE_LIST(globals); EOLIAN_STAGING_MERGE_LIST(constants); EOLIAN_STAGING_MERGE_LIST(objects); @@ -1247,17 +1240,6 @@ eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name) return cl; } -EAPI Eina_Iterator * -eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name) -{ - if (!state) return NULL; - Eina_Stringshare *shr = eina_stringshare_add(file_name); - Eina_List *l = eina_hash_find(state->main.globals_f, shr); - eina_stringshare_del(shr); - if (!l) return NULL; - return eina_list_iterator_new(l); -} - EAPI Eina_Iterator * eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name) { @@ -1382,22 +1364,12 @@ eolian_unit_classes_get(const Eolian_Unit *unit) return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL); } -EAPI const Eolian_Variable * -eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name) -{ - if (!unit) return NULL; - Eina_Stringshare *shr = eina_stringshare_add(name); - Eolian_Variable *v = eina_hash_find(unit->globals, shr); - eina_stringshare_del(shr); - return v; -} - -EAPI const Eolian_Variable * +EAPI const Eolian_Constant * eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name) { if (!unit) return NULL; Eina_Stringshare *shr = eina_stringshare_add(name); - Eolian_Variable *v = eina_hash_find(unit->constants, shr); + Eolian_Constant *v = eina_hash_find(unit->constants, shr); eina_stringshare_del(shr); return v; } @@ -1418,12 +1390,6 @@ eolian_unit_constants_get(const Eolian_Unit *unit) return (unit ? eina_hash_iterator_data_new(unit->constants) : NULL); } -EAPI Eina_Iterator * -eolian_unit_globals_get(const Eolian_Unit *unit) -{ - return (unit ? eina_hash_iterator_data_new(unit->globals) : NULL); -} - EAPI Eina_Iterator * eolian_unit_errors_get(const Eolian_Unit *unit) { diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index ab49424cad..ffe8067e76 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -39,7 +39,6 @@ struct _Eolian_Unit Eolian_State *state; Eina_Hash *children; Eina_Hash *classes; - Eina_Hash *globals; Eina_Hash *constants; Eina_Hash *errors; Eina_Hash *aliases; @@ -59,7 +58,6 @@ typedef struct _Eolian_State_Area Eina_Hash *aliases_f; Eina_Hash *structs_f; Eina_Hash *enums_f; - Eina_Hash *globals_f; Eina_Hash *constants_f; Eina_Hash *errors_f; Eina_Hash *objects_f; @@ -286,7 +284,6 @@ struct _Eolian_Type Eina_Bool is_const :1; Eina_Bool is_ptr :1; Eina_Bool move :1; - Eina_Bool owned :1; Eina_Bool ownable :1; }; @@ -394,10 +391,9 @@ struct _Eolian_Expression Eina_Bool weak_rhs :1; }; -struct _Eolian_Variable +struct _Eolian_Constant { Eolian_Object base; - Eolian_Variable_Type type; Eolian_Type *base_type; Eolian_Expression *value; Eolian_Documentation *doc; @@ -449,8 +445,8 @@ void database_expr_print(Eolian_Expression *expr); /* variables */ -void database_var_del(Eolian_Variable *var); -void database_var_add(Eolian_Unit *unit, Eolian_Variable *var); +void database_constant_del(Eolian_Constant *var); +void database_constant_add(Eolian_Unit *unit, Eolian_Constant *var); /* classes */ void database_class_del(Eolian_Class *cl); diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index a7a01cc243..2dcd4bb5ba 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -113,13 +113,6 @@ inline typedecl_type typedecl_type_get(Eolian_Typedecl const* decl) } } -enum class variable_type -{ - unknown, - constant, - global -}; - struct type_def; bool operator==(type_def const& lhs, type_def const& rhs); @@ -1070,63 +1063,57 @@ struct property_def } }; -struct variable_def +struct constant_def { std::string name; std::string full_name; type_def base_type; documentation_def documentation; - variable_type type; std::vector namespaces; Eolian_Value expression_value; bool is_extern : 1; - friend inline bool operator==(variable_def const& lhs, variable_def const& rhs) + friend inline bool operator==(constant_def const& lhs, constant_def const& rhs) { return lhs.name == rhs.name && lhs.full_name == rhs.full_name && lhs.base_type == rhs.base_type && lhs.documentation == rhs.documentation - && lhs.type == rhs.type && lhs.namespaces == rhs.namespaces && lhs.expression_value.type == rhs.expression_value.type && lhs.expression_value.value.ll == rhs.expression_value.value.ll && lhs.is_extern == rhs.is_extern; } - friend inline bool operator!=(variable_def const& lhs, variable_def const& rhs) + friend inline bool operator!=(constant_def const& lhs, constant_def const& rhs) { return !(lhs == rhs); } - variable_def() = default; - variable_def(Eolian_Variable const* variable, Eolian_Unit const* unit) - : name(::eolian_variable_short_name_get(variable)) - , full_name(::eolian_variable_name_get(variable)) - , base_type(::eolian_variable_base_type_get(variable) + constant_def() = default; + constant_def(Eolian_Constant const* constant, Eolian_Unit const* unit) + : name(::eolian_constant_short_name_get(constant)) + , full_name(::eolian_constant_name_get(constant)) + , base_type(::eolian_constant_type_get(constant) , unit - , ::eolian_type_c_type_get(eolian_variable_base_type_get(variable)) + , ::eolian_type_c_type_get(eolian_constant_type_get(constant)) , value_ownership::unmoved , is_by::value) - , documentation(::eolian_variable_documentation_get(variable)) - , type(static_cast(::eolian_variable_type_get(variable))) + , documentation(::eolian_constant_documentation_get(constant)) , expression_value() - , is_extern(::eolian_variable_is_extern(variable)) + , is_extern(::eolian_constant_is_extern(constant)) { - for(efl::eina::iterator namespace_iterator( ::eolian_variable_namespaces_get(variable)) + for(efl::eina::iterator namespace_iterator( ::eolian_constant_namespaces_get(constant)) , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) { this->namespaces.push_back((&*namespace_iterator)); } - if (this->type == variable_type::constant) - { - auto expr = ::eolian_variable_value_get(variable); - if (!expr) - throw std::runtime_error("Could not get constant variable value expression"); + auto expr = ::eolian_constant_value_get(constant); + if (!expr) + throw std::runtime_error("Could not get constant variable value expression"); - this->expression_value = ::eolian_expression_eval(expr, ::EOLIAN_MASK_ALL); - } + this->expression_value = ::eolian_expression_eval(expr, ::EOLIAN_MASK_ALL); } }; diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index aa89c367ff..5e2d4046a0 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -61,7 +61,7 @@ _efl_canvas_animation_player_animation_set(Eo *eo_obj, if (pd->animation) { - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); efl_unref(pd->animation); } pd->animation = anim; @@ -83,7 +83,7 @@ _animator_cb(void *data) EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); double duration, elapsed_time, vector; - if (efl_player_seekable_get(eo_obj)) + if (efl_playable_seekable_get(eo_obj)) { pd->time.current = ecore_loop_time_get(); @@ -147,7 +147,7 @@ _animator_cb(void *data) return ECORE_CALLBACK_RENEW; } - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); return ECORE_CALLBACK_CANCEL; } @@ -188,30 +188,6 @@ _start_delay_timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } -EOLIAN static void -_efl_canvas_animation_player_efl_player_start(Eo *eo_obj, - Efl_Canvas_Animation_Player_Data *pd) -{ - double start_delay; - EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - - if (!efl_player_playable_get(eo_obj)) return; - pd->is_play = EINA_TRUE; - //TODO: check this case is correct - if (pd->start_delay_timer) return; - - pd->progress = 0.0; - start_delay = efl_animation_start_delay_get(anim); - if (start_delay > 0.0) - { - pd->start_delay_timer = ecore_timer_add(start_delay, - _start_delay_timer_cb, eo_obj); - return; - } - - _start(eo_obj, pd); -} - static Eina_Bool _is_final_state(Efl_Canvas_Animation *anim, double progress) { @@ -240,60 +216,86 @@ _is_final_state(Efl_Canvas_Animation *anim, double progress) return EINA_FALSE; } -EOLIAN static void -_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj, - Efl_Canvas_Animation_Player_Data *pd) +static void +_player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animation *anim) { - EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - //Reset the state of the target to the initial state efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj)); - Eina_Bool play = efl_player_play_get(eo_obj); - if (play) + if (efl_animation_final_state_keep_get(anim)) { - efl_player_play_set(eo_obj, EINA_FALSE); - if (efl_animation_final_state_keep_get(anim)) + if (_is_final_state(anim, pd->progress)) { - if (_is_final_state(anim, pd->progress)) - { - /* Keep the final state only if efl_player_stop is called at - * the end of _animator_cb. */ - efl_animation_apply(anim, pd->progress, - efl_animation_player_target_get(eo_obj)); - } - else - { - pd->progress = 0.0; - } + /* Keep the final state only if efl_player_playing_set(EINA_FALSE) is called at + * the end of _animator_cb. */ + efl_animation_apply(anim, pd->progress, + efl_animation_player_target_get(eo_obj)); } else { pd->progress = 0.0; } - efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); } else { pd->progress = 0.0; } - + efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); if (pd->auto_del) efl_del(eo_obj); } -EOLIAN static void -_efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, - Efl_Canvas_Animation_Player_Data *pd, - Eina_Bool play) +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Eina_Bool playing) { - if (efl_player_play_get(eo_obj) == !!play) - return; + double start_delay; + EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - pd->is_play = play; - if (play) + if (!efl_playable_get(eo_obj)) return EINA_FALSE; + if ((!playing) && (!pd->is_play)) return EINA_TRUE; + if ((playing) && (pd->is_play)) return EINA_TRUE; + pd->is_play = !!playing; + if (!playing) + { + if (!pd->is_play) return EINA_TRUE; + pd->is_paused = EINA_FALSE; + _player_stop(eo_obj, pd, anim); + return EINA_TRUE; + } + //TODO: check this case is correct + if (pd->start_delay_timer) return EINA_TRUE; + + pd->progress = 0.0; + start_delay = efl_animation_start_delay_get(anim); + if (start_delay > 0.0) + { + pd->start_delay_timer = ecore_timer_add(start_delay, + _start_delay_timer_cb, eo_obj); + } + else + _start(eo_obj, pd); + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) +{ + return pd->is_play; +} + +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_paused_set(Eo *eo_obj, + Efl_Canvas_Animation_Player_Data *pd, + Eina_Bool paused) +{ + paused = !!paused; + /* can't pause if not playing */ + if (!pd->is_play) return EINA_FALSE; + if (pd->is_paused == paused) return EINA_TRUE; + pd->is_paused = paused; + if (!paused) { //TODO: check this case is correct. - if (pd->start_delay_timer) return; + if (pd->start_delay_timer) return EINA_FALSE; pd->time.prev = ecore_loop_time_get(); pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj); @@ -307,17 +309,18 @@ _efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, ecore_animator_del(pd->animator); pd->animator = NULL; } + return EINA_TRUE; } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_play_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_paused_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { - return pd->is_play; + return pd->is_paused; } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_playable_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_playable_playable_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj); @@ -326,23 +329,23 @@ _efl_canvas_animation_player_efl_player_playable_get(const Eo *eo_obj, } EOLIAN static double -_efl_canvas_animation_player_efl_player_pos_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_player_playback_position_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { //TODO: this is not correct Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj); double length = efl_animation_duration_get(anim); - return length * efl_player_progress_get(eo_obj); + return length * efl_player_playback_progress_get(eo_obj); } EOLIAN static void -_efl_canvas_animation_player_efl_player_pos_set(Eo *eo_obj, +_efl_canvas_animation_player_efl_player_playback_position_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED, double sec) { //TODO: this is not correct - if (!efl_player_seekable_get(eo_obj)) + if (!efl_playable_seekable_get(eo_obj)) return; EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); @@ -357,14 +360,14 @@ _efl_canvas_animation_player_efl_player_pos_set(Eo *eo_obj, } EOLIAN static double -_efl_canvas_animation_player_efl_player_progress_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_progress_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { return pd->progress; } EOLIAN static void -_efl_canvas_animation_player_efl_player_play_speed_set(Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_speed_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd, double play_speed) { @@ -375,14 +378,14 @@ _efl_canvas_animation_player_efl_player_play_speed_set(Eo *eo_obj EINA_UNUSED, } EOLIAN static double -_efl_canvas_animation_player_efl_player_play_speed_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_speed_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { return pd->play_speed; } EOLIAN static double -_efl_canvas_animation_player_efl_player_length_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); @@ -390,7 +393,7 @@ _efl_canvas_animation_player_efl_player_length_get(const Eo *eo_obj, } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_seekable_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); @@ -425,7 +428,7 @@ _efl_canvas_animation_player_efl_object_destructor(Eo *eo_obj, pd->animator = NULL; //Reset the state of the target to the initial state - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); } diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 8d33cc783d..361dfcbad5 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -1,4 +1,4 @@ -class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player +class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player, Efl.Playable { [[Efl animation object class]] c_prefix: efl_animation_player; @@ -35,17 +35,16 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.Player.start; - Efl.Player.stop; - Efl.Player.play { get; set; } - Efl.Player.playable { get; } - Efl.Player.pos { get; set; } - Efl.Player.progress { get;} - Efl.Player.play_speed { get; set; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } + Efl.Playable.playable { get; } + Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get;} + Efl.Player.playback_speed { get; set; } //Efl.Player.volume { get; set; } //Efl.Player.mute { get; set; } - Efl.Player.length { get; } - Efl.Player.seekable { get; } + Efl.Playable.length { get; } + Efl.Playable.seekable { get; } } events { /* FIXME: This event is similar to Efl.Canvas.Object.anim_started but with different type, might be confusing. */ diff --git a/src/lib/evas/canvas/efl_canvas_animation_player_private.h b/src/lib/evas/canvas/efl_canvas_animation_player_private.h index f0128aaa74..aff74db408 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player_private.h +++ b/src/lib/evas/canvas/efl_canvas_animation_player_private.h @@ -41,6 +41,7 @@ typedef struct _Efl_Canvas_Animation_Player_Data Eina_Bool auto_del : 1; Eina_Bool is_play : 1; + Eina_Bool is_paused : 1; Eina_Bool keep_final_state : 1; Eina_Bool is_direction_forward : 1; } Efl_Canvas_Animation_Player_Data; diff --git a/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c b/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c index 034d8c1ece..853f7da502 100644 --- a/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c +++ b/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c @@ -68,6 +68,7 @@ evas_object_propagate_events_set(Efl_Canvas_Object *obj, Eina_Bool propagate) EAPI Eina_Bool evas_object_propagate_events_get(const Efl_Canvas_Object *obj) { + if (!efl_isa(obj, EFL_CANVAS_OBJECT_CLASS)) return EINA_FALSE; return efl_canvas_object_propagate_events_get(obj); } diff --git a/src/lib/evas/canvas/efl_input_clickable.eo b/src/lib/evas/canvas/efl_input_clickable.eo index a9285db4fc..a108035fb3 100644 --- a/src/lib/evas/canvas/efl_input_clickable.eo +++ b/src/lib/evas/canvas/efl_input_clickable.eo @@ -1,10 +1,10 @@ -struct @beta Efl.Input.Clickable_Clicked { +struct Efl.Input.Clickable_Clicked { [[A struct that expresses a click in elementary.]] repeated : uint; [[The amount of how often the clicked event was repeated in a certain amount of time]] button : uint; [[The Button that is pressed]] } -mixin @beta Efl.Input.Clickable +mixin Efl.Input.Clickable { [[Efl input clickable interface]] event_prefix: efl_input; diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c index cadd0212f0..35ef78aef2 100644 --- a/src/lib/evas/canvas/evas_callbacks.c +++ b/src/lib/evas/canvas/evas_callbacks.c @@ -805,6 +805,8 @@ _animator_repeater(void *data, const Efl_Event *event) void evas_object_callbacks_finalized(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { + EINA_SAFETY_ON_NULL_RETURN(obj); + if (obj->animator_ref > 0) { if (obj->layer && obj->layer->evas) diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index 5729493e99..9911a5b1f3 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -107,7 +107,7 @@ _evas_object_intercept_call_internal(Evas_Object *eo_obj, /* If show is called during hide animation is running, then the * current hide animation is cancelled and show operation is * proceeded. */ - if ((!obj->anim_player) || (!efl_player_play_get(obj->anim_player))) + if ((!obj->anim_player) || (!efl_player_playing_get(obj->anim_player))) return 1; } if (!obj->interceptors) return 0; diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 95ee8a21d5..abd8a2d5e2 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1870,7 +1870,7 @@ static void _show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) { if (obj->anim_player) - efl_player_stop(obj->anim_player); + efl_player_playing_set(obj->anim_player, EINA_FALSE); if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class->show) { obj->smart.smart->smart_class->show(eo_obj); @@ -2583,7 +2583,7 @@ _efl_canvas_object_event_animation_cancel(Eo *eo_obj) Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj); if (obj) - efl_player_stop(obj->anim_player); + efl_player_playing_set(obj->anim_player, EINA_FALSE); } /* legacy */ diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index c76bc49e72..23ebd22c66 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -173,11 +173,6 @@ class Eolian_Expression_Mask(IntEnum): NUMBER = INT | FLOAT ALL = NUMBER | BOOL | STRING | CHAR | NULL -class Eolian_Variable_Type(IntEnum): - UNKNOWN = 0 - CONSTANT = 1 - GLOBAL = 2 - class Eolian_Binary_Operator(IntEnum): INVALID = 0 ADD = 1 # + int, float @@ -350,19 +345,11 @@ class Eolian_Unit(EolianBaseObject): @property def constants(self): - return Iterator(Variable, lib.eolian_unit_constants_get(self)) + return Iterator(Constant, lib.eolian_unit_constants_get(self)) def constant_by_name_get(self, name): c_var = lib.eolian_unit_constant_by_name_get(self, _str_to_bytes(name)) - return Variable(c_var) if c_var else None - - @property - def globals(self): - return Iterator(Variable, lib.eolian_unit_globals_get(self)) - - def global_by_name_get(self, name): - c_var = lib.eolian_unit_global_by_name_get(self, _str_to_bytes(name)) - return Variable(c_var) if c_var else None + return Constant(c_var) if c_var else None @property def enums(self): @@ -472,13 +459,9 @@ class Eolian_State(Eolian_Unit): return Class(c_cls) if c_cls else None def constants_by_file_get(self, file_name): - return Iterator(Variable, + return Iterator(Constant, lib.eolian_state_constants_by_file_get(self, _str_to_bytes(file_name))) - def globals_by_file_get(self, file_name): - return Iterator(Variable, - lib.eolian_state_globals_by_file_get(self, _str_to_bytes(file_name))) - def aliases_by_file_get(self, file_name): return Iterator(Typedecl, lib.eolian_state_aliases_by_file_get(self, _str_to_bytes(file_name))) @@ -662,8 +645,8 @@ class Class(Object): return ret @cached_property - def eo_prefix(self): - return _str_to_py(lib.eolian_class_eo_prefix_get(self)) + def c_prefix(self): + return _str_to_py(lib.eolian_class_c_prefix_get(self)) @cached_property def event_prefix(self): @@ -1079,10 +1062,6 @@ class Type(Object): c_cls = lib.eolian_type_class_get(self) return Class(c_cls) if c_cls else None - @cached_property - def is_owned(self): - return bool(lib.eolian_type_is_owned(self)) - @cached_property def is_const(self): return bool(lib.eolian_type_is_const(self)) @@ -1238,31 +1217,27 @@ class Expression(Object): return Expression(c_expr) if c_expr is not None else None -class Variable(Object): +class Constant(Object): def __repr__(self): - return "".format(self) - - @cached_property - def type(self): - return Eolian_Variable_Type(lib.eolian_variable_type_get(self)) + return "".format(self) @cached_property def value(self): - c_expr = lib.eolian_variable_value_get(self) + c_expr = lib.eolian_constant_value_get(self) return Expression(c_expr) if c_expr else None @cached_property - def base_type(self): - c_type = lib.eolian_variable_base_type_get(self) + def type(self): + c_type = lib.eolian_constant_type_get(self) return Type(c_type) if c_type else None @cached_property def is_extern(self): - return bool(lib.eolian_variable_is_extern(self)) + return bool(lib.eolian_constant_is_extern(self)) @cached_property def documentation(self): - c_doc = lib.eolian_variable_documentation_get(self) + c_doc = lib.eolian_constant_documentation_get(self) return Documentation(c_doc) if c_doc else None @@ -1380,7 +1355,7 @@ class _Eolian_Object_Type(IntEnum): STRUCT_FIELD = 3 ENUM_FIELD = 4 TYPE = 5 - VARIABLE = 6 + CONSTANT = 6 EXPRESSION = 7 FUNCTION = 8 FUNCTION_PARAMETER = 9 @@ -1397,7 +1372,7 @@ _eolian_type_class_mapping = { _Eolian_Object_Type.STRUCT_FIELD: Struct_Type_Field, _Eolian_Object_Type.ENUM_FIELD: Enum_Type_Field, _Eolian_Object_Type.TYPE: Type, - _Eolian_Object_Type.VARIABLE: Variable, + _Eolian_Object_Type.CONSTANT: Constant, _Eolian_Object_Type.EXPRESSION: Expression, _Eolian_Object_Type.FUNCTION: Function, _Eolian_Object_Type.FUNCTION_PARAMETER: Function_Parameter, diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index b9ee5d39a1..36e0341b80 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -108,10 +108,6 @@ lib.eolian_state_objects_by_file_get.restype = c_void_p lib.eolian_state_class_by_file_get.argtypes = (c_void_p, c_char_p) lib.eolian_state_class_by_file_get.restype = c_void_p -# EAPI Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); -lib.eolian_state_globals_by_file_get.argtypes = (c_void_p, c_char_p) -lib.eolian_state_globals_by_file_get.restype = c_void_p - # EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name); lib.eolian_state_constants_by_file_get.argtypes = (c_void_p, c_char_p) lib.eolian_state_constants_by_file_get.restype = c_void_p @@ -182,11 +178,7 @@ lib.eolian_unit_structs_get.restype = c_void_p lib.eolian_unit_enums_get.argtypes = (c_void_p,) lib.eolian_unit_enums_get.restype = c_void_p -# EAPI const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); -lib.eolian_unit_global_by_name_get.argtypes = (c_void_p, c_char_p) -lib.eolian_unit_global_by_name_get.restype = c_void_p - -# EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); +# EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); lib.eolian_unit_constant_by_name_get.argtypes = (c_void_p, c_char_p) lib.eolian_unit_constant_by_name_get.restype = c_void_p @@ -194,10 +186,6 @@ lib.eolian_unit_constant_by_name_get.restype = c_void_p lib.eolian_unit_constants_get.argtypes = (c_void_p,) lib.eolian_unit_constants_get.restype = c_void_p -# EAPI Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); -lib.eolian_unit_globals_get.argtypes = (c_void_p,) -lib.eolian_unit_globals_get.restype = c_void_p - ### Eolian_Object ########################################################### # EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj); @@ -246,9 +234,9 @@ lib.eolian_class_type_get.restype = c_int lib.eolian_class_documentation_get.argtypes = (c_void_p,) lib.eolian_class_documentation_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_class_eo_prefix_get(const Eolian_Class *klass); -lib.eolian_class_eo_prefix_get.argtypes = (c_void_p,) -lib.eolian_class_eo_prefix_get.restype = c_char_p +# EAPI Eina_Stringshare *eolian_class_c_prefix_get(const Eolian_Class *klass); +lib.eolian_class_c_prefix_get.argtypes = (c_void_p,) +lib.eolian_class_c_prefix_get.restype = c_char_p # EAPI Eina_Stringshare* eolian_class_event_prefix_get(const Eolian_Class *klass); lib.eolian_class_event_prefix_get.argtypes = (c_void_p,) @@ -591,10 +579,6 @@ lib.eolian_type_aliased_base_get.restype = c_void_p lib.eolian_type_class_get.argtypes = (c_void_p,) lib.eolian_type_class_get.restype = c_void_p -# EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); -lib.eolian_type_is_owned.argtypes = (c_void_p,) -lib.eolian_type_is_owned.restype = c_bool - # EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); lib.eolian_type_is_const.argtypes = (c_void_p,) lib.eolian_type_is_const.restype = c_bool @@ -637,27 +621,23 @@ lib.eolian_expression_unary_operator_get.restype = c_int lib.eolian_expression_unary_expression_get.argtypes = (c_void_p,) lib.eolian_expression_unary_expression_get.restype = c_void_p -### Eolian_Variable ######################################################### +### Eolian_Constant ######################################################### -# EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); -lib.eolian_variable_type_get.argtypes = (c_void_p,) -lib.eolian_variable_type_get.restype = c_int +# EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); +lib.eolian_constant_documentation_get.argtypes = (c_void_p,) +lib.eolian_constant_documentation_get.restype = c_void_p -# EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); -lib.eolian_variable_documentation_get.argtypes = (c_void_p,) -lib.eolian_variable_documentation_get.restype = c_void_p +# EAPI const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); +lib.eolian_constant_type_get.argtypes = (c_void_p,) +lib.eolian_constant_type_get.restype = c_void_p -# EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); -lib.eolian_variable_base_type_get.argtypes = (c_void_p,) -lib.eolian_variable_base_type_get.restype = c_void_p +# EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); +lib.eolian_constant_value_get.argtypes = (c_void_p,) +lib.eolian_constant_value_get.restype = c_void_p -# EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); -lib.eolian_variable_value_get.argtypes = (c_void_p,) -lib.eolian_variable_value_get.restype = c_void_p - -# EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); -lib.eolian_variable_is_extern.argtypes = (c_void_p,) -lib.eolian_variable_is_extern.restype = c_bool +# EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); +lib.eolian_constant_is_extern.argtypes = (c_void_p,) +lib.eolian_constant_is_extern.restype = c_bool ### Eolian_Documentation #################################################### diff --git a/src/scripts/pyolian/generator.py b/src/scripts/pyolian/generator.py index cd4d105858..a86e03240c 100755 --- a/src/scripts/pyolian/generator.py +++ b/src/scripts/pyolian/generator.py @@ -125,7 +125,7 @@ class Template(pyratemp.Template): 'Enum_Type_Field': eolian.Enum_Type_Field, 'Struct_Type_Field': eolian.Struct_Type_Field, 'Expression': eolian.Expression, - 'Variable': eolian.Variable, + 'Constant': eolian.Constant, 'Documentation': eolian.Documentation, 'Documentation_Token': eolian.Documentation_Token, # Eolian Enums @@ -139,7 +139,6 @@ class Template(pyratemp.Template): 'Eolian_C_Type_Type': eolian.Eolian_C_Type_Type, 'Eolian_Expression_Type': eolian.Eolian_Expression_Type, 'Eolian_Expression_Mask': eolian.Eolian_Expression_Mask, - 'Eolian_Variable_Type': eolian.Eolian_Variable_Type, 'Eolian_Binary_Operator': eolian.Eolian_Binary_Operator, 'Eolian_Unary_Operator': eolian.Eolian_Unary_Operator, 'Eolian_Doc_Token_Type': eolian.Eolian_Doc_Token_Type, diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 36c19ea1ae..01e916b4b4 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -180,22 +180,14 @@ class TestEolianUnit(unittest.TestCase): all_count += 1 self.assertGreater(all_count, 10) - def test_variable_listing(self): + def test_constant_listing(self): l = list(eolian_db.constants) self.assertGreater(len(l), 2) - self.assertIsInstance(l[0], eolian.Variable) - - l = list(eolian_db.globals) - self.assertGreater(len(l), 20) - self.assertIsInstance(l[0], eolian.Variable) + self.assertIsInstance(l[0], eolian.Constant) l = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo')) self.assertGreater(len(l), 1) - self.assertIsInstance(l[0], eolian.Variable) - - l = list(eolian_db.globals_by_file_get('efl_net_http_types.eot')) - self.assertGreater(len(l), 10) - self.assertIsInstance(l[0], eolian.Variable) + self.assertIsInstance(l[0], eolian.Constant) def test_class_listing(self): all_count = 0 @@ -341,7 +333,7 @@ class TestEolianClass(unittest.TestCase): self.assertEqual(list(cls.namespaces), ['Efl']) self.assertEqual(cls.type, eolian.Eolian_Class_Type.REGULAR) self.assertIsInstance(cls.documentation, eolian.Documentation) - self.assertIsNone(cls.eo_prefix) # TODO fin a class with a value + self.assertIsNone(cls.c_prefix) # TODO fin a class with a value self.assertIsNone(cls.event_prefix) # TODO same as above self.assertIsNone(cls.data_type) # TODO same as above self.assertEqual(cls.parent.name, 'Efl.Loop_Consumer') @@ -473,31 +465,17 @@ class TestEolianDocumentation(unittest.TestCase): self.assertEqual(doc.since, '1.22') -class TestEolianVariable(unittest.TestCase): - def test_variable_global(self): - var = eolian_db.global_by_name_get('Efl.Net.Http.Error.BAD_CONTENT_ENCODING') - self.assertIsInstance(var, eolian.Variable) - self.assertEqual(var.name, 'Efl.Net.Http.Error.BAD_CONTENT_ENCODING') - self.assertEqual(var.short_name, 'BAD_CONTENT_ENCODING') - self.assertEqual(var.type, eolian.Eolian_Variable_Type.GLOBAL) - self.assertEqual(var.file, 'efl_net_http_types.eot') - self.assertFalse(var.is_extern) - self.assertEqual(list(var.namespaces), ['Efl','Net','Http','Error']) - self.assertIsInstance(var.documentation, eolian.Documentation) - self.assertIsInstance(var.base_type, eolian.Type) - self.assertIsNone(var.value) # TODO is None correct here? no value? - - def test_variable_constant(self): +class TestEolianConstant(unittest.TestCase): + def test_constant(self): var = eolian_db.constant_by_name_get('Efl.Gfx.Hint_Expand') - self.assertIsInstance(var, eolian.Variable) + self.assertIsInstance(var, eolian.Constant) self.assertEqual(var.name, 'Efl.Gfx.Hint_Expand') self.assertEqual(var.short_name, 'Hint_Expand') - self.assertEqual(var.type, eolian.Eolian_Variable_Type.CONSTANT) self.assertEqual(var.file, 'efl_gfx_hint.eo') self.assertFalse(var.is_extern) self.assertEqual(list(var.namespaces), ['Efl','Gfx']) self.assertIsInstance(var.documentation, eolian.Documentation) - self.assertIsInstance(var.base_type, eolian.Type) + self.assertIsInstance(var.type, eolian.Type) self.assertIsInstance(var.value, eolian.Expression) self.assertEqual(float(var.value.serialize), +1.0) @@ -575,7 +553,6 @@ class TestEolianType(unittest.TestCase): self.assertEqual(t.file, 'efl_loop_timer.eo') # TODO is this correct ? self.assertIsNone(t.base_type) # TODO find a better test self.assertIsNone(t.next_type) # TODO find a better test - self.assertFalse(t.is_owned) self.assertFalse(t.is_const) self.assertFalse(t.is_ptr) self.assertEqual(list(t.namespaces), []) diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs index 4c7196ec5b..a2e178adbb 100644 --- a/src/tests/efl_mono/Eo.cs +++ b/src/tests/efl_mono/Eo.cs @@ -621,4 +621,15 @@ class TestStaticInterfaceMembers } } +class TestHiddenClasses +{ + public static void test_hidden_class() + { + var obj = new Dummy.TestObject(); + var hidden = obj.HiddenObject; + + Test.AssertEquals(hidden.Name, "hidden_object"); + } +} + } diff --git a/src/tests/efl_mono/Model.cs b/src/tests/efl_mono/Model.cs index 4ec6ef3f0b..13e0d1559f 100644 --- a/src/tests/efl_mono/Model.cs +++ b/src/tests/efl_mono/Model.cs @@ -65,7 +65,9 @@ public class TestModel { { string propertyBound = null; bool callbackCalled = false; - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); factory.PropertyBoundEvent += (object sender, Efl.Ui.PropertyBindPropertyBoundEventArgs args) => { propertyBound = args.arg; callbackCalled = true; diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs index 14743ac634..bf47fed945 100644 --- a/src/tests/efl_mono/Parts.cs +++ b/src/tests/efl_mono/Parts.cs @@ -43,7 +43,9 @@ public static class TestMVVMParts { public static void mvvm_dynamic_parts() { - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); var bindablePart = factory.TextPart(); var error = bindablePart.Markup().Bind("name"); @@ -53,7 +55,9 @@ public static class TestMVVMParts public static void mvvm_factory_properties() { - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); var iconFactory = new Efl.Ui.ImageFactory(null); iconFactory.BindProperty("filename", "modelProperty"); var error = factory.IconPart().BindFactory(iconFactory); diff --git a/src/tests/efl_mono/dummy_hidden_object.c b/src/tests/efl_mono/dummy_hidden_object.c new file mode 100644 index 0000000000..cf9c9cde5b --- /dev/null +++ b/src/tests/efl_mono/dummy_hidden_object.c @@ -0,0 +1,8 @@ +#include "libefl_mono_native_test.h" + +typedef struct Dummy_Hidden_Object_Data +{ +} Dummy_Hidden_Object_Data; + + +#include "dummy_hidden_object.eo.c" diff --git a/src/tests/efl_mono/dummy_hidden_object.eo b/src/tests/efl_mono/dummy_hidden_object.eo new file mode 100644 index 0000000000..1b29472a1c --- /dev/null +++ b/src/tests/efl_mono/dummy_hidden_object.eo @@ -0,0 +1,2 @@ +class Dummy.Hidden_Object extends Efl.Object { +} diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c index 0406dd3f53..7f158430a2 100644 --- a/src/tests/efl_mono/dummy_test_object.c +++ b/src/tests/efl_mono/dummy_test_object.c @@ -22,6 +22,7 @@ typedef struct Dummy_Test_Object_Data Eo *iface_provider; int prop1; int prop2; + Eo *hidden_object; // Containers passed to C# as iterator/accessors Eina_Array *out_array; @@ -75,6 +76,8 @@ _dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd) { efl_constructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS)); pd->provider = efl_add(DUMMY_NUMBERWRAPPER_CLASS, obj); + pd->hidden_object = efl_add(DUMMY_HIDDEN_OBJECT_CLASS, obj); + efl_name_set(pd->hidden_object, "hidden_object"); if (efl_parent_get(obj) == NULL) { // Avoid recursion pd->iface_provider = efl_add(DUMMY_TEST_OBJECT_CLASS, obj); @@ -4738,6 +4741,11 @@ int _dummy_test_object_dummy_test_iface_call_method_protected(const Eo *obj, EIN return dummy_test_iface_method_protected(obj, x); } +Eo *_dummy_test_object_hidden_object_get(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd) +{ + return pd->hidden_object; +} + // Inherit int _dummy_inherit_helper_receive_dummy_and_call_int_out(Dummy_Test_Object *x) { diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo index a63c822375..44a7c97464 100644 --- a/src/tests/efl_mono/dummy_test_object.eo +++ b/src/tests/efl_mono/dummy_test_object.eo @@ -1646,6 +1646,14 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface { } return: const(ptr(Eina.Value_Type)); } + + @property hidden_object { + get {} + + values { + obj: Efl.Object; + } + } } implements { Efl.Object.constructor; diff --git a/src/tests/efl_mono/libefl_mono_native_test.h b/src/tests/efl_mono/libefl_mono_native_test.h index b726bd05c1..87abefe5e2 100644 --- a/src/tests/efl_mono/libefl_mono_native_test.h +++ b/src/tests/efl_mono/libefl_mono_native_test.h @@ -56,6 +56,7 @@ #include "dummy_part_holder.eo.h" #include "dummy_event_manager.eo.h" #include "dummy_constructible_object.eo.h" +#include "dummy_hidden_object.eo.h" #include diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build index 8dedc3e543..d7cd6bbff7 100644 --- a/src/tests/efl_mono/meson.build +++ b/src/tests/efl_mono/meson.build @@ -10,9 +10,13 @@ eo_files = [ 'dummy_constructible_object.eo', ] +private_eo_files = [ + 'dummy_hidden_object.eo' +] + eo_file_targets = [] -foreach eo_file : eo_files +foreach eo_file : eo_files + private_eo_files eo_file_targets += custom_target('eolian_gen_' + eo_file, input : eo_file, output : [eo_file + '.h'], @@ -35,6 +39,7 @@ efl_mono_native_test = library('efl_mono_native_test', 'dummy_test_object.c', 'dummy_event_manager.c', 'dummy_constructible_object.c', + 'dummy_hidden_object.c', ], dependencies : [ecore, eo, efl], ) @@ -92,6 +97,7 @@ efl_mono_suite = executable('efl-mono-suite', env_mono = environment() env_mono.set('MONO_PATH', efl_mono_test_suite_path ) +env_mono.set('EFL_RUN_IN_TREE', '1') if (cs_is_dotnet) copy_prog = find_program(['cp', 'copy']) diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c index e11155c0aa..e2b61c5677 100644 --- a/src/tests/elementary/efl_ui_test_select_model.c +++ b/src/tests/elementary/efl_ui_test_select_model.c @@ -111,12 +111,12 @@ EFL_START_TEST(efl_test_select_model) ecore_main_loop_begin(); - it = efl_ui_select_model_selected_get(model); + it = efl_ui_multi_selectable_async_selected_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index != 2); eina_iterator_free(it); - it = efl_ui_select_model_unselected_get(model); + it = efl_ui_multi_selectable_async_unselected_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index == 2); eina_iterator_free(it); diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index 23118fee86..74e8f2eac9 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -19,8 +19,7 @@ static void _small_ui(State *s) { s->win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); s->ic = efl_add(EFL_UI_IMAGE_CLASS, s->win, efl_ui_win_icon_object_set(s->win, efl_added)); @@ -233,8 +232,7 @@ EFL_START_TEST(efl_ui_test_widget_parent_relation) Efl_Ui_Win *win, *w1, *w2, *w3; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); ck_assert_ptr_eq(efl_ui_widget_parent_get(w1), win); @@ -257,8 +255,7 @@ EFL_START_TEST(efl_ui_test_widget_disabled_parent) Efl_Ui_Win *win, *w1, *w2, *t; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); efl_ui_widget_disabled_set(w1, EINA_TRUE); @@ -293,8 +290,7 @@ EFL_START_TEST(efl_ui_test_widget_disabled_behaviour) Efl_Ui_Win *win, *w1, *w2, *t; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); efl_ui_widget_disabled_set(w1, EINA_TRUE); diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c index 4e61e5bff2..2d893be5bb 100644 --- a/src/tests/elementary/efl_ui_test_win.c +++ b/src/tests/elementary/efl_ui_test_win.c @@ -433,6 +433,17 @@ EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_cancel) ck_assert_int_eq(called, 2); } EFL_END_TEST + +EFL_START_TEST(efl_ui_win_test_type) +{ + Efl_Ui_Win *win; + + win = win_add(); + + ck_assert_int_eq(efl_ui_win_type_get(win), EFL_UI_WIN_TYPE_BASIC); +} +EFL_END_TEST + void efl_ui_test_win(TCase *tc) { @@ -447,4 +458,5 @@ efl_ui_test_win(TCase *tc) tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_in_out); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_wheel); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_cancel); + tcase_add_test(tc, efl_ui_win_test_type); } diff --git a/src/tests/elementary/elm_test_win.c b/src/tests/elementary/elm_test_win.c index dc335bff68..e90a31a4b6 100644 --- a/src/tests/elementary/elm_test_win.c +++ b/src/tests/elementary/elm_test_win.c @@ -465,6 +465,18 @@ EFL_START_TEST(elm_win_test_rotation) } EFL_END_TEST +EFL_START_TEST(elm_win_test_default_type) +{ + Evas_Object *win; + + win = elm_win_add(NULL, "test win default type", ELM_WIN_UNKNOWN); + ck_assert_int_eq(elm_win_type_get(win), ELM_WIN_UNKNOWN); + + win = elm_win_util_standard_add("test win default type", "test"); + ck_assert_int_eq(elm_win_type_get(win), ELM_WIN_BASIC); +} +EFL_END_TEST + void elm_test_win(TCase *tc) { tcase_add_test(tc, elm_win_legacy_type_check); @@ -475,6 +487,7 @@ void elm_test_win(TCase *tc) tcase_add_test(tc, elm_win_test_app_exit_on_windows_close); tcase_add_test(tc, efl_ui_win_multi_touch_inputs); tcase_add_test(tc, elm_win_test_rotation); + tcase_add_test(tc, elm_win_test_default_type); #ifdef HAVE_ELEMENTARY_X tcase_add_test(tc, elm_win_autohide); tcase_add_test(tc, elm_win_autohide_and_policy_quit_last_window_hidden); diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c index a2606a13b8..5e2c719d77 100644 --- a/src/tests/elementary/spec/efl_test_multi_selectable.c +++ b/src/tests/elementary/spec/efl_test_multi_selectable.c @@ -52,7 +52,7 @@ EFL_START_TEST(test_multi_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -87,7 +87,7 @@ EFL_START_TEST(test_multi_select_removal) c = 0; ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -114,7 +114,7 @@ EFL_START_TEST(test_single_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2)); @@ -144,20 +144,20 @@ EFL_START_TEST(test_none_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); } EFL_END_TEST -EFL_START_TEST(select_all_api) +EFL_START_TEST(all_select_api) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_all_select(widget); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 3); @@ -167,69 +167,69 @@ EFL_START_TEST(select_all_api) } EFL_END_TEST -EFL_START_TEST(unselect_all_api) +EFL_START_TEST(all_unselect_api) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); - efl_ui_unselect_all(widget); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_all_unselect(widget); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); } EFL_END_TEST -EFL_START_TEST(unselect_range) +EFL_START_TEST(range_unselect) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); + efl_ui_all_select(widget); - efl_ui_unselect_range(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } EFL_END_TEST -EFL_START_TEST(unselect_range2) +EFL_START_TEST(range_unselect2) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); + efl_ui_all_select(widget); - efl_ui_unselect_range(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } EFL_END_TEST -EFL_START_TEST(select_range) +EFL_START_TEST(range_select) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_range(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); } EFL_END_TEST -EFL_START_TEST(select_range2) +EFL_START_TEST(range_select2) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_range(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + efl_ui_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -244,11 +244,11 @@ efl_ui_multi_selectable_behavior_test(TCase *tc) tcase_add_test(tc, test_multi_select_removal); tcase_add_test(tc, test_single_select); tcase_add_test(tc, test_none_select); - tcase_add_test(tc, select_all_api); - tcase_add_test(tc, unselect_all_api); - tcase_add_test(tc, unselect_range); - tcase_add_test(tc, unselect_range2); - tcase_add_test(tc, select_range); - tcase_add_test(tc, select_range2); + tcase_add_test(tc, all_select_api); + tcase_add_test(tc, all_unselect_api); + tcase_add_test(tc, range_unselect); + tcase_add_test(tc, range_unselect2); + tcase_add_test(tc, range_select); + tcase_add_test(tc, range_select2); efl_ui_single_selectable_behavior_test(tc); } diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 81da3813f6..d4204ef79e 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -201,7 +201,7 @@ _elm_suite_win_create() if (legacy_mode) win = elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC); else - win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC)); + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get()); if (!buffer) return win; loop = efl_add(efl_loop_realized_class_get(), win); timer = efl_add(EFL_LOOP_TIMER_CLASS, loop, diff --git a/src/tests/eolian/data/class_simple.eo b/src/tests/eolian/data/class_simple.eo index ad0589b3a7..12ea743b48 100644 --- a/src/tests/eolian/data/class_simple.eo +++ b/src/tests/eolian/data/class_simple.eo @@ -2,12 +2,6 @@ const Foo: int = 5; [[doc for constant]] -var Bar: float = 10.3f; [[doc for global]] - -var Baz: long; [[in header but not in source]] - -var @extern Bah: double; // not generated - class Class_Simple { [[Class Desc Simple]] c_prefix: efl_canvas_object_simple; diff --git a/src/tests/eolian/data/class_simple_ref.c b/src/tests/eolian/data/class_simple_ref.c index 4fec41fb02..d11055ae5e 100644 --- a/src/tests/eolian/data/class_simple_ref.c +++ b/src/tests/eolian/data/class_simple_ref.c @@ -1,4 +1,3 @@ -EWAPI float BAR = 10.300000f; Eina_Bool _class_simple_a_set(Eo *obj, Evas_Simple_Data *pd, int value); diff --git a/src/tests/eolian/data/class_simple_ref_eo.h b/src/tests/eolian/data/class_simple_ref_eo.h index 60e6fe27e2..d0a6d02ce8 100644 --- a/src/tests/eolian/data/class_simple_ref_eo.h +++ b/src/tests/eolian/data/class_simple_ref_eo.h @@ -19,18 +19,6 @@ typedef Eo Class_Simple; #define FOO 5 #endif -/** doc for global - * - * @ingroup Bar - */ -EWAPI extern float BAR; - -/** in header but not in source - * - * @ingroup Baz - */ -EWAPI extern long BAZ; - #endif /** Class Desc Simple diff --git a/src/tests/eolian/data/docs_ref.h b/src/tests/eolian/data/docs_ref.h index cc4b086873..a5a92e6a4c 100644 --- a/src/tests/eolian/data/docs_ref.h +++ b/src/tests/eolian/data/docs_ref.h @@ -56,11 +56,13 @@ typedef enum */ typedef Bar Alias; +#ifndef PANTS /** Docs for var. * * @ingroup pants */ -EWAPI extern int PANTS; +#define PANTS 150 +#endif /** Opaque struct docs. See @ref Foo for another struct. * @@ -74,7 +76,7 @@ typedef struct _Opaque Opaque; * @brief Docs for class. * * More docs for class. Testing references now. @ref Foo @ref Bar @ref Alias - * @ref pants @ref eo_docs_meth @ref eo_docs_prop_get @ref eo_docs_prop_get + * @ref PANTS @ref eo_docs_meth @ref eo_docs_prop_get @ref eo_docs_prop_get * @ref eo_docs_prop_set @ref Foo.field1 @ref BAR_FOO @ref Eo_Docs * * @since 1.18 diff --git a/src/tests/eolian/data/eo_docs.eo b/src/tests/eolian/data/eo_docs.eo index 50641f2ad4..1fe72df572 100644 --- a/src/tests/eolian/data/eo_docs.eo +++ b/src/tests/eolian/data/eo_docs.eo @@ -31,7 +31,7 @@ type Alias: Bar; [[Docs for typedef. See @Bar. @since 2.0 ]] -var pants: int = 150; [[Docs for var.]] +const pants: int = 150; [[Docs for var.]] struct Opaque; [[Opaque struct docs. See @Foo for another struct.]] diff --git a/src/tests/eolian/data/var.eo b/src/tests/eolian/data/var.eo index 98afb713df..6424427ae0 100644 --- a/src/tests/eolian/data/var.eo +++ b/src/tests/eolian/data/var.eo @@ -1,15 +1,6 @@ // regular constant const Foo: int = 5; -// regular global -var Bar: float = 10.3f; - -// no-value global -var Baz: long; - -// extern global -var @extern Bah: double; - class Var { methods { foo { diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 2dd6c7775a..2e61fb97b2 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -554,7 +554,7 @@ EFL_START_TEST(eolian_simple_parsing) fail_if(eolian_class_type_get(class) != EOLIAN_CLASS_REGULAR); fail_if(eolian_class_parent_get(class) != NULL); fail_if(eolian_class_extensions_get(class) != NULL); - fail_if(strcmp(eolian_class_eo_prefix_get(class), "efl_canvas_object_simple")); + fail_if(strcmp(eolian_class_c_prefix_get(class), "efl_canvas_object_simple")); fail_if(strcmp(eolian_class_data_type_get(class), "Evas_Simple_Data")); Eina_Stringshare *dt = eolian_class_c_data_type_get(class); fail_if(strcmp(dt, "Evas_Simple_Data")); @@ -765,7 +765,7 @@ EFL_END_TEST EFL_START_TEST(eolian_var) { - const Eolian_Variable *var = NULL; + const Eolian_Constant *var = NULL; const Eolian_Expression *exp = NULL; const Eolian_Type *type = NULL; const Eolian_Class *class; @@ -785,46 +785,15 @@ EFL_START_TEST(eolian_var) /* regular constant */ fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Foo"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); + fail_if(eolian_constant_is_extern(var)); + fail_if(!(type = eolian_constant_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "int")); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 5); - /* regular global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Bar"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "float")); - fail_if(!(exp = eolian_variable_value_get(var))); - v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); - fail_if(v.type != EOLIAN_EXPR_FLOAT); - fail_if(((int)v.value.f) != 10); - - /* no-value global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Baz"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "long")); - fail_if(eolian_variable_value_get(var)); - - /* extern global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Bah"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(!eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "double")); - fail_if(eolian_variable_value_get(var)); - eolian_state_free(eos); } EFL_END_TEST @@ -879,7 +848,7 @@ EFL_END_TEST EFL_START_TEST(eolian_enum) { const Eolian_Enum_Type_Field *field = NULL; - const Eolian_Variable *var = NULL; + const Eolian_Constant *var = NULL; const Eolian_Typedecl *tdl = NULL; const Eolian_Type *type = NULL; const Eolian_Class *class; @@ -944,19 +913,16 @@ EFL_START_TEST(eolian_enum) eina_stringshare_del(cname); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Bah"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); + fail_if(!(type = eolian_constant_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "Baz")); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != (1 << 0)); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Pants"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 5); @@ -1062,7 +1028,7 @@ EFL_START_TEST(eolian_docs) const Eolian_Typedecl *tdl; const Eolian_Class *class; const Eolian_Event *event; - const Eolian_Variable *var; + const Eolian_Constant *var; const Eolian_Function *fid; const Eolian_Documentation *doc; const Eolian_Function_Parameter *par; @@ -1131,7 +1097,7 @@ EFL_START_TEST(eolian_docs) fail_if(eolian_doc_token_type_get(&tok) != EOLIAN_DOC_TOKEN_REF); txt = eolian_doc_token_text_get(&tok); fail_if(strcmp(txt, "pants")); - fail_if(eolian_doc_token_ref_resolve(&tok, eos, NULL, NULL) != EOLIAN_OBJECT_VARIABLE); + fail_if(eolian_doc_token_ref_resolve(&tok, eos, NULL, NULL) != EOLIAN_OBJECT_CONSTANT); free(txt); tdoc = eolian_documentation_tokenize(tdoc, &tok); fail_if(eolian_doc_token_type_get(&tok) != EOLIAN_DOC_TOKEN_TEXT); @@ -1210,8 +1176,8 @@ EFL_START_TEST(eolian_docs) fail_if(strcmp(eolian_documentation_since_get(doc), "2.0")); - fail_if(!(var = eolian_unit_global_by_name_get(unit, "pants"))); - fail_if(!(doc = eolian_variable_documentation_get(var))); + fail_if(!(var = eolian_unit_constant_by_name_get(unit, "pants"))); + fail_if(!(doc = eolian_constant_documentation_get(var))); fail_if(strcmp(eolian_documentation_summary_get(doc), "Docs for var.")); fail_if(eolian_documentation_description_get(doc)); diff --git a/src/tests/eolian_cxx/docs.eo b/src/tests/eolian_cxx/docs.eo index 5249b7196e..55c7dc28e6 100644 --- a/src/tests/eolian_cxx/docs.eo +++ b/src/tests/eolian_cxx/docs.eo @@ -31,7 +31,7 @@ type Alias: Bar; [[Docs for typedef. See @Bar. @since 2.0 ]] -var pants: int = 150; [[Docs for var.]] +const pants: int = 150; [[Docs for var.]] struct Opaque; [[Opaque struct docs. See @Foo for another struct.]]