From cfa8067a326ff649a68573c09bcba271726ec393 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 4 Nov 2023 20:44:37 +0000 Subject: [PATCH] elm theme - add fileman bar graph groups --- data/elementary/themes/colorclasses.edc | 2 + data/elementary/themes/edc/fileman.edc | 103 ++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/data/elementary/themes/colorclasses.edc b/data/elementary/themes/colorclasses.edc index 2d48f06e2e..99163b768d 100644 --- a/data/elementary/themes/colorclasses.edc +++ b/data/elementary/themes/colorclasses.edc @@ -406,6 +406,7 @@ color_tree { "/fg/normal/fileman/filesize/2"; "/fg/selected/fileman/filesize/2"; "/fg/normal/fileperm/execute"; + "/fg/normal/filegraph/bar"; } ":selected-alt-trans" { "/bg/normal/access"; @@ -475,6 +476,7 @@ color_tree { "/fg/normal/fileman/mount/off"; "/fg/normal/progress/busy/2"; "/fg/normal/gadgets/packagekit/pkg/low-priority"; + "/fg/normal/filegraph/bartop"; } ":light-high" { "/fg/normal/naviframe/top/overlap"; diff --git a/data/elementary/themes/edc/fileman.edc b/data/elementary/themes/edc/fileman.edc index 17235321f1..20f8c135fe 100644 --- a/data/elementary/themes/edc/fileman.edc +++ b/data/elementary/themes/edc/fileman.edc @@ -1219,6 +1219,109 @@ group { name: "e/fileman/default/circle"; } } +group { name: "e/fileman/default/graph/base"; + parts { + part { name: "e.swallow.content"; type: SWALLOW; scale; + description { state: "default" 0.0; offscale; + rel1 { offset: 2 2; } + rel2 { offset: -3 -3; } + } + } + } +} + +group { name: "e/fileman/default/graph/bar"; + script { + hex(str[], len) { + new i, val = 0; + + for (i = 0; i < len; i++) { + val <<= 4; + if ((str[i] >= '0') && (str[i] <= '9')) { + val += str[i] - '0'; + } else if ((str[i] >= 'a') && (str[i] <= 'f')) { + val += 10 + str[i] - 'a'; + } else if ((str[i] >= 'A') && (str[i] <= 'F')) { + val += 10 + str[i] - 'A'; + } + } + return val; + } + public message(Msg_Type:type, id, ...) { + if ((type == MSG_STRING) && (id == 1)) { + new cc[256]; + + getsarg(2, cc, 255); + custom_state(PART:"base", "default", 0.0); + if (!strncmp(cc, "cc:", 3)) { + strcpy(cc, cc[3]); + set_state_val(PART:"base", STATE_COLOR, 255, 255, 255, 255); + set_state_val(PART:"base", STATE_COLOR_CLASS, cc); + } else if (!strncmp(cc, "#", 1)) { + new r = 255, g = 255, b = 255, a = 255; + + strcpy(cc, cc[1]); + if (strlen(cc) == 3) { // #35a + r = hex(cc[0], 1); + g = hex(cc[1], 1); + b = hex(cc[2], 1); + } else if (strlen(cc) == 4) { // #35af + r = hex(cc[0], 1); + g = hex(cc[1], 1); + b = hex(cc[2], 1); + a = hex(cc[3], 1); + } else if (strlen(cc) == 6) { // #3355aa + r = hex(cc[0], 2); + g = hex(cc[2], 2); + b = hex(cc[4], 2); + } else if (strlen(cc) == 8) { // #3355aaff + r = hex(cc[0], 2); + g = hex(cc[2], 2); + b = hex(cc[4], 2); + a = hex(cc[6], 2); + } + set_state_val(PART:"base", STATE_COLOR, r, g, b, a); + set_state_val(PART:"base", STATE_COLOR_CLASS, ""); + } + set_state(PART:"base", "custom", 0.0); + } + } + } + parts { + part { name: "drag_base"; type: SPACER; scale; + description { state: "default" 0.0; offscale; + rel1 { offset: 1 1; } + rel2 { offset: -2 -2; } + } + } + part { name: "base"; type: RECT; + description { state: "default" 0.0; + rel1.to_y: "e.dragable.value"; + rel2.to: "drag_base"; + color_class: "/fg/normal/filegraph/bar"; + } + } + part { name: "top"; type: RECT; + description { state: "default" 0.0; + rel.to: "base"; + rel2.relative: 1.0 0.0; + rel2.offset: -1 0; + color_class: "/fg/normal/filegraph/bartop"; + } + } + part { name: "e.dragable.value"; type: SPACER; + dragable.x: 0 0 0; + dragable.y: 1 1 0; + dragable.confine: "drag_base"; + description { state: "default" 0.0; + min: 0 1; + max: 99999 1; + fixed: 1 1; + } + } + } +} + group { name: "e/fileman/default/list/detailed"; inherit: "e/fileman/default/list/variable"; parts {