Page MenuHomePhabricator

efl_ui_relative_layout: introduce new relative container
ClosedPublic

Authored by YOhoho on Dec 28 2018, 12:11 AM.

Details

Summary

Efl.Ui.Relative_Layout is a container which allows you to position and size with
relation to each other.
it is possible to position and size using relation like edje even though
you don't know a edc script.
Position and size can be changed dynamically using widget APIs.

@feature

ref T5487

Test Plan

make check
examples
elementary_test -to 'efl.ui.relative_layout'

Diff Detail

Repository
rEFL core/efl
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8712
Build 7705: arc lint + arc unit
There are a very large number of changes, so older changes are hidden. Show Older Changes
YOhoho requested review of this revision.Dec 28 2018, 12:11 AM
YOhoho added a comment.EditedDec 28 2018, 12:26 AM

TODO

  1. implement margin.
  2. add more examples.
  3. add more tests.
  4. enhance documentations.
  5. implement a chain dependency check.(efl_ui_relative_example02)
  6. implement scale.

Class Diagram


Testcase


Interesting :D

Could you move the definition of struct Efl.Ui.Relative_Params to efl_ui_relative.eo file?

src/lib/elementary/efl_ui_relative.eo
1 ↗(On Diff #18132)

Could you define struct Efl.Ui.Relative_Params here? (instead of in efl_ui_relative.h)

Otherwise, Relative_Params cannot be set with values by C# application.

cedric added a subscriber: segfaultxavi.

I am not to sure of the name of this new class as it doesn't express in the name the fact that it is a container. Also, and it is something that I am sure @segfaultxavi will point out, it is lacking a lot of documentation :-)

YOhoho updated this revision to Diff 18252.Jan 6 2019, 11:54 PM
  1. Rename Efl_Ui_Relative_Param -> Efl_Ui_Relative_Relation and integrate rel1 and rel2.
  2. (API) Rename rel1 -> left, rel2 -> right for intuitive names.
  3. Add Get method for properies.
  4. Update Class Diagram (check above comment)
YOhoho updated this revision to Diff 18253.Jan 7 2019, 2:02 AM
YOhoho retitled this revision from efl_ui_relative: introduce new relative container to efl_ui_relative_layout: introduce new relative container.
YOhoho edited the summary of this revision. (Show Details)

Rename to Efl.Ui.Relative_Layout

YOhoho added a comment.Jan 7 2019, 2:40 AM

I am not to sure of the name of this new class as it doesn't express in the name the fact that it is a container. Also, and it is something that I am sure @segfaultxavi will point out, it is lacking a lot of documentation :-)

Yes, documentation is in progress. i'll enhance it after adding more testcase and examples.
BTW, i am not sure that there isn't structural holes. :|

segfaultxavi requested changes to this revision.Jan 7 2019, 9:32 AM

OK, I'll wait for the new docs before reviewing. I am rejecting this version so we do not forget and this patch gets merged without documentation :)

This revision now requires changes to proceed.Jan 7 2019, 9:32 AM
YOhoho updated this revision to Diff 18259.Jan 7 2019, 5:57 PM

implement margin

YOhoho updated this revision to Diff 18275.Jan 9 2019, 4:03 AM
  1. add elementary_test example.
  2. rename to left, right, top, bottom.
  3. remove register api. (when a child have relation, it is registered)

I want overload relation_#direction# apis. for example,

  1. relation_left_set(Eo *obj, Eo *child, Eo *target) to set only to.
  2. relation_left_set(Eo *obj, Eo *child, double relative) to set only relative.
  3. relation_left_set(Eo *obj, Eo *child, Eo *target, double relative) to set both to and relative.

However, EO doesn't support method overloading. so there are xxx_to, xxx_relative apis.

YOhoho updated this revision to Diff 18276.EditedJan 9 2019, 4:05 AM

update a meson build file

YOhoho edited the test plan for this revision. (Show Details)Jan 9 2019, 4:33 AM
  1. add elementary_test example.
  2. rename to left, right, top, bottom.
  3. remove register api. (when a child have relation, it is registered)

    I want overload relation_#direction# apis. for example,
  4. relation_left_set(Eo *obj, Eo *child, Eo *target) to set only to.
  5. relation_left_set(Eo *obj, Eo *child, double relative) to set only relative.
  6. relation_left_set(Eo *obj, Eo *child, Eo *target, double relative) to set both to and relative.

    However, EO doesn't support method overloading. so there are xxx_to, xxx_relative apis.

Don't we have a way to define a default value here ? I would think that in C, if you pass NULL or 0.0, it would just work. In C# and other language, it could just use the default value. So something like :

relation_left_set(Eo *obj, Eo *child, Eo *target, double relative);

Would just work for all case.

YOhoho added a comment.Jan 9 2019, 8:20 PM

@cedric
Agreed.

relation_left_set(Eo *obj, Eo *child, Eo *target, double relative);

Would cover all cases passing NULL.

When widget have a relation, default relation is set as

left.to = parent;
left.relative = 0.0;
right.to = parent;
right.relative = 1.0;
top.to = parent;
top.relative = 0.0;
bottom.to = parent;
bottom.relative = 1.0;

It is same to Edje.

YOhoho updated this revision to Diff 18310.Jan 9 2019, 8:24 PM

Rebase and remove relation_dir_to_set, relation_dir_relative_set apis.

YOhoho updated this revision to Diff 18384.Jan 13 2019, 10:13 PM
  1. rebase
  2. refactoring
  3. add more tests
  4. implement chain relation (efl_ui_relative_layout_example_02)
YOhoho updated this revision to Diff 18397.Jan 14 2019, 3:50 AM

@segfaultxavi

Add documentations.

segfaultxavi accepted this revision.Jan 14 2019, 8:58 AM

Nice docs! I am approving, but only documentation-wise :)

This revision is now accepted and ready to land.Jan 14 2019, 8:58 AM
YOhoho updated this revision to Diff 18415.Jan 15 2019, 12:47 AM

Remove resize object. it is unnecessary.

YOhoho updated this revision to Diff 18452.Jan 16 2019, 12:39 AM

optimize chain_calc

YOhoho updated this revision to Diff 18453.Jan 16 2019, 12:46 AM

Remove resize object again. :(

YOhoho updated this revision to Diff 18649.Jan 20 2019, 5:49 PM

Rename Calc_Params to Calc.
Optimize chain weight calculation ( O(n^2) -> O(nlog n) )
Add testcase for chain relation.

YOhoho updated this revision to Diff 18650.Jan 20 2019, 7:19 PM

Fix margin calculation

I think its now ready to land.
I'm waiting for review.
Please check updated class diagram and testcases in my previous comment.

Should we implement Efl.Pack or not to call layout,updated event?

src/lib/elementary/efl_ui_relative_layout.c
465

EFL_PACK_EVENT_LAYOUT_UPDATED event is provided by Efl.Pack interface.
Since Efl.Ui.Relative_Layout does not implement Efl.Pack, it seems that this is not correct.

Is there any reason why relative layout itself becomes a child?

src/lib/elementary/efl_ui_relative_layout.c
514

It seems that child does nothing if the child is relative layout itself.

Is there any reason why relative layout itself becomes a child?

Should we implement Efl.Pack or not to call layout,updated event?

What do you think to move 'layout,updated' to Efl.Pack_Layout?
I think that is more suitable event for Efl.Pack_Layout which have layout_update method.

YOhoho added inline comments.Jan 31 2019, 6:36 PM
src/lib/elementary/efl_ui_relative_layout.c
514

A child can have a relationship with parent(relative layout). in this case, if relative layout itself becomes a child, layout calculation function can be more simple.

YOhoho updated this revision to Diff 19281.Feb 11 2019, 7:40 AM

use FOREACH instead of for

Jaehyun_Cho added inline comments.Feb 14 2019, 12:23 AM
src/lib/elementary/meson.build
909

this is duplicated

YOhoho updated this revision to Diff 19463.Feb 15 2019, 5:58 PM

rebase.
add hint_margin in unit test

YOhoho marked an inline comment as done.Feb 15 2019, 5:59 PM
YOhoho added inline comments.
src/lib/elementary/meson.build
909

removed

YOhoho updated this revision to Diff 19473.Feb 20 2019, 8:10 PM
YOhoho marked an inline comment as done.
YOhoho edited the summary of this revision. (Show Details)

Add missing margin_set

Jaehyun_Cho accepted this revision.Feb 22 2019, 2:47 AM
Closed by commit rEFL3118bfc34bb9: efl_ui_relative_layout: introduce new relative container (authored by Yeongjong Lee <yj34.lee@samsung.com>, committed by Jaehyun_Cho). · Explain WhyFeb 22 2019, 2:55 AM
This revision was automatically updated to reflect the committed changes.