netstar pushed a commit to branch master. http://git.enlightenment.org/apps/evisum.git/commit/?id=2d2b2845e4160113478bb79d03e4bc3c4916f2ec
commit 2d2b2845e4160113478bb79d03e4bc3c4916f2ec Author: Alastair Poole <nets...@gmail.com> Date: Fri Mar 12 15:08:36 2021 +0000 theme: Add a wee script. --- data/meson.build | 1 + data/themes/evisum.edc | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ data/themes/meson.build | 15 +++++++++ src/bin/ui/ui_cpu.c | 38 +++++++++++++++------ 4 files changed, 133 insertions(+), 11 deletions(-) diff --git a/data/meson.build b/data/meson.build index db5bf15..ccd6b1d 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,3 +1,4 @@ subdir('desktop') subdir('icons') subdir('images') +subdir('themes') diff --git a/data/themes/evisum.edc b/data/themes/evisum.edc new file mode 100644 index 0000000..13713b0 --- /dev/null +++ b/data/themes/evisum.edc @@ -0,0 +1,90 @@ +#define EVISUM_ICON(icon_code, minw, minh, maxw, maxh, a) \ +images { \ + image: icon_code".png" COMP; \ +} \ +group { \ + name: "evisum/icons/"icon_code; \ + min: minw minh; \ + max: maxw maxh; \ + parts { \ + part { \ + name: "icon"; \ + description { \ + state: "default" 0.0; \ + aspect: a a; \ + aspect_preference: BOTH; \ + image { \ + normal: icon_code".png"; \ + } \ + fill { \ + smooth: 1; \ + } \ + } \ + } \ + } \ +} + +collections { + group + { + name: "evisum"; + parts + { + part + { + name: "evisum/menu-clip"; + type: RECT; + description + { + state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + } + description + { + state: "visible" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part + { + name: "evisum/menu"; + type: SWALLOW; + description + { + clip_to: "evisum/menu-clip"; + state: "default" 0.0; + visible: 1; + } + description + { + clip_to: "evisum/menu-clip"; + state: "visible" 0.0; + visible: 1; + } + } + + } + programs + { + program + { + signal: "menu,show"; + source: "evisum/menu"; + action: STATE_SET "visible" 0.0; + transition: SINUSOIDAL 1.0; + target: "evisum/menu-clip"; + } + + program + { + signal: "menu,hide"; + source: "evisum/menu"; + action: STATE_SET "default" 0.0; + transition: SINUSOIDAL 1.0; + target: "evisum/menu-clip"; + } + } + } +} diff --git a/data/themes/meson.build b/data/themes/meson.build new file mode 100644 index 0000000..23f22a6 --- /dev/null +++ b/data/themes/meson.build @@ -0,0 +1,15 @@ +edje_cmd = find_program('edje_cc') + +cmd = [ edje_cmd, + '-id', join_paths(meson.source_root(), 'data', 'images'), + '-id', join_paths(meson.source_root(), 'data', 'icons'), + '@INPUT@', '@OUTPUT@' + ] + +custom_target('evisum.edj', + input : 'evisum.edc', + output : 'evisum.edj', + command : cmd, + install_dir : join_paths(dir_data, 'evisum', 'themes'), + install : true + ) diff --git a/src/bin/ui/ui_cpu.c b/src/bin/ui/ui_cpu.c index 3a26862..22205bd 100644 --- a/src/bin/ui/ui_cpu.c +++ b/src/bin/ui/ui_cpu.c @@ -1,4 +1,5 @@ #include "ui_cpu.h" +#include "config.h" typedef struct { short id; @@ -12,7 +13,8 @@ typedef struct { Evas_Object *win; Evas_Object *menu; - Evas_Object *btn_menu; + Elm_Layout *btn_menu; + Eina_Bool btn_visible; Evas_Object *bg; Evas_Object *obj; @@ -433,10 +435,19 @@ _win_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) ev = event_info; evas_object_geometry_get(obj, NULL, NULL, &w, &h); - if (ev->cur.canvas.x >= (w - 128) && ev->cur.canvas.y <= 128) - evas_object_show(ad->btn_menu); - else - evas_object_hide(ad->btn_menu); + if ((ev->cur.canvas.x >= (w - 128)) && (ev->cur.canvas.y <= 128)) + { + if (!ad->btn_visible) + { + elm_object_signal_emit(ad->btn_menu, "menu,show", "evisum/menu"); + ad->btn_visible = 1; + } + } + else if (ad->btn_visible) + { + elm_object_signal_emit(ad->btn_menu, "menu,hide", "evisum/menu"); + ad->btn_visible = 0; + } } static void @@ -477,6 +488,7 @@ _graph(Evisum_Ui *ui, Evas_Object *parent) { Evas_Object *tbl, *tbl2, *box, *obj, *ic, *lb, *rec; Evas_Object *fr, *bx, *hbx, *colors, *check, *btn; + Elm_Layout *lay; int i, f; char buf[128]; Eina_Bool show_icons = 1; @@ -601,18 +613,22 @@ _graph(Evisum_Ui *ui, Evas_Object *parent) ad->explainers = eina_list_append(ad->explainers, exp); } - ad->btn_menu = btn = elm_button_add(parent); + btn = elm_button_add(parent); ic = elm_icon_add(btn); elm_icon_standard_set(ic, evisum_icon_path_get("menu")); elm_object_part_content_set(btn, "icon", ic); evas_object_show(ic); - evas_object_size_hint_weight_set(btn, 1.0, 1.0); - evas_object_size_hint_align_set(btn, 0.99, 0.01); elm_object_focus_allow_set(btn, 0); - evas_object_smart_callback_add(btn, "clicked", _btn_menu_clicked_cb, ad); - // XXX: :) evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(BTN_HEIGHT), ELM_SCALE_SIZE(BTN_HEIGHT)); - elm_table_pack(tbl, btn, 0, 0, 5, ad->cpu_count); + evas_object_smart_callback_add(btn, "clicked", _btn_menu_clicked_cb, ad); + + ad->btn_menu = lay = elm_layout_add(parent); + evas_object_size_hint_weight_set(lay, 1.0, 1.0); + evas_object_size_hint_align_set(lay, 0.99, 0.01); + elm_layout_file_set(lay, PACKAGE_DATA_DIR "/themes/evisum.edj", "evisum"); + elm_layout_content_set(lay, "evisum/menu", btn); + elm_table_pack(tbl, lay, 0, 0, 5, ad->cpu_count); + evas_object_show(lay); bx = elm_box_add(box); evas_object_size_hint_align_set(bx, FILL, FILL); --