forked from enlightenment/efl
elementary ui_textpath: remove autofit api.
Toggling this option is unlikely happened by user because with autofit=false, it doesn't gurantee readable visual text. We don't need this stupid api yet. So remove it.
This commit is contained in:
parent
8d249c9445
commit
d1cce82565
|
@ -15,13 +15,6 @@
|
||||||
static Evas_Object *angle_sld, *slice_sld, *dir_chk;
|
static Evas_Object *angle_sld, *slice_sld, *dir_chk;
|
||||||
static int path_type;
|
static int path_type;
|
||||||
|
|
||||||
static void
|
|
||||||
_autofit_changed_cb(void *data, const Efl_Event *event)
|
|
||||||
{
|
|
||||||
Evas_Object *txtpath = data;
|
|
||||||
efl_ui_textpath_autofit_set(txtpath, elm_check_state_get(event->object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ellipsis_changed_cb(void *data, const Efl_Event *event)
|
_ellipsis_changed_cb(void *data, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +105,6 @@ test_ui_textpath(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
||||||
|
|
||||||
txtpath = efl_add(EFL_UI_TEXTPATH_CLASS, win);
|
txtpath = efl_add(EFL_UI_TEXTPATH_CLASS, win);
|
||||||
elm_box_pack_end(box, txtpath);
|
elm_box_pack_end(box, txtpath);
|
||||||
efl_ui_textpath_autofit_set(txtpath, EINA_TRUE);
|
|
||||||
|
|
||||||
efl_text_set(txtpath, TEST_UI_TEXTPATH_LONG_TEXT);
|
efl_text_set(txtpath, TEST_UI_TEXTPATH_LONG_TEXT);
|
||||||
|
|
||||||
|
@ -127,13 +119,6 @@ test_ui_textpath(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
||||||
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
|
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
|
||||||
elm_box_pack_end(box, hbox);
|
elm_box_pack_end(box, hbox);
|
||||||
|
|
||||||
chk = elm_check_add(win);
|
|
||||||
elm_object_text_set(chk, "Autofit");
|
|
||||||
elm_check_state_set(chk, efl_ui_textpath_autofit_get(txtpath));
|
|
||||||
efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_CHANGED, _autofit_changed_cb, txtpath);
|
|
||||||
elm_box_pack_end(hbox, chk);
|
|
||||||
efl_gfx_entity_visible_set(chk, EINA_TRUE);
|
|
||||||
|
|
||||||
chk = elm_check_add(win);
|
chk = elm_check_add(win);
|
||||||
elm_object_text_set(chk, "Ellipsis");
|
elm_object_text_set(chk, "Ellipsis");
|
||||||
elm_check_state_set(chk, efl_ui_textpath_ellipsis_get(txtpath));
|
elm_check_state_set(chk, efl_ui_textpath_ellipsis_get(txtpath));
|
||||||
|
|
|
@ -63,7 +63,6 @@ struct _Efl_Ui_Textpath_Data
|
||||||
} circle;
|
} circle;
|
||||||
Efl_Ui_Textpath_Direction direction;
|
Efl_Ui_Textpath_Direction direction;
|
||||||
int slice_no;
|
int slice_no;
|
||||||
Eina_Bool autofit;
|
|
||||||
Eina_Bool ellipsis;
|
Eina_Bool ellipsis;
|
||||||
|
|
||||||
Eina_Inlist *segments;
|
Eina_Inlist *segments;
|
||||||
|
@ -329,10 +328,7 @@ _text_draw(Efl_Ui_Textpath_Data *pd)
|
||||||
last_x1 = last_y1 = last_x2 = last_y2 = 0;
|
last_x1 = last_y1 = last_x2 = last_y2 = 0;
|
||||||
|
|
||||||
sz = efl_gfx_entity_size_get(pd->text_obj);
|
sz = efl_gfx_entity_size_get(pd->text_obj);
|
||||||
if (pd->autofit)
|
remained_w = sz.w;
|
||||||
remained_w = sz.w;
|
|
||||||
else
|
|
||||||
remained_w = pd->total_length;
|
|
||||||
|
|
||||||
map_point_no = _map_point_calc(pd);
|
map_point_no = _map_point_calc(pd);
|
||||||
if (map_point_no == 0)
|
if (map_point_no == 0)
|
||||||
|
@ -353,8 +349,6 @@ _text_draw(Efl_Ui_Textpath_Data *pd)
|
||||||
EINA_INLIST_FOREACH(pd->segments, seg)
|
EINA_INLIST_FOREACH(pd->segments, seg)
|
||||||
{
|
{
|
||||||
int len = seg->length;
|
int len = seg->length;
|
||||||
if (!pd->autofit)
|
|
||||||
len = (double)seg->length * sz.w / (double)pd->total_length;
|
|
||||||
if (remained_w <= 0)
|
if (remained_w <= 0)
|
||||||
break;
|
break;
|
||||||
w2 = w1 + len;
|
w2 = w1 + len;
|
||||||
|
@ -372,10 +366,7 @@ _text_draw(Efl_Ui_Textpath_Data *pd)
|
||||||
|
|
||||||
slice_value = pd->slice_no * seg->length / (double)pd->total_length;
|
slice_value = pd->slice_no * seg->length / (double)pd->total_length;
|
||||||
dt = (double)pd->total_length / (pd->slice_no * seg->length);
|
dt = (double)pd->total_length / (pd->slice_no * seg->length);
|
||||||
if (pd->autofit)
|
dist = (double)pd->total_length / (double)pd->slice_no;
|
||||||
dist = (double)pd->total_length / (double)pd->slice_no;
|
|
||||||
else
|
|
||||||
dist = (double)pd->total_length * (w2 - w1) / ((double)pd->slice_no * seg->length);
|
|
||||||
|
|
||||||
slice_no = (int)ceil(slice_value);
|
slice_no = (int)ceil(slice_value);
|
||||||
dt = (double)slice_value * dt / (double)slice_no;
|
dt = (double)slice_value * dt / (double)slice_no;
|
||||||
|
@ -606,7 +597,6 @@ EOLIAN static Efl_Object *
|
||||||
_efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
|
_efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
|
||||||
{
|
{
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
pd->autofit = EINA_TRUE;
|
|
||||||
pd->slice_no = SLICE_DEFAULT_NO;
|
pd->slice_no = SLICE_DEFAULT_NO;
|
||||||
pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW;
|
pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW;
|
||||||
|
|
||||||
|
@ -721,20 +711,6 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double
|
||||||
_sizing_eval(pd);
|
_sizing_eval(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
|
||||||
_efl_ui_textpath_autofit_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
|
|
||||||
{
|
|
||||||
return pd->autofit;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_textpath_autofit_set(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, Eina_Bool autofit)
|
|
||||||
{
|
|
||||||
if (pd->autofit == autofit) return;
|
|
||||||
pd->autofit = autofit;
|
|
||||||
_sizing_eval(pd);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
_efl_ui_textpath_slice_number_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
|
_efl_ui_textpath_slice_number_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,15 +18,6 @@ class Efl.Ui.Textpath (Efl.Ui.Layout.Object, Efl.Object, Efl.Text, Efl.Gfx.Path)
|
||||||
@in direction: Efl.Ui.Textpath_Direction; [[Textpath direction]]
|
@in direction: Efl.Ui.Textpath_Direction; [[Textpath direction]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property autofit {
|
|
||||||
[[The ability to fit the text within the path.
|
|
||||||
Set it to $true to let text occupy only portion
|
|
||||||
same as its size. Otherwise, text will occupied the whole path.
|
|
||||||
By default, it is $true.]]
|
|
||||||
values {
|
|
||||||
autofit: bool; [[Autofit enabled if $true, $false otherwise]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property slice_number {
|
@property slice_number {
|
||||||
[[The number of slices. The larger the number of slice_num is,
|
[[The number of slices. The larger the number of slice_num is,
|
||||||
The better the text follows the path.]]
|
The better the text follows the path.]]
|
||||||
|
|
Loading…
Reference in New Issue