forked from enlightenment/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!edi-0.8
parent
3e3e0fde8d
commit
57d2c5810a
18 changed files with 393 additions and 35 deletions
@ -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"; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
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; } |
||||
} |
||||
} |
@ -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 |
Loading…
Reference in new issue