diff --git a/data/meson.build b/data/meson.build index 36ee18d..3b2b0d8 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,3 +1,4 @@ subdir('desktop') subdir('images') subdir('extra/templates') +subdir('themes') diff --git a/data/themes/black.edc b/data/themes/black.edc new file mode 100644 index 0000000..addadeb --- /dev/null +++ b/data/themes/black.edc @@ -0,0 +1,61 @@ +collections { + +/* simple layout to pack our scrolling content into an elm_layout */ +group { name: "elm/code/layout/default"; + data { + item: "font.name" "Mono"; + item: "font.size" "10"; + } + 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; + } + } + } + } +} + +color_classes { + color_class { name: "elm/code/status/default"; color: 0 0 0 255; } + color_class { name: "elm/code/status/current"; color: 12 12 12 255; } + color_class { name: "elm/code/status/ignored"; color: 36 36 36 255; } + color_class { name: "elm/code/status/note"; color: 221 119 17 255; } + color_class { name: "elm/code/status/warning"; color: 221 119 17 255; } + color_class { name: "elm/code/status/error"; color: 204 17 17 255; } + color_class { name: "elm/code/status/fatal"; color: 204 17 17 255; } + color_class { name: "elm/code/status/added"; color: 36 96 36 255; } + color_class { name: "elm/code/status/removed"; color: 96 36 36 255; } + color_class { name: "elm/code/status/changed"; color: 36 36 96 255; } + color_class { name: "elm/code/status/passed"; color: 54 96 54 255; } + color_class { name: "elm/code/status/failed"; color: 96 54 54 255; } + color_class { name: "elm/code/status/todo"; color: 51 85 187 255; } + + color_class { name: "elm/code/token/default"; color: 187 187 187 255; } + color_class { name: "elm/code/token/comment"; color: 85 85 85 255; } + color_class { name: "elm/code/token/string"; color: 255 136 119 255; } + color_class { name: "elm/code/token/number"; color: 170 153 34 255; } + color_class { name: "elm/code/token/brace"; color: 170 102 170 255; } + color_class { name: "elm/code/token/type"; color: 255 255 255 255; } + color_class { name: "elm/code/token/class"; color: 255 255 255 255; } + color_class { name: "elm/code/token/function"; color: 255 255 255 255; } + color_class { name: "elm/code/token/param"; color: 187 187 187 255; } + color_class { name: "elm/code/token/keyword"; color: 68 136 204 255; } + color_class { name: "elm/code/token/preprocessor"; color: 102 255 85 255; } + color_class { name: "elm/code/token/added"; color: 54 255 54 255; } + color_class { name: "elm/code/token/removed"; color: 255 54 54 255; } + color_class { name: "elm/code/token/changed"; color: 54 54 255 255; } + color_class { name: "elm/code/token/match"; color: 187 187 51 255; } + + color_class { name: "elm/code/widget/color/selection"; color: 51 153 255 255; } + color_class { name: "elm/code/widget/color/gutter/bg"; color: 75 75 75 255; } + color_class { name: "elm/code/widget/color/gutter/fg"; color: 139 139 139 255; } + color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 54 54 54 255; } + color_class { name: "elm/code/widget/color/whitespace"; color: 50 50 50 127; } +} +} diff --git a/data/themes/default/default.edc b/data/themes/default/default.edc deleted file mode 100644 index b1bacd8..0000000 --- a/data/themes/default/default.edc +++ /dev/null @@ -1,21 +0,0 @@ -images.image: "enlightenment.png" COMP; - -collections { - sounds { - sample { - name: "bell" LOSSY 64; - source: "bell.wav"; - } - } - - group { - name: "test"; - parts { - part { name: "main"; type: IMAGE; - description { - image.normal: "enlightenment.png"; - } - } - } - } -} diff --git a/data/themes/default/images/enlightenment.png b/data/themes/default/images/enlightenment.png deleted file mode 100644 index 759381d..0000000 Binary files a/data/themes/default/images/enlightenment.png and /dev/null differ diff --git a/data/themes/default/sounds/bell.wav b/data/themes/default/sounds/bell.wav deleted file mode 100644 index c052881..0000000 Binary files a/data/themes/default/sounds/bell.wav and /dev/null differ diff --git a/data/themes/meson.build b/data/themes/meson.build new file mode 100644 index 0000000..6342b2b --- /dev/null +++ b/data/themes/meson.build @@ -0,0 +1,23 @@ +edje_cc = find_program('edje_cc') + +cmd = [ edje_cc, + '-id', join_paths(meson.source_root(), 'data' , 'themes'), + '@INPUT@', '@OUTPUT@' + ] + +theme_names = ['black', 'white'] + +foreach theme_name : theme_names + custom_target('theme ' + theme_name, + input : theme_name + '.edc', + output : theme_name + '.edj', + command: cmd, + install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'themes'), + install: true, + ) + + out = join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'themes', theme_name + '.edj') + meson.add_install_script('../../scripts/world_read.sh', out) +endforeach + + diff --git a/data/themes/white.edc b/data/themes/white.edc new file mode 100644 index 0000000..fa55108 --- /dev/null +++ b/data/themes/white.edc @@ -0,0 +1,61 @@ +collections { + +/* simple layout to pack our scrolling content into an elm_layout */ +group { name: "elm/code/layout/default"; + data { + item: "font.name" "Mono"; + item: "font.size" "10"; + } + 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; + } + } + } + } +} + +color_classes { + color_class { name: "elm/code/status/default"; color: 255 255 255 255; } + color_class { name: "elm/code/status/current"; color: 211 211 211 255; } + color_class { name: "elm/code/status/ignored"; color: 0 0 0 255; } + color_class { name: "elm/code/status/note"; color: 0 0 0 255; } + color_class { name: "elm/code/status/warning"; color: 0 0 0 255; } + color_class { name: "elm/code/status/error"; color: 0 0 0 255; } + color_class { name: "elm/code/status/fatal"; color: 0 0 0 255; } + color_class { name: "elm/code/status/added"; color: 0 0 0 255; } + color_class { name: "elm/code/status/removed"; color: 0 0 0 255; } + color_class { name: "elm/code/status/changed"; color: 0 0 0 255; } + color_class { name: "elm/code/status/passed"; color: 0 0 0 255; } + color_class { name: "elm/code/status/failed"; color: 0 0 0 255; } + color_class { name: "elm/code/status/todo"; color: 0 0 0 255; } + + color_class { name: "elm/code/token/default"; color: 0 0 0 255; } + color_class { name: "elm/code/token/comment"; color: 0 0 0 255; } + color_class { name: "elm/code/token/string"; color: 0 0 0 255; } + color_class { name: "elm/code/token/number"; color: 0 0 0 255; } + color_class { name: "elm/code/token/brace"; color: 0 0 0 255; } + color_class { name: "elm/code/token/type"; color: 0 0 0 255; } + color_class { name: "elm/code/token/class"; color: 0 0 0 255; } + color_class { name: "elm/code/token/function"; color: 0 0 0 255; } + color_class { name: "elm/code/token/param"; color: 0 0 0 255; } + color_class { name: "elm/code/token/keyword"; color: 0 0 0 255; } + color_class { name: "elm/code/token/preprocessor"; color: 0 0 0 255; } + color_class { name: "elm/code/token/added"; color: 0 0 0 255; } + color_class { name: "elm/code/token/removed"; color: 0 0 0 255; } + color_class { name: "elm/code/token/changed"; color: 0 0 0 255; } + color_class { name: "elm/code/token/match"; color: 0 0 0 255; } + + color_class { name: "elm/code/widget/color/selection"; color: 169 169 169 255; } + color_class { name: "elm/code/widget/color/gutter/bg"; color: 211 211 211 255; } + color_class { name: "elm/code/widget/color/gutter/fg"; color: 21 21 21 255; } + color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 255 255 255 255; } + color_class { name: "elm/code/widget/color/whitespace"; color: 255 255 255 255; } +} +} diff --git a/src/bin/edi_config.c b/src/bin/edi_config.c index 6ef604c..767750e 100644 --- a/src/bin/edi_config.c +++ b/src/bin/edi_config.c @@ -269,6 +269,7 @@ _edi_config_init(void) EDI_CONFIG_VAL(D, T, font.name, EET_T_STRING); EDI_CONFIG_VAL(D, T, font.size, EET_T_INT); EDI_CONFIG_VAL(D, T, gui.translucent, EET_T_UCHAR); + EDI_CONFIG_VAL(D, T, gui.theme, EET_T_STRING); EDI_CONFIG_VAL(D, T, gui.width, EET_T_INT); EDI_CONFIG_VAL(D, T, gui.height, EET_T_INT); EDI_CONFIG_VAL(D, T, gui.leftsize, EET_T_DOUBLE); diff --git a/src/bin/edi_config.h b/src/bin/edi_config.h index 9a265bb..59b2fba 100644 --- a/src/bin/edi_config.h +++ b/src/bin/edi_config.h @@ -77,6 +77,7 @@ struct _Edi_Project_Config struct { Eina_Bool translucent; + const char *theme; int width, height, bottomtab; double leftsize, bottomsize; Eina_Bool leftopen, bottomopen; diff --git a/src/bin/edi_consolepanel.c b/src/bin/edi_consolepanel.c index be5d8d6..42c8765 100644 --- a/src/bin/edi_consolepanel.c +++ b/src/bin/edi_consolepanel.c @@ -16,6 +16,7 @@ #include "edi_consolepanel.h" #include "mainview/edi_mainview.h" +#include "edi_theme.h" #include "edi_config.h" #include "edi_private.h" @@ -321,11 +322,13 @@ _edi_consolepanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, v EINA_LIST_FOREACH(_edi_console_code->widgets, item, widget) { elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); } EINA_LIST_FOREACH(_edi_test_code->widgets, item, widget) { elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); } return ECORE_CALLBACK_RENEW; @@ -341,6 +344,7 @@ void edi_consolepanel_add(Evas_Object *parent) widget = elm_code_widget_add(parent, code); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_consolepanel_line_cb, NULL); efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_consolepanel_clicked_cb, code); @@ -366,6 +370,7 @@ void edi_testpanel_add(Evas_Object *parent) widget = elm_code_widget_add(parent, code); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_testpanel_line_cb, NULL); efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_consolepanel_clicked_cb, code); diff --git a/src/bin/edi_debugpanel.c b/src/bin/edi_debugpanel.c index df24f0d..036df9d 100644 --- a/src/bin/edi_debugpanel.c +++ b/src/bin/edi_debugpanel.c @@ -7,6 +7,7 @@ #include #include "edi_debug.h" +#include "edi_theme.h" #include "edi_debugpanel.h" #include "edi_config.h" @@ -36,6 +37,7 @@ static Eina_Bool _edi_debugpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); return ECORE_CALLBACK_RENEW; } @@ -227,7 +229,7 @@ void edi_debugpanel_stop(void) debug = edi_debug_get(); if (!debug) - return; + return; if (debug->exe) ecore_exe_terminate(debug->exe); @@ -323,6 +325,7 @@ void edi_debugpanel_add(Evas_Object *parent) code = elm_code_create(); widget = elm_code_widget_add(parent, code); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_debugpanel_line_cb, NULL); evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/src/bin/edi_logpanel.c b/src/bin/edi_logpanel.c index fbf21d4..e743ac0 100644 --- a/src/bin/edi_logpanel.c +++ b/src/bin/edi_logpanel.c @@ -7,6 +7,7 @@ #include #include "edi_logpanel.h" +#include "edi_theme.h" #include "edi_config.h" #include "edi_private.h" @@ -36,7 +37,7 @@ _edi_logpanel_print_cb(const Eina_Log_Domain *domain, Eina_Log_Level level, unsigned int printed, buffer_len = 512; char buffer [buffer_len]; - if (_edi_log_dom == -1) return; + if (_edi_log_dom == -1) return; if (_edi_logpanel_ignore(level, fnc)) return; @@ -64,6 +65,7 @@ static Eina_Bool _edi_logpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); return ECORE_CALLBACK_RENEW; } @@ -75,6 +77,7 @@ void edi_logpanel_add(Evas_Object *parent) code = elm_code_create(); widget = elm_code_widget_add(parent, code); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_logpanel_line_cb, NULL); diff --git a/src/bin/edi_searchpanel.c b/src/bin/edi_searchpanel.c index 6983047..6404119 100644 --- a/src/bin/edi_searchpanel.c +++ b/src/bin/edi_searchpanel.c @@ -9,6 +9,7 @@ #include #include "edi_file.h" #include "edi_searchpanel.h" +#include "edi_theme.h" #include "edi_config.h" #include "mainview/edi_mainview.h" @@ -25,6 +26,7 @@ static Eina_Bool _edi_searchpanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); return ECORE_CALLBACK_RENEW; } @@ -233,6 +235,7 @@ edi_searchpanel_add(Evas_Object *parent) Elm_Code *code; code = elm_code_create(); widget = elm_code_widget_add(parent, code); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_searchpanel_line_clicked_cb, NULL); @@ -261,6 +264,7 @@ static Eina_Bool _edi_taskspanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { elm_code_widget_font_set(_tasks_widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(_tasks_widget, _edi_project_config->gui.theme); return ECORE_CALLBACK_RENEW; } @@ -300,6 +304,7 @@ edi_taskspanel_add(Evas_Object *parent) Elm_Code *code; code = elm_code_create(); widget = elm_code_widget_add(parent, code); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); elm_obj_code_widget_gravity_set(widget, 0.0, 1.0); efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_taskspanel_line_cb, NULL); diff --git a/src/bin/edi_theme.c b/src/bin/edi_theme.c new file mode 100644 index 0000000..a2ba60a --- /dev/null +++ b/src/bin/edi_theme.c @@ -0,0 +1,76 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "Edi.h" +#include "edi_theme.h" +#include "edi_config.h" +#include "edi_private.h" + +static Eina_List *_edi_themes = NULL; + +// we are hooking into Efl for now... +Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj); + +void +edi_theme_elm_code_set(Evas_Object *obj, const char *name) +{ + Eina_List *l; + Edi_Theme *theme; + + if (!name) + return; + + edi_theme_themes_get(); + + EINA_LIST_FOREACH(_edi_themes, l, theme) + { + if (strcmp(theme->name, name)) + continue; + + elm_layout_file_set(obj, theme->path, "elm/code/layout/default"); + efl_ui_widget_theme_apply(obj); + } +} + +Eina_List * +edi_theme_themes_get(void) +{ + Eina_List *files; + char *directory, *file, *name; + Edi_Theme *theme; + + if (_edi_themes) return _edi_themes; + + directory = PACKAGE_DATA_DIR "/themes"; + + theme = malloc(sizeof(Edi_Theme)); + theme->name = strdup("default"); + theme->path = edi_path_append(elm_theme_system_dir_get(), "default.edj"); + _edi_themes = eina_list_append(_edi_themes, theme); + + files = ecore_file_ls(directory); + EINA_LIST_FREE(files, file) + { + if (eina_str_has_extension(file, ".edj") && strcmp(file, "default.edj")) + { + theme = malloc(sizeof(Edi_Theme)); + name = strdup(file); + name[strlen(name) - 4] = '\0'; + theme->name = name; + + theme->path = edi_path_append(directory, file); + _edi_themes = eina_list_append(_edi_themes, theme); + } + free(file); + } + + if (files) + eina_list_free(files); + + return _edi_themes; +} + + diff --git a/src/bin/edi_theme.h b/src/bin/edi_theme.h new file mode 100644 index 0000000..552a91f --- /dev/null +++ b/src/bin/edi_theme.h @@ -0,0 +1,61 @@ +#ifndef __EDI_THEME_H__ +#define __EDI_THEME_H__ + +#include +#include + +typedef struct _Edi_Theme { + char *name; + char *path; +} Edi_Theme; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * @brief These routines used for managing Edi theme actions. + */ + +/** + * @brief Theme management functions. + * @defgroup Theme + * + * @{ + * + * Management of theming actions. + * + */ + +/** + * Set the Edi theme by name on an Elm_Code_Widget. + * + * @param obj The Elm_Code_Widget object to apply the theme to. + * @param name The name of the theme to apply. + * + * @ingroup Theme + */ +void edi_theme_elm_code_set(Evas_Object *obj, const char *name); + +/** + * Get a list of all themes available. + * + * @return a list of all available themes as Edi_Theme instances. + * + * @ingroup Theme + */ +Eina_List *edi_theme_themes_get(void); + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c index 31e56d8..7c6b903 100644 --- a/src/bin/editor/edi_editor.c +++ b/src/bin/editor/edi_editor.c @@ -12,6 +12,7 @@ #include "mainview/edi_mainview.h" #include "edi_filepanel.h" #include "edi_config.h" +#include "edi_theme.h" #include "language/edi_language_provider.h" @@ -1306,6 +1307,7 @@ _edi_editor_config_changed(void *data, int type EINA_UNUSED, void *event EINA_UN code->config.trim_whitespace = _edi_config->trim_whitespace; elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); elm_obj_code_widget_show_whitespace_set(widget, _edi_project_config->gui.show_whitespace); elm_obj_code_widget_tab_inserts_spaces_set(widget, _edi_project_config->gui.tab_inserts_spaces); elm_obj_code_widget_line_width_marker_set(widget, _edi_project_config->gui.width_marker); @@ -1398,6 +1400,8 @@ edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item) elm_code_widget_line_numbers_set(widget, EINA_TRUE); _edi_editor_config_changed(widget, 0, NULL); + edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); + editor = calloc(1, sizeof(*editor)); editor->entry = widget; editor->mimetype = item->mimetype; diff --git a/src/bin/meson.build b/src/bin/meson.build index 96ff1a3..20f82e1 100644 --- a/src/bin/meson.build +++ b/src/bin/meson.build @@ -21,6 +21,8 @@ src = files([ 'edi_private.h', 'edi_searchpanel.c', 'edi_searchpanel.h', + 'edi_theme.c', + 'edi_theme.h', ]) bin_dir = include_directories('.') diff --git a/src/bin/screens/edi_settings.c b/src/bin/screens/edi_settings.c index 4453f16..c2f890a 100644 --- a/src/bin/screens/edi_settings.c +++ b/src/bin/screens/edi_settings.c @@ -9,6 +9,7 @@ #include "edi_screens.h" #include "edi_config.h" #include "edi_debug.h" +#include "edi_theme.h" #include "edi_private.h" @@ -142,40 +143,111 @@ _edi_settings_font_preview_add(Evas_Object *parent, const char *font_name, int f return widget; } +static void +_edi_settings_display_theme_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) +{ + const char *text = elm_object_item_text_get(event_info); + + if (_edi_project_config->gui.theme) + eina_stringshare_del(_edi_project_config->gui.theme); + + _edi_project_config->gui.theme = eina_stringshare_add(text); + _edi_project_config_save(); + + elm_object_text_set(obj, text); + elm_combobox_hover_end(obj); +} + +static char * +_edi_settings_display_theme_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) +{ + Edi_Theme *current; + int i; + + i = (int)(uintptr_t) data; + current = eina_list_nth(edi_theme_themes_get(), i); + + if (!current) return NULL; + + return strdup(current->name); +} + static Evas_Object * _edi_settings_display_create(Evas_Object *parent) { Evas_Object *box, *hbox, *frame, *label, *spinner, *check, *button, *preview; + Evas_Object *table, *combobox; + Elm_Genlist_Item_Class *itc; + Edi_Theme *theme; + Eina_List *themes, *l; + int i = 0; frame = _edi_settings_panel_create(parent, _("Display")); box = elm_object_part_content_get(frame, "default"); - hbox = elm_box_add(parent); - elm_box_horizontal_set(hbox, EINA_TRUE); - evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.5); - evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, 1.0); - elm_box_pack_end(box, hbox); - evas_object_show(hbox); + table = elm_table_add(parent); + evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(table); - label = elm_label_add(hbox); + label = elm_label_add(table); elm_object_text_set(label, _("Font")); evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5); - elm_box_pack_end(hbox, label); + elm_table_pack(table, label, 0, 0, 1, 1); evas_object_show(label); - button = elm_button_add(hbox); - evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + button = elm_button_add(table); + evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0); // EVAS_HINT_EXPAND); evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(button); - preview = _edi_settings_font_preview_add(hbox, _edi_project_config->font.name, + preview = _edi_settings_font_preview_add(table, _edi_project_config->font.name, _edi_project_config->font.size); elm_layout_content_set(button, "elm.swallow.content", preview); - elm_box_pack_end(hbox, button); + elm_table_pack(table, button, 1, 0, 1, 1); evas_object_smart_callback_add(button, "clicked", _edi_settings_font_choose_cb, parent); elm_object_focus_set(button, EINA_TRUE); + label = elm_label_add(table); + elm_object_text_set(label, _("Color theme")); + evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5); + elm_table_pack(table, label, 0, 1, 1, 1); + evas_object_show(label); + + // START OF COLOR SELECTOR + + combobox = elm_combobox_add(table); + evas_object_size_hint_weight_set(combobox, 0.75, 0.0); + evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(combobox); + evas_object_smart_callback_add(combobox, "item,pressed", + _edi_settings_display_theme_pressed_cb, NULL); + + if (!_edi_project_config->gui.theme) + elm_object_text_set(combobox, _("default")); + else + elm_object_text_set(combobox, _edi_project_config->gui.theme); + + elm_table_pack(table, combobox, 1, 1, 1, 1); + elm_box_pack_end(box, table); + itc = elm_genlist_item_class_new(); + itc->item_style = "default"; + itc->func.text_get = _edi_settings_display_theme_text_get_cb; + + themes = edi_theme_themes_get(); + + EINA_LIST_FOREACH(themes, l, theme) + { + elm_genlist_item_append(combobox, itc, (void *)(uintptr_t) i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t) i); + i++; + } + + elm_genlist_realized_items_update(combobox); + elm_genlist_item_class_free(itc); + + // END OF COLOR SELECTOR + check = elm_check_add(box); elm_object_text_set(check, _("Display whitespace")); elm_check_state_set(check, _edi_project_config->gui.show_whitespace);