From f6f19be6cbba40b1ff00a81b724021fe58574b22 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sat, 14 Feb 2015 18:49:51 +0000 Subject: [PATCH] elm_code: focus: block focus leaving text area when editable. As well as setting when we should not have focus leave us a theme has been added. This allows us to extend from elm_entry which is better suited to us. --- .gitignore | 10 +- Makefile.am | 2 +- configure.ac | 10 +- elm_code/Makefile.am | 2 +- elm_code/data/Makefile.am | 4 + elm_code/data/themes/Makefile.am | 4 + elm_code/data/themes/default/Makefile.am | 20 +++ elm_code/data/themes/default/default.edc | 19 +++ elm_code/src/Makefile.am | 4 + elm_code/{ => src}/bin/Makefile.am | 4 +- elm_code/{ => src}/bin/elm_code_test_main.c | 0 .../{ => src}/bin/elm_code_test_private.h | 0 elm_code/{ => src}/lib/Elm_Code.h | 0 elm_code/{ => src}/lib/Makefile.am | 5 +- elm_code/{ => src}/lib/elm_code.c | 0 elm_code/{ => src}/lib/elm_code_common.h | 0 elm_code/{ => src}/lib/elm_code_diff_widget.c | 0 elm_code/{ => src}/lib/elm_code_diff_widget.h | 0 elm_code/{ => src}/lib/elm_code_file.c | 0 elm_code/{ => src}/lib/elm_code_file.h | 0 elm_code/{ => src}/lib/elm_code_parse.c | 0 elm_code/{ => src}/lib/elm_code_parse.h | 0 elm_code/{ => src}/lib/elm_code_private.h | 1 - elm_code/{ => src}/lib/elm_code_widget.c | 148 +++++++++--------- elm_code/{ => src}/lib/elm_code_widget.eo | 3 +- elm_code/{ => src}/lib/elm_code_widget.eo.c | 6 +- elm_code/{ => src}/lib/elm_code_widget.eo.h | 0 elm_code/{ => src}/lib/elm_code_widget_text.c | 0 elm_code/{ => src}/lib/elm_code_widget_text.h | 0 elm_code/{ => src}/tests/Makefile.am | 12 +- .../{ => src}/tests/elm_code_file_test_load.c | 0 .../tests/elm_code_file_test_memory.c | 0 elm_code/{ => src}/tests/elm_code_suite.c | 0 elm_code/{ => src}/tests/elm_code_suite.h | 0 .../{ => src}/tests/elm_code_test_basic.c | 0 .../{ => src}/tests/elm_code_test_parse.c | 0 .../{ => src}/tests/elm_code_test_widget.c | 0 elm_code/{ => src}/tests/testdiff.diff | 0 .../{ => src}/tests/testfile-withblanks.txt | 0 elm_code/{ => src}/tests/testfile.txt | 0 src/bin/Makefile.am | 4 +- src/tests/Makefile.am | 6 +- 42 files changed, 157 insertions(+), 107 deletions(-) create mode 100644 elm_code/data/Makefile.am create mode 100644 elm_code/data/themes/Makefile.am create mode 100644 elm_code/data/themes/default/Makefile.am create mode 100644 elm_code/data/themes/default/default.edc create mode 100644 elm_code/src/Makefile.am rename elm_code/{ => src}/bin/Makefile.am (77%) rename elm_code/{ => src}/bin/elm_code_test_main.c (100%) rename elm_code/{ => src}/bin/elm_code_test_private.h (100%) rename elm_code/{ => src}/lib/Elm_Code.h (100%) rename elm_code/{ => src}/lib/Makefile.am (89%) rename elm_code/{ => src}/lib/elm_code.c (100%) rename elm_code/{ => src}/lib/elm_code_common.h (100%) rename elm_code/{ => src}/lib/elm_code_diff_widget.c (100%) rename elm_code/{ => src}/lib/elm_code_diff_widget.h (100%) rename elm_code/{ => src}/lib/elm_code_file.c (100%) rename elm_code/{ => src}/lib/elm_code_file.h (100%) rename elm_code/{ => src}/lib/elm_code_parse.c (100%) rename elm_code/{ => src}/lib/elm_code_parse.h (100%) rename elm_code/{ => src}/lib/elm_code_private.h (96%) rename elm_code/{ => src}/lib/elm_code_widget.c (88%) rename elm_code/{ => src}/lib/elm_code_widget.eo (97%) rename elm_code/{ => src}/lib/elm_code_widget.eo.c (95%) rename elm_code/{ => src}/lib/elm_code_widget.eo.h (100%) rename elm_code/{ => src}/lib/elm_code_widget_text.c (100%) rename elm_code/{ => src}/lib/elm_code_widget_text.h (100%) rename elm_code/{ => src}/tests/Makefile.am (66%) rename elm_code/{ => src}/tests/elm_code_file_test_load.c (100%) rename elm_code/{ => src}/tests/elm_code_file_test_memory.c (100%) rename elm_code/{ => src}/tests/elm_code_suite.c (100%) rename elm_code/{ => src}/tests/elm_code_suite.h (100%) rename elm_code/{ => src}/tests/elm_code_test_basic.c (100%) rename elm_code/{ => src}/tests/elm_code_test_parse.c (100%) rename elm_code/{ => src}/tests/elm_code_test_widget.c (100%) rename elm_code/{ => src}/tests/testdiff.diff (100%) rename elm_code/{ => src}/tests/testfile-withblanks.txt (100%) rename elm_code/{ => src}/tests/testfile.txt (100%) diff --git a/.gitignore b/.gitignore index 31f94c2..acef3ca 100644 --- a/.gitignore +++ b/.gitignore @@ -66,9 +66,9 @@ po/stamp-po /src/tests/test-suite.log /src/tests/check-results.xml -/elm_code/bin/elm_code_test +/elm_code/src/bin/elm_code_test -/elm_code/tests/elm_code_suite -/elm_code/tests/elm_code_suite.* -/elm_code/tests/test-suite.log -/elm_code/tests/check-results.xml +/elm_code/src/tests/elm_code_suite +/elm_code/src/tests/elm_code_suite.* +/elm_code/src/tests/test-suite.log +/elm_code/src/tests/check-results.xml diff --git a/Makefile.am b/Makefile.am index 75beb48..c539a3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -76,7 +76,7 @@ endif if EFL_HAVE_TESTS -TESTS = elm_code/tests/elm_code_suite src/tests/edi_suite +TESTS = elm_code/src/tests/elm_code_suite src/tests/edi_suite lcov-check: if EFL_HAVE_LCOV diff --git a/configure.ac b/configure.ac index 9e07729..375a168 100644 --- a/configure.ac +++ b/configure.ac @@ -118,9 +118,13 @@ src/bin/Makefile src/lib/Makefile src/tests/Makefile elm_code/Makefile -elm_code/lib/Makefile -elm_code/bin/Makefile -elm_code/tests/Makefile +elm_code/data/Makefile +elm_code/data/themes/Makefile +elm_code/data/themes/default/Makefile +elm_code/src/Makefile +elm_code/src/lib/Makefile +elm_code/src/bin/Makefile +elm_code/src/tests/Makefile doc/edi.1 ]) AC_OUTPUT diff --git a/elm_code/Makefile.am b/elm_code/Makefile.am index 15871c9..b10ba50 100644 --- a/elm_code/Makefile.am +++ b/elm_code/Makefile.am @@ -1,4 +1,4 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = lib bin tests +SUBDIRS = src data diff --git a/elm_code/data/Makefile.am b/elm_code/data/Makefile.am new file mode 100644 index 0000000..f67d4f3 --- /dev/null +++ b/elm_code/data/Makefile.am @@ -0,0 +1,4 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = themes + diff --git a/elm_code/data/themes/Makefile.am b/elm_code/data/themes/Makefile.am new file mode 100644 index 0000000..31a2b40 --- /dev/null +++ b/elm_code/data/themes/Makefile.am @@ -0,0 +1,4 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = default + diff --git a/elm_code/data/themes/default/Makefile.am b/elm_code/data/themes/default/Makefile.am new file mode 100644 index 0000000..46593bf --- /dev/null +++ b/elm_code/data/themes/default/Makefile.am @@ -0,0 +1,20 @@ +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = \ +default.edc + +include ../../../../Makefile_Edje_Helper.am + +filesdir = $(datadir)/$(PACKAGE)/themes +files_DATA = elm_code.edj + +elm_code.edj: Makefile $(EXTRA_DIST) + $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) \ + -id ${top_srcdir}/elm_code/data/themes/default/images \ + -sd ${top_srcdir}/elm_code/data/themes/default/sounds \ + $(top_srcdir)/elm_code/data/themes/default/default.edc \ + $(top_builddir)/elm_code/data/themes/default/elm_code.edj + +clean-local: + rm -f *.edj diff --git a/elm_code/data/themes/default/default.edc b/elm_code/data/themes/default/default.edc new file mode 100644 index 0000000..dea7a81 --- /dev/null +++ b/elm_code/data/themes/default/default.edc @@ -0,0 +1,19 @@ +collections { + /* simple layout to pack our scrolling content into an elm_layout */ + group { name: "elm_code/layout/default"; + parts { + part { name: "elm.swallow.content"; type: SWALLOW; + description { state: "default" 0.0; + align: 0.5 0.0; + fixed: 0 1; + + rel2 { + relative: 1.0 1.0; + offset: 0 0; + } + } + } + } + } +} + diff --git a/elm_code/src/Makefile.am b/elm_code/src/Makefile.am new file mode 100644 index 0000000..15871c9 --- /dev/null +++ b/elm_code/src/Makefile.am @@ -0,0 +1,4 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = lib bin tests + diff --git a/elm_code/bin/Makefile.am b/elm_code/src/bin/Makefile.am similarity index 77% rename from elm_code/bin/Makefile.am rename to elm_code/src/bin/Makefile.am index 0e6d5ba..74d06a8 100644 --- a/elm_code/bin/Makefile.am +++ b/elm_code/src/bin/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ --I$(top_srcdir)/elm_code/lib/ \ +-I$(top_srcdir)/elm_code/src/lib/ \ -DLOCALEDIR=\"$(datadir)/locale\" \ -DEFL_BETA_API_SUPPORT \ @EFL_CFLAGS@ @@ -15,7 +15,7 @@ elm_code_test_SOURCES = \ elm_code_test_main.c \ elm_code_test_private.h -elm_code_test_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/lib/libelm_code.la +elm_code_test_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/src/lib/libelm_code.la elm_code_test_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ diff --git a/elm_code/bin/elm_code_test_main.c b/elm_code/src/bin/elm_code_test_main.c similarity index 100% rename from elm_code/bin/elm_code_test_main.c rename to elm_code/src/bin/elm_code_test_main.c diff --git a/elm_code/bin/elm_code_test_private.h b/elm_code/src/bin/elm_code_test_private.h similarity index 100% rename from elm_code/bin/elm_code_test_private.h rename to elm_code/src/bin/elm_code_test_private.h diff --git a/elm_code/lib/Elm_Code.h b/elm_code/src/lib/Elm_Code.h similarity index 100% rename from elm_code/lib/Elm_Code.h rename to elm_code/src/lib/Elm_Code.h diff --git a/elm_code/lib/Makefile.am b/elm_code/src/lib/Makefile.am similarity index 89% rename from elm_code/lib/Makefile.am rename to elm_code/src/lib/Makefile.am index 5b927f0..3e8a4c8 100644 --- a/elm_code/lib/Makefile.am +++ b/elm_code/src/lib/Makefile.am @@ -3,12 +3,13 @@ MAINTAINERCLEANFILES = Makefile.in CLEANFILES= EOLIAN_FLAGS = @DEPS_EOLIAN_FLAGS@ \ - -I$(top_srcdir)/elm_code/lib + -I$(top_srcdir)/elm_code/src/lib include $(top_srcdir)/Makefile_Eolian_Helper.am AM_CPPFLAGS = \ --I$(top_srcdir)/elm_code/lib \ +-I$(top_srcdir)/elm_code/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ -DEFL_BETA_API_SUPPORT \ -DEFL_EO_API_SUPPORT \ @EFL_CFLAGS@ \ diff --git a/elm_code/lib/elm_code.c b/elm_code/src/lib/elm_code.c similarity index 100% rename from elm_code/lib/elm_code.c rename to elm_code/src/lib/elm_code.c diff --git a/elm_code/lib/elm_code_common.h b/elm_code/src/lib/elm_code_common.h similarity index 100% rename from elm_code/lib/elm_code_common.h rename to elm_code/src/lib/elm_code_common.h diff --git a/elm_code/lib/elm_code_diff_widget.c b/elm_code/src/lib/elm_code_diff_widget.c similarity index 100% rename from elm_code/lib/elm_code_diff_widget.c rename to elm_code/src/lib/elm_code_diff_widget.c diff --git a/elm_code/lib/elm_code_diff_widget.h b/elm_code/src/lib/elm_code_diff_widget.h similarity index 100% rename from elm_code/lib/elm_code_diff_widget.h rename to elm_code/src/lib/elm_code_diff_widget.h diff --git a/elm_code/lib/elm_code_file.c b/elm_code/src/lib/elm_code_file.c similarity index 100% rename from elm_code/lib/elm_code_file.c rename to elm_code/src/lib/elm_code_file.c diff --git a/elm_code/lib/elm_code_file.h b/elm_code/src/lib/elm_code_file.h similarity index 100% rename from elm_code/lib/elm_code_file.h rename to elm_code/src/lib/elm_code_file.h diff --git a/elm_code/lib/elm_code_parse.c b/elm_code/src/lib/elm_code_parse.c similarity index 100% rename from elm_code/lib/elm_code_parse.c rename to elm_code/src/lib/elm_code_parse.c diff --git a/elm_code/lib/elm_code_parse.h b/elm_code/src/lib/elm_code_parse.h similarity index 100% rename from elm_code/lib/elm_code_parse.h rename to elm_code/src/lib/elm_code_parse.h diff --git a/elm_code/lib/elm_code_private.h b/elm_code/src/lib/elm_code_private.h similarity index 96% rename from elm_code/lib/elm_code_private.h rename to elm_code/src/lib/elm_code_private.h index c464d95..854d4b6 100644 --- a/elm_code/lib/elm_code_private.h +++ b/elm_code/src/lib/elm_code_private.h @@ -35,7 +35,6 @@ typedef struct double gravity_x, gravity_y; unsigned int cursor_line, cursor_col; - Eina_Bool cursor_move_vetoed; Eina_Bool editable, focussed; Eina_Bool show_line_numbers; } Elm_Code_Widget_Data; diff --git a/elm_code/lib/elm_code_widget.c b/elm_code/src/lib/elm_code_widget.c similarity index 88% rename from elm_code/lib/elm_code_widget.c rename to elm_code/src/lib/elm_code_widget.c index bc98b03..a12fac1 100644 --- a/elm_code/lib/elm_code_widget.c +++ b/elm_code/src/lib/elm_code_widget.c @@ -35,7 +35,6 @@ _elm_code_widget_eo_base_constructor(Eo *obj, Elm_Code_Widget_Data *pd EINA_UNUS pd->cursor_line = 1; pd->cursor_col = 1; - pd->cursor_move_vetoed = EINA_TRUE; } EOLIAN static void @@ -271,6 +270,57 @@ _elm_code_widget_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN _elm_code_widget_fill(widget); } +static Eina_Bool +_elm_code_widget_cursor_key_will_move(Elm_Code_Widget *widget, const char *key) +{ + Elm_Code_Widget_Data *pd; + Elm_Code_Line *line; + + pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + line = elm_code_file_line_get(pd->code->file, pd->cursor_line); + + if (!line) + return EINA_FALSE; + + if (!strcmp(key, "Up")) + return pd->cursor_line > 1; + else if (!strcmp(key, "Down")) + return pd->cursor_line < elm_code_file_lines_get(pd->code->file); + else if (!strcmp(key, "Left")) + return pd->cursor_col > 1; + else if (!strcmp(key, "Right")) + return pd->cursor_col < (unsigned int) line->length + 1; + else + return EINA_FALSE; +} + +static void +_elm_code_widget_update_focus_directions(Elm_Code_Widget *obj) +{ + if (_elm_code_widget_cursor_key_will_move(obj, "Up")) + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_UP); + else + elm_widget_focus_next_object_set(obj, NULL, ELM_FOCUS_UP); + + if (_elm_code_widget_cursor_key_will_move(obj, "Down")) + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_DOWN); + else + elm_widget_focus_next_object_set(obj, NULL, ELM_FOCUS_DOWN); + + if (_elm_code_widget_cursor_key_will_move(obj, "Left")) + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_LEFT); + else + elm_widget_focus_next_object_set(obj, NULL, ELM_FOCUS_LEFT); + + if (_elm_code_widget_cursor_key_will_move(obj, "Right")) + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_RIGHT); + else + elm_widget_focus_next_object_set(obj, NULL, ELM_FOCUS_RIGHT); + + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_PREVIOUS); + elm_widget_focus_next_object_set(obj, obj, ELM_FOCUS_NEXT); +} + static void _elm_code_widget_clicked_editable_cb(Elm_Code_Widget *widget, Evas_Coord x, Evas_Coord y) { @@ -298,6 +348,7 @@ _elm_code_widget_clicked_editable_cb(Elm_Code_Widget *widget, Evas_Coord x, Evas if (pd->cursor_col == 0) pd->cursor_col = 1; + _elm_code_widget_update_focus_directions(widget); _elm_code_widget_fill(widget); } @@ -407,42 +458,6 @@ _elm_code_widget_cursor_move_right(Elm_Code_Widget *widget) _elm_code_widget_fill(widget); } -static Eina_Bool -_elm_code_widget_cursor_key_can_control(Evas_Event_Key_Down *event) -{ - if (!strcmp(event->key, "Up")) - return EINA_TRUE; - else if (!strcmp(event->key, "Down")) - return EINA_TRUE; - else if (!strcmp(event->key, "Left")) - return EINA_TRUE; - else if (!strcmp(event->key, "Right")) - return EINA_TRUE; - else - return EINA_FALSE; -} - -static Eina_Bool -_elm_code_widget_cursor_key_will_move(Elm_Code_Widget *widget, Evas_Event_Key_Down *event) -{ - Elm_Code_Widget_Data *pd; - Elm_Code_Line *line; - - pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); - line = elm_code_file_line_get(pd->code->file, pd->cursor_line); - - if (!strcmp(event->key, "Up")) - return pd->cursor_line > 1; - else if (!strcmp(event->key, "Down")) - return pd->cursor_line < elm_code_file_lines_get(pd->code->file); - else if (!strcmp(event->key, "Left")) - return pd->cursor_col > 1; - else if (!strcmp(event->key, "Right")) - return pd->cursor_col < (unsigned int) line->length + 1; - else - return EINA_FALSE; -} - static void _elm_code_widget_key_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) @@ -458,12 +473,7 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas EINA_UNUSED, if (!pd->editable) return; - pd->cursor_move_vetoed = EINA_TRUE; - if (_elm_code_widget_cursor_key_can_control(ev) && !_elm_code_widget_cursor_key_will_move(widget, ev)) - { - pd->cursor_move_vetoed = EINA_FALSE; - return; - } + _elm_code_widget_update_focus_directions(widget); if (!strcmp(ev->key, "Up")) _elm_code_widget_cursor_move_up(widget); @@ -477,48 +487,34 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas EINA_UNUSED, INF("Unhandled key %s", ev->key); } -static Eina_Bool -_elm_code_widget_event_veto_cb(void *data, Evas_Object *obj EINA_UNUSED, - Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, - void *event_info EINA_UNUSED) +static void +_elm_code_widget_focused_event_cb(void *data, Evas_Object *obj, + void *event_info EINA_UNUSED) { Elm_Code_Widget *widget; Elm_Code_Widget_Data *pd; - Eina_Bool vetoed; widget = (Elm_Code_Widget *)data; pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); - if (!pd->editable) - return EINA_FALSE; + pd->focussed = EINA_TRUE; - vetoed = EINA_TRUE; - if (type == EVAS_CALLBACK_KEY_DOWN) - { - vetoed = pd->cursor_move_vetoed; - pd->cursor_move_vetoed = EINA_TRUE; - } - - return vetoed; + _elm_code_widget_update_focus_directions(widget); + _elm_code_widget_fill(obj); } -EOLIAN static Eina_Bool -_elm_code_widget_elm_widget_on_focus(Eo *obj, Elm_Code_Widget_Data *pd) +static void +_elm_code_widget_unfocused_event_cb(void *data, Evas_Object *obj, + void *event_info EINA_UNUSED) { - Eina_Bool int_ret; + Elm_Code_Widget *widget; + Elm_Code_Widget_Data *pd; - if (!pd->editable) - return EINA_FALSE; - - eo_do_super(obj, ELM_CODE_WIDGET_CLASS, int_ret = elm_obj_widget_on_focus()); - - if (!int_ret) - return EINA_TRUE; - - pd->focussed = elm_widget_focus_get(obj); + widget = (Elm_Code_Widget *)data; + pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + pd->focussed = EINA_FALSE; _elm_code_widget_fill(obj); - return pd->focussed; } EOLIAN static Eina_Bool @@ -652,11 +648,14 @@ _elm_code_widget_evas_object_smart_add(Eo *obj, Elm_Code_Widget_Data *pd) eo_do_super(obj, ELM_CODE_WIDGET_CLASS, evas_obj_smart_add()); elm_object_focus_allow_set(obj, EINA_TRUE); + elm_layout_file_set(obj, PACKAGE_DATA_DIR "/themes/elm_code.edj", "elm_code/layout/default"); + scroller = elm_scroller_add(obj); evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(scroller); - elm_box_pack_end(obj, scroller); + elm_layout_content_set(obj, "elm.swallow.content", scroller); + elm_object_focus_allow_set(scroller, EINA_FALSE); pd->scroller = scroller; grid = evas_object_textgrid_add(obj); @@ -667,11 +666,12 @@ _elm_code_widget_evas_object_smart_add(Eo *obj, Elm_Code_Widget_Data *pd) pd->grid = grid; _elm_code_widget_setup_palette(grid); - evas_object_event_callback_add(grid, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); evas_object_event_callback_add(grid, EVAS_CALLBACK_MOUSE_UP, _elm_code_widget_clicked_cb, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj); - elm_object_event_callback_add(obj, _elm_code_widget_event_veto_cb, obj); + evas_object_smart_callback_add(obj, "focused", _elm_code_widget_focused_event_cb, obj); + evas_object_smart_callback_add(obj, "unfocused", _elm_code_widget_unfocused_event_cb, obj); eo_do(obj, eo_event_callback_add(&ELM_CODE_EVENT_LINE_SET_DONE, _elm_code_widget_line_cb, obj); diff --git a/elm_code/lib/elm_code_widget.eo b/elm_code/src/lib/elm_code_widget.eo similarity index 97% rename from elm_code/lib/elm_code_widget.eo rename to elm_code/src/lib/elm_code_widget.eo index 1b29f39..3bc81b8 100644 --- a/elm_code/lib/elm_code_widget.eo +++ b/elm_code/src/lib/elm_code_widget.eo @@ -1,4 +1,4 @@ -class Elm_Code_Widget (Elm_Box, Elm_Interface_Atspi_Text) +class Elm_Code_Widget (Elm_Layout, Elm_Interface_Atspi_Text) { eo_prefix: elm_code_widget; properties { @@ -110,7 +110,6 @@ class Elm_Code_Widget (Elm_Box, Elm_Interface_Atspi_Text) class.constructor; Eo.Base.constructor; Evas.Object_Smart.add; - Elm_Widget.on_focus; Elm_Widget.focus_next_manager_is; Elm_Widget.focus_direction_manager_is; } diff --git a/elm_code/lib/elm_code_widget.eo.c b/elm_code/src/lib/elm_code_widget.eo.c similarity index 95% rename from elm_code/lib/elm_code_widget.eo.c rename to elm_code/src/lib/elm_code_widget.eo.c index 7364d59..a61a1cb 100644 --- a/elm_code/lib/elm_code_widget.eo.c +++ b/elm_code/src/lib/elm_code_widget.eo.c @@ -47,9 +47,6 @@ void _elm_code_widget_eo_base_constructor(Eo *obj, Elm_Code_Widget_Data *pd); void _elm_code_widget_evas_object_smart_add(Eo *obj, Elm_Code_Widget_Data *pd); -Eina_Bool _elm_code_widget_elm_widget_on_focus(Eo *obj, Elm_Code_Widget_Data *pd); - - Eina_Bool _elm_code_widget_elm_widget_focus_next_manager_is(Eo *obj, Elm_Code_Widget_Data *pd); @@ -59,7 +56,6 @@ Eina_Bool _elm_code_widget_elm_widget_focus_direction_manager_is(Eo *obj, Elm_Co static Eo_Op_Description _elm_code_widget_op_desc[] = { EO_OP_FUNC_OVERRIDE(eo_constructor, _elm_code_widget_eo_base_constructor), EO_OP_FUNC_OVERRIDE(evas_obj_smart_add, _elm_code_widget_evas_object_smart_add), - EO_OP_FUNC_OVERRIDE(elm_obj_widget_on_focus, _elm_code_widget_elm_widget_on_focus), EO_OP_FUNC_OVERRIDE(elm_obj_widget_focus_next_manager_is, _elm_code_widget_elm_widget_focus_next_manager_is), EO_OP_FUNC_OVERRIDE(elm_obj_widget_focus_direction_manager_is, _elm_code_widget_elm_widget_focus_direction_manager_is), EO_OP_FUNC(elm_code_widget_code_set, _elm_code_widget_code_set, "Set the underlying code object that this widget renders"), @@ -91,4 +87,4 @@ static const Eo_Class_Description _elm_code_widget_class_desc = { NULL }; -EO_DEFINE_CLASS(elm_code_widget_class_get, &_elm_code_widget_class_desc, ELM_BOX_CLASS, ELM_INTERFACE_ATSPI_TEXT_INTERFACE, NULL); \ No newline at end of file +EO_DEFINE_CLASS(elm_code_widget_class_get, &_elm_code_widget_class_desc, ELM_LAYOUT_CLASS, ELM_INTERFACE_ATSPI_TEXT_INTERFACE, NULL); \ No newline at end of file diff --git a/elm_code/lib/elm_code_widget.eo.h b/elm_code/src/lib/elm_code_widget.eo.h similarity index 100% rename from elm_code/lib/elm_code_widget.eo.h rename to elm_code/src/lib/elm_code_widget.eo.h diff --git a/elm_code/lib/elm_code_widget_text.c b/elm_code/src/lib/elm_code_widget_text.c similarity index 100% rename from elm_code/lib/elm_code_widget_text.c rename to elm_code/src/lib/elm_code_widget_text.c diff --git a/elm_code/lib/elm_code_widget_text.h b/elm_code/src/lib/elm_code_widget_text.h similarity index 100% rename from elm_code/lib/elm_code_widget_text.h rename to elm_code/src/lib/elm_code_widget_text.h diff --git a/elm_code/tests/Makefile.am b/elm_code/src/tests/Makefile.am similarity index 66% rename from elm_code/tests/Makefile.am rename to elm_code/src/tests/Makefile.am index af4ae1a..168321d 100644 --- a/elm_code/tests/Makefile.am +++ b/elm_code/src/tests/Makefile.am @@ -13,19 +13,19 @@ elm_code_test_parse.c \ elm_code_test_widget.c \ elm_code_suite.c -elm_code_suite_CPPFLAGS = -I$(top_builddir)/elm_code/lib/ \ +elm_code_suite_CPPFLAGS = -I$(top_builddir)/elm_code/src/lib/ \ -DEFL_BETA_API_SUPPORT \ -DEFL_EO_API_SUPPORT \ --I$(top_srcdir)/elm_code/lib \ --DPACKAGE_TESTS_DIR=\"$(top_srcdir)/elm_code/tests/\" \ --DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/elm_code/tests/\" \ +-I$(top_srcdir)/elm_code/src/lib \ +-DPACKAGE_TESTS_DIR=\"$(top_srcdir)/elm_code/src/tests/\" \ +-DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/elm_code/src/tests/\" \ -DTESTS_DIR=\"$(abspath $(srcdir))/\" \ -DEFL_BETA_API_SUPPORT \ @EFL_CFLAGS@ \ @CHECK_CFLAGS@ -elm_code_suite_LDADD = @EFL_LIBS@ @CHECK_LIBS@ $(top_builddir)/elm_code/lib/libelm_code.la -elm_code_suite_DEPENDENCIES = $(top_builddir)/elm_code/lib/libelm_code.la +elm_code_suite_LDADD = @EFL_LIBS@ @CHECK_LIBS@ $(top_builddir)/elm_code/src/lib/libelm_code.la +elm_code_suite_DEPENDENCIES = $(top_builddir)/elm_code/src/lib/libelm_code.la testdir = $(PACKAGE_TESTS_DIR) test_DATA = \ diff --git a/elm_code/tests/elm_code_file_test_load.c b/elm_code/src/tests/elm_code_file_test_load.c similarity index 100% rename from elm_code/tests/elm_code_file_test_load.c rename to elm_code/src/tests/elm_code_file_test_load.c diff --git a/elm_code/tests/elm_code_file_test_memory.c b/elm_code/src/tests/elm_code_file_test_memory.c similarity index 100% rename from elm_code/tests/elm_code_file_test_memory.c rename to elm_code/src/tests/elm_code_file_test_memory.c diff --git a/elm_code/tests/elm_code_suite.c b/elm_code/src/tests/elm_code_suite.c similarity index 100% rename from elm_code/tests/elm_code_suite.c rename to elm_code/src/tests/elm_code_suite.c diff --git a/elm_code/tests/elm_code_suite.h b/elm_code/src/tests/elm_code_suite.h similarity index 100% rename from elm_code/tests/elm_code_suite.h rename to elm_code/src/tests/elm_code_suite.h diff --git a/elm_code/tests/elm_code_test_basic.c b/elm_code/src/tests/elm_code_test_basic.c similarity index 100% rename from elm_code/tests/elm_code_test_basic.c rename to elm_code/src/tests/elm_code_test_basic.c diff --git a/elm_code/tests/elm_code_test_parse.c b/elm_code/src/tests/elm_code_test_parse.c similarity index 100% rename from elm_code/tests/elm_code_test_parse.c rename to elm_code/src/tests/elm_code_test_parse.c diff --git a/elm_code/tests/elm_code_test_widget.c b/elm_code/src/tests/elm_code_test_widget.c similarity index 100% rename from elm_code/tests/elm_code_test_widget.c rename to elm_code/src/tests/elm_code_test_widget.c diff --git a/elm_code/tests/testdiff.diff b/elm_code/src/tests/testdiff.diff similarity index 100% rename from elm_code/tests/testdiff.diff rename to elm_code/src/tests/testdiff.diff diff --git a/elm_code/tests/testfile-withblanks.txt b/elm_code/src/tests/testfile-withblanks.txt similarity index 100% rename from elm_code/tests/testfile-withblanks.txt rename to elm_code/src/tests/testfile-withblanks.txt diff --git a/elm_code/tests/testfile.txt b/elm_code/src/tests/testfile.txt similarity index 100% rename from elm_code/tests/testfile.txt rename to elm_code/src/tests/testfile.txt diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index fb99137..2b565dd 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -11,7 +11,7 @@ AM_CPPFLAGS = \ -DLOCALEDIR=\"$(datadir)/locale\" \ -I$(top_srcdir)/src/lib \ -I$(top_srcdir)/src/bin \ --I$(top_srcdir)/elm_code/lib \ +-I$(top_srcdir)/elm_code/src/lib \ -I$(top_builddir)/src/lib \ -DEFL_BETA_API_SUPPORT \ @EFL_CFLAGS@ @@ -42,7 +42,7 @@ mainview/edi_mainview.c \ edi_main.c \ edi_private.h -edi_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/lib/libelm_code.la $(top_builddir)/src/lib/libedi.la $(LTLIBINTL) +edi_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/src/lib/libelm_code.la $(top_builddir)/src/lib/libedi.la $(LTLIBINTL) edi_build_SOURCES = \ edi_build_main.c diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index eb836f5..fbe3925 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -12,7 +12,7 @@ edi_suite.c edi_suite_CPPFLAGS = -I$(top_builddir)/src/lib/ -I$(top_builddir)/src/bin/ \ -I$(top_srcdir)/src/lib \ --I$(top_srcdir)/elm_code/lib \ +-I$(top_srcdir)/elm_code/src/lib \ -I$(top_srcdir)/src/bin \ -DPACKAGE_TESTS_DIR=\"$(top_srcdir)/src/tests/\" \ -DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/src/tests/\" \ @@ -20,8 +20,8 @@ edi_suite_CPPFLAGS = -I$(top_builddir)/src/lib/ -I$(top_builddir)/src/bin/ \ @EFL_CFLAGS@ \ @CHECK_CFLAGS@ -edi_suite_LDADD = @EFL_LIBS@ @CHECK_LIBS@ $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/lib/libelm_code.la -edi_suite_DEPENDENCIES = $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/lib/libelm_code.la +edi_suite_LDADD = @EFL_LIBS@ @CHECK_LIBS@ $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/src/lib/libelm_code.la +edi_suite_DEPENDENCIES = $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/src/lib/libelm_code.la endif