theme: roll back for the 0.7 releaes

It looks like we won't have an efl major releases soon enough to add this
This commit is contained in:
Andy Williams 2018-02-10 20:58:52 +00:00
parent a5ce833292
commit 13ffef1042
12 changed files with 1 additions and 383 deletions

2
NEWS
View File

@ -4,8 +4,6 @@ Edi 0.7
Features:
* Added theme support and new themes.
* Added editor translucency option.
* Added notification support.
* Added split-view option for editors.
* Project wizard and new project templates.

View File

@ -16,7 +16,6 @@
#include "edi_consolepanel.h"
#include "mainview/edi_mainview.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "edi_private.h"
@ -322,13 +321,11 @@ _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;
@ -344,7 +341,6 @@ 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);
@ -370,7 +366,6 @@ 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);

View File

@ -7,7 +7,6 @@
#include <Elementary.h>
#include "edi_debug.h"
#include "edi_theme.h"
#include "edi_debugpanel.h"
#include "edi_config.h"
@ -37,7 +36,6 @@ 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;
}
@ -325,7 +323,6 @@ 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);

View File

@ -7,7 +7,6 @@
#include <Elementary.h>
#include "edi_logpanel.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "edi_private.h"
@ -65,7 +64,6 @@ 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;
}
@ -77,7 +75,6 @@ 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);

View File

@ -8,12 +8,10 @@
#include <Ecore_Getopt.h>
#include <Elementary.h>
#include <Efl_Ui.h>
#include <Eio.h>
#include "Edi.h"
#include "edi_config.h"
#include "edi_theme.h"
#include "edi_filepanel.h"
#include "edi_file.h"
#include "edi_logpanel.h"
@ -1371,7 +1369,6 @@ static Eina_Bool
_edi_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
_edi_toolbar_set_visible(!_edi_project_config->gui.toolbar_hidden);
edi_theme_window_alpha_set();
return ECORE_CALLBACK_RENEW;
}
@ -1520,8 +1517,6 @@ edi_open(const char *inputpath)
elm_win_resize_object_add(win, hbx);
evas_object_show(hbx);
edi_theme_window_alpha_set();
tb = edi_toolbar_setup(hbx);
elm_box_pack_start(hbx, tb);
_edi_toolbar = tb;

View File

@ -9,7 +9,6 @@
#include <string.h>
#include "edi_file.h"
#include "edi_searchpanel.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "mainview/edi_mainview.h"
@ -26,7 +25,6 @@ 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;
}
@ -235,7 +233,6 @@ 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);
@ -264,7 +261,6 @@ 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;
}
@ -304,7 +300,6 @@ 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);

View File

@ -1,136 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Elementary.h>
#include <Efl_Ui.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_window_alpha_set(void)
{
Evas_Object *win;
Eina_Bool enabled = _edi_project_config->gui.translucent;
win = edi_main_win_get();
elm_win_alpha_set(win, enabled);
if (enabled)
efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, _edi_project_config->gui.alpha);
else
efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, 255);
}
void edi_theme_elm_code_alpha_set(Evas_Object *obj)
{
if (_edi_project_config->gui.translucent)
elm_code_widget_alpha_set(obj, _edi_project_config->gui.alpha);
else
elm_code_widget_alpha_set(obj, 255);
}
void
edi_theme_elm_code_set(Evas_Object *obj, const char *name)
{
Eina_List *l;
Edi_Theme *theme;
if (!obj || !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);
}
}
Edi_Theme *
edi_theme_theme_by_name(const char *name)
{
Eina_List *l;
Edi_Theme *theme;
if (!name) return NULL;
edi_theme_themes_get();
EINA_LIST_FOREACH(_edi_themes, l, theme)
{
if (!strcmp(theme->name, name))
return theme;
}
return NULL;
}
static int
_theme_sort_cb(const void *t1, const void *t2)
{
const Edi_Theme *theme1 = t1;
const Edi_Theme *theme2 = t2;
if (!theme1) return 1;
if (!theme2) return -1;
return strcmp(theme1->title, theme2->title);
}
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");
theme->title = strdup("Default EFL");
_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);
theme->title = edje_file_data_get(theme->path, "title");
_edi_themes = eina_list_append(_edi_themes, theme);
}
free(file);
}
if (files)
eina_list_free(files);
_edi_themes = eina_list_sort(_edi_themes, eina_list_count(_edi_themes), _theme_sort_cb);
return _edi_themes;
}

View File

@ -1,73 +0,0 @@
#ifndef __EDI_THEME_H__
#define __EDI_THEME_H__
#include <Eina.h>
#include <Evas.h>
typedef struct _Edi_Theme {
char *name;
char *path;
char *title;
} 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);
/**
* Get theme obj by its name.
*
* @return the theme obj matching the name.
*
* @ingroup Theme
*/
Edi_Theme *edi_theme_theme_by_name(const char *name);
void edi_theme_window_alpha_set(void);
void edi_theme_elm_code_alpha_set(Evas_Object *obj);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -12,7 +12,6 @@
#include "mainview/edi_mainview.h"
#include "edi_filepanel.h"
#include "edi_config.h"
#include "edi_theme.h"
#include "language/edi_language_provider.h"
@ -1307,8 +1306,6 @@ _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_alpha_set(widget);
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);
@ -1401,8 +1398,6 @@ 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;

View File

@ -16,7 +16,6 @@
#include "edi_content_provider.h"
#include "edi_searchpanel.h"
#include "edi_file.h"
#include "edi_theme.h"
#include "edi_private.h"
#include "edi_config.h"
@ -291,8 +290,6 @@ _edi_mainview_split_config_changed_cb(void *data, int type EINA_UNUSED, void *ev
Elm_Code_Widget *widget = data;
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_alpha_set(widget);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
return ECORE_CALLBACK_RENEW;
}

View File

@ -21,8 +21,6 @@ src = files([
'edi_private.h',
'edi_searchpanel.c',
'edi_searchpanel.h',
'edi_theme.c',
'edi_theme.h',
])
bin_dir = include_directories('.')

View File

@ -9,7 +9,6 @@
#include "edi_screens.h"
#include "edi_config.h"
#include "edi_debug.h"
#include "edi_theme.h"
#include "edi_private.h"
@ -146,74 +145,11 @@ _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)
{
Edi_Theme *theme;
const char *text = elm_object_item_text_get(event_info);
theme = elm_object_item_data_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(theme->name);
_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;
current = data;
return strdup(current->title);
}
static void
_edi_settings_display_translucent_state_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
{
Evas_Object *slider, *check;
int state;
check = obj;
slider = data;
state = elm_check_state_get(check);
_edi_project_config->gui.translucent = state;
_edi_project_config_save();
elm_object_disabled_set(slider, !state);
}
static void
_edi_settings_display_alpha_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
_edi_project_config->gui.alpha = elm_slider_value_get(obj);
_edi_project_config_save();
}
static char *
_edi_settings_display_alpha_format(double value)
{
return (char*)eina_stringshare_printf("%1.0f%%", (value/255)*100);
}
static Evas_Object *
_edi_settings_display_create(Evas_Object *parent)
{
Evas_Object *container, *box, *frame, *label, *spinner, *check, *button, *preview;
Evas_Object *table, *combobox, *slider;
Elm_Genlist_Item_Class *itc;
Edi_Theme *theme;
Eina_List *themes, *l;
Evas_Object *table;
container = elm_box_add(parent);
evas_object_size_hint_weight_set(container, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -249,82 +185,6 @@ _edi_settings_display_create(Evas_Object *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 THEME 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, edi_theme_theme_by_name("default")->title);
else
elm_object_text_set(combobox, edi_theme_theme_by_name(_edi_project_config->gui.theme)->title);
elm_table_pack(table, combobox, 1, 1, 1, 1);
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, theme, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
elm_genlist_realized_items_update(combobox);
elm_genlist_item_class_free(itc);
// END OF THEME SELECTOR
// START OF ALPHA SELECTOR
label = elm_label_add(table);
elm_object_text_set(label, _("Translucent"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 2, 1, 1);
evas_object_show(label);
slider = elm_slider_add(table);
check = elm_check_add(box);
elm_check_state_set(check, _edi_project_config->gui.translucent);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(table, check, 1, 2, 1, 1);
evas_object_show(check);
evas_object_smart_callback_add(check, "changed",
_edi_settings_display_translucent_state_cb, slider);
label = elm_label_add(table);
elm_object_text_set(label, _("Alpha"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 3, 1, 1);
evas_object_show(label);
elm_object_disabled_set(slider, !_edi_project_config->gui.translucent);
evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_slider_min_max_set(slider, 0, 255);
elm_slider_value_set(slider, _edi_project_config->gui.alpha);
elm_slider_span_size_set(slider, 255);
elm_slider_step_set(slider, 0.01);
elm_slider_units_format_function_set(slider, _edi_settings_display_alpha_format,
(void(*)(char*))eina_stringshare_del);
elm_slider_indicator_format_function_set(slider, _edi_settings_display_alpha_format,
(void(*)(char*))eina_stringshare_del);
elm_table_pack(table, slider, 1, 3, 1, 1);
evas_object_show(slider);
evas_object_smart_callback_add(slider, "slider,drag,stop", _edi_settings_display_alpha_changed_cb, NULL);
evas_object_smart_callback_add(slider, "delay,changed", _edi_settings_display_alpha_changed_cb, NULL);
label = elm_label_add(table);
elm_object_text_set(label, _("Hide Toolbar"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);