2016-06-08 08:37:35 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-09-25 01:15:44 -07:00
|
|
|
#define EFL_ACCESS_TEXT_PROTECTED
|
|
|
|
#define EFL_ACCESS_EDITABLE_TEXT_PROTECTED
|
2016-06-08 08:37:35 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2018-11-12 08:57:24 -08:00
|
|
|
#define EFL_PART_PROTECTED
|
2019-07-29 02:42:34 -07:00
|
|
|
#define EFL_INPUT_CLICKABLE_PROTECTED
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include <Elementary_Cursor.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
|
|
|
#include "elm_entry_common.h"
|
|
|
|
#include "elm_widget_entry.h"
|
2020-01-15 23:47:23 -08:00
|
|
|
#include "efl_ui_textbox_part.eo.h"
|
2018-11-12 08:57:24 -08:00
|
|
|
#include "elm_part_helper.h"
|
2019-12-10 00:39:59 -08:00
|
|
|
#include "efl_canvas_textblock_internal.h"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
typedef struct _Efl_Ui_Textbox_Data Efl_Ui_Textbox_Data;
|
2016-06-08 08:37:35 -07:00
|
|
|
typedef struct _Efl_Ui_Text_Rectangle Efl_Ui_Text_Rectangle;
|
2016-06-22 05:12:15 -07:00
|
|
|
typedef struct _Anchor Anchor;
|
2018-09-13 02:45:29 -07:00
|
|
|
typedef struct _Selection_Loss_Data Selection_Loss_Data;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base widget smart data extended with entry instance data.
|
|
|
|
*/
|
2019-12-10 16:47:50 -08:00
|
|
|
struct _Efl_Ui_Textbox_Data
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-06 02:09:04 -08:00
|
|
|
Evas_Object *hit_rect, *entry_edje;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
Eo *popup;
|
|
|
|
Eo *popup_list;
|
2017-01-12 08:01:52 -08:00
|
|
|
Eo *text_obj;
|
2018-11-12 05:09:56 -08:00
|
|
|
Eo *text_guide_obj;
|
|
|
|
Eo *text_table;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *pan;
|
|
|
|
Eo *scroller;
|
|
|
|
Eo *manager;
|
2016-06-08 08:37:35 -07:00
|
|
|
Eo *cursor;
|
|
|
|
Eo *cursor_bidi;
|
|
|
|
Evas_Object *start_handler;
|
|
|
|
Evas_Object *end_handler;
|
2020-01-28 08:36:52 -08:00
|
|
|
Eina_Future *deferred_decoration_job;
|
2016-06-08 08:37:35 -07:00
|
|
|
/* for deferred appending */
|
|
|
|
int append_text_position;
|
|
|
|
int append_text_len;
|
|
|
|
/* Only for clipboard */
|
|
|
|
const char *text;
|
2017-05-23 06:04:04 -07:00
|
|
|
Evas_Coord ent_w, ent_h;
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Coord downx, downy;
|
|
|
|
Evas_Coord ox, oy;
|
2016-06-22 05:12:15 -07:00
|
|
|
Eina_List *anchors;
|
2018-09-13 02:45:29 -07:00
|
|
|
int gen;
|
2016-10-05 07:10:20 -07:00
|
|
|
Eina_List *sel;
|
2019-12-10 00:39:59 -08:00
|
|
|
Efl_Canvas_Textblock_Factory *item_factory;
|
|
|
|
Efl_Canvas_Textblock_Factory *item_fallback_factory;
|
2016-06-08 08:37:35 -07:00
|
|
|
Mod_Api *api; // module api if supplied
|
|
|
|
int cursor_pos;
|
|
|
|
Elm_Scroller_Policy policy_h, policy_v;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_handler_cursor;
|
2016-06-08 08:37:35 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *hover_parent; /**< hover parent object. entry is a hover parent object by default */
|
|
|
|
Evas_Object *pop; /**< hidden icon for hover target */
|
|
|
|
Evas_Object *hover; /**< hover object */
|
|
|
|
const char *hover_style; /**< style of a hover object */
|
|
|
|
} anchor_hover;
|
|
|
|
|
2019-02-07 03:41:51 -08:00
|
|
|
Efl_Ui_Selection_Format cnp_mode;
|
2016-06-08 08:37:35 -07:00
|
|
|
Elm_Sel_Format drop_format;
|
|
|
|
|
2017-09-11 22:38:51 -07:00
|
|
|
struct {
|
|
|
|
char *text;
|
|
|
|
Eina_Bool enabled;
|
|
|
|
} async;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
struct {
|
|
|
|
Eina_Size2D scroll;
|
|
|
|
Eina_Size2D layout;
|
|
|
|
} last;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Eina_Future *primary;
|
|
|
|
Eina_Future *clipboard;
|
|
|
|
} sel_future;
|
2020-01-08 20:44:50 -08:00
|
|
|
Eina_Bool sel_handles_enabled : 1;
|
2016-06-08 08:37:35 -07:00
|
|
|
Eina_Bool start_handler_down : 1;
|
|
|
|
Eina_Bool start_handler_shown : 1;
|
|
|
|
Eina_Bool end_handler_down : 1;
|
|
|
|
Eina_Bool end_handler_shown : 1;
|
2016-06-22 10:02:32 -07:00
|
|
|
Eina_Bool deferred_decoration_selection : 1;
|
|
|
|
Eina_Bool deferred_decoration_cursor : 1;
|
|
|
|
Eina_Bool deferred_decoration_anchor : 1;
|
2019-12-20 05:04:18 -08:00
|
|
|
Eina_Bool context_menu_enabled : 1;
|
2016-06-08 08:37:35 -07:00
|
|
|
Eina_Bool long_pressed : 1;
|
|
|
|
Eina_Bool has_text : 1;
|
|
|
|
Eina_Bool use_down : 1;
|
|
|
|
Eina_Bool sel_mode : 1;
|
|
|
|
Eina_Bool changed : 1;
|
|
|
|
Eina_Bool scroll : 1;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Bool text_changed : 1;
|
|
|
|
Eina_Bool calc_force : 1;
|
|
|
|
Eina_Bool cursor_update : 1;
|
2016-06-22 05:12:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Anchor
|
|
|
|
{
|
|
|
|
Eo *obj;
|
|
|
|
char *name;
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Attribute_Handle *annotation;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_List *rects;
|
|
|
|
int gen;
|
2016-06-22 05:12:15 -07:00
|
|
|
Eina_Bool item : 1;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Bool updated : 1;
|
2016-06-08 08:37:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define EFL_UI_TEXT_DATA_GET(o, sd) \
|
2019-12-10 16:47:50 -08:00
|
|
|
Efl_Ui_Textbox_Data * sd = efl_data_scope_get(o, EFL_UI_TEXTBOX_CLASS)
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
#define EFL_UI_TEXT_DATA_GET_OR_RETURN(o, ptr) \
|
|
|
|
EFL_UI_TEXT_DATA_GET(o, ptr); \
|
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
|
|
|
{ \
|
2018-01-31 19:16:28 -08:00
|
|
|
ERR("No widget data for object %p (%s)", \
|
2020-01-28 08:54:32 -08:00
|
|
|
o, efl_class_name_get(o)); \
|
2016-06-08 08:37:35 -07:00
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EFL_UI_TEXT_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
|
|
|
|
EFL_UI_TEXT_DATA_GET(o, ptr); \
|
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
|
|
|
{ \
|
2018-01-31 19:16:28 -08:00
|
|
|
ERR("No widget data for object %p (%s)", \
|
2020-01-28 08:54:32 -08:00
|
|
|
o, efl_class_name_get(o)); \
|
2016-06-08 08:37:35 -07:00
|
|
|
return val; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EFL_UI_TEXT_CHECK(obj) \
|
2019-12-10 16:47:50 -08:00
|
|
|
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_TEXTBOX_CLASS))) \
|
2016-06-08 08:37:35 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
struct _Efl_Ui_Text_Rectangle
|
|
|
|
{
|
2016-10-05 07:10:20 -07:00
|
|
|
Evas_Object *obj_bg, *obj_fg, *obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
};
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
struct _Selection_Loss_Data
|
|
|
|
{
|
|
|
|
Eo *obj;
|
2018-12-21 13:46:06 -08:00
|
|
|
Efl_Ui_Selection_Type stype;
|
2018-09-13 02:45:29 -07:00
|
|
|
};
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
#define MY_CLASS EFL_UI_TEXTBOX_CLASS
|
|
|
|
#define MY_CLASS_PFX efl_ui_textbox
|
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Textbox"
|
2016-07-12 02:03:54 -07:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_entry"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
#include "efl_ui_internal_text_interactive.h"
|
2018-11-05 13:55:20 -08:00
|
|
|
#include "efl_ui_internal_text_scroller.h"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
/* Maximum chunk size to be inserted to the entry at once
|
|
|
|
* FIXME: This size is arbitrary, should probably choose a better size.
|
|
|
|
* Possibly also find a way to set it to a low value for weak computers,
|
|
|
|
* and to a big value for better computers. */
|
|
|
|
#define EFL_UI_TEXT_CHUNK_SIZE 10000
|
|
|
|
#define EFL_UI_TEXT_DELAY_WRITE_TIME 2.0
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
#define ENTRY_PASSWORD_MASK_CHARACTER 0x002A
|
|
|
|
#define ENTRY_PASSWORD_MASK_CHARACTER_UTF8 "\x2A"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
static Eina_List *entries = NULL;
|
|
|
|
|
|
|
|
struct _Mod_Api
|
|
|
|
{
|
|
|
|
void (*obj_hook)(Evas_Object *obj);
|
|
|
|
void (*obj_unhook)(Evas_Object *obj);
|
|
|
|
void (*obj_longpress)(Evas_Object *obj);
|
|
|
|
};
|
|
|
|
|
2017-11-14 03:38:49 -08:00
|
|
|
static const char PART_NAME_HANDLER_START[] = "handler/start";
|
|
|
|
static const char PART_NAME_HANDLER_END[] = "handler/end";
|
|
|
|
static const char PART_NAME_CURSOR[] = "cursor";
|
|
|
|
static const char PART_NAME_SELECTION[] = "selection";
|
|
|
|
static const char PART_NAME_ANCHOR[] = "anchor";
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
static void _create_selection_handlers(Evas_Object *obj, Efl_Ui_Textbox_Data *sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
static void _update_decorations(Eo *obj);
|
2019-12-10 16:47:50 -08:00
|
|
|
static void _create_text_cursors(Eo *obj, Efl_Ui_Textbox_Data *sd);
|
|
|
|
static void _efl_ui_textbox_changed_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _efl_ui_textbox_changed_user_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _efl_ui_textbox_selection_start_clear_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _efl_ui_textbox_selection_changed_cb(void *data, const Efl_Event *event);
|
|
|
|
static void _efl_ui_textbox_cursor_changed_cb(void *data, const Efl_Event *event);
|
2018-09-13 02:45:29 -07:00
|
|
|
static void _text_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
|
|
|
|
static void _scroller_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
|
|
|
|
static void _text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
|
2020-01-28 08:54:32 -08:00
|
|
|
static void _efl_ui_textbox_move_cb(void *data, const Efl_Event *event EINA_UNUSED);
|
2019-12-10 16:47:50 -08:00
|
|
|
static const char* _efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd);
|
|
|
|
static void _edje_signal_emit(Efl_Ui_Textbox_Data *obj, const char *sig, const char *src);
|
2016-07-10 07:30:51 -07:00
|
|
|
static void _decoration_defer_all(Eo *obj);
|
2019-12-10 16:47:50 -08:00
|
|
|
static inline Eo * _decoration_create(Eo *obj, Efl_Ui_Textbox_Data *sd, const char *source, Eina_Bool above);
|
2016-10-05 07:10:20 -07:00
|
|
|
static void _decoration_defer(Eo *obj);
|
2019-12-10 16:47:50 -08:00
|
|
|
static void _clear_text_selection(Efl_Ui_Textbox_Data *sd);
|
|
|
|
static void _anchors_free(Efl_Ui_Textbox_Data *sd);
|
|
|
|
static void _selection_defer(Eo *obj, Efl_Ui_Textbox_Data *sd);
|
|
|
|
static Eina_Position2D _decoration_calc_offset(Efl_Ui_Textbox_Data *sd);
|
|
|
|
static void _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd);
|
2020-01-13 03:50:37 -08:00
|
|
|
static void _efl_ui_textbox_selection_paste_type(Eo *obj, Efl_Ui_Selection_Type type);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
static Eina_Bool _key_action_copy(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_paste(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_cut(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_menu(Evas_Object *obj, const char *params);
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"copy", _key_action_copy},
|
|
|
|
{"paste", _key_action_paste},
|
|
|
|
{"cut", _key_action_cut},
|
|
|
|
{"menu", _key_action_menu},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_guide_update(Evas_Object *obj,
|
2016-06-08 08:37:35 -07:00
|
|
|
Eina_Bool has_text)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((has_text) && (!sd->has_text))
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,guide,disabled", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
else if ((!has_text) && (sd->has_text))
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,guide,enabled", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
sd->has_text = has_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_ui_mirrored_set(sd->entry_edje, rtl);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (sd->anchor_hover.hover)
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(sd->anchor_hover.hover, rtl);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_hide_selection_handler(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->start_handler) return;
|
|
|
|
|
|
|
|
if (sd->start_handler_shown)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->start_handler, "efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->end_handler_shown)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->end_handler, "efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
static Eina_Rect
|
2016-06-08 08:37:35 -07:00
|
|
|
_viewport_region_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Rect rect;
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Object *parent;
|
|
|
|
|
|
|
|
if (sd->scroll)
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
rect = efl_ui_scrollable_viewport_geometry_get(sd->scroller);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
else
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
rect = efl_gfx_entity_geometry_get(sd->text_obj);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
parent = efl_ui_widget_parent_get(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
while (parent)
|
|
|
|
{
|
2020-01-02 02:00:35 -08:00
|
|
|
if (efl_isa(parent, EFL_UI_SCROLLABLE_INTERFACE))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect r = efl_gfx_entity_geometry_get(parent);
|
|
|
|
if (!eina_rectangle_intersection(&rect.rect, &r.rect))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
rect = EINA_RECT_EMPTY();
|
2016-06-08 08:37:35 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-12-29 17:31:32 -08:00
|
|
|
parent = efl_ui_widget_parent_get(parent);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-07-10 09:52:14 -07:00
|
|
|
_update_selection_handler(Eo *obj)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
Evas_Coord sx, sy, sh;
|
|
|
|
Evas_Coord ex, ey, eh;
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_interactive_have_selection_get(obj))
|
2016-11-28 23:30:36 -08:00
|
|
|
{
|
|
|
|
_hide_selection_handler(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-08 20:44:50 -08:00
|
|
|
if (sd->sel_handles_enabled)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Rect rect;
|
|
|
|
Eina_Position2D off;
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Coord hx, hy;
|
|
|
|
Eina_Bool hidden = EINA_FALSE;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
|
|
|
Eina_Rect rc_tmp;
|
2016-07-10 09:52:14 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (!sd->start_handler)
|
2017-11-14 03:38:49 -08:00
|
|
|
_create_selection_handlers(obj, sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
//evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL);
|
2016-07-10 09:52:14 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
rc_tmp = efl_text_cursor_geometry_get(sel_start, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
sx = rc_tmp.x;
|
|
|
|
sy = rc_tmp.y;
|
|
|
|
sh = rc_tmp.h;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
off = _decoration_calc_offset(sd);
|
|
|
|
hx = off.x + sx;
|
|
|
|
hy = off.y + sy + sh;
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_position_set(sd->start_handler, EINA_POSITION2D(hx, hy));
|
2016-07-10 09:52:14 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
rect = _viewport_region_get(obj);
|
|
|
|
|
|
|
|
if (!eina_rectangle_xcoord_inside(&rect.rect, hx) ||
|
|
|
|
!eina_rectangle_ycoord_inside(&rect.rect, hy))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
hidden = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (!sd->start_handler_shown && !hidden)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->start_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,show", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->start_handler_shown = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (sd->start_handler_shown && hidden)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->start_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
hidden = EINA_FALSE;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
rc_tmp = efl_text_cursor_geometry_get(sel_end, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ex = rc_tmp.x;
|
|
|
|
ey = rc_tmp.y;
|
|
|
|
eh = rc_tmp.h;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
hx = off.x + ex;
|
|
|
|
hy = off.y + ey + eh;
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_position_set(sd->end_handler, EINA_POSITION2D(hx, hy));
|
2016-07-10 09:52:14 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
if (!eina_rectangle_xcoord_inside(&rect.rect, hx) ||
|
|
|
|
!eina_rectangle_ycoord_inside(&rect.rect, hy))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
hidden = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (!sd->end_handler_shown && !hidden)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->end_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,show", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->end_handler_shown = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (sd->end_handler_shown && hidden)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->end_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->start_handler_shown)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->start_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->end_handler_shown)
|
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->end_handler,
|
2018-04-26 04:24:09 -07:00
|
|
|
"efl,handler,hide", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-09-13 02:45:29 -07:00
|
|
|
_selection_data_cb(void *data EINA_UNUSED, Eo *obj,
|
2018-12-21 13:46:06 -08:00
|
|
|
Efl_Ui_Selection_Data *sel_data)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *cur, *start, *end;
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
char *buf = eina_slice_strdup(sel_data->content);
|
2019-02-07 03:42:00 -08:00
|
|
|
size_t len = sel_data->content.len;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(obj, &start, &end);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
if (!efl_text_cursor_equal(start, end))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_range_delete(start, end);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_text_interactive_all_unselect(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
cur = efl_text_interactive_main_cursor_get(obj);
|
2020-02-03 01:57:57 -08:00
|
|
|
info.type = EFL_TEXT_CHANGE_TYPE_INSERT;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
info.position = efl_text_cursor_position_get(cur);
|
2019-02-07 03:42:00 -08:00
|
|
|
info.length = len;
|
|
|
|
info.content = buf;
|
2018-12-21 13:46:06 -08:00
|
|
|
if (sel_data->format == EFL_UI_SELECTION_FORMAT_MARKUP)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_markup_insert(cur, buf);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
else // TEXT
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_text_insert(cur, buf);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
|
2016-06-08 08:37:35 -07:00
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_dnd_enter_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj)
|
|
|
|
{
|
2020-01-08 20:57:04 -08:00
|
|
|
efl_ui_focus_util_focus(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_dnd_leave_cb(void *data EINA_UNUSED,
|
2020-01-09 06:17:28 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_dnd_pos_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj,
|
|
|
|
Evas_Coord x,
|
|
|
|
Evas_Coord y,
|
|
|
|
Elm_Xdnd_Action action EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int pos;
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect o, e;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
o = efl_gfx_entity_geometry_get(obj);
|
|
|
|
e = efl_gfx_entity_geometry_get(sd->entry_edje);
|
|
|
|
x = x + o.x - e.x;
|
|
|
|
y = y + o.y - e.y;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
edje_object_part_text_cursor_coord_set
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", EDJE_CURSOR_USER, x, y);
|
2016-06-08 08:37:35 -07:00
|
|
|
pos = edje_object_part_text_cursor_pos_get
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", EDJE_CURSOR_USER);
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "efl.text",
|
2016-06-08 08:37:35 -07:00
|
|
|
EDJE_CURSOR_MAIN, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_dnd_drop_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj,
|
|
|
|
Elm_Selection_Data *drop)
|
|
|
|
{
|
|
|
|
Eina_Bool rv;
|
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
rv = edje_object_part_text_cursor_coord_set
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", EDJE_CURSOR_MAIN, drop->x, drop->y);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (!rv) WRN("Warning: Failed to position cursor: paste anyway");
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
//rv = _selection_data_cb(NULL, obj, drop);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Sel_Format
|
|
|
|
_get_drop_format(Evas_Object *obj)
|
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_editable_get(obj) && (efl_text_multiline_get(obj)) && (!efl_text_password_get(obj)) && (!efl_ui_widget_disabled_get(obj)))
|
2019-02-07 09:59:41 -08:00
|
|
|
return EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE;
|
2018-12-21 13:46:06 -08:00
|
|
|
return EFL_UI_SELECTION_FORMAT_MARKUP;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we can't reuse layout's here, because it's on entry_edje only */
|
2019-02-27 11:00:14 -08:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool disabled)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-02-27 11:00:14 -08:00
|
|
|
const char *emission;
|
|
|
|
|
2020-01-16 03:55:59 -08:00
|
|
|
if (efl_ui_widget_disabled_get(obj) == disabled)
|
|
|
|
return;
|
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
|
2017-08-23 22:06:32 -07:00
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2017-08-23 22:06:32 -07:00
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
emission = efl_ui_widget_disabled_get(obj) ? "efl,state,disabled" : "efl,state,enabled";
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, emission, "efl");
|
2017-08-23 22:06:32 -07:00
|
|
|
if (sd->scroll)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-12 08:31:05 -08:00
|
|
|
efl_ui_scrollable_scroll_freeze_set(obj, efl_ui_widget_disabled_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
2017-08-23 22:06:32 -07:00
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
if (!efl_ui_widget_disabled_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
|
|
|
}
|
2019-08-05 10:03:21 -07:00
|
|
|
_update_text_theme(obj, sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we can't issue the layout's theming code here, cause it assumes an
|
|
|
|
* unique edje object, always */
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error theme_apply;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
2020-01-16 03:55:59 -08:00
|
|
|
theme_apply = efl_ui_widget_theme_apply(efl_super(obj,MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (theme_apply == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-16 03:55:59 -08:00
|
|
|
_update_text_theme(obj, sd);
|
|
|
|
|
2017-09-11 22:38:51 -07:00
|
|
|
efl_event_freeze(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
edje_object_mirrored_set
|
2017-06-13 03:41:15 -07:00
|
|
|
(wd->resize_obj, efl_ui_mirrored_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_gfx_entity_scale_set
|
2016-06-08 08:37:35 -07:00
|
|
|
(wd->resize_obj,
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-11-14 03:38:49 -08:00
|
|
|
elm_widget_element_update(obj, sd->entry_edje,
|
2017-12-06 00:33:03 -08:00
|
|
|
elm_widget_theme_element_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
// elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set
|
|
|
|
// -> smart_objects_calculate will call all smart calculate functions,
|
|
|
|
// and one of them can delete elm_entry.
|
2020-01-12 08:31:05 -08:00
|
|
|
efl_ref(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,action,focus", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_process(sd->entry_edje, EINA_FALSE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
Evas_Object* clip = efl_canvas_object_clipper_get(sd->entry_edje);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_canvas_object_clipper_set(sd->hit_rect, clip);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (sd->start_handler)
|
|
|
|
{
|
2017-11-14 03:38:49 -08:00
|
|
|
elm_widget_element_update(obj, sd->start_handler, PART_NAME_HANDLER_START);
|
|
|
|
elm_widget_element_update(obj, sd->end_handler, PART_NAME_HANDLER_END);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
sd->has_text = !sd->has_text;
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_guide_update(obj, !sd->has_text);
|
2017-09-11 22:38:51 -07:00
|
|
|
efl_event_thaw(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-12 08:31:05 -08:00
|
|
|
efl_unref(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-16 03:55:59 -08:00
|
|
|
if (efl_content_get(efl_part(sd->entry_edje, "efl.text")) == NULL && !sd->scroller)
|
|
|
|
{
|
|
|
|
efl_pack_table(sd->text_table, sd->text_obj, 0, 0, 1, 1);
|
|
|
|
efl_pack_table(sd->text_table, sd->text_guide_obj, 0, 0, 1, 1);
|
|
|
|
efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
_create_text_cursors(obj, sd);
|
|
|
|
|
2017-08-02 05:15:50 -07:00
|
|
|
return theme_apply;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cursor_geometry_recalc(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2016-07-10 07:30:51 -07:00
|
|
|
Evas_Coord cx, cy, cw, ch;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Eina_Rect rc;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_interactive_editable_get(obj)) return;
|
2017-09-11 22:38:51 -07:00
|
|
|
|
2017-06-07 22:10:19 -07:00
|
|
|
cx = cy = cw = ch = 0;
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *main_cur =
|
|
|
|
efl_text_interactive_main_cursor_get(obj);
|
|
|
|
|
|
|
|
rc = efl_text_cursor_geometry_get(main_cur, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
cx = rc.x;
|
|
|
|
cy = rc.y;
|
|
|
|
cw = rc.w;
|
|
|
|
ch = rc.h;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-07-10 07:30:51 -07:00
|
|
|
edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0);
|
|
|
|
if (cw < 1) cw = 1;
|
|
|
|
if (ch < 1) ch = 1;
|
|
|
|
edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0);
|
2018-11-12 05:09:56 -08:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_ui_scrollable_scroll(sd->scroller, EINA_RECT(cx, cy, cw, ch), EINA_FALSE);
|
|
|
|
|
2016-07-03 09:38:03 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
#define SIZE2D_EQ(X, Y) (((X).w == (Y).w) && ((X).h == (Y).h))
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Size2D min = EINA_SIZE2D(0, 0);
|
|
|
|
Eina_Size2D edmin = EINA_SIZE2D(0, 0);
|
|
|
|
Eina_Size2D sz = EINA_SIZE2D(0, 0);
|
2019-07-30 10:11:48 -07:00
|
|
|
|
|
|
|
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
2018-09-13 02:45:29 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2016-11-28 03:22:40 -08:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sz = efl_gfx_entity_size_get(obj);
|
|
|
|
if (!sd->calc_force && SIZE2D_EQ(sd->last.layout, sz) &&
|
|
|
|
!sd->text_changed)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2016-11-28 03:22:40 -08:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->calc_force = EINA_FALSE;
|
|
|
|
sd->last.layout.w = sz.w;
|
|
|
|
sd->last.layout.h = sz.h;
|
|
|
|
sd->text_changed = EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-11-28 03:22:40 -08:00
|
|
|
if (sd->scroll)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_calculate(sd->scroller);
|
2019-02-21 09:19:45 -08:00
|
|
|
min = efl_gfx_hint_size_min_get(sd->scroller);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_multiline_get(obj))
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
edje_object_size_min_calc(wd->resize_obj, &edmin.w, &edmin.h);
|
|
|
|
min.w = edmin.w;
|
|
|
|
min.h = edmin.h;
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_size_restricted_min_set(obj, min);
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
2017-05-23 06:04:04 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->cursor_update = EINA_TRUE;
|
|
|
|
_decoration_defer_all(obj);
|
2017-09-11 22:38:51 -07:00
|
|
|
}
|
|
|
|
else
|
2017-09-09 03:21:06 -07:00
|
|
|
{
|
2019-08-16 12:12:25 -07:00
|
|
|
Eina_Size2D text_sz = efl_gfx_entity_size_get(sd->text_obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &edmin.w, &edmin.h);
|
2019-08-16 12:12:25 -07:00
|
|
|
efl_event_freeze(sd->text_obj);
|
|
|
|
efl_gfx_entity_size_set(sd->text_obj, EINA_SIZE2D(sz.w, 0));
|
|
|
|
/* ignore current object size for single-line since we always need to know the actual size */
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_multiline_get(obj))
|
2019-12-10 00:39:59 -08:00
|
|
|
min = efl_canvas_textblock_size_native_get(sd->text_obj);
|
2019-08-16 12:12:25 -07:00
|
|
|
else
|
2019-12-10 00:39:59 -08:00
|
|
|
min = efl_canvas_textblock_size_formatted_get(sd->text_obj);
|
2019-08-16 12:12:25 -07:00
|
|
|
efl_gfx_entity_size_set(sd->text_obj, text_sz);
|
|
|
|
efl_event_thaw(sd->text_obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
min.w += edmin.w;
|
|
|
|
min.h += edmin.h;
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_size_restricted_min_set(obj, min);
|
2017-09-09 03:21:06 -07:00
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-19 23:55:31 -08:00
|
|
|
Efl_Object *top;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_interactive_editable_get(obj)) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-30 07:36:02 -08:00
|
|
|
top = efl_provider_find(obj, EFL_UI_WIN_CLASS);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-08 20:57:04 -08:00
|
|
|
efl_canvas_object_key_focus_set(sd->text_obj, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
_edje_signal_emit(sd, "efl,action,focus", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-19 23:55:31 -08:00
|
|
|
if (efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
|
|
|
|
if (_elm_config->atspi_mode)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-12 05:09:56 -08:00
|
|
|
Eo *sw = sd->text_obj;
|
2016-07-10 07:30:51 -07:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
_edje_signal_emit(sd, "efl,action,unfocus", "efl");
|
2020-01-08 20:57:04 -08:00
|
|
|
efl_canvas_object_key_focus_set(sw, EINA_FALSE);
|
2016-07-10 07:30:51 -07:00
|
|
|
|
2020-01-19 23:55:31 -08:00
|
|
|
if (efl_input_text_input_panel_autoshow_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
|
|
|
|
if (_elm_config->atspi_mode)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_FALSE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (_elm_config->selection_clear_enable)
|
|
|
|
{
|
2020-01-14 08:29:50 -08:00
|
|
|
if ((efl_text_interactive_have_selection_get(obj)) && (!sd->popup))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
sd->sel_mode = EINA_FALSE;
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_ui_widget_scroll_hold_pop(obj);
|
2018-04-26 03:27:43 -07:00
|
|
|
edje_object_part_text_select_allow_set(sd->entry_edje, "efl.text", EINA_FALSE);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
|
2018-04-26 03:27:43 -07:00
|
|
|
edje_object_part_text_select_none(sd->entry_edje, "efl.text");
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_ui_widget_interest_region_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect edje, elm;
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r = {};
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
r = efl_text_cursor_geometry_get(
|
|
|
|
efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_multiline_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect rr = efl_gfx_entity_geometry_get(sd->entry_edje);
|
|
|
|
r.h = rr.h;
|
2017-08-29 19:29:08 -07:00
|
|
|
r.y = 0;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
edje = efl_gfx_entity_geometry_get(sd->entry_edje);
|
|
|
|
elm = efl_gfx_entity_geometry_get(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
r.x += edje.x - elm.x;
|
|
|
|
r.y += edje.y - elm.y;
|
2017-08-29 19:29:08 -07:00
|
|
|
if (r.w < 1) r.w = 1;
|
|
|
|
if (r.h < 1) r.h = 1;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-08-29 19:29:08 -07:00
|
|
|
return r;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_position(Evas_Object *obj)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect r;
|
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
Eina_Size2D m;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
cx = cy = 0;
|
|
|
|
cw = ch = 1;
|
2020-01-28 08:54:32 -08:00
|
|
|
r = efl_gfx_entity_geometry_get(sd->entry_edje);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (sd->use_down)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
cx = sd->downx - r.x;
|
|
|
|
cy = sd->downy - r.y;
|
2016-06-08 08:37:35 -07:00
|
|
|
cw = 1;
|
|
|
|
ch = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
edje_object_part_text_cursor_geometry_get
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", &cx, &cy, &cw, &ch);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
m = efl_gfx_hint_size_restricted_min_get(sd->popup);
|
|
|
|
if (cx + m.w > r.w)
|
|
|
|
cx = r.w - m.w;
|
|
|
|
if (cy + m.h > r.h)
|
|
|
|
cy = r.h - m.h;
|
|
|
|
efl_gfx_entity_geometry_set(sd->popup, EINA_RECT(r.x + cx, r.y + cy, m.w, m.h));
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Value
|
|
|
|
_selection_lost_cb(void *data, const Eina_Value value)
|
|
|
|
{
|
|
|
|
Selection_Loss_Data *sdata = data;
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
EFL_UI_TEXT_DATA_GET(sdata->obj, sd);
|
|
|
|
|
|
|
|
efl_text_interactive_all_unselect(sdata->obj);
|
|
|
|
_selection_defer(sdata->obj, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
switch (sdata->stype)
|
|
|
|
{
|
2018-12-21 13:46:06 -08:00
|
|
|
case EFL_UI_SELECTION_TYPE_CLIPBOARD:
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->sel_future.clipboard = NULL;
|
|
|
|
break;
|
2018-12-21 13:46:06 -08:00
|
|
|
case EFL_UI_SELECTION_TYPE_PRIMARY:
|
2018-09-13 02:45:29 -07:00
|
|
|
default:
|
|
|
|
sd->sel_future.primary = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-12-21 13:46:06 -08:00
|
|
|
_selection_store(Efl_Ui_Selection_Type seltype,
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Object *obj)
|
|
|
|
{
|
|
|
|
char *sel;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *start, *end;
|
2018-12-21 13:46:06 -08:00
|
|
|
Efl_Ui_Selection_Format selformat = EFL_UI_SELECTION_FORMAT_MARKUP;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Slice slice;
|
|
|
|
Selection_Loss_Data *ldata;
|
|
|
|
Eina_Future *f;
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(obj, &start, &end);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
sel = efl_text_cursor_range_markup_get(start, end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
slice.len = strlen(sel);
|
|
|
|
slice.mem = sel;
|
|
|
|
|
|
|
|
switch (seltype)
|
|
|
|
{
|
2018-12-21 13:46:06 -08:00
|
|
|
case EFL_UI_SELECTION_TYPE_CLIPBOARD:
|
2018-09-13 02:45:29 -07:00
|
|
|
if (sd->sel_future.clipboard)
|
|
|
|
{
|
|
|
|
eina_future_cancel(sd->sel_future.clipboard);
|
|
|
|
}
|
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
f = sd->sel_future.clipboard = efl_ui_selection_set(obj, seltype,
|
2018-09-13 02:45:29 -07:00
|
|
|
selformat, slice, 1);
|
|
|
|
break;
|
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
case EFL_UI_SELECTION_TYPE_PRIMARY:
|
2018-09-13 02:45:29 -07:00
|
|
|
default:
|
|
|
|
if (sd->sel_future.primary)
|
|
|
|
{
|
|
|
|
eina_future_cancel(sd->sel_future.primary);
|
|
|
|
}
|
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
f = sd->sel_future.primary = efl_ui_selection_set(obj, seltype,
|
2018-09-13 02:45:29 -07:00
|
|
|
selformat, slice, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-03-15 09:14:05 -07:00
|
|
|
ldata = calloc(1, sizeof(Selection_Loss_Data));
|
|
|
|
if (!ldata) goto end;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
ldata->obj = obj;
|
|
|
|
eina_future_then_easy(f, _selection_lost_cb, NULL, NULL, EINA_VALUE_TYPE_UINT, ldata);
|
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
//if (seltype == EFL_UI_SELECTION_TYPE_CLIPBOARD)
|
2018-09-13 02:45:29 -07:00
|
|
|
// eina_stringshare_replace(&sd->cut_sel, sel);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-03-15 09:14:05 -07:00
|
|
|
end:
|
2016-06-08 08:37:35 -07:00
|
|
|
free(sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_dismiss( Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-14 08:29:50 -08:00
|
|
|
efl_del(sd->popup_list);
|
|
|
|
efl_del(sd->popup);
|
|
|
|
sd->popup = NULL;
|
|
|
|
sd->popup_list = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_backwall_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
_popup_dismiss(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_popup_item_cut_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_ui_textbox_selection_cut(data);
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_dismiss(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_item_copy_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-14 08:29:50 -08:00
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_ui_textbox_selection_copy(data);
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_dismiss(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_item_cancel_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
if (!efl_text_interactive_selection_allowed_get(data)) return;
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_ui_widget_scroll_hold_pop(data);
|
2020-01-14 08:29:50 -08:00
|
|
|
|
|
|
|
sd->sel_mode = EINA_FALSE;
|
|
|
|
efl_text_interactive_all_unselect(data);
|
|
|
|
_popup_dismiss(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_item_paste_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-14 08:29:50 -08:00
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
efl_ui_textbox_selection_paste(data);
|
|
|
|
_popup_dismiss(sd);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
static void
|
|
|
|
_menu_call(Evas_Object *obj)
|
|
|
|
{
|
2016-06-08 08:37:35 -07:00
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->anchor_hover.hover) return;
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_CONTEXT_OPEN, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if ((sd->api) && (sd->api->obj_longpress))
|
|
|
|
{
|
|
|
|
sd->api->obj_longpress(obj);
|
|
|
|
}
|
2019-12-20 05:04:18 -08:00
|
|
|
else if (sd->context_menu_enabled)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Eina_Bool ownersel;
|
|
|
|
|
|
|
|
ownersel = elm_selection_selection_has_owner(obj);
|
2020-01-06 02:09:04 -08:00
|
|
|
/* prevent stupid blank hoversel */
|
|
|
|
if (efl_text_interactive_have_selection_get(obj) && efl_text_password_get(obj)) return;
|
|
|
|
if (_elm_config->desktop_entry && (!efl_text_interactive_have_selection_get(obj)) && ((!efl_text_interactive_editable_get(obj)) || (!ownersel)))
|
|
|
|
return;
|
2020-01-14 08:29:50 -08:00
|
|
|
if (sd->popup) _popup_dismiss(sd);
|
2019-12-29 17:31:32 -08:00
|
|
|
else efl_ui_widget_scroll_freeze_push(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
sd->popup = efl_add(EFL_UI_POPUP_CLASS, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
sd->popup_list = efl_add(EFL_UI_LIST_CLASS, sd->popup);
|
|
|
|
efl_content_set(sd->popup, sd->popup_list);
|
|
|
|
efl_gfx_hint_align_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
efl_ui_widget_sub_object_add(obj, sd->popup);
|
|
|
|
efl_ui_popup_anchor_set(sd->popup, obj);
|
|
|
|
efl_event_callback_add(sd->popup, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, _backwall_clicked, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_have_selection_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!efl_text_password_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_editable_get(obj))
|
2020-01-14 08:29:50 -08:00
|
|
|
{
|
|
|
|
Eo *il = NULL;
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Cut"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cut_cb, obj);
|
|
|
|
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Copy"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_copy_cb, obj);
|
|
|
|
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Paste"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_paste_cb, obj);
|
|
|
|
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Cancel"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cancel_cb, obj);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!sd->sel_mode)
|
|
|
|
{
|
|
|
|
if (ownersel)
|
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_editable_get(obj))
|
2020-01-14 08:29:50 -08:00
|
|
|
{
|
|
|
|
Eo *il = NULL;
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Paste"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_paste_cb, obj);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-01-14 08:29:50 -08:00
|
|
|
{
|
|
|
|
Eo *il = NULL;
|
|
|
|
il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list);
|
|
|
|
efl_text_set(il, E_("Cancel"));
|
|
|
|
efl_gfx_hint_align_set(il, 1.0, 1.0);
|
|
|
|
efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0);
|
|
|
|
efl_pack_end(sd->popup_list, il);
|
|
|
|
efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cancel_cb, obj);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
if (sd->popup)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_position(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 12:50:47 -07:00
|
|
|
static void
|
|
|
|
_long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
/* Context menu will not appear if context menu disabled is set
|
|
|
|
* as false on a long press callback */
|
|
|
|
if (!_elm_config->context_menu_disabled &&
|
|
|
|
(!_elm_config->desktop_entry))
|
|
|
|
_menu_call(data);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->long_pressed = EINA_TRUE;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_copy(Evas_Object *obj, const char *params EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-02-02 06:07:45 -08:00
|
|
|
efl_ui_textbox_selection_copy(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_cut(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
efl_ui_textbox_selection_cut(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_paste(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
efl_ui_textbox_selection_paste(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_menu(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eina_Bool b_ret = EINA_FALSE;
|
|
|
|
if (!_elm_config->context_menu_disabled)
|
|
|
|
{
|
|
|
|
_menu_call(obj);
|
|
|
|
b_ret = EINA_TRUE;
|
|
|
|
}
|
|
|
|
return b_ret;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_mouse_down_cb(void *data, const Efl_Event *event)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Efl_Input_Pointer_Data *ev;
|
|
|
|
ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
|
2016-06-08 08:37:35 -07:00
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_ui_widget_disabled_get(data)) return;
|
2016-06-08 08:37:35 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
2020-01-28 08:54:32 -08:00
|
|
|
sd->downx = ev->cur.x;
|
|
|
|
sd->downy = ev->cur.y;
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->long_pressed = EINA_FALSE;
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
|
|
|
|
if (ev->button == 2)
|
|
|
|
{
|
2020-01-13 03:50:37 -08:00
|
|
|
_efl_ui_textbox_selection_paste_type(data, EFL_UI_SELECTION_TYPE_PRIMARY);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
/* If right button is pressed and context menu disabled is true,
|
|
|
|
* then only context menu will appear */
|
2019-05-14 12:50:47 -07:00
|
|
|
if (ev->button == 3 && (!_elm_config->context_menu_disabled))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (_elm_config->desktop_entry)
|
|
|
|
{
|
|
|
|
sd->use_down = 1;
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_mouse_up_cb(void *data, const Efl_Event *event)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Efl_Input_Pointer_Data *ev;
|
|
|
|
ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
|
2020-01-19 23:55:31 -08:00
|
|
|
Efl_Object *top;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_ui_widget_disabled_get(data)) return;
|
2016-06-08 08:37:35 -07:00
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
2019-08-01 02:19:51 -07:00
|
|
|
efl_input_clickable_longpress_abort(data, 1);
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
/* Since context menu disabled flag was checked at long press start while mouse
|
|
|
|
* down, hence the same should be checked at mouse up from a long press
|
|
|
|
* as well */
|
2018-09-13 02:45:29 -07:00
|
|
|
if (sd->long_pressed)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (!_elm_config->context_menu_disabled)
|
|
|
|
{
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-01-19 23:55:31 -08:00
|
|
|
top = efl_provider_find(data, EFL_UI_WIN_CLASS);
|
|
|
|
if (efl_input_text_input_panel_autoshow_get(data) && efl_input_text_input_panel_show_on_demand_get(data))
|
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Since context menu disabled flag was checked at mouse right key down,
|
|
|
|
* hence the same should be stopped at mouse up of right key as well */
|
|
|
|
else if ((ev->button == 3) && (!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry))
|
|
|
|
{
|
|
|
|
sd->use_down = 1;
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_mouse_move_cb(void *data, const Efl_Event *event)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Efl_Input_Pointer_Data *ev;
|
|
|
|
ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
|
2019-08-01 02:19:51 -07:00
|
|
|
Evas_Coord dx, dy;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_ui_widget_disabled_get(data)) return;
|
2020-01-28 08:54:32 -08:00
|
|
|
if (ev->pressed_buttons == 1)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
if (sd->long_pressed)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect r;
|
2016-06-08 08:37:35 -07:00
|
|
|
Eina_Bool rv;
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
r = efl_gfx_entity_geometry_get(sd->entry_edje);
|
2016-06-08 08:37:35 -07:00
|
|
|
rv = edje_object_part_text_cursor_coord_set
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", EDJE_CURSOR_USER,
|
2020-01-28 08:54:32 -08:00
|
|
|
ev->cur.x - r.x, ev->cur.y - r.y);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (rv)
|
|
|
|
{
|
|
|
|
edje_object_part_text_cursor_copy
|
2018-04-26 03:27:43 -07:00
|
|
|
(sd->entry_edje, "efl.text", EDJE_CURSOR_USER, EDJE_CURSOR_MAIN);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
WRN("Warning: Cannot move cursor");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!sd->sel_mode)
|
|
|
|
{
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
2019-08-01 02:19:51 -07:00
|
|
|
efl_input_clickable_longpress_abort(data, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
dx = sd->downx - ev->cur.x;
|
2019-08-01 02:19:51 -07:00
|
|
|
dx *= dx;
|
2020-01-28 08:54:32 -08:00
|
|
|
dy = sd->downy - ev->cur.y;
|
2019-08-01 02:19:51 -07:00
|
|
|
dy *= dy;
|
|
|
|
if ((dx + dy) > ((_elm_config->finger_size / 2) *
|
|
|
|
(_elm_config->finger_size / 2)))
|
|
|
|
{
|
|
|
|
efl_input_clickable_longpress_abort(data, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2016-06-22 05:12:15 -07:00
|
|
|
_item_get(void *data, const char *item)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-11-09 07:53:20 -08:00
|
|
|
Evas_Object *o = NULL;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
2017-11-09 07:53:20 -08:00
|
|
|
if (item)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-11-09 07:53:20 -08:00
|
|
|
if (sd->item_factory)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 00:39:59 -08:00
|
|
|
o = efl_canvas_textblock_factory_create(sd->item_factory, data, item);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
2017-11-09 07:53:20 -08:00
|
|
|
else if (sd->item_fallback_factory)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 00:39:59 -08:00
|
|
|
o = efl_canvas_textblock_factory_create(sd->item_fallback_factory,
|
2017-11-09 07:53:20 -08:00
|
|
|
data, item);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-09-13 02:45:29 -07:00
|
|
|
_selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
Evas_Coord hh;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Position2D pos;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Eina_Rect rc;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
pos = efl_gfx_entity_position_get(sd->text_obj);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
rc = efl_text_cursor_geometry_get(
|
|
|
|
efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
cx = rc.x;
|
|
|
|
cy = rc.y;
|
|
|
|
cw = rc.w;
|
|
|
|
ch = rc.h;
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
edje_object_size_min_calc(handler, NULL, &hh);
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->ox = pos.x + cx + (cw / 2);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (ch > hh)
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
sd->oy = pos.y + cy + ch;
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
else
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
sd->oy = pos.y + cy + (ch / 2);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-08-01 02:19:51 -07:00
|
|
|
efl_input_clickable_longpress_abort(obj, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->long_pressed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_start_handler_mouse_down_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
int start_pos, end_pos, pos;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
|
|
|
Efl_Text_Cursor *main_cur;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = sd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
sd->start_handler_down = EINA_TRUE;
|
|
|
|
|
|
|
|
/* Get the cursors */
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
main_cur = efl_text_interactive_main_cursor_get(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
start_pos = efl_text_cursor_position_get(sel_start);
|
|
|
|
end_pos = efl_text_cursor_position_get(sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (start_pos <= end_pos)
|
|
|
|
{
|
|
|
|
pos = start_pos;
|
|
|
|
sd->sel_handler_cursor = sel_start;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos = end_pos;
|
|
|
|
sd->sel_handler_cursor = sel_end;
|
|
|
|
}
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(main_cur, pos);
|
2018-09-13 02:45:29 -07:00
|
|
|
_selection_handlers_offset_calc(data, sd->start_handler);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_start_handler_mouse_up_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
sd->start_handler_down = EINA_FALSE;
|
|
|
|
/* Context menu should not appear, even in case of selector mode, if the
|
|
|
|
* flag is false (disabled) */
|
|
|
|
if ((!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_start_handler_mouse_move_cb(void *data, const Efl_Event *event)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
if (!sd->start_handler_down) return;
|
2020-01-28 08:54:32 -08:00
|
|
|
Efl_Input_Pointer_Data *ev;
|
|
|
|
ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
|
|
|
|
Eina_Rect re;
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Coord cx, cy;
|
|
|
|
int pos;
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
re = efl_gfx_entity_geometry_get(sd->entry_edje);
|
|
|
|
cx = ev->cur.x - sd->ox - re.x;
|
|
|
|
cy = ev->cur.y - sd->oy - re.y;
|
2016-06-08 08:37:35 -07:00
|
|
|
if (cx <= 0) cx = 1;
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy));
|
|
|
|
pos = efl_text_cursor_position_get(sd->sel_handler_cursor);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
/* Set the main cursor. */
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(
|
|
|
|
efl_text_interactive_main_cursor_get(sd->text_obj), pos);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-08-01 02:19:51 -07:00
|
|
|
efl_input_clickable_longpress_abort(data, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->long_pressed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_end_handler_mouse_down_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
|
|
|
Efl_Text_Cursor *main_cur;
|
2016-06-08 08:37:35 -07:00
|
|
|
int pos, start_pos, end_pos;
|
|
|
|
|
|
|
|
sd->end_handler_down = EINA_TRUE;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = sd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
main_cur = efl_text_interactive_main_cursor_get(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
start_pos = efl_text_cursor_position_get(sel_start);
|
|
|
|
end_pos = efl_text_cursor_position_get(sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (start_pos < end_pos)
|
|
|
|
{
|
|
|
|
pos = end_pos;
|
2016-07-10 09:52:14 -07:00
|
|
|
sd->sel_handler_cursor = sel_end;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos = start_pos;
|
2016-07-10 09:52:14 -07:00
|
|
|
sd->sel_handler_cursor = sel_start;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(main_cur, pos);
|
2018-09-13 02:45:29 -07:00
|
|
|
_selection_handlers_offset_calc(data, sd->end_handler);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_end_handler_mouse_up_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
sd->end_handler_down = EINA_FALSE;
|
|
|
|
/* Context menu appear was checked in case of selector start, and hence
|
|
|
|
* the same should be checked at selector end as well */
|
|
|
|
if ((!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_end_handler_mouse_move_cb(void *data, const Efl_Event *event)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
2020-01-28 08:54:32 -08:00
|
|
|
Efl_Input_Pointer_Data *ev;
|
|
|
|
ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (!sd->end_handler_down) return;
|
2020-01-28 08:54:32 -08:00
|
|
|
Eina_Rect re;
|
2016-06-08 08:37:35 -07:00
|
|
|
Evas_Coord cx, cy;
|
|
|
|
int pos;
|
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
re = efl_gfx_entity_geometry_get(sd->entry_edje);
|
|
|
|
cx = ev->cur.x - sd->ox - re.x;
|
|
|
|
cy = ev->cur.y - sd->oy - re.y;
|
2016-06-08 08:37:35 -07:00
|
|
|
if (cx <= 0) cx = 1;
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy));
|
|
|
|
pos = efl_text_cursor_position_get(sd->sel_handler_cursor);
|
2016-06-08 08:37:35 -07:00
|
|
|
/* Set the main cursor. */
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(data), pos);
|
2019-08-01 02:19:51 -07:00
|
|
|
efl_input_clickable_longpress_abort(data, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->long_pressed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_create_selection_handlers(Evas_Object *obj, Efl_Ui_Textbox_Data *sd)
|
2017-12-06 00:33:03 -08:00
|
|
|
{
|
|
|
|
Evas_Object *handle;
|
|
|
|
|
|
|
|
handle = _decoration_create(obj, sd, PART_NAME_HANDLER_START, EINA_TRUE);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_canvas_object_pass_events_set(handle, EINA_FALSE);
|
2017-12-06 00:33:03 -08:00
|
|
|
sd->start_handler = handle;
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_DOWN,
|
2017-12-06 00:33:03 -08:00
|
|
|
_start_handler_mouse_down_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_MOVE,
|
2017-12-06 00:33:03 -08:00
|
|
|
_start_handler_mouse_move_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_UP,
|
2017-12-06 00:33:03 -08:00
|
|
|
_start_handler_mouse_up_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(handle, EINA_TRUE);
|
2017-12-06 00:33:03 -08:00
|
|
|
|
|
|
|
handle = _decoration_create(obj, sd, PART_NAME_HANDLER_END, EINA_TRUE);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_canvas_object_pass_events_set(handle, EINA_FALSE);
|
2017-12-06 00:33:03 -08:00
|
|
|
sd->end_handler = handle;
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_DOWN,
|
2017-12-06 00:33:03 -08:00
|
|
|
_end_handler_mouse_down_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_MOVE,
|
2017-12-06 00:33:03 -08:00
|
|
|
_end_handler_mouse_move_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(handle, EFL_EVENT_POINTER_UP,
|
2017-12-06 00:33:03 -08:00
|
|
|
_end_handler_mouse_up_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(handle, EINA_TRUE);
|
2017-12-06 00:33:03 -08:00
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Position2D pos)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
|
|
|
efl_gfx_entity_position_set(sd->hit_rect, pos);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
if (sd->popup) _popup_position(obj);
|
2017-12-06 00:33:03 -08:00
|
|
|
}
|
2016-07-10 04:43:43 -07:00
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Size2D sz)
|
2017-12-06 00:33:03 -08:00
|
|
|
{
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(sd->hit_rect, sz);
|
2017-12-06 00:33:03 -08:00
|
|
|
_update_selection_handler(obj);
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2017-12-06 00:33:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_gfx_entity_visible_set(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED, Eina_Bool vis)
|
2017-12-06 00:33:03 -08:00
|
|
|
{
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis);
|
2017-12-06 00:33:03 -08:00
|
|
|
if (vis) _update_selection_handler(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Textbox_Data *sd, Evas_Object *member)
|
2017-12-06 00:33:03 -08:00
|
|
|
{
|
|
|
|
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
|
|
|
|
|
|
|
|
if (sd->hit_rect)
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_stack_raise_to_top(sd->hit_rect);
|
2017-12-06 00:33:03 -08:00
|
|
|
}
|
|
|
|
|
2018-11-12 05:09:56 -08:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_update_guide_text(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2018-11-12 05:09:56 -08:00
|
|
|
{
|
|
|
|
const char *txt;
|
|
|
|
Eina_Bool show_guide;
|
|
|
|
|
|
|
|
txt = efl_text_get(sd->text_obj);
|
|
|
|
|
|
|
|
show_guide = (!txt || (txt[0] == '\0'));
|
|
|
|
|
|
|
|
efl_gfx_entity_visible_set(sd->text_guide_obj, show_guide);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-11-12 05:14:11 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Returns the numeric value of HEX chars for example for ch = 'A'
|
|
|
|
* the function will return 10.
|
|
|
|
*
|
|
|
|
* @param ch The HEX char.
|
|
|
|
* @return numeric value of HEX.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
_hex_string_get(char ch, Eina_Bool *ok)
|
|
|
|
{
|
|
|
|
if ((ch >= '0') && (ch <= '9')) return (ch - '0');
|
|
|
|
else if ((ch >= 'A') && (ch <= 'F')) return (ch - 'A' + 10);
|
|
|
|
else if ((ch >= 'a') && (ch <= 'f')) return (ch - 'a' + 10);
|
|
|
|
*ok = EINA_FALSE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_format_color_parse(const char *str, int slen,
|
|
|
|
unsigned char *r, unsigned char *g,
|
|
|
|
unsigned char *b, unsigned char *a)
|
|
|
|
{
|
|
|
|
Eina_Bool v = EINA_TRUE;
|
|
|
|
|
|
|
|
*r = *g = *b = *a = 0;
|
|
|
|
|
|
|
|
if (slen == 7) /* #RRGGBB */
|
|
|
|
{
|
|
|
|
*r = (_hex_string_get(str[1], &v) << 4) | (_hex_string_get(str[2], &v));
|
|
|
|
*g = (_hex_string_get(str[3], &v) << 4) | (_hex_string_get(str[4], &v));
|
|
|
|
*b = (_hex_string_get(str[5], &v) << 4) | (_hex_string_get(str[6], &v));
|
|
|
|
*a = 0xff;
|
|
|
|
}
|
|
|
|
else if (slen == 9) /* #RRGGBBAA */
|
|
|
|
{
|
|
|
|
*r = (_hex_string_get(str[1], &v) << 4) | (_hex_string_get(str[2], &v));
|
|
|
|
*g = (_hex_string_get(str[3], &v) << 4) | (_hex_string_get(str[4], &v));
|
|
|
|
*b = (_hex_string_get(str[5], &v) << 4) | (_hex_string_get(str[6], &v));
|
|
|
|
*a = (_hex_string_get(str[7], &v) << 4) | (_hex_string_get(str[8], &v));
|
|
|
|
}
|
|
|
|
else if (slen == 4) /* #RGB */
|
|
|
|
{
|
|
|
|
*r = _hex_string_get(str[1], &v);
|
|
|
|
*r = (*r << 4) | *r;
|
|
|
|
*g = _hex_string_get(str[2], &v);
|
|
|
|
*g = (*g << 4) | *g;
|
|
|
|
*b = _hex_string_get(str[3], &v);
|
|
|
|
*b = (*b << 4) | *b;
|
|
|
|
*a = 0xff;
|
|
|
|
}
|
|
|
|
else if (slen == 5) /* #RGBA */
|
|
|
|
{
|
|
|
|
*r = _hex_string_get(str[1], &v);
|
|
|
|
*r = (*r << 4) | *r;
|
|
|
|
*g = _hex_string_get(str[2], &v);
|
|
|
|
*g = (*g << 4) | *g;
|
|
|
|
*b = _hex_string_get(str[3], &v);
|
|
|
|
*b = (*b << 4) | *b;
|
|
|
|
*a = _hex_string_get(str[4], &v);
|
|
|
|
*a = (*a << 4) | *a;
|
|
|
|
}
|
|
|
|
else v = EINA_FALSE;
|
|
|
|
|
|
|
|
*r = (*r * *a) / 255;
|
|
|
|
*g = (*g * *a) / 255;
|
|
|
|
*b = (*b * *a) / 255;
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Updates the text properties of the object from the theme.
|
2019-02-27 11:00:14 -08:00
|
|
|
*
|
2018-11-12 05:14:11 -08:00
|
|
|
* This update functions skips any property that was already set,
|
|
|
|
* to allow users to override the theme during the construction of the widget.
|
|
|
|
*/
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2018-11-12 05:14:11 -08:00
|
|
|
{
|
|
|
|
const char *font_name;
|
|
|
|
const char *font_size;
|
2019-08-05 10:03:21 -07:00
|
|
|
const char *colorcode = NULL;
|
|
|
|
Eina_Bool disabled;
|
2018-11-12 05:14:11 -08:00
|
|
|
|
|
|
|
int font_size_n;
|
|
|
|
unsigned char r, g, b, a;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2019-08-05 10:03:21 -07:00
|
|
|
disabled = efl_ui_widget_disabled_get(obj);
|
2018-11-12 05:14:11 -08:00
|
|
|
|
|
|
|
// Main Text
|
|
|
|
// font_set
|
2020-01-16 03:55:59 -08:00
|
|
|
font_name = efl_layout_group_data_get(wd->resize_obj, "font.name");
|
|
|
|
font_size = efl_layout_group_data_get(wd->resize_obj, "font.size");
|
2018-11-12 05:14:11 -08:00
|
|
|
font_size_n = font_size ? atoi(font_size) : 0;
|
2019-11-27 23:55:26 -08:00
|
|
|
efl_text_font_family_set(sd->text_obj, font_name);
|
|
|
|
efl_text_font_size_set(sd->text_obj, font_size_n);
|
2018-11-12 05:14:11 -08:00
|
|
|
|
|
|
|
// color
|
2019-08-05 10:03:21 -07:00
|
|
|
if (disabled)
|
2020-01-16 03:55:59 -08:00
|
|
|
colorcode = efl_layout_group_data_get(wd->resize_obj, "style.color_disabled");
|
2019-08-05 10:03:21 -07:00
|
|
|
if (!colorcode)
|
2020-01-16 03:55:59 -08:00
|
|
|
colorcode = efl_layout_group_data_get(wd->resize_obj, "style.color");
|
2018-11-12 05:14:11 -08:00
|
|
|
if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a))
|
|
|
|
{
|
2019-12-20 00:49:41 -08:00
|
|
|
efl_text_color_set(sd->text_obj, r, g, b, a);
|
2018-11-12 05:14:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Guide Text
|
2020-01-16 03:55:59 -08:00
|
|
|
font_name = efl_layout_group_data_get(wd->resize_obj, "guide.font.name");
|
|
|
|
font_size = efl_layout_group_data_get(wd->resize_obj, "guide.font.size");
|
2018-11-12 05:14:11 -08:00
|
|
|
font_size_n = font_size ? atoi(font_size) : 0;
|
2019-11-27 23:55:26 -08:00
|
|
|
efl_text_font_family_set(sd->text_guide_obj, font_name);
|
|
|
|
efl_text_font_size_set(sd->text_guide_obj, font_size_n);
|
2018-11-12 05:14:11 -08:00
|
|
|
|
2019-08-05 10:03:21 -07:00
|
|
|
colorcode = NULL;
|
2018-11-12 05:14:11 -08:00
|
|
|
// color
|
2019-08-05 10:03:21 -07:00
|
|
|
if (disabled)
|
2020-01-16 03:55:59 -08:00
|
|
|
colorcode = efl_layout_group_data_get(wd->resize_obj, "guide.style.color_disabled");
|
2019-08-05 10:03:21 -07:00
|
|
|
if (!colorcode)
|
2020-01-16 03:55:59 -08:00
|
|
|
colorcode = efl_layout_group_data_get(wd->resize_obj, "guide.style.color");
|
2018-11-28 04:39:45 -08:00
|
|
|
if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a))
|
2018-11-12 05:14:11 -08:00
|
|
|
{
|
2019-12-20 00:49:41 -08:00
|
|
|
efl_text_color_set(sd->text_guide_obj, r, g, b, a);
|
2018-11-12 05:14:11 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
EOLIAN static Eo *
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_object_constructor(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2017-12-06 00:33:03 -08:00
|
|
|
{
|
|
|
|
Eo *text_obj;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
|
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
|
|
|
elm_widget_theme_klass_set(obj, "text");
|
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_add(obj, EFL_INPUT_EVENT_LONGPRESSED, _long_press_cb, obj);
|
2017-05-31 00:50:55 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, obj);
|
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, obj);
|
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, obj);
|
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_REDO_REQUEST, obj);
|
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_UNDO_REQUEST, obj);
|
|
|
|
efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_PREEDIT_CHANGED, obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->text_obj = text_obj;
|
2019-12-10 00:39:59 -08:00
|
|
|
sd->text_guide_obj = efl_add(EFL_CANVAS_TEXTBLOCK_CLASS, obj);
|
2018-11-12 05:09:56 -08:00
|
|
|
sd->text_table = efl_add(EFL_UI_TABLE_CLASS, obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_composite_attach(obj, text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
sd->entry_edje = wd->resize_obj;
|
2018-12-21 13:46:06 -08:00
|
|
|
sd->cnp_mode = EFL_UI_SELECTION_FORMAT_TEXT;
|
2019-12-20 05:04:18 -08:00
|
|
|
sd->context_menu_enabled = EINA_TRUE;
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_text_interactive_editable_set(obj, EINA_TRUE);
|
|
|
|
efl_text_interactive_selection_allowed_set(obj, EINA_TRUE);
|
2019-02-07 09:59:41 -08:00
|
|
|
sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE;
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->last.scroll = EINA_SIZE2D(0, 0);
|
2020-01-08 20:44:50 -08:00
|
|
|
sd->sel_handles_enabled = EINA_FALSE;
|
2018-09-13 02:45:29 -07:00
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_object_finalize(Eo *obj,
|
|
|
|
Efl_Ui_Textbox_Data *sd)
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
obj = efl_finalize(efl_super(obj, MY_CLASS));
|
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
2016-06-08 08:37:35 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
|
2017-12-06 00:33:03 -08:00
|
|
|
|
2018-11-12 05:09:56 -08:00
|
|
|
_update_guide_text(obj, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
|
2018-11-12 05:09:56 -08:00
|
|
|
sd->item_fallback_factory = efl_add(EFL_UI_TEXT_FACTORY_FALLBACK_CLASS, obj);
|
2017-12-06 00:33:03 -08:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_hint_weight_set
|
2017-12-06 00:33:03 -08:00
|
|
|
(sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_hint_align_set
|
2017-12-06 00:33:03 -08:00
|
|
|
(sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_changed_user_cb, obj);
|
2019-12-10 00:39:59 -08:00
|
|
|
efl_event_callback_add(sd->text_obj, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_changed_cb, obj);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_start_clear_cb, obj);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_changed_cb, obj);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_event_callback_add(efl_text_interactive_main_cursor_get(sd->text_obj), EFL_TEXT_CURSOR_EVENT_CHANGED,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_cursor_changed_cb, obj);
|
2019-02-21 10:01:56 -08:00
|
|
|
efl_event_callback_add(sd->text_obj, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED,
|
2018-09-13 02:45:29 -07:00
|
|
|
_text_position_changed_cb, obj);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add(sd->entry_edje, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED,
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_move_cb, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_event_callback_add
|
|
|
|
(sd->entry_edje, EFL_EVENT_POINTER_DOWN, _mouse_down_cb, obj);
|
|
|
|
efl_event_callback_add
|
|
|
|
(sd->entry_edje, EFL_EVENT_POINTER_UP, _mouse_up_cb, obj);
|
|
|
|
efl_event_callback_add
|
|
|
|
(sd->entry_edje, EFL_EVENT_POINTER_MOVE, _mouse_move_cb, obj);
|
2019-08-01 22:03:38 -07:00
|
|
|
efl_ui_action_connector_bind_clickable_to_object(sd->entry_edje, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-02-21 10:01:56 -08:00
|
|
|
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
|
2018-09-13 02:45:29 -07:00
|
|
|
_text_size_changed_cb, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_ui_widget_focus_allow_set(obj, efl_text_interactive_editable_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_input_text_input_panel_layout_set(obj, EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_NORMAL);
|
|
|
|
efl_input_text_input_panel_autoshow_set(obj, EINA_TRUE);
|
|
|
|
efl_input_text_predictable_set(obj, EINA_TRUE);
|
2020-01-20 04:25:43 -08:00
|
|
|
efl_input_text_input_content_type_set(obj, EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-11-18 02:20:10 -08:00
|
|
|
sd->calc_force = EINA_TRUE;
|
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
return obj;
|
2018-09-13 02:45:29 -07:00
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_object_destructor(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-09-11 22:38:51 -07:00
|
|
|
efl_event_freeze(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-14 08:29:50 -08:00
|
|
|
_popup_dismiss(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
if ((sd->api) && (sd->api->obj_unhook))
|
|
|
|
sd->api->obj_unhook(obj); // module - unhook
|
|
|
|
|
|
|
|
entries = eina_list_remove(entries, obj);
|
|
|
|
eina_stringshare_del(sd->text);
|
|
|
|
eina_stringshare_del(sd->anchor_hover.hover_style);
|
|
|
|
|
2017-09-11 22:38:51 -07:00
|
|
|
efl_event_thaw(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
if (sd->start_handler)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_del(sd->start_handler);
|
|
|
|
efl_del(sd->end_handler);
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
2016-06-22 10:02:32 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
_anchors_free(sd);
|
|
|
|
_clear_text_selection(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-11-09 07:53:20 -08:00
|
|
|
if (sd->item_factory) efl_unref(sd->item_factory);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(obj, MY_CLASS));
|
2016-06-22 10:02:32 -07:00
|
|
|
}
|
|
|
|
|
2020-01-02 00:19:24 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_textbox_efl_text_format_multiline_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
enabled = !!enabled;
|
|
|
|
if (efl_text_multiline_get(obj) == enabled) return;
|
|
|
|
efl_text_multiline_set(sd->text_obj, enabled);
|
|
|
|
|
|
|
|
if (sd->scroller)
|
|
|
|
{
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_text_format_password_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool password)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
password = !!password;
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_password_get(obj) == password) return;
|
|
|
|
if (!efl_text_replacement_char_get(obj))
|
|
|
|
efl_text_replacement_char_set(obj, ENTRY_PASSWORD_MASK_CHARACTER_UTF8);
|
|
|
|
efl_text_password_set(sd->text_obj, password);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
|
|
|
if (password)
|
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_text_multiline_set(obj, EINA_FALSE);
|
2020-01-20 04:25:43 -08:00
|
|
|
efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) & ~EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA));
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PASSWORD_TEXT);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_text_multiline_set(obj, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2020-01-20 04:25:43 -08:00
|
|
|
efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) | EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA));
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_calc_force(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->calc_force = EINA_TRUE;
|
2016-06-08 08:37:35 -07:00
|
|
|
edje_object_calc_force(sd->entry_edje);
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_calculate(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *start_obj, *end_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if ((efl_text_password_get(obj))) return NULL;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(obj, &start_obj, &end_obj);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
return efl_text_cursor_range_text_get(start_obj, end_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2020-01-08 20:44:50 -08:00
|
|
|
_efl_ui_textbox_selection_handles_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-08 20:44:50 -08:00
|
|
|
if (sd->sel_handles_enabled == enabled) return;
|
|
|
|
sd->sel_handles_enabled = enabled;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2020-01-08 20:44:50 -08:00
|
|
|
_efl_ui_textbox_selection_handles_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-08 20:44:50 -08:00
|
|
|
return sd->sel_handles_enabled;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_entry_insert(Eo *obj, Efl_Ui_Textbox_Data *sd, const char *entry)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
|
|
|
|
efl_text_cursor_text_insert(cur_obj, entry);
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->text_changed = EINA_TRUE;
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
EOLIAN static Efl_Text_Cursor *
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_cursor_create(Eo *obj, Efl_Ui_Textbox_Data *pd)
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
{
|
2020-01-09 05:33:07 -08:00
|
|
|
Eo* cursor = efl_text_cursor_create(pd->text_obj);;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_text_object_set(cursor, pd->text_obj, obj);
|
|
|
|
return cursor;
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool editable)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_editable_get(obj) == editable) return;
|
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2019-07-16 04:58:48 -07:00
|
|
|
efl_ui_widget_focus_allow_set(obj, editable);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
|
|
|
if (editable)
|
|
|
|
{
|
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2016-12-01 03:25:11 -08:00
|
|
|
if (sd->cursor)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(sd->cursor, EINA_TRUE);
|
|
|
|
efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_TRUE);
|
2016-12-01 03:25:11 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!editable && sd->cursor)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(sd->cursor, EINA_FALSE);
|
|
|
|
efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_select_region_set(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED, int start, int end)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
2016-10-05 07:09:46 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_password_get(obj)) return;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(sel_start, start);
|
|
|
|
efl_text_cursor_position_set(sel_end, end);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-08 20:57:04 -08:00
|
|
|
static void
|
|
|
|
_efl_ui_textbox_select_region_get(Eo *obj, int *start, int *end)
|
|
|
|
{
|
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
|
|
|
|
|
|
|
efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
|
|
|
|
|
|
|
|
if(start) *start = efl_text_cursor_position_get(sel_start);
|
|
|
|
if(end) *end = efl_text_cursor_position_get(sel_end);
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
Efl_Text_Cursor *start, *end;
|
|
|
|
Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
|
|
|
|
char *tmp;
|
|
|
|
int end_pos, start_pos;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
/* Store it */
|
|
|
|
sd->sel_mode = EINA_FALSE;
|
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "efl.text", EINA_FALSE);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (!_elm_config->desktop_entry)
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_ui_widget_scroll_hold_pop(obj);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
|
|
|
|
/*In password mode, cut will remove text only*/
|
|
|
|
if (!efl_text_password_get(obj))
|
|
|
|
_selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
|
|
|
|
efl_text_interactive_selection_cursors_get(obj, &start, &end);
|
|
|
|
|
|
|
|
start_pos = efl_text_cursor_position_get(start);
|
|
|
|
end_pos = efl_text_cursor_position_get(end);
|
|
|
|
tmp = efl_text_cursor_range_text_get(start, end);
|
2020-02-03 01:57:57 -08:00
|
|
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
info.position = start_pos;
|
|
|
|
info.length = end_pos - start_pos;
|
|
|
|
info.content = tmp;
|
|
|
|
efl_text_cursor_range_delete(start, end);
|
|
|
|
efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
|
|
|
|
free(tmp);
|
|
|
|
tmp = NULL;
|
|
|
|
efl_text_interactive_all_unselect(obj);
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_SELECTION_CUT, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_copy(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_password_get(obj)) return;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
|
|
|
if (!_elm_config->desktop_entry)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "efl.text", EINA_FALSE);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
|
|
|
|
efl_ui_widget_scroll_hold_pop(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
_selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_SELECTION_COPY, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-13 03:50:37 -08:00
|
|
|
static void
|
|
|
|
_efl_ui_textbox_selection_paste_type(Eo *obj, Efl_Ui_Selection_Type type)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
Efl_Ui_Selection_Format formats = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2020-01-13 03:50:37 -08:00
|
|
|
efl_ui_selection_get(obj, type, formats,
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
NULL, _selection_data_cb, NULL, 1);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_SELECTION_PASTE, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-13 03:50:37 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_textbox_selection_paste(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_efl_ui_textbox_selection_paste_type(obj, EFL_UI_SELECTION_TYPE_CLIPBOARD);
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
EOLIAN static void
|
2019-12-20 05:04:18 -08:00
|
|
|
_efl_ui_textbox_context_menu_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-20 05:04:18 -08:00
|
|
|
if (sd->context_menu_enabled == enabled) return;
|
|
|
|
sd->context_menu_enabled = enabled;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-20 05:04:18 -08:00
|
|
|
_efl_ui_textbox_context_menu_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-20 05:04:18 -08:00
|
|
|
return sd->context_menu_enabled;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_cnp_mode_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Ui_Selection_Format cnp_mode)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-12-21 13:46:06 -08:00
|
|
|
Elm_Sel_Format dnd_format = EFL_UI_SELECTION_FORMAT_MARKUP;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
if (cnp_mode != EFL_UI_SELECTION_FORMAT_TARGETS)
|
2018-01-17 23:19:01 -08:00
|
|
|
{
|
2018-12-21 13:46:06 -08:00
|
|
|
if (cnp_mode & EFL_UI_SELECTION_FORMAT_VCARD)
|
2018-01-17 23:19:01 -08:00
|
|
|
ERR("VCARD format not supported for copy & paste!");
|
2018-12-21 13:46:06 -08:00
|
|
|
else if (cnp_mode & EFL_UI_SELECTION_FORMAT_HTML)
|
2018-01-17 23:19:01 -08:00
|
|
|
ERR("HTML format not supported for copy & paste!");
|
2018-12-21 13:46:06 -08:00
|
|
|
cnp_mode &= ~EFL_UI_SELECTION_FORMAT_VCARD;
|
|
|
|
cnp_mode &= ~EFL_UI_SELECTION_FORMAT_HTML;
|
2018-01-17 23:19:01 -08:00
|
|
|
}
|
|
|
|
|
2018-11-08 09:12:35 -08:00
|
|
|
if (sd->cnp_mode == cnp_mode) return;
|
|
|
|
sd->cnp_mode = cnp_mode;
|
2018-12-21 13:46:06 -08:00
|
|
|
if (sd->cnp_mode == EFL_UI_SELECTION_FORMAT_TEXT)
|
|
|
|
dnd_format = EFL_UI_SELECTION_FORMAT_TEXT;
|
|
|
|
else if (cnp_mode == EFL_UI_SELECTION_FORMAT_IMAGE)
|
2019-02-07 09:59:41 -08:00
|
|
|
dnd_format |= EFL_UI_SELECTION_FORMAT_IMAGE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2018-01-17 23:19:01 -08:00
|
|
|
sd->drop_format = dnd_format;
|
2016-06-08 08:37:35 -07:00
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
|
|
|
}
|
|
|
|
|
2018-12-21 13:46:06 -08:00
|
|
|
EOLIAN static Efl_Ui_Selection_Format
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_cnp_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
return sd->cnp_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2020-01-02 00:19:24 -08:00
|
|
|
_efl_ui_textbox_scrollable_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool scroll)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (sd->scroll == scroll) return;
|
|
|
|
sd->scroll = scroll;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
if (scroll)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_content_set(efl_part(sd->entry_edje, "efl.text"), NULL);
|
2018-11-12 05:09:56 -08:00
|
|
|
sd->scroller = efl_add(EFL_UI_INTERNAL_TEXT_SCROLLER_CLASS, obj,
|
|
|
|
efl_ui_internal_text_scroller_initialize(efl_added,
|
|
|
|
sd->text_obj, sd->text_table));
|
2020-01-02 00:19:24 -08:00
|
|
|
|
|
|
|
if (efl_text_multiline_get(obj))
|
|
|
|
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE);
|
|
|
|
else
|
|
|
|
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
|
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->scroller);
|
|
|
|
efl_canvas_object_clipper_set(sd->cursor,
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_ui_internal_text_scroller_viewport_clip_get(sd->scroller));
|
2019-02-21 10:01:56 -08:00
|
|
|
efl_event_callback_add(sd->scroller, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
|
2018-09-13 02:45:29 -07:00
|
|
|
_scroller_size_changed_cb, obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-12-26 17:17:17 -08:00
|
|
|
/* sd->text_table should not be deleted, so we need to use content_unset
|
|
|
|
* instead of efl_content_set(sd->scroller, NULL)
|
|
|
|
*/
|
|
|
|
efl_content_unset(sd->scroller);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table);
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_del(sd->scroller);
|
|
|
|
sd->scroller = NULL;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_scrollable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
return sd->scroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, Efl_Ui_Activate act)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-10-15 21:33:52 -07:00
|
|
|
if (act != EFL_UI_ACTIVATE_DEFAULT) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2019-12-29 17:31:32 -08:00
|
|
|
if (!efl_ui_widget_disabled_get(obj) &&
|
2020-01-28 08:54:32 -08:00
|
|
|
!(efl_event_freeze_count_get(obj) > 0))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_call(obj, EFL_INPUT_EVENT_CLICKED, NULL);
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_editable_get(obj) && efl_input_text_input_panel_autoshow_get(obj))
|
2018-04-26 03:27:43 -07:00
|
|
|
edje_object_part_text_input_panel_show(sd->entry_edje, "efl.text");
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ATSPI Accessibility
|
|
|
|
|
|
|
|
EOLIAN static Eina_Unicode
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_character_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2016-07-10 03:37:02 -07:00
|
|
|
const char *txt;
|
2016-06-08 08:37:35 -07:00
|
|
|
int idx = 0;
|
|
|
|
Eina_Unicode ret = 0;
|
|
|
|
if (offset < 0) return ret;
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_password_get(obj)) return ENTRY_PASSWORD_MASK_CHARACTER;
|
2016-07-10 03:37:02 -07:00
|
|
|
|
|
|
|
txt = efl_text_get(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!txt) return ret;
|
|
|
|
|
|
|
|
ret = eina_unicode_utf8_next_get(txt, &idx);
|
|
|
|
while (offset--) ret = eina_unicode_utf8_next_get(txt, &idx);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_character_count_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2016-07-10 03:37:02 -07:00
|
|
|
const char *txt;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-07-10 03:37:02 -07:00
|
|
|
txt = efl_text_get(obj);
|
|
|
|
if (!txt) return -1;
|
|
|
|
return eina_unicode_utf8_get_len(txt);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static char*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL;
|
|
|
|
char *ret = NULL;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
cur = evas_object_textblock_cursor_new(pd->text_obj);
|
|
|
|
cur2 = evas_object_textblock_cursor_new(pd->text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur || !cur2) goto fail;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, *start_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur) != *start_offset) goto fail;
|
|
|
|
|
|
|
|
switch (granularity)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_CHAR:
|
2016-06-08 08:37:35 -07:00
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_WORD:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_word_start(cur);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE:
|
2016-06-08 08:37:35 -07:00
|
|
|
// TODO - add sentence support in textblock first
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_LINE:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_line_char_first(cur);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_paragraph_char_first(cur);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*start_offset = evas_textblock_cursor_pos_get(cur);
|
|
|
|
evas_textblock_cursor_copy(cur, cur2);
|
|
|
|
|
|
|
|
switch (granularity)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_CHAR:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_char_next(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_WORD:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_word_end(cur2);
|
|
|
|
// since word_end sets cursor position ON (before) last
|
|
|
|
// char of word, we need to manually advance cursor to get
|
|
|
|
// proper string from function range_text_get
|
|
|
|
evas_textblock_cursor_char_next(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE:
|
2016-06-08 08:37:35 -07:00
|
|
|
// TODO - add sentence support in textblock first
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_LINE:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_line_char_last(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH:
|
2016-06-08 08:37:35 -07:00
|
|
|
evas_textblock_cursor_paragraph_char_last(cur2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (end_offset) *end_offset = evas_textblock_cursor_pos_get(cur2);
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (ret && efl_text_password_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (ret[i] != '\0')
|
|
|
|
ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (start_offset) *start_offset = -1;
|
|
|
|
if (end_offset) *end_offset = -1;
|
|
|
|
if (cur) evas_textblock_cursor_free(cur);
|
|
|
|
if (cur2) evas_textblock_cursor_free(cur2);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static char*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_access_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int start_offset, int end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL;
|
|
|
|
char *ret = NULL;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = pd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur = evas_object_textblock_cursor_new(text_obj);
|
|
|
|
cur2 = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur || !cur2) goto fail;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, start_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur) != start_offset) goto fail;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur2) != end_offset) goto fail;
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (ret && efl_text_password_get(obj))
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (ret[i] != '\0')
|
|
|
|
ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (cur) evas_textblock_cursor_free(cur);
|
|
|
|
if (cur2) evas_textblock_cursor_free(cur2);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_caret_offset_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
return efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(obj));
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_caret_offset_set(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(obj), offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_selections_count_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 16:47:50 -08:00
|
|
|
return _efl_ui_textbox_selection_get(obj, _pd) ? 1 : 0;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_access_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int selection_number, int *start_offset, int *end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return;
|
|
|
|
|
2020-01-08 20:57:04 -08:00
|
|
|
_efl_ui_textbox_select_region_get((Eo *)obj, start_offset, end_offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_access_selection_set(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int selection_number, int start_offset, int end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return EINA_FALSE;
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_select_region_set(obj, _pd, start_offset, end_offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_selection_remove(Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int selection_number)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return EINA_FALSE;
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
efl_text_interactive_all_unselect(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_selection_add(Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int start_offset, int end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_select_region_set(obj, pd, start_offset, end_offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_bounded_ranges_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, Eina_Bool screen_coods EINA_UNUSED, Eina_Rect rect EINA_UNUSED, Efl_Access_Text_Clip_Type xclip EINA_UNUSED, Efl_Access_Text_Clip_Type yclip EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_offset_at_point_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, Eina_Bool screen_coods, int x, int y)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur;
|
|
|
|
int ret;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = pd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!text_obj) return -1;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur) return -1;
|
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
x -= ee_x;
|
|
|
|
y -= ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!evas_textblock_cursor_char_coord_set(cur, x, y))
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_pos_get(cur);
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_character_extents_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int offset, Eina_Bool screen_coods, Eina_Rect *rect)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur;
|
|
|
|
int ret;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = pd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!text_obj) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur) return EINA_FALSE;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, offset);
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_char_geometry_get(cur, &rect->x, &rect->y, &rect->w, &rect->h);
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
|
|
|
|
if (ret == -1) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
rect->x += ee_x;
|
|
|
|
rect->y += ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_range_extents_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, Eina_Bool screen_coods, int start_offset, int end_offset, Eina_Rect *rect)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
|
|
|
int ret;
|
|
|
|
int x, xx, y, yy;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = pd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!text_obj) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur1 = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur2 = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_char_geometry_get(cur1, &x, &y, NULL, NULL);
|
|
|
|
ret += evas_textblock_cursor_char_geometry_get(cur2, &xx, &yy, NULL, NULL);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
|
|
|
if (ret != 0) return EINA_FALSE;
|
|
|
|
|
|
|
|
rect->x = x < xx ? x : xx;
|
|
|
|
rect->y = y < yy ? y : yy;
|
|
|
|
rect->w = abs(x - xx);
|
|
|
|
rect->h = abs(y - yy);
|
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
rect->x += ee_x;
|
|
|
|
rect->y += ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-09-25 01:15:44 -07:00
|
|
|
static Efl_Access_Text_Attribute*
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
_textblock_node_format_to_atspi_text_attr(Efl_Text_Attribute_Handle *annotation)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *ret;
|
2016-06-08 08:37:35 -07:00
|
|
|
const char *txt;
|
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
txt = efl_text_formatter_attribute_get(annotation);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!txt) return NULL;
|
|
|
|
|
2017-09-25 01:15:44 -07:00
|
|
|
ret = calloc(1, sizeof(Efl_Access_Text_Attribute));
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!ret) return NULL;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
ret->value = eina_stringshare_add(txt);
|
|
|
|
int size = strlen(txt);
|
|
|
|
ret->name = eina_stringshare_add_length(txt, size);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, const char *attr_name EINA_UNUSED, int *start_offset, int *end_offset, char **value)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Cursor *cur1, *cur2;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
2016-10-05 07:09:46 -07:00
|
|
|
Eina_Iterator *annotations;
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Attribute_Handle *an;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Eo *mobj = (Eo *)obj;
|
2019-12-10 16:47:50 -08:00
|
|
|
cur1 = efl_ui_textbox_cursor_create(mobj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
cur2 = efl_ui_textbox_cursor_create(mobj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur2)
|
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_del(cur1);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_text_cursor_position_set(cur1, *start_offset);
|
|
|
|
efl_text_cursor_position_set(cur2, *end_offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
annotations = efl_text_formatter_range_attributes_get(cur1, cur2);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_del(cur1);
|
|
|
|
efl_del(cur2);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!annotations) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
EINA_ITERATOR_FOREACH(annotations, an)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(an);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!attr) continue;
|
|
|
|
if (!strcmp(attr->name, attr_name))
|
|
|
|
{
|
|
|
|
*value = attr->value ? strdup(attr->value) : NULL;
|
|
|
|
elm_atspi_text_text_attribute_free(attr);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
elm_atspi_text_text_attribute_free(attr);
|
|
|
|
}
|
2016-10-05 07:09:46 -07:00
|
|
|
eina_iterator_free(annotations);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int *start_offset, int *end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Cursor *cur1, *cur2;
|
2016-10-05 07:09:46 -07:00
|
|
|
Eina_List *ret = NULL;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
2016-10-05 07:09:46 -07:00
|
|
|
Eina_Iterator *annotations;
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Attribute_Handle *an;
|
|
|
|
Eo *mobj = (Eo *)obj;
|
2019-12-10 16:47:50 -08:00
|
|
|
cur1 = efl_ui_textbox_cursor_create(mobj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur1) return NULL;
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
cur2 = efl_ui_textbox_cursor_create(mobj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur2)
|
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_del(cur1);
|
2016-06-08 08:37:35 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_text_cursor_position_set(cur1, *start_offset);
|
|
|
|
efl_text_cursor_position_set(cur2, *end_offset);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
annotations = efl_text_formatter_range_attributes_get(cur1, cur2);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
efl_del(cur1);
|
|
|
|
efl_del(cur2);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!annotations) return NULL;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
EINA_ITERATOR_FOREACH(annotations, an)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(an);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!attr) continue;
|
|
|
|
ret = eina_list_append(ret, attr);
|
|
|
|
}
|
2016-10-05 07:09:46 -07:00
|
|
|
eina_iterator_free(annotations);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Eina_List *ret = NULL;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *start, *end;
|
2016-10-05 07:09:46 -07:00
|
|
|
Eina_Iterator *annotations;
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Attribute_Handle *an;
|
2016-10-05 07:09:46 -07:00
|
|
|
|
|
|
|
/* Retrieve all annotations in the text. */
|
2018-04-17 11:09:44 -07:00
|
|
|
Eo *mobj = (Eo *)obj; /* XXX const */
|
2019-12-10 16:47:50 -08:00
|
|
|
start = efl_ui_textbox_cursor_create(mobj);
|
|
|
|
end = efl_ui_textbox_cursor_create(mobj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-09 01:49:13 -08:00
|
|
|
efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
|
|
|
|
efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
annotations = efl_text_formatter_range_attributes_get(start, end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
EINA_ITERATOR_FOREACH(annotations, an)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(an);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!attr) continue;
|
|
|
|
ret = eina_list_append(ret, attr);
|
|
|
|
}
|
2016-10-05 07:09:46 -07:00
|
|
|
eina_iterator_free(annotations);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_text_content_set(Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, const char *content)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2016-07-10 03:37:02 -07:00
|
|
|
efl_text_set(obj, content);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_insert(Eo *obj, Efl_Ui_Textbox_Data *pd, const char *string, int position)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
|
|
|
|
efl_text_cursor_position_set(cur_obj, position);
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_entry_insert(obj, pd, string);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_copy(Eo *obj, Efl_Ui_Textbox_Data *pd, int start, int end)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_select_region_set(obj, pd, start, end);
|
|
|
|
efl_ui_textbox_selection_copy(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_delete(Eo *obj, Efl_Ui_Textbox_Data *pd, int start_offset, int end_offset)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = pd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
if (!text_obj) return EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur1 = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
2016-10-05 07:09:46 -07:00
|
|
|
cur2 = evas_object_textblock_cursor_new(text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
|
|
|
|
evas_textblock_cursor_range_delete(cur1, cur2);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_calc_force(obj, pd);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_paste(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int position)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
|
|
|
|
efl_text_cursor_position_set(cur_obj, position);
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_ui_textbox_selection_paste(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_editable_text_cut(Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int start, int end)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_select_region_set(obj, pd, start, end);
|
|
|
|
efl_ui_textbox_selection_cut(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN static Efl_Access_State_Set
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_object_state_set_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2019-12-10 16:47:50 -08:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(obj, EFL_UI_TEXTBOX_CLASS));
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
if (efl_text_interactive_editable_get(obj))
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_TYPE_EDITABLE);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN static const char*
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_efl_access_object_i18n_name_get(const Eo *obj, Efl_Ui_Textbox_Data *pd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *name;
|
2019-12-10 16:47:50 -08:00
|
|
|
name = efl_access_object_i18n_name_get(efl_super(obj, EFL_UI_TEXTBOX_CLASS));
|
2016-06-08 08:37:35 -07:00
|
|
|
if (name && strncmp("", name, 1)) return name;
|
2018-04-26 03:27:43 -07:00
|
|
|
const char *ret = edje_object_part_text_get(pd->entry_edje, "efl.guide");
|
2016-11-09 17:58:41 -08:00
|
|
|
return ret;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2016-06-28 05:24:35 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_edje_signal_emit(Efl_Ui_Textbox_Data *sd, const char *sig, const char *src)
|
2016-06-28 05:24:35 -07:00
|
|
|
{
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, sig, src);
|
|
|
|
efl_layout_signal_emit(sd->cursor, sig, src);
|
|
|
|
efl_layout_signal_emit(sd->cursor_bidi, sig, src);
|
2016-06-28 05:24:35 -07:00
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
static inline Eo *
|
2019-12-10 16:47:50 -08:00
|
|
|
_decoration_create(Eo *obj, Efl_Ui_Textbox_Data *sd,
|
2017-11-14 03:38:49 -08:00
|
|
|
const char *group_name, Eina_Bool above)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *ret = NULL;
|
|
|
|
Eo *clip = efl_ui_internal_text_scroller_viewport_clip_get(sd->scroller);
|
|
|
|
|
|
|
|
ret = efl_add(EFL_CANVAS_LAYOUT_CLASS, obj);
|
2017-11-14 03:38:49 -08:00
|
|
|
elm_widget_element_update(obj, ret, group_name);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_canvas_group_member_add(sd->entry_edje, ret);
|
2016-06-08 08:37:35 -07:00
|
|
|
if (above)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_stack_above(ret, sd->text_table);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_stack_below(ret, NULL);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_canvas_object_clipper_set(ret, clip);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_canvas_object_pass_events_set(ret, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_create_text_cursors(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2017-11-14 03:38:49 -08:00
|
|
|
sd->cursor = _decoration_create(obj, sd, PART_NAME_CURSOR, EINA_TRUE);
|
|
|
|
sd->cursor_bidi = _decoration_create(obj, sd, PART_NAME_CURSOR, EINA_TRUE);
|
2016-12-01 03:25:11 -08:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
if (!efl_text_interactive_editable_get(obj))
|
2016-12-01 03:25:11 -08:00
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(sd->cursor, EINA_FALSE);
|
|
|
|
efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE);
|
2016-12-01 03:25:11 -08:00
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
static Eina_Position2D
|
2019-12-10 16:47:50 -08:00
|
|
|
_decoration_calc_offset(Efl_Ui_Textbox_Data *sd)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Position2D ret;
|
|
|
|
Eina_Position2D text;
|
|
|
|
Eina_Position2D ed = EINA_POSITION2D(0,0), scr = EINA_POSITION2D(0, 0);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
text = efl_gfx_entity_position_get(sd->text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
ret.x = ed.x + scr.x + text.x;
|
|
|
|
ret.y = ed.y + scr.y + text.y;
|
|
|
|
|
|
|
|
return ret;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_update_text_cursors(Eo *obj)
|
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Evas_Coord xx, yy, ww, hh;
|
|
|
|
Eina_Position2D off;
|
2017-09-09 03:21:06 -07:00
|
|
|
Eo *text_obj;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Eina_Rect rc_tmp1;
|
|
|
|
Eina_Rect rc_tmp2;
|
|
|
|
Eina_Bool bidi_cursor;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
2016-06-22 10:02:32 -07:00
|
|
|
if (!sd->deferred_decoration_cursor) return;
|
|
|
|
sd->deferred_decoration_cursor = EINA_FALSE;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
text_obj = sd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
xx = yy = ww = hh = -1;
|
2018-09-13 02:45:29 -07:00
|
|
|
off =_decoration_calc_offset(sd);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
rc_tmp1 = efl_text_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
bidi_cursor = efl_text_cursor_lower_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), &rc_tmp2);
|
|
|
|
xx = rc_tmp1.x;
|
|
|
|
yy = rc_tmp1.y;
|
|
|
|
ww = rc_tmp1.w;
|
|
|
|
hh = rc_tmp1.h;
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
if (ww < 1) ww = 1;
|
|
|
|
if (hh < 1) hh = 1;
|
|
|
|
if (sd->cursor)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(sd->cursor, EINA_RECT(off.x + xx, off.y + yy, ww, hh));
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
if (sd->cursor_bidi)
|
|
|
|
{
|
|
|
|
if (bidi_cursor)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(sd->cursor_bidi,
|
|
|
|
EINA_RECT(off.x + rc_tmp2.x, off.y + rc_tmp2.y + (hh / 2),
|
|
|
|
ww, hh / 2));
|
|
|
|
efl_gfx_entity_size_set(sd->cursor, EINA_SIZE2D(ww, hh / 2));
|
|
|
|
efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
if (sd->cursor_update)
|
|
|
|
{
|
|
|
|
sd->cursor_update = EINA_FALSE;
|
|
|
|
_cursor_geometry_recalc(obj);
|
|
|
|
}
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2017-06-07 22:50:14 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_clear_text_selection(Efl_Ui_Textbox_Data *sd)
|
2017-06-07 22:50:14 -07:00
|
|
|
{
|
|
|
|
Efl_Ui_Text_Rectangle *r;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(sd->sel, r)
|
|
|
|
{
|
|
|
|
free(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
static void
|
|
|
|
_update_text_selection(Eo *obj, Eo *text_obj)
|
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Position2D off;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *sel_start, *sel_end;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
Eina_List *l;
|
|
|
|
Eina_Iterator *range;
|
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
Eina_Rectangle *r;
|
|
|
|
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
2016-06-22 10:02:32 -07:00
|
|
|
if (!sd->deferred_decoration_selection) return;
|
|
|
|
sd->deferred_decoration_selection = EINA_FALSE;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
off = _decoration_calc_offset(sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
range = efl_text_cursor_range_geometry_get(sel_start, sel_end);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2016-10-05 07:10:20 -07:00
|
|
|
l = sd->sel;
|
2016-06-08 08:37:35 -07:00
|
|
|
EINA_ITERATOR_FOREACH(range, r)
|
|
|
|
{
|
|
|
|
/* Create if there isn't a rectangle to populate. */
|
|
|
|
if (!l)
|
|
|
|
{
|
|
|
|
rect = calloc(1, sizeof(Efl_Ui_Text_Rectangle));
|
2016-10-05 07:10:20 -07:00
|
|
|
sd->sel = eina_list_append(sd->sel, rect);
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-11-14 03:38:49 -08:00
|
|
|
rect->obj_bg = _decoration_create(obj, sd, PART_NAME_SELECTION, EINA_FALSE);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_visible_set(rect->obj_bg, EINA_TRUE);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rect = eina_list_data_get(l);
|
|
|
|
l = l->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rect->obj_bg)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(rect->obj_bg, EINA_RECT(off.x + r->x, off.y + r->y,
|
|
|
|
r->w, r->h));
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(range);
|
|
|
|
|
|
|
|
/* delete redundant rectection rects */
|
|
|
|
while (l)
|
|
|
|
{
|
|
|
|
Eina_List *temp = l->next;
|
|
|
|
rect = eina_list_data_get(l);
|
|
|
|
if (rect)
|
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
if (rect->obj_bg) efl_del(rect->obj_bg);
|
2016-06-08 08:37:35 -07:00
|
|
|
free(rect);
|
|
|
|
}
|
2016-10-05 07:10:20 -07:00
|
|
|
sd->sel = eina_list_remove_list(sd->sel, l);
|
2016-06-08 08:37:35 -07:00
|
|
|
l = temp;
|
|
|
|
}
|
2016-07-10 09:52:14 -07:00
|
|
|
|
|
|
|
/* Update selection handlers */
|
|
|
|
_update_selection_handler(obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2016-06-22 05:12:15 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_anchors_free(Efl_Ui_Textbox_Data *sd)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Anchor *an;
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
EINA_LIST_FREE(sd->anchors, an)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
EINA_LIST_FREE(an->rects, rect)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
free(rect);
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
|
|
|
free(an->name);
|
|
|
|
free(an);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_anchor_format_parse(const char *item)
|
|
|
|
{
|
|
|
|
const char *start, *end;
|
|
|
|
char *tmp;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
start = strchr(item, '=');
|
|
|
|
if (!start) return NULL;
|
|
|
|
|
|
|
|
start++; /* Advance after the '=' */
|
|
|
|
/* If we can find a quote as the first non-space char,
|
|
|
|
* our new delimiter is a quote, not a space. */
|
|
|
|
while (*start == ' ')
|
|
|
|
start++;
|
|
|
|
|
|
|
|
if (*start == '\'')
|
|
|
|
{
|
|
|
|
start++;
|
|
|
|
end = strchr(start, '\'');
|
|
|
|
while ((end) && (end > start) && (end[-1] == '\\'))
|
|
|
|
end = strchr(end + 1, '\'');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end = strchr(start, ' ');
|
|
|
|
while ((end) && (end > start) && (end[-1] == '\\'))
|
|
|
|
end = strchr(end + 1, ' ');
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Null terminate before the spaces */
|
|
|
|
if (end) len = end - start;
|
|
|
|
else len = strlen(start);
|
|
|
|
|
|
|
|
tmp = malloc(len + 1);
|
|
|
|
strncpy(tmp, start, len);
|
|
|
|
tmp[len] = '\0';
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
static Anchor *
|
2019-12-10 16:47:50 -08:00
|
|
|
_anchor_get(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Text_Attribute_Handle *an)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2019-02-27 11:00:14 -08:00
|
|
|
Anchor *anc;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_List *i;
|
|
|
|
const char *str;
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
str = efl_text_formatter_attribute_get(an);
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
EINA_LIST_FOREACH(sd->anchors, i, anc)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
if (anc->annotation == an) break;
|
|
|
|
}
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
if (!anc && (efl_text_formatter_attribute_is_item(an) || !strncmp(str, "a ", 2)))
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
const char *p;
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
anc = calloc(1, sizeof(Anchor));
|
|
|
|
if (anc)
|
2016-10-05 07:10:20 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
anc->obj = obj;
|
|
|
|
anc->annotation = an;
|
2019-12-20 03:35:13 -08:00
|
|
|
anc->item = efl_text_formatter_attribute_is_item(an);
|
2018-09-13 02:45:29 -07:00
|
|
|
p = strstr(str, "href=");
|
2016-10-05 07:10:20 -07:00
|
|
|
if (p)
|
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
anc->name = _anchor_format_parse(p);
|
2016-10-05 07:10:20 -07:00
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->anchors = eina_list_append(sd->anchors, anc);
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
|
|
|
}
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
return anc;
|
2016-10-05 07:10:20 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Recreates and updates the anchors in the text.
|
|
|
|
*/
|
2016-06-22 05:12:15 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
|
|
|
Evas_Object *smart, *clip;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_Position2D off;
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
Efl_Text_Cursor *start, *end;
|
Efl.Text.Attribute_Factory
Summary:
Implementation of new Efl.Text.Attribute_Factory class which replace the annotation interface.
Currently, we have two public methods:
```
void efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
unsigned int efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
```
Other methods will be internal methods, for the time being, we will redesign internal methods
Reviewers: woohyun, tasn, segfaultxavi, bu5hm4n, zmike
Subscribers: zmike, q66, cedric, segfaultxavi, bu5hm4n, a.srour, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10646
2019-11-26 20:04:31 -08:00
|
|
|
Efl_Text_Attribute_Handle *an;
|
2018-09-13 02:45:29 -07:00
|
|
|
Eina_List *i, *ii;
|
|
|
|
Anchor *anc;
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2016-06-22 10:02:32 -07:00
|
|
|
if (!sd->deferred_decoration_anchor) return;
|
|
|
|
sd->deferred_decoration_anchor = EINA_FALSE;
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->gen++;
|
2017-09-09 03:21:06 -07:00
|
|
|
|
2019-12-10 00:39:59 -08:00
|
|
|
start = efl_canvas_textblock_cursor_create(sd->text_obj);
|
|
|
|
end = efl_canvas_textblock_cursor_create(sd->text_obj);
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
/* Retrieve all annotations in the text. */
|
2019-12-09 01:49:13 -08:00
|
|
|
efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
|
|
|
|
efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2019-12-20 03:35:13 -08:00
|
|
|
it = efl_text_formatter_range_attributes_get(start, end);
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
efl_del(start);
|
|
|
|
efl_del(end);
|
2017-09-19 10:16:59 -07:00
|
|
|
|
2020-01-28 08:54:32 -08:00
|
|
|
smart = efl_canvas_object_render_parent_get(obj);
|
|
|
|
clip = efl_canvas_object_clipper_get(sd->text_obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
off = _decoration_calc_offset(sd);
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, an)
|
|
|
|
{
|
|
|
|
anc = _anchor_get(obj, sd, an);
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
if (anc)
|
|
|
|
{
|
|
|
|
anc->gen = sd->gen;
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
if (anc->item)
|
2016-10-05 07:10:20 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
Evas_Coord cx, cy, cw, ch;
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
// Item anchor (one rectangle)
|
|
|
|
if (!anc->rects)
|
2016-10-05 07:10:20 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *ob;
|
|
|
|
|
|
|
|
rect = calloc(1, sizeof(Efl_Ui_Text_Rectangle));
|
|
|
|
anc->rects = eina_list_append(anc->rects, rect);
|
|
|
|
|
|
|
|
ob = _item_get(obj, anc->name);
|
|
|
|
|
|
|
|
if (ob)
|
|
|
|
{
|
|
|
|
efl_canvas_group_member_add(smart, ob);
|
|
|
|
efl_gfx_stack_above(ob, obj);
|
2019-02-27 10:17:37 -08:00
|
|
|
efl_canvas_object_clipper_set(ob, clip);
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_canvas_object_pass_events_set(ob, EINA_TRUE);
|
|
|
|
rect->obj = ob;
|
|
|
|
}
|
2016-10-05 07:10:20 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
rect = eina_list_data_get(anc->rects);
|
2019-12-20 03:35:13 -08:00
|
|
|
efl_text_formatter_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch);
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_gfx_entity_size_set(rect->obj, EINA_SIZE2D(cw, ch));
|
|
|
|
efl_gfx_entity_position_set(rect->obj,
|
|
|
|
EINA_POSITION2D(off.x + cx, off.y + cy));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Link anchor (multiple rectangles) i.e. "a href=..."
|
|
|
|
Eina_Iterator *range;
|
|
|
|
Eina_List *l;
|
|
|
|
Eina_Rectangle *r;
|
|
|
|
size_t count;
|
2019-12-10 16:47:50 -08:00
|
|
|
start = efl_ui_textbox_cursor_create(obj);
|
|
|
|
end = efl_ui_textbox_cursor_create(obj);
|
2019-12-20 03:35:13 -08:00
|
|
|
efl_text_formatter_attribute_cursors_get(anc->annotation, start, end);
|
2018-09-13 02:45:29 -07:00
|
|
|
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
range = efl_text_cursor_range_geometry_get(start, end);
|
2018-09-13 02:45:29 -07:00
|
|
|
count = eina_list_count(eina_iterator_container_get(range));
|
|
|
|
|
|
|
|
// Add additional rectangles if needed
|
|
|
|
while (count > eina_list_count(anc->rects))
|
2016-10-05 07:10:20 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
Eo *ob;
|
2016-10-05 07:10:20 -07:00
|
|
|
rect = calloc(1, sizeof(Efl_Ui_Text_Rectangle));
|
2018-09-13 02:45:29 -07:00
|
|
|
anc->rects = eina_list_append(anc->rects, rect);
|
2016-10-05 07:10:20 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
ob = _decoration_create(obj, sd, PART_NAME_ANCHOR, EINA_TRUE);
|
2016-10-05 07:10:20 -07:00
|
|
|
rect->obj_fg = ob;
|
2018-09-13 02:45:29 -07:00
|
|
|
// hit-rectangle
|
2020-01-28 08:54:32 -08:00
|
|
|
ob = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj);
|
|
|
|
efl_gfx_color_set(ob, 0, 0, 0, 0);
|
|
|
|
efl_canvas_group_member_add(smart, ob);
|
|
|
|
efl_gfx_stack_above(ob, obj);
|
2019-12-29 17:31:32 -08:00
|
|
|
efl_canvas_object_clipper_set(ob, clip);
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_canvas_object_repeat_events_set(ob, EINA_TRUE);
|
2016-10-05 07:10:20 -07:00
|
|
|
rect->obj = ob;
|
2018-09-13 02:45:29 -07:00
|
|
|
//FIXME: add event handlers
|
2016-10-05 07:10:20 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
// Remove extra rectangles if needed
|
|
|
|
while (count < eina_list_count(anc->rects))
|
2016-10-05 07:10:20 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
rect = eina_list_data_get(anc->rects);
|
|
|
|
if (rect->obj) efl_del(rect->obj);
|
|
|
|
if (rect->obj_fg) efl_del(rect->obj_fg);
|
|
|
|
if (rect->obj_bg) efl_del(rect->obj_bg);
|
|
|
|
free(rect);
|
|
|
|
anc->rects = eina_list_remove_list(anc->rects, anc->rects);
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
|
|
|
|
l = anc->rects;
|
|
|
|
EINA_ITERATOR_FOREACH(range, r)
|
2016-06-22 05:12:15 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
|
|
|
|
rect = eina_list_data_get(l);
|
|
|
|
if (rect->obj_bg)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(rect->obj_bg,
|
|
|
|
EINA_RECT(off.x + r->x, off.y + r->y,
|
|
|
|
r->w, r->h));
|
|
|
|
efl_gfx_entity_visible_set(rect->obj_bg, EINA_TRUE);
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
|
|
|
if (rect->obj_fg)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(rect->obj_fg,
|
|
|
|
EINA_RECT(off.x + r->x, off.y + r->y,
|
|
|
|
r->w, r->h));
|
|
|
|
efl_gfx_entity_visible_set(rect->obj_fg, EINA_TRUE);
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
|
|
|
if (rect->obj)
|
|
|
|
{
|
2020-01-28 08:54:32 -08:00
|
|
|
efl_gfx_entity_geometry_set(rect->obj,
|
|
|
|
EINA_RECT(off.x + r->x, off.y + r->y,
|
|
|
|
r->w, r->h));
|
|
|
|
efl_gfx_entity_visible_set(rect->obj, EINA_TRUE);
|
2018-09-13 02:45:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
l = eina_list_next(l);
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
eina_iterator_free(range);
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-13 02:45:29 -07:00
|
|
|
eina_iterator_free(it);
|
2016-06-22 05:12:15 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
// Remove anchors that weren't matched to any annotation
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->anchors, i, ii, anc)
|
|
|
|
{
|
|
|
|
if (anc->gen != sd->gen)
|
|
|
|
{
|
|
|
|
Efl_Ui_Text_Rectangle *rect;
|
|
|
|
sd->anchors = eina_list_remove_list(sd->anchors, i);
|
|
|
|
EINA_LIST_FREE(anc->rects, rect)
|
|
|
|
{
|
|
|
|
efl_del(rect->obj);
|
|
|
|
efl_del(rect->obj_bg);
|
|
|
|
efl_del(rect->obj_fg);
|
|
|
|
free(rect);
|
|
|
|
}
|
|
|
|
free(anc->name);
|
|
|
|
free(anc);
|
|
|
|
}
|
|
|
|
}
|
2016-06-22 05:12:15 -07:00
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
static void
|
|
|
|
_update_decorations(Eo *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *text_obj = sd->text_obj;
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_event_freeze(sd->text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
_update_text_cursors(obj);
|
|
|
|
_update_text_selection(obj, text_obj);
|
2016-06-22 05:12:15 -07:00
|
|
|
_anchors_update(obj, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
efl_event_thaw(sd->text_obj);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-28 08:36:52 -08:00
|
|
|
static Eina_Value
|
|
|
|
_deferred_decoration_job(Eo *o, void *data EINA_UNUSED, const Eina_Value value EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2020-01-28 08:36:52 -08:00
|
|
|
EFL_UI_TEXT_DATA_GET(o, sd);
|
|
|
|
_update_decorations(o);
|
2017-09-11 22:38:51 -07:00
|
|
|
sd->deferred_decoration_job = NULL;
|
2020-01-28 08:36:52 -08:00
|
|
|
|
|
|
|
return EINA_VALUE_EMPTY;
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2016-06-22 10:02:32 -07:00
|
|
|
static void
|
|
|
|
_decoration_defer(Eo *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
2020-01-28 08:36:52 -08:00
|
|
|
if (sd->deferred_decoration_job) return;
|
|
|
|
|
|
|
|
Eina_Future *f = efl_loop_job(efl_main_loop_get());
|
|
|
|
sd->deferred_decoration_job = efl_future_then(obj, f, _deferred_decoration_job);
|
2016-06-22 10:02:32 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_selection_defer(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
2018-09-13 02:45:29 -07:00
|
|
|
{
|
|
|
|
sd->deferred_decoration_selection = EINA_TRUE;
|
|
|
|
_decoration_defer(obj);
|
|
|
|
}
|
|
|
|
|
2016-06-22 10:02:32 -07:00
|
|
|
static void
|
|
|
|
_decoration_defer_all(Eo *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
sd->deferred_decoration_anchor = EINA_TRUE;
|
|
|
|
sd->deferred_decoration_cursor = EINA_TRUE;
|
|
|
|
sd->deferred_decoration_selection = EINA_TRUE;
|
|
|
|
_decoration_defer(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_changed_cb(void *data, const Efl_Event *event)
|
2016-06-22 10:02:32 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
|
|
|
sd->text_changed = EINA_TRUE;
|
|
|
|
sd->cursor_update = EINA_TRUE;
|
2018-11-12 05:09:56 -08:00
|
|
|
_update_guide_text(data, sd);
|
2019-12-10 16:47:50 -08:00
|
|
|
efl_event_callback_call(data, EFL_UI_TEXTBOX_EVENT_CHANGED, NULL);
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(data);
|
2018-09-13 02:45:29 -07:00
|
|
|
_decoration_defer(data);
|
2016-06-22 10:02:32 -07:00
|
|
|
}
|
|
|
|
|
2017-12-12 22:05:15 -08:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_changed_user_cb(void *data, const Efl_Event *event)
|
2017-12-12 22:05:15 -08:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
Eo *obj = data;
|
|
|
|
|
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
sd->text_changed = EINA_TRUE;
|
2018-11-12 05:09:56 -08:00
|
|
|
_update_guide_text(data, sd);
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
_decoration_defer_all(obj);
|
2017-12-12 22:05:15 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_cursor_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
if (efl_invalidated_get(event->object)) return;
|
2016-06-22 10:02:32 -07:00
|
|
|
EFL_UI_TEXT_DATA_GET(data, sd);
|
2018-09-13 02:45:29 -07:00
|
|
|
sd->cursor_update = EINA_TRUE;
|
2017-09-11 22:38:51 -07:00
|
|
|
sd->deferred_decoration_cursor = EINA_TRUE;
|
|
|
|
_decoration_defer(data);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2018-09-13 02:45:29 -07:00
|
|
|
static void
|
|
|
|
_scroller_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
|
|
|
|
_decoration_defer_all(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_text_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
|
|
|
|
_decoration_defer_all(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
|
|
|
|
_decoration_defer_all(data);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_start_clear_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2018-09-13 02:45:29 -07:00
|
|
|
if (efl_invalidated_get(event->object)) return;
|
2016-06-28 05:24:35 -07:00
|
|
|
Eo *obj = data;
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_text_interactive_have_selection_get(data))
|
2016-06-28 05:24:35 -07:00
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
_edje_signal_emit(sd, "selection,start", "efl.text");
|
|
|
|
_selection_defer(obj, sd);
|
2016-06-28 05:24:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
Eo *obj = data;
|
|
|
|
_edje_signal_emit(sd, "selection,cleared", "efl.text");
|
|
|
|
_selection_defer(obj, sd);
|
2016-06-28 05:24:35 -07:00
|
|
|
}
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_selection_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
Efl.Ui.Text : all related interfaces
Summary:
Change summary:
Removed :
- efl_ui_text_selectable.eo and add it functionality into efl_text_interactive.eo
- efl_ui_text_editable.eo because it is same as efl_ui_text.eo (just set one property by default)
Modifications:
- Move all Text Input enums and functionality from efl_ui_text class into its own interface, this interface will be implemented at efl_ui_internal_text_interactive class.
- Rename selection_allowed property to selectable (same as other "editable" property) in efl_text_interactive
- Add select_all function into efl_text_interactive interface
- Add have_selection property into efl_text_interactive interface
- Move user_change , selection_start/change/clear and undo/redo events into efl_text_interactive interface.
- Move methods and events of copy/paste/cut into efl_ui_text
- Fix password-related functionality
- Remove context menu clear and add_item methods. (these should be added later with better design)
- Remove Validation event from EFL_UI_TEXT. (these should be added later with better design)
Reviewers: woohyun, tasn, segfaultxavi, zmike, bu5hm4n
Subscribers: stefan_schmidt, a.srour, q66, zmike, segfaultxavi, cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10711
2019-12-08 17:58:39 -08:00
|
|
|
{
|
|
|
|
if (efl_invalidated_get(event->object)) return;
|
|
|
|
Eo *obj = data;
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
|
|
|
_edje_signal_emit(sd, "selection,changed", "efl.text");
|
|
|
|
_selection_store(EFL_UI_SELECTION_TYPE_PRIMARY, obj);
|
2018-09-13 02:45:29 -07:00
|
|
|
_selection_defer(obj, sd);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-01-28 08:54:32 -08:00
|
|
|
_efl_ui_textbox_move_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-06-08 08:37:35 -07:00
|
|
|
{
|
2016-06-22 10:02:32 -07:00
|
|
|
_decoration_defer_all(data);
|
2016-06-08 08:37:35 -07:00
|
|
|
}
|
|
|
|
|
2017-11-09 07:53:20 -08:00
|
|
|
static void
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_item_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd,
|
2019-12-10 00:39:59 -08:00
|
|
|
Efl_Canvas_Textblock_Factory *item_factory)
|
2017-11-09 07:53:20 -08:00
|
|
|
{
|
|
|
|
if (pd->item_factory) efl_unref(pd->item_factory);
|
|
|
|
pd->item_factory = efl_ref(item_factory);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eo *
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_item_factory_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd)
|
2017-11-09 07:53:20 -08:00
|
|
|
{
|
|
|
|
return pd->item_factory;
|
|
|
|
}
|
|
|
|
|
2016-06-08 08:37:35 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_efl_ui_textbox_text_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd,
|
2018-11-12 08:57:24 -08:00
|
|
|
const char *part, const char *text)
|
|
|
|
{
|
2020-01-28 09:04:51 -08:00
|
|
|
if (!part) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!strcmp("efl.text_guide", part))
|
2018-11-12 08:57:24 -08:00
|
|
|
{
|
|
|
|
efl_text_set(pd->text_guide_obj, text);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2020-01-28 09:04:51 -08:00
|
|
|
else if (!strcmp("efl.text", part))
|
2018-11-12 08:57:24 -08:00
|
|
|
{
|
|
|
|
efl_text_set(pd->text_obj, text);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
static const char *
|
|
|
|
_efl_ui_textbox_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd,
|
2018-11-12 08:57:24 -08:00
|
|
|
const char *part)
|
|
|
|
{
|
2020-01-28 09:04:51 -08:00
|
|
|
if (!part) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!strcmp("efl.text_guide", part))
|
2018-11-12 08:57:24 -08:00
|
|
|
{
|
|
|
|
return efl_text_get(pd->text_guide_obj);
|
|
|
|
}
|
2020-01-28 09:04:51 -08:00
|
|
|
else if (!strcmp("efl.text", part))
|
2018-11-12 08:57:24 -08:00
|
|
|
{
|
|
|
|
return efl_text_get(pd->text_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-05-15 01:23:32 -07:00
|
|
|
static Eina_Bool
|
2020-01-15 23:47:23 -08:00
|
|
|
_part_is_efl_ui_textbox_part(const Eo *obj EINA_UNUSED, const char *part)
|
2019-05-15 01:23:32 -07:00
|
|
|
{
|
2020-01-16 02:19:08 -08:00
|
|
|
if (eina_streq(part, "efl.text_guide") || eina_streq(part, "efl.text"))
|
|
|
|
return EINA_TRUE;
|
2019-05-15 01:23:32 -07:00
|
|
|
|
2020-01-16 02:19:08 -08:00
|
|
|
return EINA_FALSE;
|
2019-05-15 01:23:32 -07:00
|
|
|
}
|
|
|
|
|
2020-02-02 06:07:45 -08:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_textbox, Efl_Ui_Textbox_Data)
|
|
|
|
|
2020-01-15 23:47:23 -08:00
|
|
|
ELM_PART_OVERRIDE_PARTIAL(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data, _part_is_efl_ui_textbox_part)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data)
|
2019-12-10 16:47:50 -08:00
|
|
|
|
2020-01-15 23:47:23 -08:00
|
|
|
#include "efl_ui_textbox_part.eo.c"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2019-09-23 10:24:51 -07:00
|
|
|
//EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2017-07-27 23:35:10 -07:00
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
#include "efl_ui_textbox.eo.c"
|
2016-06-08 08:37:35 -07:00
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
EOLIAN static Eo *
|
2019-12-10 16:47:50 -08:00
|
|
|
_efl_ui_textbox_async_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
2017-09-11 22:38:51 -07:00
|
|
|
{
|
|
|
|
EFL_UI_TEXT_DATA_GET(obj, sd);
|
2017-12-06 00:33:03 -08:00
|
|
|
|
2017-09-11 22:38:51 -07:00
|
|
|
sd->async.enabled = EINA_TRUE;
|
|
|
|
|
2017-12-06 00:33:03 -08:00
|
|
|
// FIXME: should we have to keep this efl_ui_text_xxx classes?
|
|
|
|
// Then, going to make new theme for these classes? ex) efl/text_async?
|
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
|
|
|
elm_widget_theme_klass_set(obj, "text");
|
2019-12-10 16:47:50 -08:00
|
|
|
obj = efl_constructor(efl_super(obj, EFL_UI_TEXTBOX_ASYNC_CLASS));
|
2017-09-11 22:38:51 -07:00
|
|
|
|
2018-11-12 05:14:11 -08:00
|
|
|
_update_text_theme(obj, sd);
|
2017-12-06 00:33:03 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2017-09-11 22:38:51 -07:00
|
|
|
|
2019-12-10 16:47:50 -08:00
|
|
|
#include "efl_ui_textbox_async.eo.c"
|