forked from enlightenment/edi
edi_theme: Add support for colour themes in EDI.
Finally adding theme support for Elm_Code_Widget. Fairly self-explanatory. Settings-> Display -> Choose theme. Work from both myself and Andy Williams on this one. A good one!
This commit is contained in:
parent
3e3e0fde8d
commit
57d2c5810a
|
@ -1,3 +1,4 @@
|
|||
subdir('desktop')
|
||||
subdir('images')
|
||||
subdir('extra/templates')
|
||||
subdir('themes')
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
@ -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
|
||||
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <Elementary.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <Elementary.h>
|
||||
|
||||
#include "edi_logpanel.h"
|
||||
#include "edi_theme.h"
|
||||
#include "edi_config.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
@ -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);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <string.h>
|
||||
#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);
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Elementary.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef __EDI_THEME_H__
|
||||
#define __EDI_THEME_H__
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Evas.h>
|
||||
|
||||
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
|
|
@ -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;
|
||||
|
|
|
@ -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('.')
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue