Ui text: cleanup some port leftovers

This commit is contained in:
Daniel Hirt 2016-07-10 11:44:22 +00:00
parent 491b323d06
commit fe69830261
1 changed files with 12 additions and 136 deletions

View File

@ -323,24 +323,7 @@ _file_load(const char *file)
static char *
_plain_load(const char *file)
{
#if 0
char *text;
text = _file_load(file);
if (text)
{
char *text2;
text2 = efl_ui_text_utf8_to_markup(text);
free(text);
return text2;
}
return NULL;
#else
(void) file;
return NULL;
#endif
return _file_load(file);
}
static Eina_Bool
@ -358,37 +341,32 @@ _load_do(Evas_Object *obj)
switch (sd->format)
{
/* Only available format */
case ELM_TEXT_FORMAT_PLAIN_UTF8:
text = _plain_load(sd->file);
break;
case ELM_TEXT_FORMAT_MARKUP_UTF8:
text = _file_load(sd->file);
break;
text = _plain_load(sd->file);
break;
default:
text = NULL;
break;
text = NULL;
break;
}
if (text)
{
elm_object_text_set(obj, text);
efl_text_set(obj, text);
free(text);
return EINA_TRUE;
}
else
{
elm_object_text_set(obj, "");
efl_text_set(obj, "");
return EINA_FALSE;
}
}
static void
_utf8_markup_save(const char *file,
const char *text)
_text_save(const char *file,
const char *text)
{
FILE *f;
@ -410,25 +388,6 @@ _utf8_markup_save(const char *file,
fclose(f);
}
static void
_utf8_plain_save(const char *file,
const char *text)
{
#if 0
char *text2;
text2 = efl_ui_text_markup_to_utf8(text);
if (!text2)
return;
_utf8_markup_save(file, text2);
free(text2);
#else
(void) file;
(void) text;
#endif
}
static void
_save_do(Evas_Object *obj)
{
@ -437,14 +396,12 @@ _save_do(Evas_Object *obj)
if (!sd->file) return;
switch (sd->format)
{
/* Only supported format */
case ELM_TEXT_FORMAT_PLAIN_UTF8:
_utf8_plain_save(sd->file, elm_object_text_get(obj));
_text_save(sd->file, efl_text_get(obj));
break;
case ELM_TEXT_FORMAT_MARKUP_UTF8:
_utf8_markup_save(sd->file, elm_object_text_get(obj));
break;
default:
break;
}
@ -2690,87 +2647,6 @@ _text_append_idler(void *data)
}
}
#if 0
static void
_chars_add_till_limit(Evas_Object *obj,
char **text,
int can_add,
Length_Unit unit)
{
int i = 0, current_len = 0;
char *new_text;
if (!*text) return;
if (unit >= LENGTH_UNIT_LAST) return;
if (strstr(*text, "<preedit")) return;
new_text = *text;
current_len = strlen(*text);
while (*new_text)
{
int idx = 0, unit_size = 0;
char *markup, *utfstr;
if (*new_text == '<')
{
while (*(new_text + idx) != '>')
{
idx++;
if (!*(new_text + idx)) break;
}
}
else if (*new_text == '&')
{
while (*(new_text + idx) != ';')
{
idx++;
if (!*(new_text + idx)) break;
}
}
idx = evas_string_char_next_get(new_text, idx, NULL);
markup = malloc(idx + 1);
if (markup)
{
strncpy(markup, new_text, idx);
markup[idx] = 0;
utfstr = efl_ui_text_markup_to_utf8(markup);
if (utfstr)
{
if (unit == LENGTH_UNIT_BYTE)
unit_size = strlen(utfstr);
else if (unit == LENGTH_UNIT_CHAR)
unit_size = evas_string_char_len_get(utfstr);
ELM_SAFE_FREE(utfstr, free);
}
ELM_SAFE_FREE(markup, free);
}
if (can_add < unit_size)
{
if (!i)
{
eo_event_callback_call
(obj, EFL_UI_TEXT_EVENT_MAXLENGTH_REACHED, NULL);
ELM_SAFE_FREE(*text, free);
return;
}
can_add = 0;
strncpy(new_text, new_text + idx,
current_len - ((new_text + idx) - *text));
current_len -= idx;
(*text)[current_len] = 0;
}
else
{
new_text += idx;
can_add -= unit_size;
}
i++;
}
eo_event_callback_call(obj, EFL_UI_TEXT_EVENT_MAXLENGTH_REACHED, NULL);
}
#endif
EOLIAN static void
_efl_ui_text_edje_object_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source)
{