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:
Hermet Park 2018-05-28 15:21:22 +09:00
parent 8d249c9445
commit d1cce82565
3 changed files with 2 additions and 50 deletions

View File

@ -15,13 +15,6 @@
static Evas_Object *angle_sld, *slice_sld, *dir_chk;
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
_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);
elm_box_pack_end(box, txtpath);
efl_ui_textpath_autofit_set(txtpath, EINA_TRUE);
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);
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);
elm_object_text_set(chk, "Ellipsis");
elm_check_state_set(chk, efl_ui_textpath_ellipsis_get(txtpath));

View File

@ -63,7 +63,6 @@ struct _Efl_Ui_Textpath_Data
} circle;
Efl_Ui_Textpath_Direction direction;
int slice_no;
Eina_Bool autofit;
Eina_Bool ellipsis;
Eina_Inlist *segments;
@ -329,10 +328,7 @@ _text_draw(Efl_Ui_Textpath_Data *pd)
last_x1 = last_y1 = last_x2 = last_y2 = 0;
sz = efl_gfx_entity_size_get(pd->text_obj);
if (pd->autofit)
remained_w = sz.w;
else
remained_w = pd->total_length;
remained_w = sz.w;
map_point_no = _map_point_calc(pd);
if (map_point_no == 0)
@ -353,8 +349,6 @@ _text_draw(Efl_Ui_Textpath_Data *pd)
EINA_INLIST_FOREACH(pd->segments, seg)
{
int len = seg->length;
if (!pd->autofit)
len = (double)seg->length * sz.w / (double)pd->total_length;
if (remained_w <= 0)
break;
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;
dt = (double)pd->total_length / (pd->slice_no * seg->length);
if (pd->autofit)
dist = (double)pd->total_length / (double)pd->slice_no;
else
dist = (double)pd->total_length * (w2 - w1) / ((double)pd->slice_no * seg->length);
dist = (double)pd->total_length / (double)pd->slice_no;
slice_no = (int)ceil(slice_value);
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)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
pd->autofit = EINA_TRUE;
pd->slice_no = SLICE_DEFAULT_NO;
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);
}
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
_efl_ui_textpath_slice_number_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
{

View File

@ -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]]
}
}
@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 {
[[The number of slices. The larger the number of slice_num is,
The better the text follows the path.]]