hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=e4896f1090dac0113a66f550331fc8e35a44b5d8
commit e4896f1090dac0113a66f550331fc8e35a44b5d8 Author: Hermet Park <[email protected]> Date: Sat Jul 2 17:32:11 2016 +0900 multi-file: ++implementation. Now it works on search/replace. API changes. Below object APIs replaced with item APIs. enventor_object_text_get() enventor_object_text_insert() enventor_object_selection_get() enventor_object_cursor_pos_get() enventor_object_cursor_pos_set() enventor_object_select_none() enventor_object_select_region_set() enventor_object_syntax_color_partial_apply() enventor_object_syntax_color_full_apply() --- src/bin/console.c | 14 ++--- src/bin/edc_navigator.c | 44 +++++++------- src/bin/file_mgr.c | 12 +++- src/bin/goto.c | 6 +- src/bin/main.c | 16 ++++- src/bin/search.c | 80 +++++++++++++++---------- src/include/file_mgr.h | 1 + src/include/search.h | 1 + src/lib/Enventor_Legacy.h | 9 +++ src/lib/edc_editor.c | 30 ++++++++++ src/lib/enventor_object.eo | 37 ------------ src/lib/enventor_private.h | 6 +- src/lib/enventor_smart.c | 143 +++++++++++++++++++++++---------------------- 13 files changed, 218 insertions(+), 181 deletions(-) diff --git a/src/bin/console.c b/src/bin/console.c index 63ec6a9..8ad5e69 100644 --- a/src/bin/console.c +++ b/src/bin/console.c @@ -37,17 +37,15 @@ error_word_select(Evas_Object *console) token_value_get(error_token, "name", '\0', 1, error_word); else return; - //find error word position - const char *entry_text = enventor_object_text_get(base_enventor_get()); - char *utf8 = elm_entry_markup_to_utf8(entry_text); - //FIXME: Need to get the file that contains errors. - Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get()); + Enventor_Item *it = file_mgr_focused_item_get(); EINA_SAFETY_ON_NULL_RETURN(it); + //find error word position enventor_item_line_goto(it, atoi(error_line)); - int pos = enventor_object_cursor_pos_get(base_enventor_get()); - + int pos = enventor_item_cursor_pos_get(it); + const char *entry_text = enventor_item_text_get(it); + char *utf8 = elm_entry_markup_to_utf8(entry_text); const char *search_line = utf8 + pos * sizeof(char); const char *matched = strstr(search_line, error_word); @@ -64,7 +62,7 @@ error_word_select(Evas_Object *console) free(utf8); //select error word - enventor_object_select_region_set(base_enventor_get(), start, end); + enventor_item_select_region_set(it, start, end); } static void diff --git a/src/bin/edc_navigator.c b/src/bin/edc_navigator.c index e9d04e9..46eb281 100644 --- a/src/bin/edc_navigator.c +++ b/src/bin/edc_navigator.c @@ -332,8 +332,7 @@ find_group_proc(const char *group_name) { if (!group_name) return; - const char *text = - (const char *) enventor_object_text_get(base_enventor_get()); + const char *text = enventor_item_text_get(file_mgr_focused_item_get()); if (!text) return; @@ -345,8 +344,9 @@ find_group_proc(const char *group_name) if (!result) goto end; //Got you! - enventor_object_select_region_set(base_enventor_get(), (result - utf8), - (result - utf8) + strlen(group_name)); + enventor_item_select_region_set(file_mgr_focused_item_get(), + (result - utf8), + (result - utf8) + strlen(group_name)); end: free(utf8); } @@ -444,9 +444,7 @@ find_part_proc(const char *group_name, const char *part_name, { if (!group_name || !part_name) return; - const char *text = - (const char *) enventor_object_text_get(base_enventor_get()); - + const char *text = enventor_item_text_get(file_mgr_focused_item_get()); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); @@ -457,8 +455,9 @@ find_part_proc(const char *group_name, const char *part_name, if (!result) goto end; //Got you! - enventor_object_select_region_set(base_enventor_get(), (result - utf8), - (result - utf8) + strlen(part_name)); + enventor_item_select_region_set(file_mgr_focused_item_get(), + (result - utf8), + (result - utf8) + strlen(part_name)); end: free(utf8); } @@ -469,9 +468,7 @@ find_state_proc(const char *group_name, const char *part_name, { if (!group_name || !part_name) return; - const char *text = - (const char *) enventor_object_text_get(base_enventor_get()); - + const char *text = enventor_item_text_get(file_mgr_focused_item_get()); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); @@ -528,8 +525,9 @@ find_state_proc(const char *group_name, const char *part_name, if (!result) goto end; //Got you! - enventor_object_select_region_set(base_enventor_get(), (result - utf8), - (result - utf8) + strlen(state_name)); + enventor_item_select_region_set(file_mgr_focused_item_get(), + (result - utf8), + (result - utf8) + strlen(state_name)); end: free(utf8); } @@ -571,9 +569,7 @@ find_programs_proc(const char *group_name) { if (!group_name) return; - const char *text = - (const char *) enventor_object_text_get(base_enventor_get()); - + const char *text = enventor_item_text_get(file_mgr_focused_item_get()); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); @@ -585,8 +581,9 @@ find_programs_proc(const char *group_name) if (!result) goto end; //Got you! - enventor_object_select_region_set(base_enventor_get(), (result - utf8), - (result - utf8) + strlen("programs")); + enventor_item_select_region_set(file_mgr_focused_item_get(), + (result - utf8), + (result - utf8) + strlen("programs")); end: free(utf8); } @@ -596,9 +593,7 @@ find_program_proc(const char *group_name, const char *program_name) { if (!group_name || !program_name) return; - const char *text = - (const char *) enventor_object_text_get(base_enventor_get()); - + const char *text = enventor_item_text_get(file_mgr_focused_item_get()); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); @@ -652,8 +647,9 @@ find_program_proc(const char *group_name, const char *program_name) if (!result) goto end; //Got you! - enventor_object_select_region_set(base_enventor_get(), (result - utf8), - (result - utf8) + strlen(program_name)); + enventor_item_select_region_set(file_mgr_focused_item_get(), + (result - utf8), + (result - utf8) + strlen(program_name)); end: free(utf8); } diff --git a/src/bin/file_mgr.c b/src/bin/file_mgr.c index 248105f..a056ecc 100644 --- a/src/bin/file_mgr.c +++ b/src/bin/file_mgr.c @@ -230,7 +230,6 @@ file_mgr_sub_file_add(const char *path) file_tab_it_add(it); file_tab_it_select(it); - file_mgr_file_focus(it); return it; @@ -244,9 +243,7 @@ file_mgr_main_file_set(const char *path) file_tab_clear(); file_tab_it_add(it); - file_mgr_file_focus(it); - base_console_reset(); return it; @@ -261,4 +258,13 @@ file_mgr_file_focus(Enventor_Item *it) enventor_item_focus_set(it); base_text_editor_set(it); base_title_set(enventor_item_file_get(it)); + + //Reset context if the find/replace is working on. + search_reset(); +} + +Enventor_Item * +file_mgr_focused_item_get(void) +{ + return enventor_object_focused_item_get(base_enventor_get()); } diff --git a/src/bin/goto.c b/src/bin/goto.c index 9593284..413ac18 100644 --- a/src/bin/goto.c +++ b/src/bin/goto.c @@ -139,6 +139,9 @@ goto_open(void) search_close(); + Enventor_Item *it = file_mgr_focused_item_get(); + EINA_SAFETY_ON_NULL_RETURN(it); + gd = calloc(1, sizeof(goto_data)); if (!gd) { @@ -147,9 +150,6 @@ goto_open(void) } g_gd = gd; - Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get()); - EINA_SAFETY_ON_NULL_RETURN(it); - //Win Evas_Object *win = elm_win_add(base_win_get(), _("Enventor Goto Line"), ELM_WIN_DIALOG_BASIC); diff --git a/src/bin/main.c b/src/bin/main.c index 908d8bb..5e77f16 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -80,8 +80,18 @@ syntax_color_update(Enventor_Object *enventor) } } - if (color_changed) - enventor_object_syntax_color_full_apply(enventor, EINA_TRUE); + if (!color_changed) return; + + Enventor_Item *it; + + it = enventor_object_main_item_get(enventor); + enventor_item_syntax_color_full_apply(it, EINA_TRUE); + + Eina_List *l; + Eina_List *sub_its = (Eina_List *)enventor_object_sub_items_get(enventor); + EINA_LIST_FOREACH(sub_its, l, it) + enventor_item_syntax_color_full_apply(it, EINA_TRUE); + } static void @@ -161,7 +171,7 @@ main_mouse_wheel_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev) } //Font Size - Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get()); + Enventor_Item *it = file_mgr_focused_item_get(); if (!it) { EINA_LOG_ERR("No focused enventor item??"); diff --git a/src/bin/search.c b/src/bin/search.c index efe3658..977cf0d 100644 --- a/src/bin/search.c +++ b/src/bin/search.c @@ -13,6 +13,7 @@ typedef struct search_s int pos; int len; int syntax_color; + Enventor_Item *it; Eina_Bool forward : 1; } search_data; @@ -27,6 +28,17 @@ static Evas_Coord win_h = DEFAULT_SEARCH_WIN_H; /*****************************************************************************/ static void +syntax_color_context_clear(search_data *sd) +{ + enventor_item_select_none(sd->it); + while (sd->syntax_color > 0) + { + enventor_item_syntax_color_partial_apply(sd->it, -1); + sd->syntax_color--; + } +} + +static void win_delete_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -63,10 +75,8 @@ replace_all_proc(search_data *sd) char buf[256]; int replace_cnt = 0; - Enventor_Object *enventor = base_enventor_get(); - const char *text = - (const char *) enventor_object_text_get(enventor); + const char *text = enventor_item_text_get(sd->it); char *utf8 = elm_entry_markup_to_utf8(text); char *s = utf8; @@ -76,9 +86,9 @@ replace_all_proc(search_data *sd) while ((s = strstr(s, find))) { pos = s + (delta * replace_cnt) - utf8; - enventor_object_select_region_set(enventor, pos, (pos + find_len)); - enventor_object_text_insert(enventor, replace); - enventor_object_select_none(enventor); + enventor_item_select_region_set(sd->it, pos, (pos + find_len)); + enventor_item_text_insert(sd->it, replace); + enventor_item_select_none(sd->it); replace_cnt++; s++; } @@ -95,8 +105,8 @@ static Eina_Bool selection_region_anim_cb(void *data) { search_data *sd = data; - enventor_object_select_region_set(base_enventor_get(), sd->pos, - (sd->pos + sd->len)); + enventor_item_select_region_set(sd->it, sd->pos, + (sd->pos + sd->len)); return ECORE_CALLBACK_CANCEL; } @@ -108,14 +118,13 @@ find_forward_proc(search_data *sd) char buf[256]; Eina_Bool need_iterate = EINA_TRUE; - Enventor_Object *enventor = base_enventor_get(); - const char *text = (const char *) enventor_object_text_get(enventor); + const char *text = enventor_item_text_get(sd->it); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); //get the character position begun with searching. - if (sd->pos == -1) sd->pos = enventor_object_cursor_pos_get(enventor); + if (sd->pos == -1) sd->pos = enventor_item_cursor_pos_get(sd->it); else if (sd->pos == 0) need_iterate = EINA_FALSE; else sd->pos++; @@ -157,17 +166,15 @@ find_backward_proc(search_data *sd) char buf[256]; Eina_Bool need_iterate = EINA_TRUE; int len = 0; - Enventor_Object *enventor = base_enventor_get(); - - const char *text = (const char *) enventor_object_text_get(enventor); + const char *text = enventor_item_text_get(sd->it); if (!text) return; char *utf8 = elm_entry_markup_to_utf8(text); //get the character position begun with searching. if (sd->pos == -1) { - sd->pos = enventor_object_cursor_pos_get(enventor); + sd->pos = enventor_item_cursor_pos_get(sd->it); } else { @@ -215,14 +222,12 @@ static Eina_Bool replace_proc(search_data *sd) { const char *find = elm_entry_entry_get(sd->en_find); - Enventor_Object *enventor = base_enventor_get(); - const char *selection = - (const char * ) enventor_object_selection_get(enventor); + const char *selection = enventor_item_selection_get(sd->it); if (!find || !selection) return EINA_FALSE; char *utf8 = elm_entry_markup_to_utf8(selection); if (strcmp(find, utf8)) return EINA_FALSE; const char *replace = elm_entry_entry_get(sd->en_replace); - enventor_object_text_insert(enventor, replace); + enventor_item_text_insert(sd->it, replace); free(utf8); return EINA_TRUE; } @@ -244,7 +249,7 @@ replace_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, search_data *sd = data; Eina_Bool next; next = replace_proc(sd); - enventor_object_syntax_color_full_apply(base_enventor_get(), EINA_TRUE); + enventor_item_syntax_color_full_apply(sd->it, EINA_TRUE); if (!next) return; if (sd->forward) find_forward_proc(sd); else find_backward_proc(sd); @@ -256,7 +261,7 @@ replace_all_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, { search_data *sd = data; replace_all_proc(sd); - enventor_object_syntax_color_full_apply(base_enventor_get(), EINA_TRUE); + enventor_item_syntax_color_full_apply(sd->it, EINA_TRUE); } static void @@ -285,7 +290,7 @@ replace_activated_cb(void *data, Evas_Object *obj EINA_UNUSED, search_data *sd = data; Eina_Bool next; next = replace_proc(sd); - enventor_object_syntax_color_full_apply(base_enventor_get(), EINA_TRUE); + enventor_item_syntax_color_full_apply(sd->it, EINA_TRUE); if (!next) return; if (sd->forward) find_forward_proc(sd); else find_backward_proc(sd); @@ -296,7 +301,7 @@ win_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { search_data *sd = g_sd; - enventor_object_syntax_color_full_apply(base_enventor_get(), EINA_FALSE); + enventor_item_syntax_color_full_apply(sd->it, EINA_FALSE); sd->syntax_color++; /* FIXME: reset position because search requests syntax color partial apply when it's window is unfocused. the selection region would be dismissed. @@ -310,7 +315,7 @@ win_unfocused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { search_data *sd = g_sd; - enventor_object_syntax_color_partial_apply(base_enventor_get(), -1); + enventor_item_syntax_color_partial_apply(sd->it, -1); sd->syntax_color--; } @@ -339,6 +344,9 @@ search_open(void) goto_close(); + Enventor_Item *it = file_mgr_focused_item_get(); + EINA_SAFETY_ON_NULL_RETURN(it); + sd = calloc(1, sizeof(search_data)); if (!sd) { @@ -442,6 +450,7 @@ search_open(void) sd->en_replace = entry_replace; sd->pos = -1; sd->forward = EINA_TRUE; + sd->it = it; } Eina_Bool @@ -457,14 +466,7 @@ search_close(void) search_data *sd = g_sd; if (!sd) return EINA_FALSE; - Enventor_Object *enventor = base_enventor_get(); - - enventor_object_select_none(enventor); - while (sd->syntax_color > 0) - { - enventor_object_syntax_color_partial_apply(enventor, -1); - sd->syntax_color--; - } + syntax_color_context_clear(sd); //Save last state evas_object_geometry_get(sd->win, NULL, NULL, &win_w, &win_h); @@ -477,3 +479,17 @@ search_close(void) return EINA_TRUE; } + +void +search_reset(void) +{ + search_data *sd = g_sd; + if (!sd) return; + + syntax_color_context_clear(sd); + + sd->it = file_mgr_focused_item_get(); + sd->pos = -1; + sd->forward = EINA_TRUE; + sd->len = 0; +} diff --git a/src/include/file_mgr.h b/src/include/file_mgr.h index def17a7..af51771 100644 --- a/src/include/file_mgr.h +++ b/src/include/file_mgr.h @@ -8,4 +8,5 @@ void file_mgr_reset(void); void file_mgr_edc_save(void); Enventor_Item *file_mgr_main_file_set(const char *path); Enventor_Item *file_mgr_sub_file_add(const char *path); +Enventor_Item *file_mgr_focused_item_get(void); void file_mgr_file_focus(Enventor_Item *it); diff --git a/src/include/search.h b/src/include/search.h index f316cda..9abb4fe 100644 --- a/src/include/search.h +++ b/src/include/search.h @@ -3,3 +3,4 @@ void search_open(void); Eina_Bool search_close(void); Eina_Bool search_is_opened(void); +void search_reset(void); diff --git a/src/lib/Enventor_Legacy.h b/src/lib/Enventor_Legacy.h index 315d90f..3a71ec3 100644 --- a/src/lib/Enventor_Legacy.h +++ b/src/lib/Enventor_Legacy.h @@ -13,5 +13,14 @@ EAPI Enventor_Item *enventor_object_focused_item_get(const Evas_Object *obj); EAPI Eina_Bool enventor_item_focus_set(Enventor_Item *it); EAPI int enventor_item_max_line_get(const Enventor_Item *it); EAPI void enventor_item_line_goto(Enventor_Item *it, int line); +EAPI void enventor_item_syntax_color_full_apply(Enventor_Item *it, Eina_Bool force); +EAPI void enventor_item_syntax_color_partial_apply(Enventor_Item *it, double interval); +EAPI void enventor_item_select_region_set(Enventor_Item *it, int start, int end); +EAPI void enventor_item_select_none(Enventor_Item *it); +EAPI void enventor_item_cursor_pos_set(Enventor_Item *it, int position); +EAPI int enventor_item_cursor_pos_get(const Enventor_Item *it); +EAPI const char *enventor_item_selection_get(const Enventor_Item *it); +EAPI void enventor_item_text_insert(Enventor_Item *it, const char *text); +EAPI const char * enventor_item_text_get(const Enventor_Item *it); #include "enventor_object.eo.legacy.h" diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c index 0bd0ce9..fe5d217 100644 --- a/src/lib/edc_editor.c +++ b/src/lib/edc_editor.c @@ -1799,3 +1799,33 @@ edit_selection_region_center_set(edit_data *ed, int start, int end) //Select region elm_entry_select_region_set(ed->en_edit, start, end); } + +void +edit_select_none(edit_data *ed) +{ + elm_entry_select_none(ed->en_edit); +} + +void +edit_cursor_pos_set(edit_data *ed, int position) +{ + elm_entry_cursor_pos_set(ed->en_edit, position); +} + +int +edit_cursor_pos_get(edit_data *ed) +{ + return elm_entry_cursor_pos_get(ed->en_edit); +} + +const char * +edit_selection_get(edit_data *ed) +{ + return elm_entry_selection_get(ed->en_edit); +} + +const char * +edit_text_get(edit_data *ed) +{ + return elm_entry_entry_get(ed->en_edit); +} diff --git a/src/lib/enventor_object.eo b/src/lib/enventor_object.eo index f3160a6..9cf96a6 100644 --- a/src/lib/enventor_object.eo +++ b/src/lib/enventor_object.eo @@ -149,33 +149,6 @@ class Enventor.Object (Elm.Widget, Efl.File) { parts_list_get { return: list<char *>; } - text_get { - return: const(char) *; - } - text_insert { - params { - @in text: const(char) *; - } - } - selection_get { - return: const(char) *; - } - cursor_pos_get { - return: int; - } - cursor_pos_set { - params { - @in position: int; - } - } - select_none { - } - select_region_set { - params { - @in start: int; - @in end: int; - } - } line_delete { } save { @@ -206,16 +179,6 @@ class Enventor.Object (Elm.Widget, Efl.File) { @in color_type: Enventor_Syntax_Color_Type; } } - syntax_color_full_apply { - params { - @in force: bool; - } - } - syntax_color_partial_apply { - params { - @in interval: double; - } - } template_insert { return: bool; params { diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h index c7f43ae..6c94529 100644 --- a/src/lib/enventor_private.h +++ b/src/lib/enventor_private.h @@ -269,6 +269,7 @@ Eina_Bool edit_ctxpopup_visible_get(edit_data *ed); void edit_ctxpopup_dismiss(edit_data *ed); Eina_Bool edit_load(edit_data *ed, const char *edc_path); void edit_selection_clear(edit_data *ed); +const char *edit_text_get(edit_data *ed); Eina_Bool edit_redoundo(edit_data *ed, Eina_Bool undo); void edit_disabled_set(edit_data *ed, Eina_Bool disabled); void edit_error_set(edit_data *ed, int line, const char *target); @@ -277,7 +278,10 @@ void edit_part_cursor_set(edit_data *ed, const char *group_name, const char *par redoundo_data *edit_redoundo_get(edit_data *ed); void edit_selection_region_center_set(edit_data *ed, int start, int end); const char *edit_file_get(edit_data *ed); - +void edit_select_none(edit_data *ed); +void edit_cursor_pos_set(edit_data *ed, int position); +int edit_cursor_pos_get(edit_data *ed); +const char *edit_selection_get(edit_data *ed); /* util */ void mem_fail_msg(void); diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c index df7696c..a773697 100644 --- a/src/lib/enventor_smart.c +++ b/src/lib/enventor_smart.c @@ -669,60 +669,6 @@ _enventor_object_focus_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd) return elm_object_focus_get(edit_entry_get(pd->main_it.ed)); } -//TODO: Itemize -EOLIAN static const char * -_enventor_object_text_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd) -{ - return elm_entry_entry_get(edit_entry_get(pd->main_it.ed)); -} - -//TODO: Itemize -EOLIAN static int -_enventor_object_cursor_pos_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd) -{ - return elm_entry_cursor_pos_get(edit_entry_get(pd->main_it.ed)); -} - -//TODO: Itemize -EOLIAN static void -_enventor_object_cursor_pos_set(Eo *obj EINA_UNUSED, - Enventor_Object_Data *pd, - int position) -{ - elm_entry_cursor_pos_set(edit_entry_get(pd->main_it.ed), position); -} - -//TODO: Itemize -EOLIAN static const char * -_enventor_object_selection_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd) -{ - return elm_entry_selection_get(edit_entry_get(pd->main_it.ed)); -} - -//TODO: Itemize -EOLIAN static void -_enventor_object_select_none(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd) -{ - elm_entry_select_none(edit_entry_get(pd->main_it.ed)); -} - -//TODO: Itemize -EOLIAN static void -_enventor_object_text_insert(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd, - const char *text) -{ - edit_text_insert(pd->main_it.ed, text); -} - -//TODO: Itemize -EOLIAN static void -_enventor_object_select_region_set(Eo *obj EINA_UNUSED, - Enventor_Object_Data *pd, int start, int end) -{ - edit_selection_clear(pd->main_it.ed); - edit_selection_region_center_set(pd->main_it.ed, start, end); -} - EOLIAN static void _enventor_object_font_scale_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd, double font_scale) @@ -775,6 +721,7 @@ _enventor_object_syntax_color_set(Eo *obj EINA_UNUSED, Enventor_Syntax_Color_Type color_type, const char *val) { + //TODO: Might need for items edit_syntax_color_set(pd->main_it.ed, color_type, val); } @@ -783,25 +730,10 @@ _enventor_object_syntax_color_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd, Enventor_Syntax_Color_Type color_type) { + //TODO: Might need for items return edit_syntax_color_get(pd->main_it.ed, color_type); } -EOLIAN static void -_enventor_object_syntax_color_full_apply(Eo *obj EINA_UNUSED, - Enventor_Object_Data *pd, - Eina_Bool force) -{ - edit_syntax_color_full_apply(pd->main_it.ed, force); -} - -EOLIAN static void -_enventor_object_syntax_color_partial_apply(Eo *obj EINA_UNUSED, - Enventor_Object_Data *pd, - double interval) -{ - edit_syntax_color_partial_apply(pd->main_it.ed, interval); -} - //TODO: Might need for items EOLIAN static Eina_Bool _enventor_object_save(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd, @@ -1068,5 +1000,76 @@ enventor_item_line_goto(Enventor_Item *it, int line) edit_goto(it->ed, line); } +EAPI void +enventor_item_syntax_color_full_apply(Enventor_Item *it, Eina_Bool force) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_syntax_color_full_apply(it->ed, force); +} +EAPI void +enventor_item_syntax_color_partial_apply(Enventor_Item *it, double interval) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_syntax_color_partial_apply(it->ed, interval); +} + +EAPI void +enventor_item_select_region_set(Enventor_Item *it, int start, int end) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_selection_clear(it->ed); + edit_selection_region_center_set(it->ed, start, end); +} + +EAPI void +enventor_item_select_none(Enventor_Item *it) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_select_none(it->ed); +} + +EAPI void +enventor_item_cursor_pos_set(Enventor_Item *it, int position) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_cursor_pos_set(it->ed, position); +} + +EAPI int +enventor_item_cursor_pos_get(const Enventor_Item *it) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(it, 0); + + return edit_cursor_pos_get(it->ed); +} + +EAPI const char * +enventor_item_selection_get(const Enventor_Item *it) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL); + + return edit_selection_get(it->ed); +} + +EAPI void +enventor_item_text_insert(Enventor_Item *it, const char *text) +{ + EINA_SAFETY_ON_NULL_RETURN(it); + + edit_text_insert(it->ed, text); +} + +EAPI const char * +enventor_item_text_get(const Enventor_Item *it) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL); + + return edit_text_get(it->ed); +} #include "enventor_object.eo.c" --
