diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 4647a3f5c2..a228933b66 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -337,6 +337,7 @@ lib/elementary/elm_calendar_eo.legacy.c \ lib/elementary/elm_calendar_item_eo.c \ lib/elementary/elm_clock_eo.c \ lib/elementary/elm_clock_eo.legacy.c \ +lib/elementary/elm_code_widget_eo.legacy.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_item_eo.c \ lib/elementary/elm_hoversel_item_eo.legacy.c @@ -399,6 +400,7 @@ lib/elementary/elm_calendar_item_eo.h \ lib/elementary/elm_calendar_item_eo.legacy.h \ lib/elementary/elm_clock_eo.h \ lib/elementary/elm_clock_eo.legacy.h \ +lib/elementary/elm_code_widget_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/bin/elementary/test_code.c b/src/bin/elementary/test_code.c index bb010ce5e6..846dc613a3 100644 --- a/src/bin/elementary/test_code.c +++ b/src/bin/elementary/test_code.c @@ -69,7 +69,7 @@ _elm_code_test_welcome_setup(Evas_Object *parent) evas_object_show(widget); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL); - efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code); + efl_event_callback_add(widget, EFL_UI_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code); _append_line(code->file, "❤ Hello World, Elm Code! ❤"); _append_line(code->file, "*** Currently experimental ***"); @@ -103,10 +103,10 @@ _elm_code_test_editor_setup(Evas_Object *parent, Eina_Bool log) evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(widget); - elm_obj_code_widget_font_set(widget, NULL, 14); - elm_obj_code_widget_editable_set(widget, EINA_TRUE); - elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); - elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE); + efl_ui_code_widget_font_set(widget, NULL, 14); + efl_ui_code_widget_editable_set(widget, EINA_TRUE); + efl_ui_code_widget_show_whitespace_set(widget, EINA_TRUE); + efl_ui_code_widget_line_numbers_set(widget, EINA_TRUE); if (!log) { @@ -135,11 +135,11 @@ _elm_code_test_syntax_setup(Evas_Object *parent) evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(widget); - elm_obj_code_widget_editable_set(widget, EINA_TRUE); - elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE); - elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc"; - elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); - elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE); + efl_ui_code_widget_editable_set(widget, EINA_TRUE); + efl_ui_code_widget_syntax_enabled_set(widget, EINA_TRUE); + efl_ui_code_widget_code_get(widget)->file->mime = "text/x-csrc"; + efl_ui_code_widget_show_whitespace_set(widget, EINA_TRUE); + efl_ui_code_widget_line_numbers_set(widget, EINA_TRUE); _append_line(code->file, "#include "); _append_line(code->file, "int main(int argc, char **argv)"); @@ -163,13 +163,13 @@ _elm_code_test_syntax_tabbed_setup(Evas_Object *parent) code = elm_code_create(); code->config.indent_style_efl = EINA_FALSE; - widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); - elm_obj_code_widget_editable_set(widget, EINA_TRUE); - elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE); - elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc"; - elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); - elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE); - elm_obj_code_widget_tab_inserts_spaces_set(widget, EINA_FALSE); + widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, efl_ui_code_widget_code_set(efl_added, code)); + efl_ui_code_widget_editable_set(widget, EINA_TRUE); + efl_ui_code_widget_syntax_enabled_set(widget, EINA_TRUE); + efl_ui_code_widget_code_get(widget)->file->mime = "text/x-csrc"; + efl_ui_code_widget_show_whitespace_set(widget, EINA_TRUE); + efl_ui_code_widget_line_numbers_set(widget, EINA_TRUE); + efl_ui_code_widget_tab_inserts_spaces_set(widget, EINA_FALSE); _append_line(code->file, "#include "); _append_line(code->file, "int main(int argc, char **argv)"); @@ -199,8 +199,8 @@ _elm_code_test_mirror_setup(Elm_Code *code, char *font_name, Evas_Object *parent evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(widget); - elm_obj_code_widget_font_set(widget, font_name, 11); - elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE); + efl_ui_code_widget_font_set(widget, font_name, 11); + efl_ui_code_widget_line_numbers_set(widget, EINA_TRUE); return widget; } @@ -326,7 +326,7 @@ test_code_log(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ o = elm_button_add(screen); elm_object_text_set(o, "log"); - evas_object_smart_callback_add(o, "clicked", _elm_code_test_log_clicked, elm_obj_code_widget_code_get(code)); + evas_object_smart_callback_add(o, "clicked", _elm_code_test_log_clicked, efl_ui_code_widget_code_get(code)); elm_box_pack_end(screen, o); evas_object_show(o); @@ -348,7 +348,7 @@ test_code_mirror(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve evas_object_size_hint_weight_set(screen, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); widget = _elm_code_test_editor_setup(screen, EINA_FALSE); - code = elm_obj_code_widget_code_get(widget); + code = efl_ui_code_widget_code_get(widget); elm_box_pack_end(screen, widget); elm_box_pack_end(screen, _elm_code_test_mirror_setup(code, "Mono:style=Oblique", screen)); diff --git a/src/lib/elementary/elm_code_diff_widget.c b/src/lib/elementary/elm_code_diff_widget.c index 593f044bc7..6386e15ff5 100644 --- a/src/lib/elementary/elm_code_diff_widget.c +++ b/src/lib/elementary/elm_code_diff_widget.c @@ -96,7 +96,7 @@ elm_code_diff_widget_add(Evas_Object *parent, Elm_Code *code) // left side of diff wcode1 = elm_code_create(); elm_code_parser_standard_add(wcode1, ELM_CODE_PARSER_STANDARD_DIFF); - widget_left = elm_legacy_add(ELM_CODE_WIDGET_LEGACY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, wcode1)); + widget_left = elm_legacy_add(ELM_CODE_WIDGET_LEGACY_CLASS, parent, efl_ui_code_widget_code_set(efl_added, wcode1)); evas_object_size_hint_weight_set(widget_left, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(widget_left, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -107,7 +107,7 @@ elm_code_diff_widget_add(Evas_Object *parent, Elm_Code *code) // right side of diff wcode2 = elm_code_create(); elm_code_parser_standard_add(wcode2, ELM_CODE_PARSER_STANDARD_DIFF); - widget_right = elm_legacy_add(ELM_CODE_WIDGET_LEGACY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, wcode2)); + widget_right = elm_legacy_add(ELM_CODE_WIDGET_LEGACY_CLASS, parent, efl_ui_code_widget_code_set(efl_added, wcode2)); evas_object_size_hint_weight_set(widget_right, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(widget_right, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -125,8 +125,8 @@ elm_code_diff_widget_font_set(Evas_Object *widget, const char *name, int size) Elm_Code_Widget *child; child = (Elm_Code_Widget *) evas_object_data_get(widget, _ELM_CODE_DIFF_WIDGET_LEFT); - elm_obj_code_widget_font_set(child, name, size); + efl_ui_code_widget_font_set(child, name, size); child = (Elm_Code_Widget *) evas_object_data_get(widget, _ELM_CODE_DIFF_WIDGET_RIGHT); - elm_obj_code_widget_font_set(child, name, size); + efl_ui_code_widget_font_set(child, name, size); } diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 8a6a73c97a..ec8a7fbd57 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -65,7 +65,7 @@ elm_code_widget_add(Evas_Object *parent, Elm_Code *code) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); return elm_legacy_add(ELM_CODE_WIDGET_LEGACY_CLASS, parent, - elm_obj_code_widget_code_set(efl_added, code)); + efl_ui_code_widget_code_set(efl_added, code)); } #include "elm_code_widget_legacy.eo.c" @@ -175,7 +175,7 @@ _elm_code_widget_fill_line_tokens(Elm_Code_Widget *widget, Evas_Textgrid_Cell *c unsigned int end, length, offset; unsigned int token_start_col, token_end_col; - offset = elm_obj_code_widget_text_left_gutter_width_get(widget); + offset = efl_ui_code_widget_text_left_gutter_width_get(widget); length = elm_code_widget_line_text_column_width_get(widget, line) + offset; EINA_LIST_FOREACH(line->tokens, item, token) @@ -397,7 +397,7 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, El EINA_SAFETY_ON_NULL_RETURN(line); - gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); + gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); if (eina_list_count(pd->grids) < line->number) return; @@ -478,7 +478,7 @@ _elm_code_widget_fill_range(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, _elm_code_widget_fill_line(widget, pd, newline); // if called from new line cb, no need to update whole range unless visible - if (newline && !elm_obj_code_widget_line_visible_get(widget, newline)) + if (newline && !efl_ui_code_widget_line_visible_get(widget, newline)) return; // cursor will be shown if it should be visible @@ -676,7 +676,7 @@ _elm_code_widget_cursor_ensure_visible(Elm_Code_Widget *widget) grid = eina_list_data_get(eina_list_nth_list(pd->grids, pd->cursor_line - 1)); evas_object_geometry_get(grid, NULL, &rowy, NULL, NULL); - gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); + gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); curx = (pd->cursor_col + gutter - 1) * cellw; cury = rowy + viewy - oy; @@ -705,7 +705,7 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, if (position < length && text[position] == '\t') pd->cursor_col = elm_code_widget_line_text_column_width_to_position(widget, line_obj, position); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CURSOR_CHANGED, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CURSOR_CHANGED, widget); if (!pd->selection || (pd->selection && pd->selection->in_progress)) _elm_code_widget_cursor_ensure_visible(widget); @@ -737,7 +737,7 @@ _elm_code_widget_position_at_coordinates_get(Eo *obj, Elm_Code_Widget_Data *pd, y = y + sy - oy; _elm_code_widget_cell_size_get(widget, &cw, &ch); - gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); + gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); if (y >= 0 && ch > 0) guess = ((double) y / ch) + 1; @@ -794,7 +794,7 @@ _elm_code_widget_geometry_for_position_get(Elm_Code_Widget *widget, Elm_Code_Wid elm_code_line_text_get(line, &length); _elm_code_widget_cell_size_get(widget, &cellw, h); - gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); + gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); grid = eina_list_nth(pd->grids, row - 1); evas_object_geometry_get(grid, x, y, NULL, NULL); @@ -1000,7 +1000,7 @@ _elm_code_widget_clicked_gutter_cb(Elm_Code_Widget *widget, unsigned int row) return; } - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_GUTTER_CLICKED, line); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_LINE_GUTTER_CLICKED, line); } static void @@ -1036,7 +1036,7 @@ _elm_code_widget_clicked_readonly_cb(Elm_Code_Widget *widget, unsigned int row) if (!line) return; - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, line); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_LINE_CLICKED, line); } static void @@ -1366,7 +1366,7 @@ _elm_code_widget_cursor_move_page_height_get(Elm_Code_Widget *widget) { unsigned int lines; - lines = elm_obj_code_widget_lines_visible_get(widget); + lines = efl_ui_code_widget_lines_visible_get(widget); return lines * 0.85; } @@ -1491,7 +1491,7 @@ _elm_code_widget_tab_at_cursor_insert(Elm_Code_Widget *widget) return; } - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); rem = (col - 1) % pd->tabstop; while (rem < pd->tabstop) @@ -1513,8 +1513,8 @@ _elm_code_widget_newline(Elm_Code_Widget *widget) if (!elm_code_widget_selection_is_empty(widget)) elm_code_widget_selection_delete(widget); - code = elm_obj_code_widget_code_get(widget); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + code = efl_ui_code_widget_code_get(widget); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); line = elm_code_file_line_get(code->file, row); if (line == NULL) { @@ -1536,9 +1536,9 @@ _elm_code_widget_newline(Elm_Code_Widget *widget) elm_code_widget_text_at_cursor_insert(widget, leading); free(oldtext); - indent = elm_obj_code_widget_line_text_column_width_to_position(widget, line, + indent = efl_ui_code_widget_line_text_column_width_to_position(widget, line, strlen(leading)); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); textlen = strlen(leading) + 2; text = malloc(sizeof(char) * textlen); @@ -1560,8 +1560,8 @@ _elm_code_widget_backspaceline(Elm_Code_Widget *widget, Eina_Bool nextline) Eina_Bool cursor_move = EINA_TRUE; unsigned int row, col, oldlength, position = 0; - code = elm_obj_code_widget_code_get(widget); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + code = efl_ui_code_widget_code_get(widget); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); line = elm_code_file_line_get(code->file, row); if (nextline) @@ -1600,7 +1600,7 @@ _elm_code_widget_backspaceline(Elm_Code_Widget *widget, Eina_Bool nextline) } // TODO construct and pass a change object - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); } void @@ -1618,8 +1618,8 @@ _elm_code_widget_backspace(Elm_Code_Widget *widget) return; } - code = elm_obj_code_widget_code_get(widget); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + code = efl_ui_code_widget_code_get(widget); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); if (col <= 1) { @@ -1640,9 +1640,9 @@ _elm_code_widget_backspace(Elm_Code_Widget *widget) text = elm_code_widget_text_between_positions_get(widget, row, start_col, row, end_col); elm_code_line_text_remove(line, position - char_width, char_width); - elm_obj_code_widget_cursor_position_set(widget, row, start_col); + efl_ui_code_widget_cursor_position_set(widget, row, start_col); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); change = _elm_code_widget_change_create(start_col, row, end_col - 1, row, text, char_width, EINA_FALSE); _elm_code_widget_undo_change_add(widget, change); @@ -1664,8 +1664,8 @@ _elm_code_widget_delete(Elm_Code_Widget *widget) return; } - code = elm_obj_code_widget_code_get(widget); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + code = efl_ui_code_widget_code_get(widget); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); line = elm_code_file_line_get(code->file, row); if (col > elm_code_widget_line_text_column_width_get(widget, line)) { @@ -1685,8 +1685,8 @@ _elm_code_widget_delete(Elm_Code_Widget *widget) text = elm_code_widget_text_between_positions_get(widget, row, start_col, row, end_col); elm_code_line_text_remove(line, position, char_width); - elm_obj_code_widget_cursor_position_set(widget, row, start_col); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_ui_code_widget_cursor_position_set(widget, row, start_col); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); change = _elm_code_widget_change_create(start_col, row, col - 1, row, text, char_width, EINA_FALSE); _elm_code_widget_undo_change_add(widget, change); @@ -2020,7 +2020,7 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) Elm_Code_Widget_Data *pd; pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); - gutter = elm_obj_code_widget_text_left_gutter_width_get(widget); + gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); if (!pd->code) return; @@ -2188,15 +2188,15 @@ _elm_code_widget_gravity_get(const Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd } EOLIAN static void -_elm_code_widget_policy_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +_elm_code_widget_policy_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Elm_Code_Widget_Scroller_Policy policy_h, Elm_Code_Widget_Scroller_Policy policy_v) { - elm_scroller_policy_set(pd->scroller, policy_h, policy_v); + elm_scroller_policy_set(pd->scroller, (Elm_Scroller_Policy)policy_h, (Elm_Scroller_Policy)policy_v); } EOLIAN static void -_elm_code_widget_policy_get(const Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +_elm_code_widget_policy_get(const Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Elm_Code_Widget_Scroller_Policy *policy_h, Elm_Code_Widget_Scroller_Policy *policy_v) { - elm_scroller_policy_get(pd->scroller, policy_h, policy_v); + elm_scroller_policy_get(pd->scroller, (Elm_Scroller_Policy*)policy_h, (Elm_Scroller_Policy*)policy_v); } EOLIAN static void @@ -2429,8 +2429,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) efl_event_callback_add(obj, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_widget_line_cb, obj); efl_event_callback_add(obj, &ELM_CODE_EVENT_FILE_LOAD_DONE, _elm_code_widget_file_cb, obj); - efl_event_callback_add(obj, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, _elm_code_widget_selection_cb, obj); - efl_event_callback_add(obj, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, _elm_code_widget_selection_clear_cb, obj); + efl_event_callback_add(obj, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CHANGED, _elm_code_widget_selection_cb, obj); + efl_event_callback_add(obj, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CLEARED, _elm_code_widget_selection_clear_cb, obj); } /* Internal EO APIs and hidden overrides */ @@ -2441,3 +2441,4 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) #include "elm_code_widget_text.c" #include "elm_code_widget_undo.c" #include "elm_code_widget.eo.c" +#include "elm_code_widget_eo.legacy.c" diff --git a/src/lib/elementary/elm_code_widget.eo b/src/lib/elementary/elm_code_widget.eo index cdc33212b0..c43adfd52b 100644 --- a/src/lib/elementary/elm_code_widget.eo +++ b/src/lib/elementary/elm_code_widget.eo @@ -1,4 +1,15 @@ -import elm_interface_scrollable; +/* FIXME: this widget should just implement a scroller */ +enum Elm.Code_Widget_Scroller_Policy +{ + [[Type that controls when scrollbars should appear. + + See also @Elm.Interface_Scrollable.policy.set. + ]] + auto = 0, [[Show scrollbars as needed]] + on, [[Always show scrollbars]] + off, [[Never show scrollbars]] + last [[Sentinel value to indicate last enum field during iteration]] +} /* FIXME: Those types make elm_code unusable from pure EO */ struct @extern Elm.Code; [[Elementary code main data structure]] /* The main interface currently defined in code */ @@ -7,8 +18,7 @@ struct @extern Elm.Code_Line; [[Elementary code line data structure]] /* Parts o class Elm.Code_Widget extends Efl.Ui.Layout_Base { [[Elementary code widget]] - eo_prefix: elm_obj_code_widget; - legacy_prefix: elm_code_widget; + eo_prefix: efl_ui_code_widget; methods { @property code { set { @@ -70,8 +80,8 @@ class Elm.Code_Widget extends Efl.Ui.Layout_Base [[Get the widget's policy for scrollbar visibility.]] } values { - policy_h: Elm.Scroller.Policy; [[The horizontal scrollbar visibility policy]] - policy_v: Elm.Scroller.Policy; [[The vertical scrollbar visibility policy]] + policy_h: Elm.Code_Widget_Scroller_Policy; [[The horizontal scrollbar visibility policy]] + policy_v: Elm.Code_Widget_Scroller_Policy; [[The vertical scrollbar visibility policy]] } } @property tabstop { diff --git a/src/lib/elementary/elm_code_widget_eo.legacy.c b/src/lib/elementary/elm_code_widget_eo.legacy.c new file mode 100644 index 0000000000..cc91160565 --- /dev/null +++ b/src/lib/elementary/elm_code_widget_eo.legacy.c @@ -0,0 +1,270 @@ + +EAPI void +elm_code_widget_code_set(Elm_Code_Widget *obj, Elm_Code *code) +{ + efl_ui_code_widget_code_set(obj, code); +} + +EAPI Elm_Code * +elm_code_widget_code_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_code_get(obj); +} + +EAPI void +elm_code_widget_font_set(Elm_Code_Widget *obj, const char *name, int size) +{ + efl_ui_code_widget_font_set(obj, name, size); +} + +EAPI void +elm_code_widget_font_get(const Elm_Code_Widget *obj, const char **name, int *size) +{ + efl_ui_code_widget_font_get(obj, name, size); +} + +EAPI unsigned int +elm_code_widget_columns_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_columns_get(obj); +} + +EAPI void +elm_code_widget_gravity_set(Elm_Code_Widget *obj, double x, double y) +{ + efl_ui_code_widget_gravity_set(obj, x, y); +} + +EAPI void +elm_code_widget_gravity_get(const Elm_Code_Widget *obj, double *x, double *y) +{ + efl_ui_code_widget_gravity_get(obj, x, y); +} + +EAPI void +elm_code_widget_policy_set(Elm_Code_Widget *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +{ + efl_ui_code_widget_policy_set(obj, (Elm_Code_Widget_Scroller_Policy)policy_h, (Elm_Code_Widget_Scroller_Policy)policy_v); +} + +EAPI void +elm_code_widget_policy_get(const Elm_Code_Widget *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +{ + efl_ui_code_widget_policy_get(obj, (Elm_Code_Widget_Scroller_Policy*)policy_h, (Elm_Code_Widget_Scroller_Policy*)policy_v); +} + +EAPI void +elm_code_widget_tabstop_set(Elm_Code_Widget *obj, unsigned int tabstop) +{ + efl_ui_code_widget_tabstop_set(obj, tabstop); +} + +EAPI unsigned int +elm_code_widget_tabstop_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_tabstop_get(obj); +} + +EAPI void +elm_code_widget_editable_set(Elm_Code_Widget *obj, Eina_Bool editable) +{ + efl_ui_code_widget_editable_set(obj, editable); +} + +EAPI Eina_Bool +elm_code_widget_editable_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_editable_get(obj); +} + +EAPI void +elm_code_widget_line_numbers_set(Elm_Code_Widget *obj, Eina_Bool line_numbers) +{ + efl_ui_code_widget_line_numbers_set(obj, line_numbers); +} + +EAPI Eina_Bool +elm_code_widget_line_numbers_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_line_numbers_get(obj); +} + +EAPI void +elm_code_widget_line_width_marker_set(Elm_Code_Widget *obj, unsigned int line_width_marker) +{ + efl_ui_code_widget_line_width_marker_set(obj, line_width_marker); +} + +EAPI unsigned int +elm_code_widget_line_width_marker_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_line_width_marker_get(obj); +} + +EAPI void +elm_code_widget_show_whitespace_set(Elm_Code_Widget *obj, Eina_Bool show_whitespace) +{ + efl_ui_code_widget_show_whitespace_set(obj, show_whitespace); +} + +EAPI Eina_Bool +elm_code_widget_show_whitespace_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_show_whitespace_get(obj); +} + +EAPI void +elm_code_widget_alpha_set(Elm_Code_Widget *obj, int alpha) +{ + efl_ui_code_widget_alpha_set(obj, alpha); +} + +EAPI int +elm_code_widget_alpha_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_alpha_get(obj); +} + +EAPI void +elm_code_widget_syntax_enabled_set(Elm_Code_Widget *obj, Eina_Bool syntax_enabled) +{ + efl_ui_code_widget_syntax_enabled_set(obj, syntax_enabled); +} + +EAPI Eina_Bool +elm_code_widget_syntax_enabled_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_syntax_enabled_get(obj); +} + +EAPI void +elm_code_widget_tab_inserts_spaces_set(Elm_Code_Widget *obj, Eina_Bool tab_inserts_spaces) +{ + efl_ui_code_widget_tab_inserts_spaces_set(obj, tab_inserts_spaces); +} + +EAPI Eina_Bool +elm_code_widget_tab_inserts_spaces_get(const Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_tab_inserts_spaces_get(obj); +} + +EAPI void +elm_code_widget_cursor_position_set(Elm_Code_Widget *obj, unsigned int row, unsigned int col) +{ + efl_ui_code_widget_cursor_position_set(obj, row, col); +} + +EAPI void +elm_code_widget_cursor_position_get(const Elm_Code_Widget *obj, unsigned int *row, unsigned int *col) +{ + efl_ui_code_widget_cursor_position_get(obj, row, col); +} + +EAPI void +elm_code_widget_theme_refresh(Elm_Code_Widget *obj) +{ + efl_ui_code_widget_theme_refresh(obj); +} + +EAPI void +elm_code_widget_line_refresh(Elm_Code_Widget *obj, Elm_Code_Line *line) +{ + efl_ui_code_widget_line_refresh(obj, line); +} + +EAPI Eina_Bool +elm_code_widget_line_visible_get(Elm_Code_Widget *obj, Elm_Code_Line *line) +{ + return efl_ui_code_widget_line_visible_get(obj, line); +} + +EAPI unsigned int +elm_code_widget_lines_visible_get(Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_lines_visible_get(obj); +} + +EAPI Eina_Bool +elm_code_widget_position_at_coordinates_get(Elm_Code_Widget *obj, int x, int y, unsigned int *row, int *col) +{ + return efl_ui_code_widget_position_at_coordinates_get(obj, x, y, row, col); +} + +EAPI Eina_Bool +elm_code_widget_geometry_for_position_get(Elm_Code_Widget *obj, unsigned int row, int col, int *x, int *y, int *w, int *h) +{ + return efl_ui_code_widget_geometry_for_position_get(obj, row, col, x, y, w, h); +} + +EAPI int +elm_code_widget_text_left_gutter_width_get(Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_text_left_gutter_width_get(obj); +} + +EAPI char * +elm_code_widget_text_between_positions_get(Elm_Code_Widget *obj, unsigned int start_line, unsigned int start_col, unsigned int end_line, unsigned int end_col) +{ + return efl_ui_code_widget_text_between_positions_get(obj, start_line, start_col, end_line, end_col); +} + +EAPI void +elm_code_widget_text_at_cursor_insert(Elm_Code_Widget *obj, const char *text) +{ + efl_ui_code_widget_text_at_cursor_insert(obj, text); +} + +EAPI unsigned int +elm_code_widget_line_text_column_width_to_position(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int position) +{ + return efl_ui_code_widget_line_text_column_width_to_position(obj, line, position); +} + +EAPI unsigned int +elm_code_widget_line_text_column_width_get(Elm_Code_Widget *obj, Elm_Code_Line *line) +{ + return efl_ui_code_widget_line_text_column_width_get(obj, line); +} + +EAPI unsigned int +elm_code_widget_line_text_position_for_column_get(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int column) +{ + return efl_ui_code_widget_line_text_position_for_column_get(obj, line, column); +} + +EAPI unsigned int +elm_code_widget_text_tabwidth_at_column_get(Elm_Code_Widget *obj, unsigned int column) +{ + return efl_ui_code_widget_text_tabwidth_at_column_get(obj, column); +} + +EAPI void +elm_code_widget_line_status_toggle(Elm_Code_Widget *obj, Elm_Code_Line *line) +{ + efl_ui_code_widget_line_status_toggle(obj, line); +} + +EAPI void +elm_code_widget_undo(Elm_Code_Widget *obj) +{ + efl_ui_code_widget_undo(obj); +} + +EAPI Eina_Bool +elm_code_widget_can_undo_get(Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_can_undo_get(obj); +} + +EAPI void +elm_code_widget_redo(Elm_Code_Widget *obj) +{ + efl_ui_code_widget_redo(obj); +} + +EAPI Eina_Bool +elm_code_widget_can_redo_get(Elm_Code_Widget *obj) +{ + return efl_ui_code_widget_can_redo_get(obj); +} diff --git a/src/lib/elementary/elm_code_widget_eo.legacy.h b/src/lib/elementary/elm_code_widget_eo.legacy.h new file mode 100644 index 0000000000..0d72c8c11e --- /dev/null +++ b/src/lib/elementary/elm_code_widget_eo.legacy.h @@ -0,0 +1,550 @@ +#ifndef _ELM_CODE_WIDGET_EO_LEGACY_H_ +#define _ELM_CODE_WIDGET_EO_LEGACY_H_ + +#ifndef _ELM_CODE_WIDGET_EO_CLASS_TYPE +#define _ELM_CODE_WIDGET_EO_CLASS_TYPE + +typedef Eo Elm_Code_Widget; + +#endif + +#ifndef _ELM_CODE_WIDGET_EO_TYPES +#define _ELM_CODE_WIDGET_EO_TYPES + + +#endif + +/** + * @brief Set the underlying code object that this widget renders. This can + * only be set during construction, once the widget is created the backing code + * object cannot be changed. + * + * @param[in] obj The object. + * @param[in] code Our underlying Elm.Code object + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_code_set(Elm_Code_Widget *obj, Elm_Code *code); + +/** + * @brief Get the underlying code object we are rendering + * + * @param[in] obj The object. + * + * @return Our underlying Elm.Code object + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Elm_Code *elm_code_widget_code_get(const Elm_Code_Widget *obj); + +/** + * @brief Set the font that this widget uses, the font should be a monospaced + * scalable font. Passing NULL will load the default system monospaced font. + * + * @param[in] obj The object. + * @param[in] name The name of the font to load + * @param[in] size The font size for the widget + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_font_set(Elm_Code_Widget *obj, const char *name, int size); + +/** + * @brief Get the font currently in use. The font name is a copy ad should be + * freed once it is no longer needed + * + * @param[in] obj The object. + * @param[out] name The name of the font to load + * @param[out] size The font size for the widget + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_font_get(const Elm_Code_Widget *obj, const char **name, int *size); + +/** + * @brief Get the number of columns in the widget currently. This will be the + * max of the number of columns to represent the longest line and the minimum + * required to fill the visible widget width. + * + * @param[in] obj The object. + * + * @return The number of columns required to render the widget + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_columns_get(const Elm_Code_Widget *obj); + +/** + * @brief Set how this widget's scroller should respond to new lines being + * added. + * + * An x value of 0.0 will maintain the distance from the left edge, 1.0 will + * ensure the rightmost edge (of the longest line) is respected With 0.0 for y + * the view will keep it's position relative to the top whereas 1.0 will scroll + * downward as lines are added. + * + * @param[in] obj The object. + * @param[in] x The horizontal value of the scroller gravity - valid values are + * 0.0 and 1.0 + * @param[in] y The vertical gravity of the widget's scroller - valid values + * are 0.0 and 1.0 + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_gravity_set(Elm_Code_Widget *obj, double x, double y); + +/** + * @brief Get the current x and y gravity of the widget's scroller + * + * @param[in] obj The object. + * @param[out] x The horizontal value of the scroller gravity - valid values + * are 0.0 and 1.0 + * @param[out] y The vertical gravity of the widget's scroller - valid values + * are 0.0 and 1.0 + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_gravity_get(const Elm_Code_Widget *obj, double *x, double *y); + +/** + * @brief Set the policy for scrollbar visibility. + * + * @param[in] obj The object. + * @param[in] policy_h The horizontal scrollbar visibility policy + * @param[in] policy_v The vertical scrollbar visibility policy + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_policy_set(Elm_Code_Widget *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * @brief Get the widget's policy for scrollbar visibility. + * + * @param[in] obj The object. + * @param[out] policy_h The horizontal scrollbar visibility policy + * @param[out] policy_v The vertical scrollbar visibility policy + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_policy_get(const Elm_Code_Widget *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * @brief Set the width of a tab stop, used purely for visual layout of tab + * characters. + * + * Recommended value is between 2 and 8. + * + * @param[in] obj The object. + * @param[in] tabstop Maximum width of a tab character + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_tabstop_set(Elm_Code_Widget *obj, unsigned int tabstop); + +/** + * @brief Get the current width of a tab stop. This is used to determine where + * characters after a tab should appear in the line. + * + * @param[in] obj The object. + * + * @return Maximum width of a tab character + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_tabstop_get(const Elm_Code_Widget *obj); + +/** + * @brief Set whether this widget allows editing + * + * If editable then the widget will allow user input to manipulate the + * underlying Elm.Code_File of this Elm.Code instance. Any other + * Elm.Code_Widget's connected to this Elm.Code will update to reflect the + * changes. + * + * @param[in] obj The object. + * @param[in] editable The editable state of the widget + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_editable_set(Elm_Code_Widget *obj, Eina_Bool editable); + +/** + * @brief Get the current editable state of this widget + * + * returns EINA_TRUE if the widget is editable, EINA_FALSE otherwise. If this + * widget is not editable the underlying Elm.Code_File could still be + * manipulated by a different widget or the filesystem. + * + * @param[in] obj The object. + * + * @return The editable state of the widget + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_editable_get(const Elm_Code_Widget *obj); + +/** + * @brief Set whether line numbers should be displayed in the left gutter. + * + * Passing EINA_TRUE will reserve a space for showing line numbers, EINA_FALSE + * will turn this off. + * + * @param[in] obj The object. + * @param[in] line_numbers Whether or not line numbers (or their placeholder) + * should be shown + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_line_numbers_set(Elm_Code_Widget *obj, Eina_Bool line_numbers); + +/** + * @brief Get the status of line number display for this widget. + * + * @param[in] obj The object. + * + * @return Whether or not line numbers (or their placeholder) should be shown + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_line_numbers_get(const Elm_Code_Widget *obj); + +/** + * @brief Set where the line width market should be shown. + * + * Passing a non-zero value will set which line width to mark with a vertical + * line. Passing 0 will hide this marker. + * + * @param[in] obj The object. + * @param[in] line_width_marker Where to display a line width marker, if at all + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_line_width_marker_set(Elm_Code_Widget *obj, unsigned int line_width_marker); + +/** + * @brief Get the position of the line width marker, any positive return + * indicates where the marker appears. + * + * @param[in] obj The object. + * + * @return Where to display a line width marker, if at all + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_line_width_marker_get(const Elm_Code_Widget *obj); + +/** + * @brief Set whether white space should be shown. + * + * @param[in] obj The object. + * @param[in] show_whitespace Whether or not we show whitespace characters + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_show_whitespace_set(Elm_Code_Widget *obj, Eina_Bool show_whitespace); + +/** + * @brief Get whether or not white space will be visible. + * + * @param[in] obj The object. + * + * @return Whether or not we show whitespace characters + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_show_whitespace_get(const Elm_Code_Widget *obj); + +/** + * @brief Set an alpha color value for this widget (0 - 255) default is fully + * opaque (255). + * + * @param[in] obj The object. + * @param[in] alpha Alpha value + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_alpha_set(Elm_Code_Widget *obj, int alpha); + +/** + * @brief Set an alpha color value for this widget (0 - 255) default is fully + * opaque (255). + * + * @param[in] obj The object. + * + * @return Alpha value + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI int elm_code_widget_alpha_get(const Elm_Code_Widget *obj); + +/** + * @brief Set whether syntax highlighting should be use for this widget. + * + * @param[in] obj The object. + * @param[in] syntax_enabled Whether or not to enable syntax highlighting + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_syntax_enabled_set(Elm_Code_Widget *obj, Eina_Bool syntax_enabled); + +/** + * @brief Get this widget's enabled state for syntax highlighting. + * + * @param[in] obj The object. + * + * @return Whether or not to enable syntax highlighting + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_syntax_enabled_get(const Elm_Code_Widget *obj); + +/** + * @brief Set whether space characters should be inserted instead of tabs. + * + * @param[in] obj The object. + * @param[in] tab_inserts_spaces @c true if we should insert space characters + * instead of a tab when the Tab key is pressed + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_tab_inserts_spaces_set(Elm_Code_Widget *obj, Eina_Bool tab_inserts_spaces); + +/** + * @brief Get whether or not space characters will be inserted instead of tabs. + * + * @param[in] obj The object. + * + * @return @c true if we should insert space characters instead of a tab when + * the Tab key is pressed + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_tab_inserts_spaces_get(const Elm_Code_Widget *obj); + +/** + * @brief Set the current location of the text cursor. + * + * @param[in] obj The object. + * @param[in] row The vertical position ov the cursur - the fist row is 1 + * @param[in] col The horizontal position of the cursor, starting from column 1 + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_cursor_position_set(Elm_Code_Widget *obj, unsigned int row, unsigned int col); + +/** + * @brief Get the current x and y position of the widget's cursor. + * + * @param[in] obj The object. + * @param[out] row The vertical position ov the cursur - the fist row is 1 + * @param[out] col The horizontal position of the cursor, starting from column + * 1 + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_cursor_position_get(const Elm_Code_Widget *obj, unsigned int *row, unsigned int *col); + +/** Update and refresh theme for widget. + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_theme_refresh(Elm_Code_Widget *obj); + +/** + * @brief Refresh code line in widget + * + * @param[in] obj The object. + * @param[in] line The line to refresh. + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_line_refresh(Elm_Code_Widget *obj, Elm_Code_Line *line); + +/** + * @brief Check if the code line is currently visible + * + * @param[in] obj The object. + * @param[in] line The line to test for visibility. + * + * @return @c true if the line specified is currently visible within the scroll + * region. + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_line_visible_get(Elm_Code_Widget *obj, Elm_Code_Line *line); + +/** + * @brief Get the number of code lines currently visible in the widget + * + * @param[in] obj The object. + * + * @return the number of lines currently visible in the widget. + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_lines_visible_get(Elm_Code_Widget *obj); + +/** + * @brief Get the row, col position for a given coordinate on the widget. + * + * @param[in] obj The object. + * @param[in] x The x coordinate in the widget + * @param[in] y The y coordinate in the widget + * @param[in] row The row for the coordinates + * @param[in] col The column for the coordinates + * + * @return @c true if a line exists at these coordinates + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_position_at_coordinates_get(Elm_Code_Widget *obj, int x, int y, unsigned int *row, int *col); + +/** + * @brief Get the geometry for the cell at the specified position. + * + * @param[in] obj The object. + * @param[in] row The row for the requested position + * @param[in] col The column for the requested position + * @param[in] x The x coordinate of the cell at specified position + * @param[in] y The y coordinate of the cell at specified position + * @param[in] w The width of the cell at specified position + * @param[in] h The height of the cell at specified position + * + * @return @c true if a cell exists at the specified position + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_geometry_for_position_get(Elm_Code_Widget *obj, unsigned int row, int col, int *x, int *y, int *w, int *h); + +/** + * @brief Get the column width of the gutter + * + * @param[in] obj The object. + * + * @return The current column width of the gutter for the widget. + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI int elm_code_widget_text_left_gutter_width_get(Elm_Code_Widget *obj); + +/** + * @brief Get text between given positions + * + * @param[in] obj The object. + * @param[in] start_line The line of the first character to get + * @param[in] start_col The widget column of the first character to get + * @param[in] end_line The line of the last character to get + * @param[in] end_col The widget column of the last character to get + * + * @return The text content between start and end positions + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI char *elm_code_widget_text_between_positions_get(Elm_Code_Widget *obj, unsigned int start_line, unsigned int start_col, unsigned int end_line, unsigned int end_col); + +/** + * @brief Insert the provided text at the cursor position. This will add the + * operation to the widget's undo list. + * + * @param[in] obj The object. + * @param[in] text The text to insert + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_text_at_cursor_insert(Elm_Code_Widget *obj, const char *text); + +/** + * @brief Get text column width at given position + * + * @param[in] obj The object. + * @param[in] line Code line + * @param[in] position Code position + * + * @return Text column width + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_line_text_column_width_to_position(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int position); + +/** + * @brief Get text column width for code line + * + * @param[in] obj The object. + * @param[in] line Code line + * + * @return Text column width + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_line_text_column_width_get(Elm_Code_Widget *obj, Elm_Code_Line *line); + +/** + * @brief Get position from column + * + * @param[in] obj The object. + * @param[in] line Code line + * @param[in] column Column + * + * @return Position + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_line_text_position_for_column_get(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int column); + +/** + * @brief Get tabwidth for column + * + * @param[in] obj The object. + * @param[in] column Column + * + * @return Tabwidth + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI unsigned int elm_code_widget_text_tabwidth_at_column_get(Elm_Code_Widget *obj, unsigned int column); + +/** + * @brief Toggle the display of the line status widget + * + * @param[in] obj The object. + * @param[in] line Code line + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_line_status_toggle(Elm_Code_Widget *obj, Elm_Code_Line *line); + +/** Undo last action + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_undo(Elm_Code_Widget *obj); + +/** + * @brief Determine if there are any available undo operations + * + * @param[in] obj The object. + * + * @return @c true if there are undo operations + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_can_undo_get(Elm_Code_Widget *obj); + +/** Redo last action + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI void elm_code_widget_redo(Elm_Code_Widget *obj); + +/** + * @brief Determine if there are any available redo operations + * + * @param[in] obj The object. + * + * @return @c true if there are redo operations + * + * @ingroup Elm_Code_Widget_Group + */ +EAPI Eina_Bool elm_code_widget_can_redo_get(Elm_Code_Widget *obj); + +#endif diff --git a/src/lib/elementary/elm_code_widget_legacy.h b/src/lib/elementary/elm_code_widget_legacy.h index 5110e301e2..e2d7661a2c 100644 --- a/src/lib/elementary/elm_code_widget_legacy.h +++ b/src/lib/elementary/elm_code_widget_legacy.h @@ -10,4 +10,4 @@ */ EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code); -#include "elm_code_widget.eo.legacy.h" +#include "elm_code_widget_eo.legacy.h" diff --git a/src/lib/elementary/elm_code_widget_selection.c b/src/lib/elementary/elm_code_widget_selection.c index 59a5615bd4..7ee3964a21 100644 --- a/src/lib/elementary/elm_code_widget_selection.c +++ b/src/lib/elementary/elm_code_widget_selection.c @@ -62,7 +62,7 @@ elm_code_widget_selection_start(Evas_Object *widget, pd->selection->start_line = line; pd->selection->start_col = col; - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_START, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_START, widget); } EAPI void @@ -90,7 +90,7 @@ elm_code_widget_selection_end(Evas_Object *widget, pd->selection->end_line = line; pd->selection->end_col = col; - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); } EAPI void @@ -110,7 +110,7 @@ elm_code_widget_selection_select_all(Evas_Object *widget) elm_code_widget_selection_end(widget, maxrow, last_col); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); } EAPI Elm_Code_Widget_Selection_Data * @@ -166,7 +166,7 @@ elm_code_widget_selection_clear(Evas_Object *widget) free(pd->selection); pd->selection = NULL; - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); } static void @@ -292,7 +292,7 @@ _elm_code_widget_selection_delete_do(Evas_Object *widget, Eina_Bool undo) pd->selection = NULL; free(selection); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); elm_code_widget_cursor_position_set(widget, row, col); } @@ -425,8 +425,8 @@ elm_code_widget_selection_cut(Evas_Object *widget) elm_code_widget_selection_delete(widget); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CUT, widget); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_CUT, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); } EAPI void @@ -442,7 +442,7 @@ elm_code_widget_selection_copy(Evas_Object *widget) elm_cnp_selection_loss_callback_set(widget, ELM_SEL_TYPE_CLIPBOARD, _selection_loss_cb, widget); free(text); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_COPY, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_COPY, widget); } static Eina_Bool @@ -454,7 +454,7 @@ _selection_paste_cb(void *data, Evas_Object *obj EINA_UNUSED, Elm_Selection_Data elm_code_widget_text_at_cursor_insert(widget, ev->data); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_PASTE, widget); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_SELECTION_PASTE, widget); return EINA_TRUE; } diff --git a/src/lib/elementary/elm_code_widget_text.c b/src/lib/elementary/elm_code_widget_text.c index f822339243..f560ac382b 100644 --- a/src/lib/elementary/elm_code_widget_text.c +++ b/src/lib/elementary/elm_code_widget_text.c @@ -218,7 +218,7 @@ _elm_code_widget_text_insert_single(Elm_Code_Widget *widget, Elm_Code *code, if (newcol > pd->col_count) _elm_code_widget_resize(widget, line); - elm_obj_code_widget_cursor_position_set(widget, row, newcol); + efl_ui_code_widget_cursor_position_set(widget, row, newcol); } static void @@ -265,8 +265,8 @@ _elm_code_widget_text_at_cursor_insert_do(Elm_Code_Widget *widget, const char *t if (undo) elm_code_widget_selection_delete(widget); - code = elm_obj_code_widget_code_get(widget); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + code = efl_ui_code_widget_code_get(widget); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); line = elm_code_file_line_get(code->file, row); if (line == NULL) { @@ -287,7 +287,7 @@ _elm_code_widget_text_at_cursor_insert_do(Elm_Code_Widget *widget, const char *t elm_code_line_text_insert(line, 0, indent_text, indent); col = elm_code_widget_line_text_column_width_to_position(widget, line, indent + 1); - elm_obj_code_widget_cursor_position_set(widget, row, col); + efl_ui_code_widget_cursor_position_set(widget, row, col); } } @@ -295,9 +295,9 @@ _elm_code_widget_text_at_cursor_insert_do(Elm_Code_Widget *widget, const char *t _elm_code_widget_text_insert_single(widget, code, col, row, text, length); else _elm_code_widget_text_insert_multi(widget, code, col, row, text, length); - elm_obj_code_widget_cursor_position_get(widget, &end_row, &end_col); + efl_ui_code_widget_cursor_position_get(widget, &end_row, &end_col); - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); if (undo) { diff --git a/src/lib/elementary/elm_code_widget_undo.c b/src/lib/elementary/elm_code_widget_undo.c index 65dbf056e0..2143e4c244 100644 --- a/src/lib/elementary/elm_code_widget_undo.c +++ b/src/lib/elementary/elm_code_widget_undo.c @@ -90,7 +90,7 @@ _elm_code_widget_undo_change(Evas_Object *widget, _elm_code_widget_text_at_cursor_insert_no_undo(widget, content, textlen); - elm_obj_code_widget_cursor_position_get(widget, &row, &col); + efl_ui_code_widget_cursor_position_get(widget, &row, &col); position = elm_code_widget_line_text_position_for_column_get(widget, line, col); elm_code_line_split_at(line, position); elm_code_widget_cursor_position_set(widget, newrow + 1, 1); @@ -108,7 +108,7 @@ _elm_code_widget_undo_change(Evas_Object *widget, info->end_col + 1); } - efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_CHANGED_USER, NULL); + efl_event_callback_legacy_call(widget, EFL_UI_CODE_WIDGET_EVENT_CHANGED_USER, NULL); } static Eina_Bool diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index b625f8c4d9..469aa03c38 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -729,6 +729,7 @@ elementary_pub_headers = [ 'elm_calendar_item_eo.legacy.h', 'elm_clock_eo.h', 'elm_clock_eo.legacy.h', + 'elm_code_widget_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h', diff --git a/src/tests/elementary/elm_code_test_syntax.c b/src/tests/elementary/elm_code_test_syntax.c index 9703227cf1..8aa3dcbc59 100644 --- a/src/tests/elementary/elm_code_test_syntax.c +++ b/src/tests/elementary/elm_code_test_syntax.c @@ -64,7 +64,7 @@ EFL_START_TEST(elm_code_syntax_c) win = win_add(NULL, "syntax", ELM_WIN_BASIC); widget = elm_code_widget_add(win, code); - elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc"; + efl_ui_code_widget_code_get(widget)->file->mime = "text/x-csrc"; elm_code_widget_syntax_enabled_set(widget, EINA_TRUE); _append_line(file, "#include ");