Commit Graph

385 Commits

Author SHA1 Message Date
Daniel Hirt d50bc7f885 Canvas text: remove old style tag 'replace_len' field
The result isn't used at all, so the field is useless.
Maybe we should use stringshare comparisons.
2018-11-06 00:54:10 +02:00
Daniel Hirt 581fa91a6b Canvas text: emit text,changed event on markup_insert 2018-11-05 18:17:42 +02:00
Daniel Hirt 9903e7d556 Text: add markup_range_get
This allows to retrieve the markup representation of the current text.

@feature
2018-11-05 17:31:06 +02:00
Daniel Hirt 294040c86e Canvas text: don't emit 'cursor,changed' on legacy cursor_copy 2018-11-05 17:31:06 +02:00
Daniel Hirt 2caa38f166 Canvas text: fix line_jump_by logic
Some cases of line_jump_by did not emit "cursor,changed" when it should
have.

@fix
2018-11-05 17:31:06 +02:00
Hermet Park 27fd6a2eab evas: remove redundant internal functions.
Summary:
Since efl object is introduced, magic check is no more used.
Plus, remove redundant object functions interfaces
 - type_id,
 - visual_id,
 - store
 - unstore

Reviewers: #committers, bu5hm4n

Reviewed By: #committers, bu5hm4n

Subscribers: bu5hm4n, raster, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7153
2018-10-11 13:46:37 +09:00
Jiyoun Park 56e6ac1f5b evas_object_textblock: fix warning the dereference before null check 2018-09-28 18:07:01 +09:00
Hermet Park 65648335c5 evas canvas: fix overflowed function initialization.
Summary:
last function pointer indicates render_pre(),
add one more element is unnecessary.

Reviewers: #committers, netstar

Reviewed By: #committers, netstar

Subscribers: netstar, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6967
2018-09-04 09:08:54 +09:00
Youngbok Shin 517018e008 evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature

Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
   only in 2 right key event with this feature.

Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns

Reviewed By: herdsman, zmike

Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 10:29:32 -04:00
Daniel Hirt cafe84a2c2 Evas text textblock: call evas_font_free even on null fonts
A null font set can potentially be stored and passed on. There is no
specific fallback in our codebase to roll-back if something like that
occurs.

This fixes a case where an entry of a null font was not removed from the
fonts_cache and was leaked to subsequent tests (the null font entry was
not removed from the fonts_cache).

Note that this was only apparent when EFL was built with
`--disable-fontconfig`, likely due to fontconfig succeeding to always
retrieve some non-null font.

@fix
2018-07-16 16:45:53 +03:00
Youngbok Shin f6acd6f9e4 Evas Textblock: Don't convert <br/> to <ps/> after changing text
Summary:
It was only happened when legacy newline is enabled. By default,
legacy newline is enabled. As I know, legacy newline option has
to change textblock's internal behavior. But, it shouldn't change
the given original text. It fixes T3399.

Test Plan: A Test case is included in Evas test suite.

Reviewers: Jaehyun_Cho, z-wony, tasn, woohyun, herdsman, Blackmole, devilhorns

Subscribers: #committers, zmike, raster, cedric, jpeg

Tags: #efl

Maniphest Tasks: T3399

Differential Revision: https://phab.enlightenment.org/D3874
2018-07-02 18:33:45 +03:00
Daniel Hirt 27c677f1e0 Evas textblock: clear ellipsis item at start of layout
The ellipsis item was tracked so it can be inserted at the correct
position. It was not cleared properly, leading to a randomly failing
test suite.

Actually, it seems that there is no need to even store the ellipsis item
as the object data, so it was also moved to be in the layout context,
instead.

A special shoutout to ManMower for lending me his machine, as the test
suite didn't fail on mine.

Fixes T6986

@fix
2018-07-02 12:50:14 +03:00
Youngbok Shin f17cae08e6 evas textblock: manage default style properly for new interfaces
Summary:
Calling efl_canvas_text_style_set() with empty key means
setting a default style to object. But, it counldn't store style
as default properly. It caused a crash issue from elementary_test.
@fix

Test Plan:
New test case is included. Run test suite. Or,
1. Run elementary_test
2. Find and launch "Image Zoomable animation" test.
3. Close the image test window.
4. See the crash issue.

Reviewers: raster, herdsman, jpeg, cedric, zmike

Subscribers: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D5692

Committer's note: rebased and removed unrelated test.
2018-05-16 22:24:11 +03:00
Youngbok Shin f437a3075a evas textblock: update format nodes when a Evas Textblock Style is updated
Summary:
A style tag among a text has to be replcaed by its matched tag when
a format node is created. If the matched tag is changed, format nodes
should be updated.
But, if a style text for Evas Textblock Style is changed,
related format nodes are not updated without setting new text.
The patch changes to update format nodes when new style text is set.
@fix

Test Plan: Included in Evas Test Suite.

Reviewers: raster, tasn, herdsman, subodh6129, zmike

Subscribers: zmike, cedric, z-wony, Blackmole

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D4697

Committer's note: rebased.
2018-05-16 22:24:11 +03:00
Youngbok Shin fa8aa7c9c8 evas textblock: remove NULL checking after dereferencing
Summary:
c->paragraphs couldn't be NULL if it is created by
_layout_paragraph_new() well. So, NULL checking should be
moved to after _layout_paragraph_new().

Test Plan: N/A

Reviewers: jpeg, tasn, raster, herdsman, cedric

Subscribers: zmike, stefan_schmidt, jpeg

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D4300
2018-05-06 12:01:41 +03:00
Youngbok Shin c33ef15d5d evas textblock: fix double free issue from user style push/pop and free
Summary: The Textblock Style which is created for user style was managed
application side.  It is created and free'd from application - outside
of Evas Textblock.  Recently, evas_object_textblock_style_user_push/pop
start to call efl_canvas_text_style_set() instead of legacy code. The
problem is efl_canvas_text_style_set() is always going to call free()
when a style is going to be deleted.  It makes conflicts(double free
issue) with application which is used to call
evas_textblock_style_free().  So, the issue will be fixed by this patch.

The patch also revise push/pop/peek code to make clean and avoid
meaningless calculation/events.

@fix

Test Plan:
A test case is Included in this patch.
The test case try to trigger double free.

Reviewers: herdsman, raster, cedric

Subscribers: zmike, woohyun

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D5812

Committer's note: formatted commit summary (80 width).
2018-05-06 12:01:41 +03:00
Xavi Artigas 6b5ac687c1 Efl.Text_* (from Efl.Text.*)
Including:
Efl.Text.Cursor_* (from Efl.Text.Cursor.Cursor_*)
Efl.Text.Font_* (from Efl.Text.Font.*)
Efl.Text.Format_* (from Efl.Text.Format.*)
Efl.Text.Style_* (from Efl.Text.Style.*)
Efl.Ui.Text_* (from Efl.Ui.Text.*)

Ref https://phab.enlightenment.org/T6847

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-24 09:03:49 -07:00
Xavi Artigas 55bd097a3d Efl.Gfx.Entity (from Efl.Gfx)
Ref https://phab.enlightenment.org/T6847

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-24 09:03:32 -07:00
Daniel Kolesa fcae7cab27 eolian gen: enable constness generation on property getter impls
This changes a lot of things all across the EFL. Previously,
methods tagged @const had both their external prototype and
internal impl generated with const on object, while property
getters only had const on the external API. This is now changed
and it all has const everywhere.

Ref T6859.
2018-04-17 20:31:55 +02:00
WooHyun Jung 3bc65be44d evas textblock: add null check to avoid segfault 2018-04-05 10:55:44 +09:00
Carsten Haitzler 1c74aaa7e9 Revert "cxx: Fix manual code after efl_app change."
This reverts commit 135154303b.

Revert "efl: move signal events from efl.loop to efl.app"
This reverts commit 3dbca39f98.

Revert "efl: add test suite for efl_app"
This reverts commit 3e94be5d73.

Revert "efl: create Efl.App class, the parent of Efl.Loop"
This reverts commit 28fe00b94e.

Go back to before efl.app because I think this should be done with
superclassing here not a parent object. reasons?

1. multiple loops per single thread make no sense. so if multilpe loop
objects they wont be contained in a single app object and then deleted
like this.
2. the app object is not really sharable in this design so it cant be
accessed from other threads
3. it makes it harder to get the main loop or app object (well 2 func
calls one calling the other and more typing. it is longer to type and
more work where it is not necessary, and again it can't work from
other threads unless we go duplicating efl.app per thread and then
what is the point of splittyign out the signal events from efl.loop
then?)

etc.
2018-03-03 13:40:33 +09:00
Mike Blumenkrantz 28fe00b94e efl: create Efl.App class, the parent of Efl.Loop 2018-02-26 14:02:51 -05:00
Mike Blumenkrantz 1e522cc71d Efl.Text.Cursor: cursor -> text_cursor 2018-02-15 13:11:00 -05:00
WooHyun Jung d8aa950a38 evas_object_textblock: add null checks for EAPIs 2018-02-07 14:19:46 +09:00
Daniel Hirt 4a905a22a4 Canvas image: add Efl.Canvas.Text.Factory + use in Ui.Text
This interface has a simple 'create' method to create Efl.Canvas.Object
given a key.
This is used higher-up in Ui.Text in the next commit.

Ui text: add ability to set item factories

Added API to set an item factory object.
This is similar to the previous item providers (that worked with
callbacks).

You instantiate a factory object and set it on the Ui.Text object.
Each factory implements the "create" method from
Efl.Canvas.Text.Item_Factory.

This also includes 3 public factories (Image, Emoticon and Fallback):
  - Image factory: creates images from added entries (key strings)
  - Emoticon factory: creates emoticons by querying the theme
  - Fallback: creates image, then falls back to emoticon

If no factory is set, then the fallback (internal) factory is used.

See the added "Ui.text Item Factory" test in elementary_test for an
example of usage.

@feature
2018-01-18 10:20:28 -08:00
Carsten Haitzler 9bedda14b3 efl loop - rename ecore_main_loop_get to efl_main_loop_get
ecore_main_loop_get() is really a new "eo api" but it's using our old
ecore_* namespace, so move to the new efl namespace.
2018-01-02 16:13:54 +09:00
Amitesh Singh 10103b9b45 efl.gfx: move scale{} from efl.ui.base to efl.gfx 2017-12-04 14:38:39 +09:00
Jean-Philippe Andre 8803040484 evas: Implement scale API in proper EO fashion
This removes the internal function pointer for scale_update. This makes
all relevant classes implement the scale API in EO.

This removes the duplicate function in Efl.Canvas.Object and only uses
the one from Efl.Ui.Base interface.

This *seems* to be working as expected. Fingers crossed!

PS: I don't like the name Efl.Ui.Base. It's an interface for a few
common API's between Gfx, Canvas and UI levels... Maybe scale simply
doesn't belong there.
2017-11-30 10:48:24 +09:00
Pawel Aksiutowicz 63f8071c7d evas: fix typos in canvas/evas_object_textblock
Reviewers: lukasz.stanislawski, stanluk, jpeg

Reviewed By: lukasz.stanislawski

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5456
2017-11-20 12:03:52 +09:00
Daniel Hirt 58ce1d654b Canvas text: change halign/valign to use doubles
There are use cases where you would want to align by a value.

The wordy alignment values are thus removed.
This commit also separates auto-modes (none, normal, locale) for
horizontal alignment to its own API.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:30:00 -08:00
Daniel Hirt 941fe1ffbd Canvas text: adjust bottom padding at edge of text
Now the edges include both the top AND bottom paddings.
Also fixes vertical alignment.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:29:53 -08:00
Daniel Hirt 45d3614345 Canvas text: fix width calculation with style effects
There are multiple places in the code where both the padded item's
width and the maximum style padding (at the edges) are accounted for.
For the sake of making calculations for wrapping/ellipsis we should
only use the maximum style padding.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:29:49 -08:00
Daniel Hirt 0725ff620b Canvas text: update style pad when no format nodes are present
This updates the style pad even if there are no format nodes.
An example of this is having a default style set to the object.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:29:44 -08:00
Daniel Hirt 20ecea1615 Canvas text: fix applying effects
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:29:39 -08:00
Daniel Hirt a80209a59e Canvas text: favor font name parsing over set properties
Since font names can also specify styles like weight, width etc, we
should parse the font name AFTER setting the respective properties to
the font description, so it can override some if required.

This allows, for example, the following operation:

efl_text_font_weight_set(obj, EFL_TEXT_FONT_WEIGHT_NORMAL);
efl_text_font_set(obj, "Sans:Bold");

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-11-10 10:29:27 -08:00
subhransu mohanty b038d7df25 Remove evas internal dependency from the evas_font module
Summary:
dev branch : devs/subhransu/font

The Final goal is to move the evas_font module to ector so that both ector and evas can reuse the code.
make the api simple so that sam eapi can be used by evas_textblock and ector text.

This is the 1st stage to achive that gola, first remove the evas internal dependancy as much as possible before moving to ector library.

Reviewers: jpeg, raster, herdsman, cedric, id213sin

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5419
2017-11-07 11:34:53 +09:00
Youngbok Shin a386597ad9 evas textblock: handle ellipsis when text's height exceed its area by "br"
Summary:
Textblock's ellipsis feature only worked when text's width exceeds its area.
So, it didn't work when text's height exceeds its area by "br" tags.
This patch will do ellipsis when only ellipsis=1.0 is set.
@fix

Test Plan: make check

Reviewers: herdsman, raster, cedric, jpeg, sohyun

Reviewed By: raster

Subscribers: woohyun

Differential Revision: https://phab.enlightenment.org/D5412
2017-11-06 11:29:43 +09:00
Youngbok Shin 9906cd211f evas textblocke: add align=end for putting a text at the opposite side of LTR/RTL
Summary:
There is a requirement for putting text at right side for LTR and at left side for RTL.
It satisfies that reqirement easily.

It also add "start" keywork for "align" tag. "start" will be same with "auto".
Intuitionally, developer will try "align=start" if they once saw "align=end" in elsewhere.
On the other hand, it only add "END" as new enumeration value for efl interface.
@feature

Test Plan: N/A

Reviewers: herdsman, cedric, jpeg, raster

Reviewed By: raster

Subscribers: woohyun

Differential Revision: https://phab.enlightenment.org/D5342
2017-10-26 11:40:44 +09:00
Daniel Hirt e34efbed96 Canvas text: use EINA_UNUSED for unused variables
Nothing special here. No need to for the "(void) eo_obj".
2017-09-28 19:32:02 +03:00
Daniel Hirt 69d0646b33 Efl text: add Efl.Text.Markup interface
Adds basic markup operations for text objects, and implements it in
Efl.Canvas.Text.

Also, this adds the Efl.Text.Markup_Util class.
This utility class allows basic text-markup conversions.

@feature
2017-09-28 19:32:02 +03:00
Youngbok Shin 42ac2136b0 evas textblock: use main font's ascent/descent as minimum value
Summary:
The patch will adjust ascent/descent with considering main font's ascent/descent
as minimum value. Actually, this patch re-apply D5217 with resolving linegap issue
on the _layout_format_ascent_descent_adjust() function.
@fix

Test Plan: Put a text which will load smaller font. And put a text which will load primary font.

Reviewers: raster, cedric, herdsman, jpeg

Differential Revision: https://phab.enlightenment.org/D5227
2017-09-26 14:33:11 +03:00
Daniel Hirt bfa7d2a3b2 Evas textblock: fix ascent/descent calc
This is a follow-up to 4d4401f3a6.
The format line adjustment (e.g. linegap) should calculate the current
item's ascent/descent, and then update c->ascent/c->descent.
Otherwise we accumulate calculations like linegap values

ref D5217
2017-09-26 10:52:38 +03:00
Youngbok Shin 4d4401f3a6 evas textblock: use primary font's size as minimum size of a line
Summary:
Textblock uses ascent, descent from primary font when there is no text.
If a text is set which need other font, Textblock uses ascent, descent from
actually loaded font. If loaded font has smaller size, text cursor and text
looks jerky in elm_entry. At least, primary font's size should be respected
as minimum size of a line for avoiding this issue.
In addition, the patch will allow negative line gap values.
@fix

Test Plan:
Put your hamburger(🍔) in Ecrire. And put an english character.
(Put a text which will load smaller font. And put a text which will load primary font.)

Reviewers: raster, cedric, herdsman, jpeg, woohyun

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D5217
2017-09-26 11:31:31 +09:00
Youngbok Shin 1750410650 evas: Add scale feature for embedded bitmap fonts.
Summary:
When evas selects a strike of embedded bitmap font,
calculate ratio and use it for scaling embedded bitmap.
@feature

Reviewers: jpeg, tasn, woohyun, raster, herdsman

Reviewed By: raster

Subscribers: charlesmilette, Francesco149, cedric

Differential Revision: https://phab.enlightenment.org/D2713
2017-09-26 11:31:31 +09:00
Daniel Hirt b7b5d08929 Canvas text: use eina_value_set and not eina_value_pset
CID 1381327
2017-09-25 12:51:49 +03:00
Jean-Philippe Andre 28b387821d elm: Split off text and content for efl_part
This is VERY tricky.
For legacy, just create an internal class that has both. It's easier
this way. For parts that are handled by Layout directly, we know from
Edje which type to return.

For EO objects we should know from the part name which kind of part we
are dealing with:
 - text (overridden by the widget)
 - content (overridden by the widget)
 - special (new efl_part based functions)
 - generic (handled by Layout)

Note: Efl.Ui.Slider was handling "span size" on ALL parts. That's bad...
This is now limited to "span" only.
2017-09-21 12:27:34 +09:00
Daniel Hirt b63c3620df Canvas text async: add async layout functionality
This adds the 'async_layout' method.
The 'async layout' method is similar to 'size_formatted_get', but done
outside of the mainloop. When a call is made to this method, a thread
is created (after some preparation like updating the logical text
items), and the visual layout is offloaded to that thread. The result
is returned as Eina.Future.

The mainloop is blocked for operations that manipulate the object, if a
thread has already been created but hasn't complete its work.
Consecutive calls for async layout for the same object are not handled
simultaneously. Each time the threads has complete its work, the next
(if exists) layout will be dispatched.

@feature
2017-09-20 14:50:09 +03:00
Jean-Philippe Andre 8fb194d969 efl: Use Eina.Position2D for Efl.Gfx.position
Note: This is a little bit more cumbersome in some places but in most
it's more convenient than (x,y).
2017-09-18 13:22:54 +09:00
Youngbok Shin 8dbbf5c8b7 evas textblock: support ZWJ, ZWNJ, LRM, RLM in escaped form
Summary:
The patch supports the following escaped string from Evas Textblock.
These unicodes are frequently used.
ZWNJ U+200C - &zwnj;
ZWJ  U+200D - &zwj;
LRM  U+200E - &lrm;
RLM  U+200F - &rlm;
@feature

Test Plan: N/A

Reviewers: raster, cedric, herdsman, jpeg, woohyun

Differential Revision: https://phab.enlightenment.org/D5173
2017-09-11 08:53:04 +03:00
Daniel Hirt de3062da89 Canvas text: emit missing events during text changes
Some text changes were not picked up by the Ui.Text widget, so no size
evaluation was triggered.
2017-09-07 16:54:38 +03:00