aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2018-03-24 10:39:32 +0000
committerAndy Williams <andy@andywilliams.me>2018-07-22 17:02:23 +0100
commit1485cf9df5f0a601fdfb17c9647168b8a47ef07f (patch)
tree349e1ee1118c233c2d75345908bac24bb5520b23 /src/bin/elementary
parentCtxpopup super slow with some more items (diff)
downloadefl-1485cf9df5f0a601fdfb17c9647168b8a47ef07f.tar.gz
elm_code: (cherry-pick) Support indentation styles that are purely tab based
read: Allow non-EFL style indentation. This is off by default but is switched on if you turn 'tabs insert spaces' off
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/test.c6
-rw-r--r--src/bin/elementary/test_code.c50
2 files changed, 54 insertions, 2 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index e4c65b13b9..8d8d9701d5 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -332,6 +332,7 @@ void test_colorclass(void *data, Evas_Object *obj, void *event_info);
void test_code_welcome(void *data, Evas_Object *obj, void *event_info);
void test_code_editor(void *data, Evas_Object *obj, void *event_info);
void test_code_syntax(void *data, Evas_Object *obj, void *event_info);
+void test_code_syntax_tabbed(void *data, Evas_Object *obj, void *event_info);
void test_code_mirror(void *data, Evas_Object *obj, void *event_info);
void test_code_log(void *data, Evas_Object *obj, void *event_info);
void test_code_diff(void *data, Evas_Object *obj, void *event_info);
@@ -848,9 +849,10 @@ add_tests:
ADD_TEST_EO(NULL, "Entries", "Efl.Ui.Tags", test_ui_tags);
//------------------------------//
+ ADD_TEST(NULL, "Advanced Entries", "Code Entry Markup", test_code_welcome);
+ ADD_TEST(NULL, "Advanced Entries", "Code Editor", test_code_editor);
ADD_TEST(NULL, "Advanced Entries", "Code Syntax", test_code_syntax);
- ADD_TEST(NULL, "Advanced Entries", "Entry Markup", test_code_welcome);
- ADD_TEST(NULL, "Advanced Entries", "Text Editor", test_code_editor);
+ ADD_TEST(NULL, "Advanced Entries", "Code Syntax (Tabbed)", test_code_syntax_tabbed);
ADD_TEST(NULL, "Advanced Entries", "Mirrored Editor", test_code_mirror);
ADD_TEST(NULL, "Advanced Entries", "Logger", test_code_log);
ADD_TEST(NULL, "Advanced Entries", "Diff Comparison", test_code_diff);
diff --git a/src/bin/elementary/test_code.c b/src/bin/elementary/test_code.c
index b6dad3ea2f..bb010ce5e6 100644
--- a/src/bin/elementary/test_code.c
+++ b/src/bin/elementary/test_code.c
@@ -156,6 +156,40 @@ _elm_code_test_syntax_setup(Evas_Object *parent)
}
static Evas_Object *
+_elm_code_test_syntax_tabbed_setup(Evas_Object *parent)
+{
+ Elm_Code *code;
+ Elm_Code_Widget *widget;
+
+ 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);
+
+ _append_line(code->file, "#include <stdio.h>");
+ _append_line(code->file, "int main(int argc, char **argv)");
+ _append_line(code->file, "{");
+ _append_line(code->file, "\t// display a welcome greeting");
+ _append_line(code->file, "\tif (argc > 0)");
+ _append_line(code->file, "\t\tprintf(\"Hello, %s!\\n\", argv[0]);");
+ _append_line(code->file, "\telse");
+ _append_line(code->file, "\t\tprintf(\"Hello, World!\\n\");");
+ _append_line(code->file, "\treturn 0;");
+ _append_line(code->file, "}");
+
+ evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(widget);
+
+ return widget;
+}
+
+static Evas_Object *
_elm_code_test_mirror_setup(Elm_Code *code, char *font_name, Evas_Object *parent)
{
Elm_Code_Widget *widget;
@@ -263,6 +297,22 @@ test_code_syntax(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
}
void
+test_code_syntax_tabbed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *screen;
+
+ win = _test_code_win_create("code-syntax-tabbed", "Code Syntax (Tabbed)");
+ screen = elm_box_add(win);
+ evas_object_size_hint_weight_set(screen, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(screen, _elm_code_test_syntax_tabbed_setup(screen));
+ elm_win_resize_object_add(win, screen);
+ evas_object_show(screen);
+
+ evas_object_show(win);
+}
+
+
+void
test_code_log(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *win, *screen, *o, *code;