ICONS: Use internal icons.

This can be enabled/disabled within Edi Settings
This commit is contained in:
Alastair Poole 2019-12-26 14:24:42 +00:00
parent e7373855d9
commit aea907e0d7
28 changed files with 87 additions and 23 deletions

View File

@ -11,7 +11,7 @@ data/extra/templates/ No license - public domain
Icons by <matthieu.james@gmail.com> from "Faenza" icon theme (GPLv2):
data/extra/templates/images/c.png
data/extra/templates/images/python.png
data/icons/*.png
edi: COPYING.GPLv2

BIN
data/icons/document-new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
data/icons/edit-copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
data/icons/edit-cut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
data/icons/edit-paste.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
data/icons/edit-redo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
data/icons/edit-undo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
data/icons/go-down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
data/icons/go-jump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
data/icons/go-up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
data/icons/help-about.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
data/icons/media-record.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

11
data/icons/meson.build Normal file
View File

@ -0,0 +1,11 @@
install_data(['document-new.png', 'window-close.png', 'window-close.png',
'document-save.png', 'edit-undo.png', 'edit-redo.png',
'edit-cut.png', 'edit-copy.png', 'edit-paste.png',
'edit-find-replace.png', 'go-jump.png', 'system-run.png',
'media-record.png', 'media-playback-start.png', 'media-playback-stop.png',
'utilities-terminal.png', 'help-about.png', 'preferences-desktop.png',
'go-up.png', 'go-down.png'
],
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'icons')
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
data/icons/system-run.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
data/icons/window-close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,5 +1,6 @@
subdir('desktop')
subdir('images')
subdir('icons')
subdir('extra/templates')
subdir('extra/examples')
subdir('themes')

View File

@ -288,6 +288,7 @@ _edi_config_init(void)
EDI_CONFIG_VAL(D, T, gui.tabstop, EET_T_UINT);
EDI_CONFIG_VAL(D, T, gui.toolbar_hidden, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, gui.toolbar_horizontal, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, gui.internal_icons, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, gui.tab_inserts_spaces, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, launch.path, EET_T_STRING);
@ -521,6 +522,7 @@ _edi_project_config_load()
_edi_project_config->gui.width_marker = 80;
_edi_project_config->gui.tabstop = 8;
_edi_project_config->gui.internal_icons = EINA_TRUE;
_edi_project_config->gui.toolbar_hidden = EINA_FALSE;
_edi_project_config->gui.toolbar_horizontal = EINA_FALSE;
IFPCFGEND;

View File

@ -88,6 +88,8 @@ struct _Edi_Project_Config
Eina_Bool show_whitespace;
unsigned int width_marker, tabstop;
Eina_Bool internal_icons;
Eina_Bool toolbar_hidden;
Eina_Bool toolbar_horizontal;
Eina_Bool tab_inserts_spaces;

View File

@ -310,8 +310,8 @@ _edi_toggle_panel(void *data, Evas_Object *obj, void *event_info)
else
{
if (_edi_selected_bottompanel)
elm_toolbar_item_icon_set(_edi_selected_bottompanel, "go-up");
elm_toolbar_item_icon_set(item, "go-down");
elm_toolbar_item_icon_set(_edi_selected_bottompanel, edi_theme_icon_path_get("go-up"));
elm_toolbar_item_icon_set(item, edi_theme_icon_path_get("go-down"));
size = elm_panes_content_right_size_get(_edi_bottompanes);
if (size == 0.0)
@ -463,7 +463,7 @@ edi_content_setup(Evas_Object *win, const char *path)
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
elm_toolbar_align_set(tb, 1.0);
elm_toolbar_icon_size_set(tb, 32);
elm_toolbar_icon_size_set(tb, 24);
elm_object_style_set(tb, "item_horizontal");
elm_object_focus_allow_set(tb, EINA_FALSE);
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
@ -473,27 +473,27 @@ edi_content_setup(Evas_Object *win, const char *path)
_edi_toolbar_separator_add(tb);
_edi_logpanel_item = elm_toolbar_item_append(tb, "go-up", _("Logs"),
_edi_logpanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Logs"),
_edi_toggle_panel, "0");
_edi_toolbar_separator_add(tb);
_edi_consolepanel_item = elm_toolbar_item_append(tb, "go-up", _("Console"),
_edi_consolepanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Console"),
_edi_toggle_panel, "1");
_edi_toolbar_separator_add(tb);
_edi_testpanel_item = elm_toolbar_item_append(tb, "go-up", _("Tests"),
_edi_testpanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Tests"),
_edi_toggle_panel, "2");
_edi_toolbar_separator_add(tb);
_edi_searchpanel_item = elm_toolbar_item_append(tb, "go-up", _("Search"),
_edi_searchpanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Search"),
_edi_toggle_panel, "3");
_edi_toolbar_separator_add(tb);
_edi_taskspanel_item = elm_toolbar_item_append(tb, "go-up", _("Tasks"),
_edi_taskspanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Tasks"),
_edi_toggle_panel, "4");
_edi_toolbar_separator_add(tb);
_edi_debugpanel_item = elm_toolbar_item_append(tb, "go-up", _("Debug"),
_edi_debugpanel_item = elm_toolbar_item_append(tb, edi_theme_icon_path_get("go-up"), _("Debug"),
_edi_toggle_panel, "5");
_edi_toolbar_separator_add(tb);
@ -542,32 +542,32 @@ edi_content_setup(Evas_Object *win, const char *path)
elm_panes_content_right_size_set(logpane, _edi_project_config->gui.bottomsize);
if (_edi_project_config->gui.bottomtab == 1)
{
elm_toolbar_item_icon_set(_edi_consolepanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_consolepanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_consolepanel_item;
}
else if (_edi_project_config->gui.bottomtab == 2)
{
elm_toolbar_item_icon_set(_edi_testpanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_testpanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_testpanel_item;
}
else if (_edi_project_config->gui.bottomtab == 3)
{
elm_toolbar_item_icon_set(_edi_searchpanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_searchpanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_searchpanel_item;
}
else if (_edi_project_config->gui.bottomtab == 4)
{
elm_toolbar_item_icon_set(_edi_taskspanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_taskspanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_taskspanel_item;
}
else if (_edi_project_config->gui.bottomtab == 5)
{
elm_toolbar_item_icon_set(_edi_debugpanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_debugpanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_debugpanel_item;
}
else
{
elm_toolbar_item_icon_set(_edi_logpanel_item, "go-down");
elm_toolbar_item_icon_set(_edi_logpanel_item, edi_theme_icon_path_get("go-down"));
_edi_selected_bottompanel = _edi_logpanel_item;
}
}
@ -1345,7 +1345,11 @@ _edi_toolbar_item_add(Evas_Object *tb, const char *icon, const char *name, Evas_
Evas_Object *content;
Elm_Object_Item *tb_it;
tb_it = elm_toolbar_item_append(tb, icon, NULL, func, NULL);
if (!_edi_project_config->gui.internal_icons)
tb_it = elm_toolbar_item_append(tb, icon, NULL, func, NULL);
else
tb_it = elm_toolbar_item_append(tb, edi_theme_icon_path_get(icon), NULL, func, NULL);
content = elm_toolbar_item_object_get(tb_it);
elm_object_tooltip_text_set(content, name);
@ -1359,10 +1363,12 @@ edi_toolbar_win_add(void)
Elm_Object_Item *tb_it;
Evas_Coord w, h;
static Eina_Bool is_horizontal = EINA_TRUE, is_init = EINA_TRUE;
static Eina_Bool internal_icons = EINA_TRUE;
if (is_init)
{
is_horizontal = _edi_project_config->gui.toolbar_horizontal;
internal_icons = _edi_project_config->gui.internal_icons;
is_init = EINA_FALSE;
_edi_toolbar_win = NULL;
}
@ -1375,12 +1381,14 @@ edi_toolbar_win_add(void)
}
if ((edi_toolbar_win_get()) &&
(is_horizontal == _edi_project_config->gui.toolbar_horizontal))
(is_horizontal == _edi_project_config->gui.toolbar_horizontal) &&
(internal_icons == _edi_project_config->gui.internal_icons))
{
return;
}
is_horizontal = _edi_project_config->gui.toolbar_horizontal;
internal_icons = _edi_project_config->gui.internal_icons;
edi_toolbar_win_del();

View File

@ -151,4 +151,23 @@ edi_theme_themes_get(void)
return _edi_themes;
}
const char *
edi_theme_icon_path_get(const char *name)
{
char *path;
const char *icon_path, *directory = PACKAGE_DATA_DIR "/icons";
icon_path = name;
path = edi_path_append(directory, eina_slstr_printf("%s.png", name));
if (path)
{
if (ecore_file_exists(path))
{
icon_path = eina_slstr_printf("%s", path);
}
free(path);
}
return icon_path;
}

View File

@ -59,6 +59,8 @@ 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);
const char *edi_theme_icon_path_get(const char *name);
/**
* @}
*/

View File

@ -215,6 +215,14 @@ _edi_settings_display_alpha_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
_edi_project_config_save();
}
static void
_edi_settings_internal_icons_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
_edi_project_config->gui.internal_icons = elm_check_state_get(obj);
_edi_project_config_save();
}
static char *
_edi_settings_display_alpha_format(double value)
{
@ -270,8 +278,6 @@ _edi_settings_display_create(Evas_Object *parent)
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);
@ -299,9 +305,6 @@ _edi_settings_display_create(Evas_Object *parent)
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);
@ -372,6 +375,22 @@ _edi_settings_display_create(Evas_Object *parent)
evas_object_show(check);
elm_box_pack_end(box, table);
label = elm_label_add(table);
elm_object_text_set(label, _("Internal Icons"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 6, 1, 1);
evas_object_show(label);
check = elm_check_add(box);
elm_check_state_set(check, _edi_project_config->gui.internal_icons);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
evas_object_smart_callback_add(check, "changed",
_edi_settings_internal_icons_changed_cb, NULL);
elm_table_pack(table, check, 1, 6, 1, 1);
evas_object_show(check);
elm_box_pack_end(box, table);
// END OF ALPHA SELECTOR