[EGIT] [core/efl] master 04/04: evas_clickable_interface: adding new event
jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=24b786462a1b10744eaeb5f807fbe01fb56d4c13 commit 24b786462a1b10744eaeb5f807fbe01fb56d4c13 Author: Avi Levin Date: Wed May 20 10:08:17 2015 +0300 evas_clickable_interface: adding new event --- src/lib/evas/canvas/evas_clickable_interface.eo | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/evas/canvas/evas_clickable_interface.eo b/src/lib/evas/canvas/evas_clickable_interface.eo index 47337b6..f945ba4 100644 --- a/src/lib/evas/canvas/evas_clickable_interface.eo +++ b/src/lib/evas/canvas/evas_clickable_interface.eo @@ -4,6 +4,7 @@ interface Evas.Clickable_Interface (Evas.Signal_Interface) clicked; clicked,double; clicked,triple; + clicked,right; pressed; unpressed; longpressed; --
[EGIT] [core/efl] master 02/04: emotion: porting evas smart callbacks to eo
jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f9c116a48749c642eb31154a4cfb5f60a110dcba commit f9c116a48749c642eb31154a4cfb5f60a110dcba Author: Avi Levin Date: Sun Apr 26 14:49:26 2015 +0300 emotion: porting evas smart callbacks to eo --- src/examples/emotion/emotion_basic_example.c | 17 +++- src/examples/emotion/emotion_border_example.c | 66 + src/examples/emotion/emotion_generic_example.c | 80 ++- .../emotion/emotion_generic_subtitle_example.c | 16 ++- src/examples/emotion/emotion_signals_example.c | 87 ++-- src/lib/emotion/emotion_smart.c| 76 ++ src/modules/ethumb/emotion/emotion.c | 56 +++ src/tests/emotion/emotion_test_main.c | 110 ++--- 8 files changed, 318 insertions(+), 190 deletions(-) diff --git a/src/examples/emotion/emotion_basic_example.c b/src/examples/emotion/emotion_basic_example.c index ec465bc..ebf8244 100644 --- a/src/examples/emotion/emotion_basic_example.c +++ b/src/examples/emotion/emotion_basic_example.c @@ -1,5 +1,9 @@ //Compile with: -// gcc -o emotion_basic_example emotion_basic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas` +// gcc -o emotion_basic_example emotion_basic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eo` + +#define EFL_BETA_API_SUPPORT +#define EFL_EO_API_SUPPORT +#include #include #include @@ -10,10 +14,13 @@ #define WIDTH (320) #define HEIGHT (240) -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + +return EINA_TRUE; } int @@ -58,8 +65,8 @@ main(int argc, const char *argv[]) em = emotion_object_add(e); emotion_object_init(em, NULL); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); + eo_do(em, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_START, _playback_started_cb, NULL)); emotion_object_file_set(em, filename); diff --git a/src/examples/emotion/emotion_border_example.c b/src/examples/emotion/emotion_border_example.c index 695b507..22eca25 100644 --- a/src/examples/emotion/emotion_border_example.c +++ b/src/examples/emotion/emotion_border_example.c @@ -1,5 +1,8 @@ //Compile with: -// gcc -o emotion_border_example emotion_border_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina` +// gcc -o emotion_border_example emotion_border_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina eo` + +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #include #include @@ -14,10 +17,13 @@ static Eina_List *filenames = NULL; static Eina_List *curfile = NULL; -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, +Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + +return EINA_TRUE; } static Evas_Object * @@ -27,8 +33,8 @@ _create_emotion_object(Evas *e) emotion_object_init(em, "gstreamer1"); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); + eo_do(em, eo_event_callback_add( + EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL)); return em; } @@ -103,38 +109,53 @@ _on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void * } } -static void -_frame_decode_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_decode_cb(void *data EINA_UNUSED, +Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { // fprintf(stderr, "smartcb: frame_decode\n"); + + return EINA_TRUE; } -static void -_length_change_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_length_change_cb(void *data EINA_UNUSED, +Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: length_change: %0.3f\n", emotion_object_play_length_get(o)); + + return EINA_TRUE; } -static void -_position_update_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_position_update_cb(void *data EINA_UNUSED, +Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: position_update: %0.3f\n", emotion_object_position_get(o)
[EGIT] [core/efl] master 03/04: evas: porting evas smart callbacks to eo
jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7d493fb4207dce83e35dc5f808d7fc1684f7c440 commit 7d493fb4207dce83e35dc5f808d7fc1684f7c440 Author: Avi Levin Date: Mon Apr 27 18:28:36 2015 +0300 evas: porting evas smart callbacks to eo --- src/lib/evas/canvas/evas_object_box.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c index eda1bcd..675e63e 100644 --- a/src/lib/evas/canvas/evas_object_box.c +++ b/src/lib/evas/canvas/evas_object_box.c @@ -221,7 +221,7 @@ _evas_box_internal_append(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child) priv->children = eina_list_append(priv->children, opt); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_ADDED, opt); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, opt)); return opt; } @@ -237,7 +237,7 @@ _evas_box_internal_prepend(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child priv->children = eina_list_prepend(priv->children, opt); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_ADDED, opt); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, opt)); return opt; } @@ -261,7 +261,7 @@ _evas_box_internal_insert_before(Eo *o, Evas_Object_Box_Data *priv, Evas_Object priv->children = eina_list_prepend_relative (priv->children, new_opt, opt); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, new_opt)); return new_opt; } } @@ -288,7 +288,7 @@ _evas_box_internal_insert_after(Eo *o, Evas_Object_Box_Data *priv, Evas_Object * priv->children = eina_list_append_relative (priv->children, new_opt, opt); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, new_opt)); return new_opt; } } @@ -311,7 +311,7 @@ _evas_box_internal_insert_at(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *chi priv->children = eina_list_prepend(priv->children, new_opt); priv->children_changed = EINA_TRUE; -evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); +eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, new_opt)); return new_opt; } @@ -330,7 +330,7 @@ _evas_box_internal_insert_at(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *chi priv->children = eina_list_prepend_relative (priv->children, new_opt, opt); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_ADDED, new_opt)); return new_opt; } } @@ -352,7 +352,7 @@ _evas_box_internal_remove(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child) priv->children = eina_list_remove(priv->children, opt); eo_do(o, evas_obj_box_internal_option_free(opt)); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_REMOVED, obj)); return obj; } @@ -380,7 +380,7 @@ _evas_box_internal_remove_at(Eo *o, Evas_Object_Box_Data *priv, unsigned int pos priv->children = eina_list_remove_list(priv->children, node); eo_do(o, evas_obj_box_internal_option_free(opt)); priv->children_changed = EINA_TRUE; - evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); + eo_do(o, eo_event_callback_call(EVAS_BOX_EVENT_CHILD_REMOVED, obj)); return obj; } --
[EGIT] [core/efl] master 01/04: edje: porting evas smart callbacks to eo
jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b563efc52ffbc02ae33d4901326a583102975cbb commit b563efc52ffbc02ae33d4901326a583102975cbb Author: Avi Levin Date: Tue Apr 21 19:00:58 2015 +0300 edje: porting evas smart callbacks to eo It's the first stage of replacing calls of evas_object_smart_callback_add/del/call with eo_callback_add/del/call. This will reduce the use of legacy events and callbacks lists in smart_object which in turn will improve performance and reduce memory use. --- src/lib/edje/edje_calc.c| 2 +- src/lib/edje/edje_object.eo | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c old mode 100644 new mode 100755 index 31cfbd0..3d75e24 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -742,7 +742,7 @@ _edje_recalc_do(Edje *ed) if (!ed->calc_only) { if (ed->recalc_call) - evas_object_smart_callback_call(ed->obj, "recalc", NULL); + eo_do(ed->obj, eo_event_callback_call(EDJE_OBJECT_EVENT_RECALC, NULL)); } else evas_object_smart_need_recalculate_set(ed->obj, need_calc); diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo old mode 100644 new mode 100755 index 5eecbe4..c05ef77 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -2399,4 +2399,7 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) Efl.File.mmap.set; Efl.File.mmap.get; } + events { + recalc; /*@ Edje re-calculated the object. */ + } } --
[EGIT] [tools/edi] master 03/05: texts: fix tests broken in previous refactor
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=2604a3cdfd456ecc336b4462f6504f4160c29e9f commit 2604a3cdfd456ecc336b4462f6504f4160c29e9f Author: Andy Williams Date: Sun Jun 7 23:12:05 2015 +0100 texts: fix tests broken in previous refactor --- elm_code/src/tests/widget/elm_code_test_widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elm_code/src/tests/widget/elm_code_test_widget.c b/elm_code/src/tests/widget/elm_code_test_widget.c index a30e6ea..3471e3c 100644 --- a/elm_code/src/tests/widget/elm_code_test_widget.c +++ b/elm_code/src/tests/widget/elm_code_test_widget.c @@ -41,10 +41,10 @@ START_TEST (elm_code_widget_token_render_simple_test) _elm_code_widget_fill_line_tokens(widget, cells, length+1, line); _assert_cell_type(cells[1], ELM_CODE_TOKEN_TYPE_DEFAULT, 1); _assert_cell_type(cells[4], ELM_CODE_TOKEN_TYPE_DEFAULT, 4); - _assert_cell_type(cells[6], ELM_CODE_TOKEN_TYPE_DEFAULT, 6); + _assert_cell_type(cells[5], ELM_CODE_TOKEN_TYPE_DEFAULT, 5); _assert_cell_type(cells[16], ELM_CODE_TOKEN_TYPE_COMMENT, 16); _assert_cell_type(cells[20], ELM_CODE_TOKEN_TYPE_DEFAULT, 20); - _assert_cell_type(cells[23], ELM_CODE_TOKEN_TYPE_COMMENT, 23); + _assert_cell_type(cells[22], ELM_CODE_TOKEN_TYPE_COMMENT, 22); elm_code_free(code); elm_shutdown(); --
[EGIT] [tools/edi] master 05/05: elm_code: remove selections if moving cursor
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=1cc89c78a25ad83007f4c00b7ecbff3866c0be52 commit 1cc89c78a25ad83007f4c00b7ecbff3866c0be52 Author: Andy Williams Date: Sun Jun 7 23:13:26 2015 +0100 elm_code: remove selections if moving cursor The selection remaining after cursor move was getting confusing --- elm_code/src/lib/widget/elm_code_widget.c | 8 1 file changed, 8 insertions(+) diff --git a/elm_code/src/lib/widget/elm_code_widget.c b/elm_code/src/lib/widget/elm_code_widget.c index bf34af4..a2888d2 100644 --- a/elm_code/src/lib/widget/elm_code_widget.c +++ b/elm_code/src/lib/widget/elm_code_widget.c @@ -758,6 +758,7 @@ _elm_code_widget_cursor_move_home(Elm_Code_Widget *widget) Elm_Code_Widget_Data *pd; pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + elm_code_widget_selection_clear(widget); if (pd->cursor_col <= 1) return; @@ -773,6 +774,7 @@ _elm_code_widget_cursor_move_end(Elm_Code_Widget *widget) unsigned int lastcol; pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + elm_code_widget_selection_clear(widget); line = elm_code_file_line_get(pd->code->file, pd->cursor_line); lastcol = elm_code_widget_line_text_column_width_get(widget, line); @@ -792,6 +794,7 @@ _elm_code_widget_cursor_move_up(Elm_Code_Widget *widget) pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); row = pd->cursor_line; col = pd->cursor_col; + elm_code_widget_selection_clear(widget); if (pd->cursor_line <= 1) return; @@ -815,6 +818,7 @@ _elm_code_widget_cursor_move_down(Elm_Code_Widget *widget) pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); row = pd->cursor_line; col = pd->cursor_col; + elm_code_widget_selection_clear(widget); if (pd->cursor_line >= elm_code_file_lines_get(pd->code->file)) return; @@ -834,6 +838,7 @@ _elm_code_widget_cursor_move_left(Elm_Code_Widget *widget) Elm_Code_Widget_Data *pd; pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + elm_code_widget_selection_clear(widget); if (pd->cursor_col <= 1) { @@ -855,6 +860,7 @@ _elm_code_widget_cursor_move_right(Elm_Code_Widget *widget) Elm_Code_Line *line; pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + elm_code_widget_selection_clear(widget); line = elm_code_file_line_get(pd->code->file, pd->cursor_line); if (pd->cursor_col > elm_code_widget_line_text_column_width_get(widget, line)) @@ -890,6 +896,7 @@ _elm_code_widget_cursor_move_pageup(Elm_Code_Widget *widget) row = pd->cursor_line; col = pd->cursor_col; + elm_code_widget_selection_clear(widget); if (pd->cursor_line <= 1) return; @@ -917,6 +924,7 @@ _elm_code_widget_cursor_move_pagedown(Elm_Code_Widget *widget) row = pd->cursor_line; col = pd->cursor_col; + elm_code_widget_selection_clear(widget); if (pd->cursor_line >= elm_code_file_lines_get(pd->code->file)) return; --
[EGIT] [tools/edi] master 01/05: docs: Fix manpage and skeleton manpage
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=1998483d0628e558fe1516cf65e7f4e962daa572 commit 1998483d0628e558fe1516cf65e7f4e962daa572 Author: Andy Williams Date: Thu Jun 4 08:40:43 2015 +0100 docs: Fix manpage and skeleton manpage --- data/extra/skeleton/eflproject/doc/${edi_name}.1.in | 4 ++-- doc/edi.1.in| 17 + src/bin/edi_main.c | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/data/extra/skeleton/eflproject/doc/${edi_name}.1.in b/data/extra/skeleton/eflproject/doc/${edi_name}.1.in index 0e3e367..5720fa3 100644 --- a/data/extra/skeleton/eflproject/doc/${edi_name}.1.in +++ b/data/extra/skeleton/eflproject/doc/${edi_name}.1.in @@ -1,11 +1,11 @@ -.TH ${EDI_NAME} 1 "01 01 1970 FIXME" "@PACKAGE_NAME@ @PACKAGE_VERSION@" +.TH ${EDI_NAME} 1 "01 01 ${Edi_Year} FIXME" "@PACKAGE_NAME@ @PACKAGE_VERSION@" .SH NAME ${edi_name} \- a demo application .SH SYNOPSIS .B ${edi_name} -[-d] [-f] [-t=THEME] [-m=MINES] [-L] [-C] [-V] [-h] +[-L] [-C] [-V] [-h] .SH DESCRIPTION diff --git a/doc/edi.1.in b/doc/edi.1.in index 67b3f23..3329f98 100644 --- a/doc/edi.1.in +++ b/doc/edi.1.in @@ -1,19 +1,20 @@ -.TH EDI 1 "01 01 1970 FIXME" "@PACKAGE_NAME@ @PACKAGE_VERSION@" +.TH EDI 1 "04 06 2015" "@PACKAGE_NAME@ @PACKAGE_VERSION@" .SH NAME -edi \- a demo application +edi \- the Enlightened IDE .SH SYNOPSIS .B edi -[-d] [-f] [-t=THEME] [-m=MINES] [-L] [-C] [-V] [-h] +[-L] [-C] [-V] [-h] +.B [project-dir] .SH DESCRIPTION -Edi is a demo application to show how to integrate EFL and autotools into a -cross platform build. You should be able to generate an executable easily for all -target supported by EFL with this edi. +Edi is an integrated development environment based on the EFL. -With no option, the program starts and display an Hello World. +With no option, the program starts and displays a project picker screen. +If you launch with a project directory parameter it will open directly to +that project. .SH OPTIONS @@ -42,7 +43,7 @@ Reports are welcome. Send them at @PACKAGE_BUGREPORT@. .SH HOMEPAGE -http://enlightenment.org +http://edi-ide.com .SH AUTHORS diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index d404fd5..48aae6b 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -34,7 +34,7 @@ typedef struct _Edi_Panel_Slide_Effect Eina_Bool left; } Edi_Panel_Slide_Effect; -#define COPYRIGHT "Copyright © 2014 Andy Williams and various contributors (see AUTHORS)." +#define COPYRIGHT "Copyright © 2014-2015 Andy Williams and various contributors (see AUTHORS)." static Evas_Object *_edi_toolbar, *_edi_leftpanes, *_edi_bottompanes; static Evas_Object *_edi_logpanel, *_edi_consolepanel, *_edi_testpanel; @@ -1099,8 +1099,8 @@ static const Ecore_Getopt optdesc = { "%prog [options] [project-dir]", PACKAGE_VERSION, COPYRIGHT, - "BSD with advertisement clause", - "The EFL IDE", + "GPLv2", + "The Enlightened IDE", EINA_TRUE, { ECORE_GETOPT_LICENSE('L', "license"), --
[EGIT] [tools/edi] master 04/05: remove tabs from indent
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=7cc03ec58d35f760ceadafcd34dbc1512e12ba4d commit 7cc03ec58d35f760ceadafcd34dbc1512e12ba4d Author: Andy Williams Date: Sun Jun 7 23:12:31 2015 +0100 remove tabs from indent --- src/bin/mainview/edi_mainview.c | 16 src/bin/screens/edi_welcome.c | 7 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/bin/mainview/edi_mainview.c b/src/bin/mainview/edi_mainview.c index 3a98651..6551164 100644 --- a/src/bin/mainview/edi_mainview.c +++ b/src/bin/mainview/edi_mainview.c @@ -60,10 +60,10 @@ edi_mainview_item_prev() EINA_LIST_FOREACH(_edi_mainview_items, item, it) { if (first->view == current) - { -prev = eina_list_nth(_edi_mainview_items, eina_list_count(_edi_mainview_items)-1); -edi_mainview_item_select(prev); - } + { + prev = eina_list_nth(_edi_mainview_items, eina_list_count(_edi_mainview_items)-1); + edi_mainview_item_select(prev); + } if (it && it->view == current) { if (prev) @@ -89,10 +89,10 @@ edi_mainview_item_next() EINA_LIST_FOREACH(_edi_mainview_items, item, it) { if (last->view == current) - { -next = eina_list_nth(_edi_mainview_items, 0); -edi_mainview_item_select(next); - } + { + next = eina_list_nth(_edi_mainview_items, 0); + edi_mainview_item_select(next); + } if (it && open_next) { edi_mainview_item_select(it); diff --git a/src/bin/screens/edi_welcome.c b/src/bin/screens/edi_welcome.c index 8a5664c..b0ad461 100644 --- a/src/bin/screens/edi_welcome.c +++ b/src/bin/screens/edi_welcome.c @@ -55,14 +55,13 @@ _edi_message_open(const char *message, Eina_Bool deletable) popup = elm_popup_add(_welcome_window); _edi_new_popup = popup; - elm_object_part_text_set(popup, "title,text", - message); + elm_object_part_text_set(popup, "title,text", message); button = elm_button_add(popup); elm_object_text_set(button, "Ok"); elm_object_part_content_set(popup, "button1", button); evas_object_smart_callback_add(button, "clicked", - _edi_on_close_message, NULL); + _edi_on_close_message, NULL); if (deletable) { @@ -70,7 +69,7 @@ _edi_message_open(const char *message, Eina_Bool deletable) elm_object_text_set(button, "Delete"); elm_object_part_content_set(popup, "button2", button); evas_object_smart_callback_add(button, "clicked", - _edi_on_delete_message, NULL); + _edi_on_delete_message, NULL); } evas_object_show(popup); --
[EGIT] [tools/edi] master 02/05: elm_code: indent lines to match whitespace above
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=866d22c40bdc6f042831432167fffb213a1a6125 commit 866d22c40bdc6f042831432167fffb213a1a6125 Author: Andy Williams Date: Sun Jun 7 23:11:25 2015 +0100 elm_code: indent lines to match whitespace above We can look at more complex scope based indenting later --- ChangeLog | 4 elm_code/src/lib/elm_code_text.c | 18 ++ elm_code/src/lib/elm_code_text.h | 2 ++ elm_code/src/lib/widget/elm_code_widget.c | 11 +-- elm_code/src/tests/elm_code_test_text.c | 19 +++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84d1e79..7cfa99b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-06-07 ajwillia.ms (Andy Williams) + + * Indent newlines to match whitespace in the previous line + 2015-05-31 ajwillia.ms (Andy Williams) * Add launch configuration so we can run a built binary diff --git a/elm_code/src/lib/elm_code_text.c b/elm_code/src/lib/elm_code_text.c index 9d42e4e..7480b4a 100644 --- a/elm_code/src/lib/elm_code_text.c +++ b/elm_code/src/lib/elm_code_text.c @@ -244,3 +244,21 @@ elm_code_text_newlinenpos(const char *text, unsigned int length, short *nllen) return crpos; } +EAPI unsigned int +elm_code_text_leading_whitespace_length(const char *text, unsigned int length) +{ + unsigned int count = 0; + char *ptr = (char *)text; + + while (count < length) + { +if (!(*ptr == ' ' || *ptr == '\t')) + break; + +count++; +ptr++; + } + + return count; +} + diff --git a/elm_code/src/lib/elm_code_text.h b/elm_code/src/lib/elm_code_text.h index f547891..07e139d 100644 --- a/elm_code/src/lib/elm_code_text.h +++ b/elm_code/src/lib/elm_code_text.h @@ -54,6 +54,8 @@ EAPI int elm_code_text_strnpos(const char *text, unsigned int length, const char EAPI int elm_code_text_newlinenpos(const char *text, unsigned int length, short *nllen); +EAPI unsigned int elm_code_text_leading_whitespace_length(const char *text, unsigned int length); + /** * @} */ diff --git a/elm_code/src/lib/widget/elm_code_widget.c b/elm_code/src/lib/widget/elm_code_widget.c index 22ba56b..bf34af4 100644 --- a/elm_code/src/lib/widget/elm_code_widget.c +++ b/elm_code/src/lib/widget/elm_code_widget.c @@ -975,19 +975,26 @@ _elm_code_widget_newline(Elm_Code_Widget *widget) { Elm_Code *code; Elm_Code_Line *line; - unsigned int row, col, position; + unsigned int row, col, position, oldlen, leading; + const char *oldtext; _elm_code_widget_delete_selection(widget); eo_do(widget, code = elm_obj_code_widget_code_get(), elm_obj_code_widget_cursor_position_get(&col, &row)); line = elm_code_file_line_get(code->file, row); + oldtext = elm_code_line_text_get(line, &oldlen); position = elm_code_widget_line_text_position_for_column_get(widget, line, col); elm_code_line_split_at(line, position); + line = elm_code_file_line_get(code->file, row + 1); + leading = elm_code_text_leading_whitespace_length(oldtext, oldlen); + elm_code_line_text_insert(line, 0, oldtext, leading); + eo_do(widget, - elm_obj_code_widget_cursor_position_set(1, row + 1), + elm_obj_code_widget_cursor_position_set( +elm_obj_code_widget_line_text_column_width_to_position(line, leading), row + 1), // TODO construct and pass a change object eo_event_callback_call(ELM_CODE_WIDGET_EVENT_CHANGED_USER, NULL)); } diff --git a/elm_code/src/tests/elm_code_test_text.c b/elm_code/src/tests/elm_code_test_text.c index 85784a4..5391eb6 100644 --- a/elm_code/src/tests/elm_code_test_text.c +++ b/elm_code/src/tests/elm_code_test_text.c @@ -94,6 +94,24 @@ START_TEST (elm_code_text_newline_position_test) } END_TEST +START_TEST (elm_code_text_leading_whitespace_test) +{ + const char *text; + + text = "testing"; + ck_assert_int_eq(0, elm_code_text_leading_whitespace_length(text, strlen(text))); + + text = " spaces"; + ck_assert_int_eq(2, elm_code_text_leading_whitespace_length(text, strlen(text))); + + text = "\t\ttabs"; + ck_assert_int_eq(2, elm_code_text_leading_whitespace_length(text, strlen(text))); + + text = " \t mix"; + ck_assert_int_eq(3, elm_code_text_leading_whitespace_length(text, strlen(text))); +} +END_TEST + void elm_code_test_text(TCase *tc) { tcase_add_test(tc, elm_code_text_get_test); @@ -101,4 +119,5 @@ void elm_code_test_text(TCase *tc) tcase_add_test(tc, elm_code_text_contains_test); tcase_add_test(tc, elm_code_text_strpos_test); tcase_add_test(tc, elm_code_text_newline_position_test); + tcase_add_test(tc, elm_code_text_leading_whitespace_test); } --