This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 6557aae759c995cc2c55f619330c3fdac4d271f9
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Thu Oct 26 18:38:22 2023 +0100
custom detailview - add sliders+range sliders
---
TODO.md | 2 --
src/backends/table/open | 66 +++++++++++++++++++++++++++++++++++++-----
src/efm/efm_util.c | 77 +++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 129 insertions(+), 16 deletions(-)
diff --git a/TODO.md b/TODO.md
index 8fdfb43..e5411c6 100644
--- a/TODO.md
+++ b/TODO.md
@@ -61,8 +61,6 @@
* line
* bars
* multiple graphs
- * slider
- * range (slider 2 val)
## Medium term
diff --git a/src/backends/table/open b/src/backends/table/open
index 93249fa..23af0e7 100755
--- a/src/backends/table/open
+++ b/src/backends/table/open
@@ -113,7 +113,7 @@ function handle_cmd_dir_set() {
e_cmd "detail-header-set col=3 size=80 label=h-three"
e_cmd "detail-header-set col=4 size=90 label=h-four"
e_cmd "detail-header-set col=5 size=130 label=h-five"
- e_cmd "detail-header-set col=6 size=60 label=h-six"
+ e_cmd "detail-header-set col=6 size=90 label=h-six"
# begin initial listing of files
e_cmd "list-begin"
@@ -123,7 +123,7 @@ function handle_cmd_dir_set() {
M="type=file icon="${M}
# add one new file (4 of them) with params
-D="detail-format=text,popdown,progress,checkview,button,size"
+ D="detail-format=text,popdown,progress,checkview,button,size"
e_val_escape F ${DIR}"abba"
e_cmd "file-add path="${F}" "${M}" "${D}\
" detail1=one detail2=Opt1!dance.gif,*Opt2!std:clock detail3=33/100 detail4=1 detail5=Click!dance.gif detail6=576/65536"
@@ -133,15 +133,65 @@ D="detail-format=text,popdown,progress,checkview,button,size"
e_cmd "file-add path="${F}" "${M}" "${D}\
" detail1=one detail2=Opt1,Opt2,*Opt3,Opt4 detail3=noval,55/100 detail4=0 detail5=Pressme!std:security-high detail6=16384/65536"
- D="detail-format=icon,check,circle,segmentsel,timestamp,size"
+ D="detail-format=icon,check,circle,segmentsel,timestamp,slider"
e_val_escape F ${DIR}"g h i"
e_cmd "file-add path="${F}" "${M}" "${D}\
- " detail1=std:dialog-error detail2=true detail3=cc::selected detail4=*!dance.gif,!std:audio-card,!std:camera detail5=1696322215 detail6=65535/65536"
+ " detail1=std:dialog-error detail2=true detail3=cc::selected detail4=*!dance.gif,!std:audio-card,!std:camera detail5=1696322215 detail6=0/100/33"
+
+ D="detail-format=icon,check,circle,segmentsel,timestamp,slider"
+ e_val_escape F ${DIR}"y~"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=dance.gif detail2=false detail3=#ff665580 detail4=Option1,Opt2,*O3 detail5=1296332215 detail6=50/200/175"
+
+ D="detail-format=icon,text,circle,text,slider,size"
+ e_val_escape F ${DIR}"zz blah blah blah"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=std:utilities-terminal detail2=Textgoesherethatislong detail3=#fec746 detail4=XXX detail5=0/10/2 detail6=32768/65536"
+
+ D="detail-format=icon,text,circle,text,slider,size"
+ e_val_escape F ${DIR}"zzz smelly fish"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=std:software-update-available detail2=hello%20world detail3=cc:/fg/normal/desklock/fprint/success detail4=Booya detail5=0/20/5/15 detail6=4096/65536"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz1"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz2"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz3"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz4"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz5"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz6"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
+
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz7"
+ e_cmd "file-add path="${F}" "${M}" "${D}\
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
- D="detail-format=icon,check,circle,segmentsel,timestamp,size"
- e_val_escape F ${DIR}"z~"
+ D="detail-format=text,text,text,text,text,text"
+ e_val_escape F ${DIR}"zzzz8"
e_cmd "file-add path="${F}" "${M}" "${D}\
- " detail1=dance.gif detail2=false detail3=#ff665580 detail4=Option1,Opt2,*O3 detail5=1296332215 detail6=7823/65536"
+ " detail1=a detail2=b detail3=c detail4=d detail5=e detail6=f"
# end initial listing of files
e_cmd "list-end"
}
@@ -193,7 +243,7 @@ function handle_cmd() {
file-rename )
;;
file-detail-change )
- e_err "file-detail-change" ${ARGS[0]} ${ARGS[1]} ${ARGS[2]} ${ARGS[3]} ${ARGS[4]} ${ARGS[5]}
+ e_err "file-detail-change" ${ARGS[0]} ${ARGS[1]} ${ARGS[2]} ${ARGS[3]} ${ARGS[4]} ${ARGS[5]} ${ARGS[6]} ${ARGS[7]}
;;
file-detail-clicked )
e_err "file-detail-clicked" ${ARGS[0]} ${ARGS[1]} ${ARGS[2]} ${ARGS[3]}
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index ef46bf8..382d62e 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1326,6 +1326,37 @@ _cb_icon_detail_popdown_changed(void *data, Evas_Object *o,
cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
}
+static void
+_cb_icon_detail_slider_changed(void *data, Evas_Object *o,
+ void *info EINA_UNUSED)
+{
+ Icon *icon = data;
+ Eina_Strbuf *buf = cmd_strbuf_new("file-detail-change");
+ char detail[32];
+ int v;
+ double val, val2;
+
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
+ v = (int)(unsigned long)evas_object_data_get(o, "detail");
+ snprintf(detail, sizeof(detail), "detail%i", v);
+ cmd_strbuf_append(buf, "detail", detail);
+ if (elm_slider_range_enabled_get(o))
+ {
+ elm_slider_range_get(o, &val, &val2);
+ snprintf(detail, sizeof(detail), "%i", (int)val);
+ cmd_strbuf_append(buf, "value", detail);
+ snprintf(detail, sizeof(detail), "%i", (int)val2);
+ cmd_strbuf_append(buf, "value2", detail);
+ }
+ else
+ {
+ val = elm_slider_value_get(o);
+ snprintf(detail, sizeof(detail), "%i", (int)val);
+ cmd_strbuf_append(buf, "value", detail);
+ }
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+}
+
static Evas_Object *
_icon_detail_icon_add(Evas_Object *base, const char *icon, const char *dir)
{
@@ -1386,19 +1417,19 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
_icon_detail_rectangle_add(icon, sd, e, col, detail);
else if (!strcmp(format, "size"))
{
- char **plist;
+ char **plist;
unsigned long long size, size_max;
- double sz;
+ double sz;
plist = eina_str_split(detail, "/", 2);
if (plist[0] && plist[1])
{ // format: "13/28" = value/max_value
- size = atoll(plist[0]);
+ size = atoll(plist[0]);
size_max = atoll(plist[1]);
- o = _icon_detail_grid_add(icon, sd, col);
- o = _icon_detail_grid_sub_edje_add(icon, e, theme_edj_file, col,
- "e/fileman/default/filesize");
+ o = _icon_detail_grid_add(icon, sd, col);
+ o = _icon_detail_grid_sub_edje_add(icon, e, theme_edj_file, col,
+ "e/fileman/default/filesize");
sz = (double)size / (double)size_max;
// counteract _size_message doins a sqrt for show
sz = sz * sz;
@@ -1629,6 +1660,40 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
free(plist);
evas_object_show(o);
}
+ else if (!strcmp(format, "slider"))
+ { // format: "min/max/val" or "min/max/val/val2"
+ char **plist;
+ unsigned long long min, max, val, val2;
+
+ plist = eina_str_split(detail, "/", 4);
+ if (plist[0] && plist[1] && plist[2])
+ {
+ min = atoll(plist[0]);
+ max = atoll(plist[1]);
+ val = atoll(plist[2]);
+
+ o = _icon_detail_grid_add(icon, sd, col);
+ o = elm_slider_add(o);
+ _icon_detail_elm_object_prepare(o, col);
+ elm_slider_min_max_set(o, min, max);
+ elm_slider_unit_format_set(o, "%1.0f");
+ if (plist[3])
+ {
+ val2 = atoll(plist[3]);
+ elm_slider_range_enabled_set(o, EINA_TRUE);
+ elm_slider_range_set(o, val, val2);
+ }
+ else elm_slider_value_set(o, val);
+
+ elm_grid_pack(icon->o_list_detail_swallow[col], o, 0, 0, 1, 1);
+ evas_object_smart_callback_add(o, "changed",
+ _cb_icon_detail_slider_changed,
+ icon);
+ evas_object_show(o);
+ }
+ free(*plist);
+ free(plist);
+ }
else
fprintf(stderr, "Uknown format for file '%s' column %i format '%s'\n",
icon->info.file, col, format);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.