summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlliver Schinagl <o.schinagl@ultimaker.com>2015-07-06 05:49:50 (GMT)
committerOlliver Schinagl <o.schinagl@ultimaker.com>2015-07-06 12:07:31 (GMT)
commit0ab6f4f9f4c2af88e4bbd10b0e11b1516577d319 (patch)
treebe0e67637b190e5c930f93a80a343f8e0d5c8b44
parentf217213dccab10e8af0953f48a7671855326c871 (diff)
downloadeulogium-master.zip
eulogium-master.tar.gz
eulogium-master.tar.bz2
archival commitHEADmaster
-rw-r--r--data/themes/default/default.edc2
-rw-r--r--data/themes/default/edc/elm/failure_slider_01.edc507
-rw-r--r--data/themes/default/edc/elm/slider.edc976
-rw-r--r--data/themes/default/img/emo-very-sorry.pngbin6371 -> 160 bytes
-rw-r--r--data/themes/default/img/slider_indicator_knob_horiz.pngbin0 -> 163 bytes
-rw-r--r--src/Makefile.am10
-rw-r--r--src/dbus_common.c54
-rw-r--r--src/dbus_common.h5
-rw-r--r--src/eulogium.c989
-rw-r--r--src/eulogium.h33
-rw-r--r--src/eulogium_private.h3
-rw-r--r--src/network.c38
-rw-r--r--src/network.h39
-rw-r--r--src/print_data.c23
-rw-r--r--src/print_data.h21
-rw-r--r--src/procedures.c503
-rw-r--r--src/procedures.h95
-rw-r--r--src/settings_data.h34
-rw-r--r--src/ui_input.c40
-rw-r--r--src/ui_input.h19
-rw-r--r--src/ui_widgets.c262
-rw-r--r--src/ui_widgets.h56
-rw-r--r--src/ui_widgets_cb.c24
23 files changed, 2288 insertions, 1445 deletions
diff --git a/data/themes/default/default.edc b/data/themes/default/default.edc
index d13d9e9..725867a 100644
--- a/data/themes/default/default.edc
+++ b/data/themes/default/default.edc
@@ -21,7 +21,7 @@ collections {
#include "edc/elm/label.edc"
#include "edc/elm/separator.edc"
#include "edc/elm/check.edc"
-//#include "edc/elm/slider.edc"
+#include "edc/elm/slider.edc"
//#include "edc/elm/radio.edc"
//#include "edc/elm/bubble.edc"
//#include "edc/elm/panes.edc"
diff --git a/data/themes/default/edc/elm/failure_slider_01.edc b/data/themes/default/edc/elm/failure_slider_01.edc
new file mode 100644
index 0000000..5aae3ad
--- /dev/null
+++ b/data/themes/default/edc/elm/failure_slider_01.edc
@@ -0,0 +1,507 @@
+group { name: "elm/slider/hidden/limit";
+ parts {
+ part { name: "elm.units.min"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ align: 1.0 0.5;
+ text { font: FN; size: 10;
+ text_class: "slider_text";
+ min: 1 1;
+ align: 0.0 0.5;
+ ellipsis: -1;
+ }
+ }
+ }
+ part { name: "elm.units.max"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ align: 1.0 0.5;
+ text { font: FN; size: 10;
+ text_class: "slider_text";
+ min: 1 1;
+ align: 0.0 0.5;
+ ellipsis: -1;
+ }
+ }
+ }
+ }
+}
+
+group { name: "elm/slider/horizontal/default";
+ alias: "elm/slider/horizontal/disabled";
+ images.image: "slider_run_base_horiz.png" COMP;
+ images.image: "slider_run_bevel_horiz.png" COMP;
+ images.image: "slider_run_base_light_horiz.png" COMP;
+ images.image: "slider_indicator_knob_horiz.png" COMP;
+#define ICON 1
+#define LABEL 2
+#define END 4
+#define UNITS 8
+#define MASK 15
+#define INVERT 16
+#define DISABLE 32
+ script {
+ public slmode;
+ public eval_mode(m) {
+ new ic = m & ICON;
+ new l = m & LABEL;
+ new e = m & END;
+ new u = m & UNITS;
+ new d = m & DISABLE;
+ new i = m & INVERT;
+ if (i) {
+ if (!d) {
+ set_state(PART:"base", "default", 0.0);
+ } else {
+ set_state(PART:"base", "disabled", 0.0);
+ }
+ } else {
+ if (!d) {
+ set_state(PART:"base", "default", 0.0);
+ } else {
+ set_state(PART:"base", "disabled", 0.0);
+ }
+ }
+ if (l) {
+ if (!d) {
+ set_state(PART:"elm.text", "visible", 0.0);
+ } else {
+ set_state(PART:"elm.text", "disabled_visible", 0.0);
+ }
+ } else {
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ if (u) {
+ if (!d) {
+ set_state(PART:"elm.units", "visible", 0.0);
+ set_state(PART:"limits", "visible", 0.0);
+ } else {
+ set_state(PART:"elm.units", "disabled_visible", 0.0);
+ set_state(PART:"limits", "disabled_visible", 0.0);
+ }
+ } else {
+ set_state(PART:"elm.units", "default", 0.0);
+ set_state(PART:"limits", "default", 0.0);
+ }
+ if (ic) {
+ set_state(PART:"elm.swallow.icon", "visible", 0.0);
+ set_state(PART:"sizer.content", "visible", 0.0);
+ } else {
+ set_state(PART:"elm.swallow.icon", "default", 0.0);
+ set_state(PART:"sizer.content", "default", 0.0);
+ }
+ if (e) {
+ set_state(PART:"elm.swallow.end", "visible", 0.0);
+ set_state(PART:"sizer.content.end", "visible", 0.0);
+ } else {
+ set_state(PART:"elm.swallow.end", "default", 0.0);
+ set_state(PART:"sizer.content.end", "default", 0.0);
+ }
+ if (!d) {
+ set_state(PART:"event", "default", 0.0);
+ set_state(PART:"dis_clip", "default", 0.0);
+ } else {
+ set_state(PART:"event", "disabled", 0.0);
+ set_state(PART:"dis_clip", "disabled", 0.0);
+ }
+ }
+ }
+ parts {
+ part { name: "elm.swallow.bar"; type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 42 14;
+ max: 99999 14;
+ align: 1.0 0.5;
+ rel1.to_x: "elm.swallow.icon";
+ rel1.relative: 1.0 0.0;
+ rel1.offset: 2 0;
+ rel2.to_x: "limits";
+ rel2.relative: 0.0 1.0;
+ rel2.offset: -3 -1;
+ }
+ }
+ part { name: "base"; mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1.to: "elm.swallow.bar";
+ rel2.to: "elm.swallow.bar";
+ image.normal: "slider_run_base_horiz.png";
+ image.border: 4 4 0 0;
+ fill.smooth: 0;
+ min: 8 5;
+ max: 99999 5;
+ fixed: 0 1;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "slider_run_base_light_horiz.png";
+ }
+ }
+ part { name: "bevel"; mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1.to: "base";
+ rel2.to: "base";
+ image.normal: "slider_run_bevel_horiz.png";
+ image.border: 5 5 0 0;
+ fill.smooth: 0;
+ }
+ }
+ part { name: "dis_clip"; type: RECT;
+ description { state: "default" 0.0;
+ rel1.to: "elm.swallow.icon";
+ rel2.to: "elm.swallow.end";
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 64;
+ }
+ }
+ part { name: "elm.swallow.icon"; type: SWALLOW;
+ clip_to: "dis_clip";
+ description { state: "default" 0.0;
+ visible: 0;
+ align: 0.0 0.5;
+ rel1.offset: 0 2;
+ rel1.to_y: "elm.swallow.bar";
+ rel2.offset: -1 -3;
+ rel2.relative: 0.0 1.0;
+ rel2.to_y: "elm.swallow.bar";
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ aspect: 1.0 1.0; aspect_preference: VERTICAL;
+ rel1.offset: 2 2;
+ rel2.offset: 2 -3;
+ }
+ }
+ part { name: "sizer.content"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ visible: 0;
+ text { font: FN; size: 10;
+ min: 0 0;
+ text_class: "slider_text";
+ }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ rel1.to: "elm.swallow.icon";
+ rel2.to: "elm.swallow.icon";
+ text {
+ min: 1 1;
+ ellipsis: -1;
+ text: "M";
+ }
+ }
+ }
+ part { name: "elm.text"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.0 0.5;
+ rel1.to_x: "elm.swallow.icon";
+ rel1.relative: 1.0 0.0;
+ rel1.offset: -1 2;
+ rel2.to_x: "elm.swallow.icon";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: -1 -3;
+ color: FN_COL_DEFAULT;
+ color_class: "slider_text";
+ text { font: FN; size: 8;
+ text_class: "slider";
+ min: 0 0;
+ align: 0.0 0.5;
+ }
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ fixed: 1 0;
+ visible: 1;
+ rel1.offset: 2 2;
+ rel2.offset: 2 -3;
+ text.min: 1 1;
+ text.ellipsis: -1;
+ }
+ description { state: "disabled_visible" 0.0;
+ inherit: "visible" 0.0;
+ color_class: "slider_text_disabled";
+ color3: 255 255 255 255;
+ }
+ }
+ part { name: "elm.swallow.end"; type: SWALLOW;
+ clip_to: "dis_clip";
+ description { state: "default" 0.0;
+ visible: 0;
+ align: 1.0 0.5;
+ rel1.offset: 0 2;
+ rel1.relative: 1.0 0.0;
+ rel2.offset: -1 -3;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ aspect: 1.0 1.0;
+ aspect_preference: VERTICAL;
+ rel1.offset: -3 2;
+ rel2.offset: -3 -3;
+ }
+ }
+ part { name: "sizer.content.end"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ visible: 0;
+ text { font: FN; size: 10;
+ min: 0 0;
+ text_class: "slider_text";
+ }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ rel1.to: "elm.swallow.end";
+ rel2.to: "elm.swallow.end";
+ text {
+ min: 1 1;
+ ellipsis: -1;
+ text: "M";
+ }
+ }
+ }
+ alias: "elm.units.min" "limits:elm.units.min";
+ alias: "elm.units.max" "limits:elm.units.max";
+ part { name: "limits"; type: GROUP; mouse_events: 0;
+ source: "elm/slider/hidden/limit";
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ align: 1.0 0.5;
+ min: SOURCE;
+ fixed: 1 1;
+ rel1.to_x: "elm.swallow.end";
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 0 2;
+ rel2.to_x: "elm.swallow.end";
+ rel2.relative: 0.0 1.0;
+ rel2.offset: -1 -3;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ rel1.offset: -3 2;
+ rel2.offset: -3 -3;
+ }
+ }
+ part { name: "elm.units"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ fixed: 1 1;
+ rel1.to_x: "limits";
+ rel2.to_x: "limits";
+ color: FN_COL_DEFAULT;
+ color_class: "slider_text";
+ text { font: FN; size: 8;
+ text_class: "slider";
+ align: 1.0 0.5;
+ min: 1 1;
+ ellipsis: -1;
+ }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "disabled_visible" 0.0;
+ inherit: "visible" 0.0;
+ color_class: "slider_text_disabled";
+ color3: 255 255 255 255;
+ }
+ }
+ part { name: "elm.dragable.slider"; type: RECT;
+ scale: 0;
+ dragable.x: 1 1 0;
+ dragable.y: 0 0 0;
+ dragable.confine: "elm.swallow.bar";
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ min: 16 16;
+ max: 16 16;
+ fixed: 1 1;
+ rel1.relative: 0.5 0.0;
+ rel1.to_x: "elm.swallow.bar";
+ rel2.relative: 0.5 1.0;
+ rel2.to_x: "elm.swallow.bar";
+ }
+ }
+ part { name: "knob";
+ scale: 0;
+ description { state: "default" 0.0;
+ image.normal: "slider_indicator_knob_horiz.png";
+ fixed: 1 1;
+ rel1.to: "elm.dragable.slider";
+ rel2.to: "elm.dragable.slider";
+ }
+ description { state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part { name: "slideevent"; type: RECT; repeat_events: 1;
+ scale: 0;
+ ignore_flags: ON_HOLD;
+ dragable.events: "elm.dragable.slider";
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1.to: "elm.dragable.slider";
+ rel2.to: "elm.dragable.slider";
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "elm.track.slider"; type: SWALLOW; mouse_events: 0;
+ description { state: "default" 0.0;
+ max: 0 0;
+ rel1.to: "elm.dragable.slider";
+ rel2.to: "elm.dragable.slider";
+ }
+ }
+ part { name: "event"; type: RECT;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "mouse,down,1"; source: "elm.dragable.slider";
+ action: STATE_SET "clicked" 0.0;
+ target: "knob";
+ }
+ program {
+ signal: "mouse,up,1"; source: "elm.dragable.slider";
+ action: STATE_SET "default" 0.0;
+ target: "knob";
+ }
+ program {
+ signal: "elm,state,text,visible"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= LABEL; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,text,hidden"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m &= ~LABEL; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,icon,visible"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= ICON; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,icon,hidden"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m &= ~ICON; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program { name: "end_show";
+ signal: "elm,state,end,visible"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= END; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program { name: "end_hide";
+ signal: "elm,state,end,hidden"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m &= ~END; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,units,visible"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= UNITS; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+// program {
+// signal: "elm,state,units,visible"; source: "elm";
+// action: SIGNAL_EMIT "limits,visible" "elm";
+// target: "limits";
+// }
+ program {
+ signal: "elm,state,units,hidden"; source: "elm";
+ action: STATE_SET "default" 0.0;
+ script {
+ new m = get_int(slmode);
+ m &= ~UNITS; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+// program {
+// signal: "elm,state,units,hidden"; source: "elm";
+// action: SIGNAL_EMIT "limits,hide" "elm";
+// target: "limits";
+// }
+ program {
+ signal: "elm,state,inverted,on"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= INVERT; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,inverted,off"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m &= ~INVERT; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,disabled"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m |= DISABLE; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ program {
+ signal: "elm,state,enabled"; source: "elm";
+ script {
+ new m = get_int(slmode);
+ m &= ~DISABLE; set_int(slmode, m);
+ eval_mode(m);
+ }
+ }
+ }
+#undef ICON
+#undef LABEL
+#undef END
+#undef UNITS
+#undef MASK
+#undef INVERT
+#undef DISABLE
+}
diff --git a/data/themes/default/edc/elm/slider.edc b/data/themes/default/edc/elm/slider.edc
index b39a680..5aae3ad 100644
--- a/data/themes/default/edc/elm/slider.edc
+++ b/data/themes/default/edc/elm/slider.edc
@@ -31,31 +31,10 @@ group { name: "elm/slider/hidden/limit";
group { name: "elm/slider/horizontal/default";
alias: "elm/slider/horizontal/disabled";
- alias: "elm/slider/horizontal/media_player/position/default";
- alias: "elm/slider/horizontal/media_player/position/flush";
- alias: "elm/slider/horizontal/media_player/volume/default";
- alias: "elm/slider/horizontal/media_player/volume/flush";
images.image: "slider_run_base_horiz.png" COMP;
images.image: "slider_run_bevel_horiz.png" COMP;
images.image: "slider_run_base_light_horiz.png" COMP;
- images.image: "horiz_glow_run.png" COMP;
- images.image: "horiz_glow_run_rev.png" COMP;
- images.image: "knob_round_small_normal.png" COMP;
- images.image: "knob_round_small_selected.png" COMP;
- set { name: "knob";
- // XXX: add more sizes (at least up to 128x128)
- image { image: "knob_sz_24.png" COMP; size: 31 31 32 32; }
- image { image: "knob_sz_22.png" COMP; size: 29 29 30 30; }
- image { image: "knob_sz_20.png" COMP; size: 27 27 28 28; }
- image { image: "knob_sz_18.png" COMP; size: 25 25 26 26; }
- image { image: "knob_sz_16.png" COMP; size: 23 23 24 24; }
- image { image: "knob_sz_14.png" COMP; size: 21 21 22 22; }
- image { image: "knob_sz_12.png" COMP; size: 19 19 20 20; }
- image { image: "knob_sz_10.png" COMP; size: 17 17 18 18; }
- image { image: "knob_sz_08.png" COMP; size: 15 15 16 16; }
- image { image: "knob_sz_06.png" COMP; size: 13 13 14 14; }
- image { image: "knob_sz_04.png" COMP; size: 0 0 12 12; }
- }
+ images.image: "slider_indicator_knob_horiz.png" COMP;
#define ICON 1
#define LABEL 2
#define END 4
@@ -75,18 +54,14 @@ group { name: "elm/slider/horizontal/default";
if (i) {
if (!d) {
set_state(PART:"base", "default", 0.0);
- set_state(PART:"glow", "inverted", 0.0);
} else {
set_state(PART:"base", "disabled", 0.0);
- set_state(PART:"glow", "disabled_inverted", 0.0);
}
} else {
if (!d) {
set_state(PART:"base", "default", 0.0);
- set_state(PART:"glow", "default", 0.0);
} else {
set_state(PART:"base", "disabled", 0.0);
- set_state(PART:"glow", "disabled", 0.0);
}
}
if (l) {
@@ -137,10 +112,10 @@ group { name: "elm/slider/horizontal/default";
part { name: "elm.swallow.bar"; type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
- min: 42 21;
- max: 99999 21;
+ min: 42 14;
+ max: 99999 14;
align: 1.0 0.5;
- rel1.to_x: "elm.text";
+ rel1.to_x: "elm.swallow.icon";
rel1.relative: 1.0 0.0;
rel1.offset: 2 0;
rel2.to_x: "limits";
@@ -164,36 +139,6 @@ group { name: "elm/slider/horizontal/default";
image.normal: "slider_run_base_light_horiz.png";
}
}
- part { name: "glow"; mouse_events: 0;
- description { state: "default" 0.0;
- image.normal: "horiz_glow_run.png";
- rel1.offset: 1 1;
- rel1.to: "base";
- rel2.relative: 0.5 1.0;
- rel2.offset: -1 -2;
- rel2.to_x: "button";
- rel2.to_y: "base";
- image.border: 0 4 0 0;
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- color: 255 255 255 64;
- }
- description { state: "inverted" 0.0;
- image.normal: "horiz_glow_run_rev.png";
- rel1.relative: 0.5 0.0;
- rel1.offset: 0 1;
- rel1.to_x: "button";
- rel1.to_y: "base";
- rel2.offset: -2 -2;
- rel2.to: "base";
- image.border: 4 0 0 0;
- }
- description { state: "disabled_inverted" 0.0;
- inherit: "inverted" 0.0;
- color: 255 255 255 64;
- }
- }
part { name: "bevel"; mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "base";
@@ -254,7 +199,6 @@ group { name: "elm/slider/horizontal/default";
}
}
part { name: "elm.text"; type: TEXT; mouse_events: 0;
- effect: SHADOW BOTTOM;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
@@ -267,7 +211,7 @@ group { name: "elm/slider/horizontal/default";
rel2.offset: -1 -3;
color: FN_COL_DEFAULT;
color_class: "slider_text";
- text { font: FN; size: 10;
+ text { font: FN; size: 8;
text_class: "slider";
min: 0 0;
align: 0.0 0.5;
@@ -352,7 +296,6 @@ group { name: "elm/slider/horizontal/default";
}
}
part { name: "elm.units"; type: TEXT; mouse_events: 0;
- effect: SHADOW BOTTOM;
scale: 1;
description { state: "default" 0.0;
visible: 0;
@@ -361,7 +304,7 @@ group { name: "elm/slider/horizontal/default";
rel2.to_x: "limits";
color: FN_COL_DEFAULT;
color_class: "slider_text";
- text { font: FN; size: 10;
+ text { font: FN; size: 8;
text_class: "slider";
align: 1.0 0.5;
min: 1 1;
@@ -378,20 +321,8 @@ group { name: "elm/slider/horizontal/default";
color3: 255 255 255 255;
}
}
- part { name: "button"; type: GROUP; mouse_events: 0;
- source: "elm/slider/horizontal/indicator/default";
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "elm.dragable.slider";
- rel2.to: "elm.dragable.slider";
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- }
part { name: "elm.dragable.slider"; type: RECT;
- scale: 1;
+ scale: 0;
dragable.x: 1 1 0;
dragable.y: 0 0 0;
dragable.confine: "elm.swallow.bar";
@@ -407,732 +338,19 @@ group { name: "elm/slider/horizontal/default";
}
}
part { name: "knob";
+ scale: 0;
description { state: "default" 0.0;
- image.normal: "knob";
- fixed: 1 1;
- min: 12 12;
- step: 2 2;
- max: 32 32; // XXX allow bigger sizes with more knob images
- rel1.to: "elm.dragable.slider";
- rel1.offset: -4 -4;
- rel2.to: "elm.dragable.slider";
- rel2.offset: 3 3;
- }
- description { state: "clicked" 0.0;
- inherit: "default" 0.0;
- }
- }
- part { name: "slideevent"; type: RECT; repeat_events: 1;
- scale: 1;
- ignore_flags: ON_HOLD;
- dragable.events: "elm.dragable.slider";
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "elm.dragable.slider";
- rel2.to: "elm.dragable.slider";
- color: 0 0 0 0;
- }
- }
- part { name: "elm.track.slider"; type: SWALLOW; mouse_events: 0;
- description { state: "default" 0.0;
- max: 0 0;
- rel1.to: "elm.dragable.slider";
- rel2.to: "elm.dragable.slider";
- }
- }
- part { name: "event"; type: RECT;
- description { state: "default" 0.0;
- color: 0 0 0 0;
- visible: 0;
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- }
- programs {
- program {
- signal: "mouse,down,1"; source: "elm.dragable.slider";
- action: STATE_SET "clicked" 0.0;
- target: "knob";
- }
- program {
- signal: "mouse,up,1"; source: "elm.dragable.slider";
- action: STATE_SET "default" 0.0;
- target: "knob";
- }
- program {
- signal: "elm,state,indicator,show"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,show" "elm";
- after: "popup_show2";
- }
- program {
- signal: "elm,state,indicator,hide"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,hide" "elm";
- after: "popup_hide2";
- }
- program {
- signal: "mouse,down,1"; source: "slideevent";
- action: SIGNAL_EMIT "elm,popup,show" "elm";
- after: "popup_show2";
- }
- program { name: "popup_show2";
- action: STATE_SET "hidden" 0.0;
- target: "button";
- }
- program {
- signal: "mouse,up,1"; source: "slideevent";
- action: SIGNAL_EMIT "elm,popup,hide" "elm";
- after: "popup_hide2";
- }
- program { name: "popup_hide2";
- action: STATE_SET "default" 0.0;
- target: "button";
- }
- program {
- signal: "elm,state,text,visible"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= LABEL; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,text,hidden"; source: "elm";
- script {
- new m = get_int(slmode);
- m &= ~LABEL; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,icon,visible"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= ICON; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,icon,hidden"; source: "elm";
- script {
- new m = get_int(slmode);
- m &= ~ICON; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program { name: "end_show";
- signal: "elm,state,end,visible"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= END; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program { name: "end_hide";
- signal: "elm,state,end,hidden"; source: "elm";
- script {
- new m = get_int(slmode);
- m &= ~END; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,units,visible"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= UNITS; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,units,visible"; source: "elm";
- action: SIGNAL_EMIT "limits,visible" "elm";
- target: "limits";
- }
- program {
- signal: "elm,state,units,hidden"; source: "elm";
- action: STATE_SET "default" 0.0;
- script {
- new m = get_int(slmode);
- m &= ~UNITS; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,units,hidden"; source: "elm";
- action: SIGNAL_EMIT "limits,hide" "elm";
- target: "limits";
- }
- program {
- signal: "elm,state,inverted,on"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= INVERT; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,inverted,off"; source: "elm";
- script {
- new m = get_int(slmode);
- m &= ~INVERT; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,disabled"; source: "elm";
- script {
- new m = get_int(slmode);
- m |= DISABLE; set_int(slmode, m);
- eval_mode(m);
- }
- }
- program {
- signal: "elm,state,enabled"; source: "elm";
- script {
- new m = get_int(slmode);
- m &= ~DISABLE; set_int(slmode, m);
- eval_mode(m);
- }
- }
- }
-#undef ICON
-#undef LABEL
-#undef END
-#undef UNITS
-#undef MASK
-#undef INVERT
-#undef DISABLE
-}
-
-group { name: "elm/slider/horizontal/indicator/default";
- alias: "elm/slider/horizontal/indicator/disabled";
- alias: "elm/slider/horizontal/popup/default";
- alias: "elm/slider/horizontal/indicator/media_player/position/default";
- alias: "elm/slider/horizontal/indicator/media_player/position/flush";
- alias: "elm/slider/horizontal/indicator/media_player/volume/default";
- alias: "elm/slider/horizontal/indicator/media_player/volume/flush";
- images.image: "darken_rounded_square.png" COMP;
- parts {
- part { name: "base"; type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- min: 16 16;
- }
- }
- part { name: "clip"; type: RECT;
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "elm.indicator";
- rel1.offset: -100 -100;
- rel2.to: "elm.indicator";
- rel2.offset: 99 99;
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "bevel"; mouse_events: 0;
- clip_to: "clip";
- description { state: "default" 0.0;
- rel1.offset: -12 -12;
- rel1.to: "elm.indicator";
- rel2.offset: 11 11;
- rel2.to: "elm.indicator";
- image.normal: "darken_rounded_square.png";
- image.border: 15 15 15 15;
- fill.smooth: 0;
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "elm.indicator"; type: TEXT; mouse_events: 0;
- clip_to: "clip";
- effect: SHADOW BOTTOM;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- align: 0.5 1.0;
- rel1.to: "base";
- rel1.relative: 0.0 -0.1;
- rel1.offset: 0 -12;
- rel2.to: "base";
- rel2.relative: 1.0 -0.1;
- rel2.offset: -1 -12;
- color_class: "slider_indicator";
- color: FN_COL_DEFAULT;
- text { font: FNBD; size: 10;
- min: 1 1;
- align: 0.5 1.0;
- text_class: "slider_indicator";
- ellipsis: -1;
- }
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- }
- programs {
- program {
- signal: "elm,popup,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,popup,hide"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,popup,hide"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,hide,done" "elm";
- }
- program {
- signal: "elm,state,val,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "clip";
- }
- program {
- signal: "elm,state,val,hide"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "clip";
- }
- program {
- signal: "elm,state,indicator,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,state,indicator,hide"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,state,disabled"; source: "elm";
- action: STATE_SET "disabled" 0.0;
- target: "base";
- }
- program {
- signal: "elm,state,enabled"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "base";
- }
- }
-}
-
-group { name: "elm/slider/vertical/default";
- alias: "elm/slider/vertical/disabled";
- alias: "elm/slider/vertical/media_player/position/default";
- alias: "elm/slider/vertical/media_player/position/flush";
- alias: "elm/slider/vertical/media_player/volume/default";
- alias: "elm/slider/vertical/media_player/volume/flush";
- images.image: "slider_run_base_vert.png" COMP;
- images.image: "slider_run_bevel_vert.png" COMP;
- images.image: "slider_run_base_light_vert.png" COMP;
- images.image: "vert_glow_run.png" COMP;
- images.image: "vert_glow_run_rev.png" COMP;
- images.image: "knob_round_small_normal.png" COMP;
- images.image: "knob_round_small_selected.png" COMP;
- set { name: "knob";
- // XXX: add more sizes (at least up to 128x128)
- image { image: "knob_sz_24.png" COMP; size: 31 31 32 32; }
- image { image: "knob_sz_22.png" COMP; size: 29 29 30 30; }
- image { image: "knob_sz_20.png" COMP; size: 27 27 28 28; }
- image { image: "knob_sz_18.png" COMP; size: 25 25 26 26; }
- image { image: "knob_sz_16.png" COMP; size: 23 23 24 24; }
- image { image: "knob_sz_14.png" COMP; size: 21 21 22 22; }
- image { image: "knob_sz_12.png" COMP; size: 19 19 20 20; }
- image { image: "knob_sz_10.png" COMP; size: 17 17 18 18; }
- image { image: "knob_sz_08.png" COMP; size: 15 15 16 16; }
- image { image: "knob_sz_06.png" COMP; size: 13 13 14 14; }
- image { image: "knob_sz_04.png" COMP; size: 0 0 12 12; }
- }
-#define ICON 1
-#define LABEL 2
-#define END 4
-#define UNITS 8
-#define MASK 15
-#define INVERT 16
-#define DISABLE 32
- script {
- public slmode;
- public eval_mode(m) {
- new ic = m & ICON;
- new l = m & LABEL;
- new e = m & END;
- new u = m & UNITS;
- new d = m & DISABLE;
- new i = m & INVERT;
- if (i) {
- if (!d) {
- set_state(PART:"base", "default", 0.0);
- set_state(PART:"glow", "inverted", 0.0);
- } else {
- set_state(PART:"base", "disabled", 0.0);
- set_state(PART:"glow", "disabled_inverted", 0.0);
- }
- } else {
- if (!d) {
- set_state(PART:"base", "default", 0.0);
- set_state(PART:"glow", "default", 0.0);
- } else {
- set_state(PART:"base", "disabled", 0.0);
- set_state(PART:"glow", "disabled", 0.0);
- }
- }
- if (l) {
- if (!d) {
- set_state(PART:"elm.text", "visible", 0.0);
- } else {
- set_state(PART:"elm.text", "disabled_visible", 0.0);
- }
- } else {
- set_state(PART:"elm.text", "default", 0.0);
- }
- if (u) {
- if (!d) {
- set_state(PART:"elm.units", "visible", 0.0);
- set_state(PART:"limits", "visible", 0.0);
- } else {
- set_state(PART:"elm.units", "disabled_visible", 0.0);
- set_state(PART:"limits", "disabled_visible", 0.0);
- }
- } else {
- set_state(PART:"elm.units", "default", 0.0);
- set_state(PART:"limits", "default", 0.0);
- }
- if (ic) {
- set_state(PART:"elm.swallow.icon", "visible", 0.0);
- set_state(PART:"sizer.content", "visible", 0.0);
- } else {
- set_state(PART:"elm.swallow.icon", "default", 0.0);
- set_state(PART:"sizer.content", "default", 0.0);
- }
- if (e) {
- set_state(PART:"elm.swallow.end", "visible", 0.0);
- set_state(PART:"sizer.content.end", "visible", 0.0);
- } else {
- set_state(PART:"elm.swallow.end", "default", 0.0);
- set_state(PART:"sizer.content.end", "default", 0.0);
- }
- if (!d) {
- set_state(PART:"event", "default", 0.0);
- set_state(PART:"dis_clip", "default", 0.0);
- } else {
- set_state(PART:"event", "disabled", 0.0);
- set_state(PART:"dis_clip", "disabled", 0.0);
- }
- }
- }
- parts {
- part { name: "elm.swallow.bar"; type: SWALLOW;
- scale: 1;
- description { state: "default" 0.0;
- min: 21 42;
- max: 21 99999;
- align: 0.5 1.0;
- rel1.to_y: "elm.text";
- rel1.relative: 0.0 1.0;
- rel1.offset: 0 2;
- rel2.to_y: "limits";
- rel2.relative: 1.0 0.0;
- rel2.offset: -1 -3;
- }
- }
- part { name: "base"; mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "elm.swallow.bar";
- rel2.to: "elm.swallow.bar";
- image.normal: "slider_run_base_vert.png";
- image.border: 0 0 4 4;
- fill.smooth: 0;
- min: 5 8;
- max: 5 99999;
- fixed: 1 0;
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- image.normal: "slider_run_base_light_vert.png";
- }
- }
- part { name: "glow"; mouse_events: 0;
- description { state: "default" 0.0;
- image.normal: "vert_glow_run.png";
- rel1.offset: 1 1;
- rel1.to: "base";
- rel2.relative: 1.0 0.5;
- rel2.offset: -2 -1;
- rel2.to_y: "button";
- rel2.to_x: "base";
- image.border: 0 0 0 4;
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- color: 255 255 255 64;
- }
- description { state: "inverted" 0.0;
- image.normal: "vert_glow_run_rev.png";
- rel1.relative: 0.0 0.5;
- rel1.offset: 1 0;
- rel1.to_y: "button";
- rel1.to_x: "base";
- rel2.offset: -2 -2;
- rel2.to: "base";
- image.border: 0 0 4 0;
- }
- description { state: "disabled_inverted" 0.0;
- inherit: "inverted" 0.0;
- color: 255 255 255 64;
- }
- }
- part { name: "bevel"; mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "base";
- rel2.to: "base";
- image.normal: "slider_run_bevel_vert.png";
- image.border: 0 0 5 5;
- fill.smooth: 0;
- }
- }
- part { name: "dis_clip"; type: RECT;
- description { state: "default" 0.0;
- rel1.to: "elm.swallow.icon";
- rel2.to: "elm.swallow.end";
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- color: 255 255 255 64;
- }
- }
- part { name: "elm.swallow.icon"; type: SWALLOW;
- clip_to: "dis_clip";
- description { state: "default" 0.0;
- visible: 0;
- align: 0.5 0.0;
- rel1.offset: 2 0;
- rel1.to_x: "elm.swallow.bar";
- rel2.offset: -3 -1;
- rel2.relative: 1.0 0.0;
- rel2.to_x: "elm.swallow.bar";
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- aspect: 1.0 1.0; aspect_preference: VERTICAL;
- rel1.offset: 2 2;
- rel2.offset: -3 2;
- }
- }
- part { name: "sizer.content"; type: TEXT; mouse_events: 0;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- visible: 0;
- text { font: FN; size: 10;
- min: 0 0;
- text_class: "slider_text";
- }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- rel1.to: "elm.swallow.icon";
- rel2.to: "elm.swallow.icon";
- text {
- min: 1 1;
- ellipsis: -1;
- text: "M";
- }
- }
- }
- part { name: "elm.text"; type: TEXT; mouse_events: 0;
- effect: SHADOW BOTTOM;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1.to_y: "elm.swallow.icon";
- rel1.relative: 0.0 1.0;
- rel1.offset: 2 -1;
- rel2.to_y: "elm.swallow.icon";
- rel2.relative: 1.0 1.0;
- rel2.offset: -3 -1;
- color: FN_COL_DEFAULT;
- color_class: "slider_text";
- text { font: FN; size: 10;
- text_class: "slider";
- min: 1 0;
- ellipsis: -1;
- align: 0.5 0.0;
- }
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- rel1.offset: 2 2;
- rel2.offset: -3 2;
- text.min: 1 1;
- text.ellipsis: -1;
-
- }
- description { state: "disabled_visible" 0.0;
- inherit: "visible" 0.0;
- color_class: "slider_text_disabled";
- color3: 255 255 255 255;
- }
- }
- part { name: "elm.swallow.end"; type: SWALLOW;
- clip_to: "dis_clip";
- description { state: "default" 0.0;
- visible: 0;
- align: 0.5 1.0;
- rel1.offset: 2 0;
- rel1.relative: 0.0 1.0;
- rel2.offset: -3 -1;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- aspect: 1.0 1.0;
- aspect_preference: VERTICAL;
- rel2.offset: 2 -3;
- rel2.offset: -3 -3;
- }
- }
- part { name: "sizer.content.end"; type: TEXT; mouse_events: 0;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- visible: 0;
- text { font: FN; size: 10;
- min: 0 0;
- text_class: "slider_text";
- }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- rel1.to: "elm.swallow.end";
- rel2.to: "elm.swallow.end";
- text {
- min: 1 1;
- ellipsis: -1;
- text: "M";
- }
- }
- }
- alias: "elm.units.min" "limits:elm.units.min";
- alias: "elm.units.max" "limits:elm.units.max";
- part { name: "limits"; type: GROUP; mouse_events: 0;
- source: "elm/slider/hidden/limit";
- scale: 1;
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 1 1;
- max: 0 0;
- rel1.to_y: "elm.swallow.end";
- rel1.relative: 0.0 0.0;
- rel1.offset: 2 1;
- rel2.to_y: "elm.swallow.end";
- rel2.relative: 1.0 0.0;
- rel2.offset: -3 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: SOURCE;
- rel1.offset: 2 -3;
- rel2.offset: -3 -3;
- }
- }
- part { name: "elm.units"; type: TEXT; mouse_events: 0;
- effect: SHADOW BOTTOM;
- scale: 1;
- description { state: "default" 0.0;
- visible: 0;
- fixed: 1 1;
- rel1.to_y: "limits";
- rel2.to_y: "limits";
- color: FN_COL_DEFAULT;
- color_class: "slider_text";
- text { font: FN; size: 10;
- text_class: "slider";
- min: 0 0;
- align: 0.5 1.0;
- ellipsis: -1;
- }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- text.min: 1 1;
- text.ellipsis: -1;
- }
- description { state: "disabled_visible" 0.0;
- inherit: "visible" 0.0;
- color_class: "slider_text_disabled";
- color3: 255 255 255 255;
- }
- }
- part { name: "button"; type: GROUP; mouse_events: 0;
- source: "elm/slider/vertical/indicator/default";
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "elm.dragable.slider";
- rel2.to: "elm.dragable.slider";
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- }
- part { name: "elm.dragable.slider"; type: RECT;
- scale: 1;
- dragable.x: 0 0 0;
- dragable.y: 1 1 0;
- dragable.confine: "elm.swallow.bar";
- description { state: "default" 0.0;
- color: 0 0 0 0;
- min: 16 16;
- max: 16 16;
- fixed: 1 1;
- rel1.relative: 0.0 0.5;
- rel1.to_x: "elm.swallow.bar";
- rel2.relative: 1.0 0.5;
- rel2.to_x: "elm.swallow.bar";
- }
- }
- part { name: "knob";
- description { state: "default" 0.0;
- image.normal: "knob";
+ image.normal: "slider_indicator_knob_horiz.png";
fixed: 1 1;
- min: 12 12;
- step: 2 2;
- max: 32 32; // XXX allow bigger sizes with more knob images
rel1.to: "elm.dragable.slider";
- rel1.offset: -4 -4;
rel2.to: "elm.dragable.slider";
- rel2.offset: 3 3;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
}
}
part { name: "slideevent"; type: RECT; repeat_events: 1;
- scale: 1;
+ scale: 0;
ignore_flags: ON_HOLD;
dragable.events: "elm.dragable.slider";
description { state: "default" 0.0;
@@ -1172,34 +390,6 @@ group { name: "elm/slider/vertical/default";
target: "knob";
}
program {
- signal: "elm,state,indicator,show"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,show" "elm";
- after: "popup_show2";
- }
- program {
- signal: "elm,state,indicator,hide"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,hide" "elm";
- after: "popup_hide2";
- }
- program {
- signal: "mouse,down,1"; source: "slideevent";
- action: SIGNAL_EMIT "elm,popup,show" "elm";
- after: "popup_show2";
- }
- program { name: "popup_show2";
- action: STATE_SET "hidden" 0.0;
- target: "button";
- }
- program {
- signal: "mouse,up,1"; source: "slideevent";
- action: SIGNAL_EMIT "elm,popup,hide" "elm";
- after: "popup_hide2";
- }
- program { name: "popup_hide2";
- action: STATE_SET "default" 0.0;
- target: "button";
- }
- program {
signal: "elm,state,text,visible"; source: "elm";
script {
new m = get_int(slmode);
@@ -1255,10 +445,11 @@ group { name: "elm/slider/vertical/default";
eval_mode(m);
}
}
- program {
- signal: "elm,state,units,visible"; source: "elm";
- action: SIGNAL_EMIT "limits:limits,visible" "elm";
- }
+// program {
+// signal: "elm,state,units,visible"; source: "elm";
+// action: SIGNAL_EMIT "limits,visible" "elm";
+// target: "limits";
+// }
program {
signal: "elm,state,units,hidden"; source: "elm";
action: STATE_SET "default" 0.0;
@@ -1268,10 +459,11 @@ group { name: "elm/slider/vertical/default";
eval_mode(m);
}
}
- program {
- signal: "elm,state,units,hidden"; source: "elm";
- action: SIGNAL_EMIT "limits:limits,hide" "elm";
- }
+// program {
+// signal: "elm,state,units,hidden"; source: "elm";
+// action: SIGNAL_EMIT "limits,hide" "elm";
+// target: "limits";
+// }
program {
signal: "elm,state,inverted,on"; source: "elm";
script {
@@ -1313,131 +505,3 @@ group { name: "elm/slider/vertical/default";
#undef INVERT
#undef DISABLE
}
-
-group { name: "elm/slider/vertical/indicator/default";
- alias: "elm/slider/vertical/indicator/disabled";
- alias: "elm/slider/vertical/popup/default";
- alias: "elm/slider/vertical/indicator/media_player/position/default";
- alias: "elm/slider/vertical/indicator/media_player/position/flush";
- alias: "elm/slider/vertical/indicator/media_player/volume/default";
- alias: "elm/slider/vertical/indicator/media_player/volume/flush";
- images.image: "darken_rounded_square.png" COMP;
- parts {
- part { name: "base"; type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- min: 16 16;
- }
- }
- part { name: "clip"; type: RECT;
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "elm.indicator";
- rel1.offset: -100 -100;
- rel2.to: "elm.indicator";
- rel2.offset: 99 99;
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "bevel"; mouse_events: 0;
- clip_to: "clip";
- description { state: "default" 0.0;
- rel1.offset: -12 -12;
- rel1.to: "elm.indicator";
- rel2.offset: 11 11;
- rel2.to: "elm.indicator";
- image.normal: "darken_rounded_square.png";
- image.border: 15 15 15 15;
- fill.smooth: 0;
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "elm.indicator"; type: TEXT; mouse_events: 0;
- clip_to: "clip";
- effect: SHADOW BOTTOM;
- scale: 1;
- description { state: "default" 0.0;
- fixed: 1 1;
- align: 0.0 0.5;
- rel1.to: "base";
- rel1.relative: 1.1 0.0;
- rel1.offset: 11 0;
- rel2.to: "base";
- rel2.relative: 1.1 1.0;
- rel2.offset: 11 -1;
- color_class: "slider_indicator";
- color: FN_COL_DEFAULT;
- text { font: FNBD; size: 10;
- min: 1 1;
- align: 0.0 0.5;
- text_class: "slider_indicator";
- ellipsis: -1;
- }
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- }
- programs {
- program {
- signal: "elm,popup,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,popup,hide"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,popup,hide"; source: "elm";
- action: SIGNAL_EMIT "elm,popup,hide,done" "elm";
- }
- program {
- signal: "elm,state,val,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "clip";
- }
- program {
- signal: "elm,state,val,hide"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "clip";
- }
- program {
- signal: "elm,state,indicator,show"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,state,indicator,hide"; source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.indicator";
- target: "bevel";
- }
- program {
- signal: "elm,state,disabled"; source: "elm";
- action: STATE_SET "disabled" 0.0;
- target: "base";
- }
- program {
- signal: "elm,state,enabled"; source: "elm";
- action: STATE_SET "default" 0.0;
- target: "base";
- }
- }
-}
diff --git a/data/themes/default/img/emo-very-sorry.png b/data/themes/default/img/emo-very-sorry.png
index 10c4736..667a30d 100644
--- a/data/themes/default/img/emo-very-sorry.png
+++ b/data/themes/default/img/emo-very-sorry.png
Binary files differ
diff --git a/data/themes/default/img/slider_indicator_knob_horiz.png b/data/themes/default/img/slider_indicator_knob_horiz.png
new file mode 100644
index 0000000..b619fb7
--- /dev/null
+++ b/data/themes/default/img/slider_indicator_knob_horiz.png
Binary files differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 824e23b..941197f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,12 +7,14 @@ bin_PROGRAMS = eulogium
AM_CPPFLAGS = -DPACKAGE_BIN_DIR=\"$(bindir)/\" \
-DPACKAGE_LIB_DIR=\"$(bindir)/\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
--I$(top_builddir)/src/ \
--I$(top_srcdir)/src/ \
-@EFL_CFLAGS@
+ -I$(top_builddir)/src/ \
+ -I$(top_srcdir)/src/ \
+ @EFL_CFLAGS@
eulogium_SOURCES = eulogium.c eulogium_item_list.c procedures.c \
- dbus_common.c
+ dbus_common.c print_data.c network.c ui_widgets.c \
+ ui_input.c
+
eulogium_LDADD = @EFL_LIBS@
localedir = $(datadir)/locale
diff --git a/src/dbus_common.c b/src/dbus_common.c
index dd3bae5..b05e9ea 100644
--- a/src/dbus_common.c
+++ b/src/dbus_common.c
@@ -12,20 +12,39 @@
#include "dbus_common.h"
#include "eulogium.h"
#include "eulogium_item_list.h"
+#include "procedures.h"
-void on_method_generic_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+void on_method_generic_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
+ const char *errname, *errmsg;
- struct list_item *item = data;
+ if (eldbus_message_error_get(msg, &errname, &errmsg)) {
+ EINA_LOG_ERR("%s %s", errname, errmsg);
+ return;
+ }
+}
+
+void on_method_generic_bool_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
const char *errname, *errmsg;
- Eina_Bool state;
+ Eina_Bool ret;
if (eldbus_message_error_get(msg, &errname, &errmsg)) {
EINA_LOG_ERR("%s %s", errname, errmsg);
return;
}
+ if (!eldbus_message_arguments_get(msg, "b", &ret)) {
+ EINA_LOG_ERR("Signature mismatch, \"b\".");
+ return;
+ }
+ if (ret)
+ EINA_LOG_INFO("Ran %s successfully.", (char *)data);
+ else
+ EINA_LOG_WARN("%s failed to run.", (char *)data);
}
+#define _TECH_ETHERNET "ethernet"
+#define _TECH_WIFI "wifi"
void on_method_get_network_info_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
struct eulogium_data *eulogium = data; /* TODO replace this by making networks direct via ** */
@@ -60,10 +79,10 @@ void on_method_get_network_info_ret(void *data, const Eldbus_Message *msg, Eldbu
else
strncpy(networks[i].obj_path, obj_path, obj_pathsize);
- networks[i].tech = UNKNOWN;
- if (strcmp(tech, _TECH_ETHERNET))
+ networks[i].tech = TECH_UNKNOWN;
+ if (!strcmp(tech, _TECH_ETHERNET))
networks[i].tech = TECH_ETHERNET;
- if (strcmp(tech, _TECH_WIFI))
+ if (!strcmp(tech, _TECH_WIFI))
networks[i].tech = TECH_WIFI;
strncpy(networks[i].ipv4, ipv4, IPV4_MAX_LEN);
@@ -81,6 +100,29 @@ void on_signal_network_info_changed_ret(void *data, const Eldbus_Message *msg)
on_method_get_network_info_ret(data, msg, NULL);
}
+void on_method_get_procedure_metadata_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+ const struct procedure_data *proc = data;
+ const char *errname, *errmsg;
+ Eldbus_Message_Iter *array;
+
+ if (eldbus_message_error_get(msg, &errname, &errmsg)) {
+ EINA_LOG_ERR("%s %s", errname, errmsg); /* XXX do these need to be free'ed? FIXME! YES! They do */
+ return;
+ }
+ if (!eldbus_message_arguments_get(msg, "a{sv}", &array)) {
+ EINA_LOG_ERR("Message content does not match expected \"a{sv}\" signature. (%s)", eldbus_message_signature_get(msg)); /* XXX this return value may need to be freed actually!! Yep they do.*/
+ return;
+ }
+ eldbus_message_iter_dict_iterate(array, "sv", proc->parser, proc->meta);
+}
+
+/* XXX we are likely not getting a signal, but will deal with this on procedure start and procedure finished. */
+void on_signal_procedure_metadata_changed_ret(void *data, const Eldbus_Message *msg)
+{
+ on_method_get_procedure_metadata_ret(data, msg, NULL);
+}
+
void on_method_is_network_powered_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
struct list_item *item = data;
diff --git a/src/dbus_common.h b/src/dbus_common.h
index fc3af51..95f1e30 100644
--- a/src/dbus_common.h
+++ b/src/dbus_common.h
@@ -24,10 +24,13 @@ struct dbus_handle {
void *set_data;
};
-void on_method_generic_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
+void on_method_generic_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
+void on_method_generic_bool_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
void on_method_get_network_info_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
void on_signal_network_info_changed_ret(void *data, const Eldbus_Message *msg);
void on_method_is_network_powered_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
void on_signal_network_power_changed_ret(void *data, const Eldbus_Message *msg);
+void on_method_get_procedure_metadata_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
+void on_signal_procedure_metadata_changed_ret(void *data, const Eldbus_Message *msg);
#endif /* _DBUS_COMMON_H */
diff --git a/src/eulogium.c b/src/eulogium.c
index 280e204..a9ddeee 100644
--- a/src/eulogium.c
+++ b/src/eulogium.c
@@ -18,38 +18,40 @@
#include "eulogium_item_list.h"
#include "eulogium_private.h"
#include "gettext.h"
+#include "network.h"
+#include "print_data.h"
#include "procedures.h"
+#include "settings_data.h"
+#include "ui_input.h"
#include "ui_widgets.h"
#define COPYRIGHT "Copyright © 2015 Olliver Schinagl <o.schinagl@ultimaker.com> and various contributors (see AUTHORS)."
-#define SECOND 1UL
-#define MINUTE (60UL * SECOND)
-#define HOUR (60UL * MINUTE)
-#define DAY (24UL * HOUR)
-#define WEEK (7UL * DAY)
-#define MONTH (4UL * WEEK)
-#define YEAR (52UL * WEEK)
-
-int INPUT_MOUSE_WHEEL_UP = 0; /* For custom ecore_event handling */
-int INPUT_MOUSE_WHEEL_DOWN = 0; /* For custom ecore_event handling */
+#define SECOND 1L
+#define MINUTE (60L * SECOND)
+#define HOUR (60L * MINUTE)
+#define DAY (24L * HOUR)
+#define WEEK (7L * DAY)
+#define MONTH (4L * WEEK)
+#define YEAR (52L * WEEK)
/* TODO this LUT can be much improved */
char *griffin_print_status[] = {
- gettext_noop("Unknown"),
- gettext_noop("Disconnected"),
- gettext_noop("Error"),
- gettext_noop("First Run Wizard"),
- gettext_noop("IDLE"),
- gettext_noop("Slicing"),
- gettext_noop("Heating"),
- gettext_noop("Printing"),
- gettext_noop("Cooling down"),
- gettext_noop("Wait for Removal"),
- gettext_noop("Paused"),
+ N_("Unknown"),
+ N_("Disconnected"),
+ N_("Error"),
+ N_("First Run Wizard"),
+ N_("IDLE"),
+ N_("Slicing"),
+ N_("Heating"),
+ N_("Printing"),
+ N_("Cooling down"),
+ N_("Wait for Removal"),
+ N_("Paused"),
};
/* TODO Create def for a menu/screen to house all the buttons */
+/* BTN is better then but-sex. */
static void _on_print_abort_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
static void _cb_content_prev_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
@@ -89,11 +91,19 @@ static void _but_settings_hotend_2_offset_cb(void *data, Evas_Object *obj EINA_U
static void _but_material_customize_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _but_print_tune_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _but_settings_led_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_led_hue_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_led_saturation_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _but_led_brightness_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_bed_heatup_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_hotend_heatup_0_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_hotend_heatup_1_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_print_speed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_fan_speed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
+static void _but_flow_rate_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
/* Buttons */
static struct button_def but_return = {
- .text = gettext_noop("RETURN"),
+ .text = N_("RETURN"),
.cb = {
.func = _cb_content_prev_set,
.data = NULL,
@@ -355,9 +365,9 @@ static struct menu_def menu_system_settings = {
.entry = {
{
.icon = "user-home",
- .label = gettext_noop("Return"),
+ .label = N_("Return"),
.item = {.type = LIST_ITEM_BUTTON},
- .footer = gettext_noop("Return to Main menu"),
+ .footer = N_("Return to Main menu"),
.footer_alt = NULL,
.func = _cb_content_prev_set,
.toggle_timer = NULL,
@@ -499,7 +509,7 @@ static struct menu_def menu_settings_network = {
}, {
.icon = NULL,
.label = "Network info",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = NULL,
.footer_alt = NULL,
.func = _but_network_info_cb,
@@ -508,7 +518,7 @@ static struct menu_def menu_settings_network = {
}, {
.icon = NULL,
.label = "Manage WiFi",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = "Connect or forget",
.footer_alt = NULL,
.func = _network_wifi_manage_cb,
@@ -594,7 +604,7 @@ static struct menu_def menu_settings_language = {
{
.icon = "user-home",
.label = "Return",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = "Return to Main menu",
.footer_alt = NULL,
.func = _cb_content_prev_set,
@@ -603,7 +613,7 @@ static struct menu_def menu_settings_language = {
}, {
.icon = NULL,
.label = "English",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = "Welcome",
.footer_alt = NULL,
.func = NULL,
@@ -782,6 +792,15 @@ static struct menu_def menu_system_maintenance = {
.data = NULL,
}, {
.icon = NULL,
+ .label = "Speed",
+ .end = NULL,
+ .footer = "100 %",
+ .footer_alt = NULL,
+ .func = &_but_print_speed_cb,
+ .toggle_timer = NULL,
+ .data = NULL,
+ }, {
+ .icon = NULL,
.label = "Level buildplate",
.end = NULL,
.footer = NULL,
@@ -795,7 +814,7 @@ static struct menu_def menu_system_maintenance = {
.end = NULL,
.footer = NULL,
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_bed_heatup_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -840,7 +859,7 @@ static struct menu_def menu_system_maintenance = {
.end = NULL,
.footer = NULL,
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_hotend_heatup_0_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -849,7 +868,7 @@ static struct menu_def menu_system_maintenance = {
.end = NULL,
.footer = NULL,
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_hotend_heatup_1_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -858,7 +877,16 @@ static struct menu_def menu_system_maintenance = {
.end = NULL,
.footer = NULL,
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_fan_speed_cb,
+ .toggle_timer = NULL,
+ .data = NULL,
+ }, {
+ .icon = NULL,
+ .label = "Set Material flow",
+ .end = NULL,
+ .footer = NULL,
+ .footer_alt = NULL,
+ .func = &_but_flow_rate_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1183,7 +1211,7 @@ static struct menu_def menu_settings_led = {
.item = {.type = LIST_ITEM_BUTTON},
.footer = "100%",
.footer_alt = NULL,
- .func = _but_led_brightness_cb,
+ .func = _but_led_hue_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1192,7 +1220,7 @@ static struct menu_def menu_settings_led = {
.item = {.type = LIST_ITEM_BUTTON},
.footer = "100%",
.footer_alt = NULL,
- .func = _but_led_brightness_cb,
+ .func = _but_led_saturation_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1255,7 +1283,7 @@ static struct menu_def menu_print_tune = {
{
.icon = "user-home",
.label = "Return",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = "Return to print",
.footer_alt = NULL,
.func = _cb_content_prev_set,
@@ -1264,7 +1292,7 @@ static struct menu_def menu_print_tune = {
}, {
.icon = NULL,
.label = "Networking",
- .end = NULL,
+ .item = {.type = LIST_ITEM_BUTTON},
.footer = "IP: ",
.footer_alt = NULL,
.func = _but_settings_network_cb,
@@ -1276,16 +1304,25 @@ static struct menu_def menu_print_tune = {
.end = NULL,
.footer = "100 %",
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_print_speed_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
.icon = NULL,
- .label = "Hotend temperature",
+ .label = "Hotend 1 temperature",
.end = NULL,
.footer = "210 °C",
.footer_alt = NULL,
- .func = NULL,
+ .func = _but_hotend_heatup_0_cb,
+ .toggle_timer = NULL,
+ .data = NULL,
+ }, {
+ .icon = NULL,
+ .label = "Hotend 2 temperature",
+ .end = NULL,
+ .footer = "210 °C",
+ .footer_alt = NULL,
+ .func = _but_hotend_heatup_1_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1294,7 +1331,7 @@ static struct menu_def menu_print_tune = {
.end = NULL,
.footer = "60 °C",
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_bed_heatup_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1303,7 +1340,7 @@ static struct menu_def menu_print_tune = {
.end = NULL,
.footer = "100 %",
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_fan_speed_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1312,7 +1349,7 @@ static struct menu_def menu_print_tune = {
.end = NULL,
.footer = "100 %",
.footer_alt = NULL,
- .func = NULL,
+ .func = &_but_flow_rate_cb,
.toggle_timer = NULL,
.data = NULL,
}, {
@@ -1377,7 +1414,137 @@ static struct menu_def menu_ = {
};
#endif
-static void eulogium_print_data_clear(struct eulogium_data *eulogium)
+static struct settings_dial_data dial_led_hue = {
+ .label = N_("Hue"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 100.0,
+ .value = 12.3,
+ .value_end = 25.0,
+ .format = "%1.0f",
+ .format_end = " | %1.0f%s",
+ .unit = "%",
+ //.method_set = "SetHue",
+ //.method_get = "GetHue",
+};
+
+static struct settings_dial_data dial_led_saturation = {
+ .label = N_("Saturation"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 100.0,
+ .value = 4.56,
+ .value_end = 25.0,
+ .format = "%1.0f",
+ .format_end = " | %1.0f%s",
+ .unit = "%",
+ //.method_set = "SetSaturation",
+ //.method_get = "GetSaturation",
+};
+
+static struct settings_dial_data dial_led_brightness = {
+ .label = N_("Brightness"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 100.0,
+ .value = 7.89,
+ .value_end = 25.0,
+ .format = "%1.0f",
+ .format_end = " | %1.0f%s",
+ .unit = "%",
+ //.method_set = "SetBrightness",
+ //.method_get = "GetBrightness",
+};
+
+static struct settings_dial_data dials[] = {
+ [PROC_BED_HEATUP] = {
+ .label = N_("Buildplate temperature"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 60.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " °C",
+ .method_set = &procedure_target_set,
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_BED_HEATUP,
+ },
+ [PROC_HOTEND_HEATUP_0] = {
+ .label = N_("Hotend 1 temperature"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 300.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " °C",
+ .method_set = &procedure_target_set, /* XXX use ampersant improve of functions */
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_HOTEND_HEATUP_0,
+ },
+ [PROC_HOTEND_HEATUP_1] = {
+ .label = N_("Hotend 2 temperature"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 300.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " °C",
+ .method_set = &procedure_target_set, /* XXX use ampersant improve of functions */
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_HOTEND_HEATUP_1,
+ },
+ [PROC_PRINT_SPEED] = {
+ .label = N_("Print speed"),
+ .step = 10.0,
+ .min = 10.0,
+ .max = 1000.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " %",
+ .method_set = &procedure_target_set,
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_PRINT_SPEED,
+ },
+ [PROC_FAN_SPEED] = {
+ .label = N_("Fan speed"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 100.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " %",
+ .method_set = &procedure_target_set,
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_FAN_SPEED,
+ },
+ [PROC_FLOW_RATE] = {
+ .label = N_("Material flow rate"),
+ .step = 1.0,
+ .min = 0.0,
+ .max = 100.0,
+ .value = 0.0,
+ .value_end = 0.0,
+ .format = "%1.1f",
+ .format_end = " | %1.0f%s",
+ .unit = " %",
+ .method_set = &procedure_target_set,
+ .method_get = &procedure_metadata_get,
+ .proc_key = PROC_FLOW_RATE,
+ },
+ { NULL }, /* sentinel */
+};
+
+void eulogium_print_data_clear(struct eulogium_data *eulogium)
{
if (eulogium->progress_data_refresh)
ecore_timer_del(eulogium->progress_data_refresh);
@@ -1391,13 +1558,11 @@ static void eulogium_print_data_clear(struct eulogium_data *eulogium)
// free(eulogium->print.name);
eulogium->print.name = NULL;
eulogium->print.name_changed = EINA_FALSE;
+ print_clear(eulogium->procedures[PROC_PRINT].meta);
// if (eulogium->print.file)
// free(eulogium->print.file);
eulogium->print.url = NULL;
- eulogium->print.time = 0;
- eulogium->print.material = 0;
- eulogium->print.progress = 0;
eulogium->print.flags = "";
}
@@ -1425,15 +1590,7 @@ static void _on_print_abort_ret(void *data, const Eldbus_Message *msg, Eldbus_Pe
static void _cb_content_prev_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- struct eulogium_data *eulogium = data;
- uint_fast8_t list_size;
-
- printf("prev ret\n");
- list_size = eina_list_count(elm_naviframe_items_get(eulogium->navi));
- if (list_size < 2)
- printf("Not popping last item cowboy\n"); /* TODO, use proper debug construct */
- else
- elm_naviframe_item_pop(eulogium->navi);
+ ui_stack_pop_cb(data, obj, event_info); /* XXX replace content_prev calls with ui_stack_pop */
}
static void _print_abort_confirm_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1441,10 +1598,8 @@ static void _print_abort_confirm_cb(void *data, Evas_Object *obj EINA_UNUSED, vo
struct eulogium_data *eulogium = data;
Evas_Object *content;
- content = eulogium_menu_confirm(eulogium->navi, gettext_noop("<br>Abort the print?"), "No", &but_print_abort);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ content = eulogium_menu_confirm(eulogium->navi, N_("<br>Abort the print?"), "No", &but_print_abort);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _print_abort_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1470,9 +1625,7 @@ static void _but_system_maintenance_cb(void *data, Evas_Object *obj EINA_UNUSED,
printf("But sys maint\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_system_maintenance);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_material_change_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1482,9 +1635,7 @@ static void _but_material_change_cb(void *data EINA_UNUSED, Evas_Object *obj EIN
printf("But material change\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_change_material_1, &but_change_material_2, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_material_settings_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1494,9 +1645,7 @@ static void _but_material_settings_cb(void *data EINA_UNUSED, Evas_Object *obj E
printf("But material settings\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_settings_material_1, &but_settings_material_2, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_hotend_change_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1506,9 +1655,7 @@ static void _but_hotend_change_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_
printf("But hotend change\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_change_hotend_1, &but_change_hotend_2, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_hotend_settings_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1518,9 +1665,7 @@ static void _but_hotend_settings_cb(void *data EINA_UNUSED, Evas_Object *obj EIN
printf("But hotend settings\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_settings_hotend_1, &but_settings_hotend_2, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_main_system_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1530,9 +1675,7 @@ static void _but_main_system_cb(void *data, Evas_Object *object EINA_UNUSED, voi
printf("Button system pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_system_settings, &but_system_maintenance, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void menu_widget_list_push(struct eulogium_data *eulogium, struct menu_def *file)
@@ -1540,9 +1683,7 @@ static void menu_widget_list_push(struct eulogium_data *eulogium, struct menu_de
Evas_Object *content;
content = menu_widget_list(eulogium, eulogium->navi, file);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void menu_wifi_list(struct eulogium_data *eulogium)
@@ -1625,9 +1766,7 @@ static void _cb_button_main_print(void *data, Evas_Object *object EINA_UNUSED, v
content = eulogium_tripple_button_menu(eulogium->navi, &but_print_local, &but_print_mmc, &but_return);
if (eeze_disk_type_get(mount->disk) == EEZE_DISK_TYPE_USB)
content = eulogium_tripple_button_menu(eulogium->navi, &but_print_local, &but_print_usb, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
}
@@ -1639,9 +1778,7 @@ static void _but_settings_network_cb(void *data, Evas_Object *obj EINA_UNUSED, v
printf("But settings network settings\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_network);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_system_settings_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1651,9 +1788,7 @@ static void _but_system_settings_cb(void *data, Evas_Object *obj EINA_UNUSED, vo
printf("But system settings settings\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_system_settings);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_hotend_1_offset_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1663,9 +1798,7 @@ static void _but_settings_hotend_1_offset_cb(void *data, Evas_Object *obj EINA_U
printf("But settings hotend 1 offset settings\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_hotend_1_offset);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_hotend_2_offset_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1675,9 +1808,7 @@ static void _but_settings_hotend_2_offset_cb(void *data, Evas_Object *obj EINA_U
printf("But settings hotend 2 offset settings\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_hotend_2_offset);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_language_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1687,9 +1818,7 @@ static void _but_settings_language_cb(void *data, Evas_Object *obj EINA_UNUSED,
printf("But menu language settings\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_language);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_led_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1702,13 +1831,93 @@ static void _but_settings_led_cb(void *data, Evas_Object *obj EINA_UNUSED, void
ui_stack_push(eulogium, content, PAGE_NORMAL);
}
+static void _but_led_hue_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button led_hue pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dial_led_hue);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
+static void _but_led_saturation_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button led_saturation pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dial_led_saturation);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
static void _but_led_brightness_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
{
struct eulogium_data *eulogium = data;
Evas_Object *content;
printf("Button led_brightness pressed\n");
- content = eulogium_settings_dial(eulogium->navi, eulogium);
+ content = ui_widget_dial(eulogium->navi, eulogium, &dial_led_brightness);
+ ui_stack_push(eulogium, content, PAGE_PRINTING);
+}
+
+static void _but_bed_heatup_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button bed temperature pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_BED_HEATUP]);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
+static void _but_hotend_heatup_0_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button hotend 1 temperature pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_HOTEND_HEATUP_0]);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
+static void _but_hotend_heatup_1_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button hotend 2 temperature pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_HOTEND_HEATUP_1]);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
+static void _but_print_speed_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button print speed pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_PRINT_SPEED]);
+ ui_stack_push(eulogium, content, PAGE_PRINTING);
+}
+
+static void _but_fan_speed_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button fan speed pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_FAN_SPEED]);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+}
+
+static void _but_flow_rate_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data;
+ Evas_Object *content;
+
+ printf("Button material flow pressed\n");
+ content = ui_widget_dial(eulogium->navi, eulogium, &dials[PROC_FLOW_RATE]);
ui_stack_push(eulogium, content, PAGE_NORMAL);
}
@@ -1735,11 +1944,11 @@ static void _but_network_info_cb(void *data, Evas_Object *obj EINA_UNUSED, void
Evas_Object *content, *_top, *_bottom;
char *buf;
- /* XXX Quick hack to make the adv feature a little more useful, this needs to be made much better! */
+ /* XXX Quick hack to make the adv feature a little more useful, put this in a list? */
_top = elm_box_add(eulogium->navi);
evas_object_show(_top);
- _top = elm_label_add(eulogium->navi); /* TODO, dynamically update IPs */
+ _top = elm_label_add(eulogium->navi); /* TODO, dynamically update IPs, requires 'redrawing' of some sort */
buf = parse_networks_for_display(eulogium->networks);
elm_object_text_set(_top, buf);
free(buf);
@@ -1750,10 +1959,8 @@ static void _but_network_info_cb(void *data, Evas_Object *obj EINA_UNUSED, void
evas_object_smart_callback_add(_bottom, "clicked", but_return.cb.func, but_return.cb.data);
evas_object_show(_bottom);
-// elm_naviframe_item_simple_push(eulogium->navi, box);
content = eulogium_split_screen(eulogium->navi, _top, _bottom);
- if (content)
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_main_mathot_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1764,9 +1971,7 @@ static void _but_main_mathot_cb(void *data, Evas_Object *object EINA_UNUSED, voi
printf("Button matts pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_mathot_material, &but_mathot_hotend, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_material_1_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1777,9 +1982,7 @@ static void _but_settings_material_1_cb(void *data, Evas_Object *object EINA_UNU
printf("Button matts settings 1 pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_material_1);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_material_2_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1790,9 +1993,7 @@ static void _but_settings_material_2_cb(void *data, Evas_Object *object EINA_UNU
printf("Button matts settings 2 pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_material_2);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_material_customize_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1803,9 +2004,7 @@ static void _but_material_customize_cb(void *data, Evas_Object *object EINA_UNUS
printf("Button matts customize pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_material_customize);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_print_tune_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1816,9 +2015,7 @@ static void _but_print_tune_cb(void *data, Evas_Object *object EINA_UNUSED, void
printf("Button print tune pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_print_tune);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_PRINTING);
}
static void _but_change_material_1_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1829,9 +2026,7 @@ static void _but_change_material_1_cb(void *data, Evas_Object *object EINA_UNUSE
printf("Button matts change 1 pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_return, &but_return, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_change_material_2_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1842,9 +2037,7 @@ static void _but_change_material_2_cb(void *data, Evas_Object *object EINA_UNUSE
printf("Button matts change 2 pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_return, &but_return, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_mathot_material_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1855,9 +2048,7 @@ static void _but_mathot_material_cb(void *data, Evas_Object *object EINA_UNUSED,
printf("Button mathot material pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_material_change, &but_material_settings, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_mathot_hotend_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1868,9 +2059,7 @@ static void _but_mathot_hotend_cb(void *data, Evas_Object *object EINA_UNUSED, v
printf("Button mathot hotend pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_hotend_change, &but_hotend_settings, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_hotend_1_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1881,9 +2070,7 @@ static void _but_settings_hotend_1_cb(void *data, Evas_Object *object EINA_UNUSE
printf("Button hotend settings 1 pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_hotend_1_offset);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_settings_hotend_2_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1894,9 +2081,7 @@ static void _but_settings_hotend_2_cb(void *data, Evas_Object *object EINA_UNUSE
printf("Button hotend settings 2 pressed\n");
content = menu_widget_list(eulogium, eulogium->navi, &menu_settings_hotend_1_offset);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_change_hotend_1_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1907,9 +2092,7 @@ static void _but_change_hotend_1_cb(void *data, Evas_Object *object EINA_UNUSED,
printf("Button hotend change 1 pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_return, &but_return, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
static void _but_change_hotend_2_cb(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -1920,9 +2103,7 @@ static void _but_change_hotend_2_cb(void *data, Evas_Object *object EINA_UNUSED,
printf("Button matts change 2 pressed\n");
content = eulogium_tripple_button_menu(eulogium->navi, &but_return, &but_return, &but_return);
- if (!content)
- return;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
}
void eulogium_button_cb_set(struct button_def *button, struct button_cb *cb)
@@ -1961,23 +2142,6 @@ void eulogium_print_data_set(struct eulogium_data *eulogium, char *filepath)
eulogium->print.time = 12;
}
-/* Function to make the Z-axis of any wheel focus the next/previous focusable widget */
-static void _cb_eulogium_input_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Wheel *ev = event_info;
- Ecore_Event *event = NULL;
-
- if (ev->z > 0) {
- elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_NEXT);
- event = ecore_event_add(INPUT_MOUSE_WHEEL_DOWN, NULL, NULL, NULL);
- } else {
- elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_PREVIOUS);
- event = ecore_event_add(INPUT_MOUSE_WHEEL_UP, NULL, NULL, NULL);
- }
- if (!event)
- EINA_LOG_ERR("Wheel event failed to queue.");
-}
-
static void _cb_eulogium_exit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
elm_exit();
@@ -2102,12 +2266,17 @@ static void _on_get_time_ret(void *data, const Eldbus_Message *msg, Eldbus_Pendi
static Eina_Bool _timer_progress_data_update_cb(void *data)
{
struct eulogium_data *eulogium = data;
+ struct print_data *print = eulogium->procedures[PROC_PRINT].meta;
static enum printer_status status = -1;
static double progress = 0;
static double time = -1;
- //eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "getProgress", _on_get_progress_ret, &eulogium->print.progress, 2, "");
- //eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "getTime", _on_get_time_ret, &eulogium->print.time, 2, "");
+ procedure_metadata_get(PROC_PRINT);
+ /* XXX This is an ugly hack that doesn't even work to abort the timer, we need to refactor this into something sensible
+ * Basically we want to stop this time whenever the item gets removed from the stack via the
+ * clean/free callback. */
+ if ((!eulogium->status) && (!eulogium->progress) && (!eulogium->name) && (!eulogium->time))
+ return ECORE_CALLBACK_CANCEL;
if (eulogium->printer.status != status) {
elm_object_text_set(eulogium->status, _(griffin_print_status[eulogium->printer.status]));
@@ -2125,7 +2294,7 @@ static Eina_Bool _timer_progress_data_update_cb(void *data)
}
if (eulogium->print.time != time) {
char buf[255], *str;
- uint_fast32_t time = 0;
+ int_fast32_t time = 0;
if (eulogium->print.time < 1) {
str = "Print time unknown";
@@ -2195,7 +2364,7 @@ static Eina_Bool _timer_print_unblock_cb(void *data)
}
}
-Evas_Object *eulogium_print_ignore(struct eulogium_data *eulogium)
+Evas_Object *eulogium_print_ignore(struct eulogium_data *eulogium) /* TODO pass print_data struct */
{
Evas_Object *_top, *_bottom;
@@ -2238,17 +2407,52 @@ Evas_Object *eulogium_print_ignore(struct eulogium_data *eulogium)
return eulogium_split_screen(eulogium->navi, _top, _bottom);
}
-Evas_Object *eulogium_print_progress(struct eulogium_data *eulogium)
+Evas_Object *eulogium_pre_print(Evas_Object *parent, struct eulogium_data *eulogium)
+{
+ Evas_Object *_top, *_bottom, *obj;
+
+ _top = elm_box_add(parent);
+ evas_object_size_hint_weight_set(_top, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(_top, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_homogeneous_set(_top, EINA_FALSE);
+ evas_object_show(_top);
+
+ obj = elm_label_add(_top);
+ elm_object_text_set(obj, _("Preparing printer ..."));
+ elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_NONE);
+ evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(obj);
+ elm_box_pack_end(_top, obj);
+
+ /* Pulse progress */
+
+ _bottom = eulogium_dual_button_add(eulogium->navi, &but_print_tune, &but_print_abort_confirm);
+ _bottom = elm_button_add(parent);
+ evas_object_size_hint_weight_set(_bottom, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(_bottom, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(_bottom, _(but_print_abort_confirm.text));
+ evas_object_smart_callback_add(_bottom, "clicked", but_print_abort_confirm.cb.func, but_print_abort_confirm.cb.data);
+ evas_object_show(obj);
+ evas_object_show(_bottom);
+
+ return eulogium_split_screen(eulogium->navi, _top, _bottom);
+}
+
+Evas_Object *eulogium_print_progress(Evas_Object *parent, struct eulogium_data *eulogium, const struct print_data *print) /* TODO pass timer var to store timer in */
{
Evas_Object *_top, *_bottom;
+ /* TODO maybe this timer needs to be split into twofold update the widgets locally here,
+ * emit a signal/tell the metadata cb to start gathering meta data */
+ /* this needs to be done, so that we can pass the proper parameters. For now, just hackishly split them.
+ */
eulogium->progress_data_refresh = ecore_timer_add(0.5, _timer_progress_data_update_cb, eulogium);
if (!eulogium->progress_data_refresh) { /* TODO make define for the timeout */
EINA_LOG_CRIT("Unable to create progress update timer");
return NULL;
}
- _top = elm_box_add(eulogium->navi);
+ _top = elm_box_add(parent);
evas_object_size_hint_weight_set(_top, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(_top, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_homogeneous_set(_top, EINA_FALSE);
@@ -2269,7 +2473,7 @@ Evas_Object *eulogium_print_progress(struct eulogium_data *eulogium)
elm_box_pack_end(_top, eulogium->status);
eulogium->name = elm_label_add(_top);
- elm_object_text_set(eulogium->name, eulogium->print.name);
+ elm_object_text_set(eulogium->name, print->jobname);
elm_label_slide_mode_set(eulogium->name, ELM_LABEL_SLIDE_MODE_AUTO);
//elm_label_slide_speed_set(object, 2);
elm_label_slide_go(eulogium->name);
@@ -2282,29 +2486,29 @@ Evas_Object *eulogium_print_progress(struct eulogium_data *eulogium)
elm_progressbar_horizontal_set(eulogium->progress, EINA_TRUE);
elm_progressbar_pulse_set(eulogium->progress, EINA_FALSE); /* TODO: pulse = time-unknown/pause */
elm_progressbar_pulse(eulogium->progress, EINA_FALSE);
- elm_progressbar_value_set(eulogium->progress, eulogium->print.progress);
+ elm_progressbar_value_set(eulogium->progress, print->progress);
elm_progressbar_unit_format_set(eulogium->progress, "%1.1f %%");
evas_object_size_hint_align_set(eulogium->progress, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(eulogium->progress);
elm_box_pack_end(_top, eulogium->progress);
- _bottom = eulogium_dual_button_add(eulogium->navi, &but_print_tune, &but_print_abort_confirm);
+ _bottom = eulogium_dual_button_add(parent, &but_print_tune, &but_print_abort_confirm);
evas_object_show(_bottom);
- return eulogium_split_screen(eulogium->navi, _top, _bottom);
+ return eulogium_split_screen(parent, _top, _bottom);
}
-Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, uint8_t eulogium_error)
+Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, int_fast16_t eulogium_error)
{
Evas_Object *box, *object;
- char buf[] = "Printer error -255.<br>Please contact support via<br>http://ultimaker.com/support.";
+ char buf[] = "Printer error 65536.<br>Please contact support via<br>http://ultimaker.com/support.";
/* TODO, replace with define of strings to collect all strings centrally */
box = elm_box_add(eulogium->navi);
evas_object_show(box);
object = elm_label_add(eulogium->navi);
- snprintf(buf, sizeof(buf), "Printer error %d.<br>Please contact support via<br>http://ultimaker.com/support.", eulogium_error);
+ snprintf(buf, sizeof(buf), "Printer error %d.<br>Please contact support via<br>http://ultimaker.com/support.", (int)eulogium_error);
elm_object_text_set(object, _(buf));
evas_object_show(object);
elm_box_pack_end(box, object);
@@ -2323,33 +2527,15 @@ Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, uint8_t eulo
return box;
}
-static void _on_cleared_printer_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
-{
- const char *errname, *errmsg;
- Eina_Bool cleared_bed = EINA_FALSE;
-
- if (eldbus_message_error_get(msg, &errname, &errmsg)) {
- EINA_LOG_ERR("%s %s", errname, errmsg);
- return;
- }
- if (!eldbus_message_arguments_get(msg, "b", &cleared_bed)) {
- EINA_LOG_ERR("Failed to get bed clear status.");
- return;
- }
- if (cleared_bed == EINA_TRUE)
- EINA_LOG_INFO("Bed has been successfully Cleared");
- else
- EINA_LOG_WARN("Unable to clear printer bed");
-}
-
-static void _cleared_bed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+static void _cleaned_bed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
struct eulogium_data *eulogium = data;
- //eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "clearedPrinter", _on_cleared_printer_ret, eulogium, -1, "");
+ procedure_print_printer_cleaned();
+ _cb_content_prev_set(eulogium, obj, event_info);
}
-Evas_Object *eulogium_clear_print_bed(struct eulogium_data *eulogium)
+Evas_Object *eulogium_clean_print_bed(struct eulogium_data *eulogium)
{
Evas_Object *_top, *_bottom, *obj;
@@ -2363,12 +2549,17 @@ Evas_Object *eulogium_clear_print_bed(struct eulogium_data *eulogium)
_bottom = elm_button_add(eulogium->navi);
elm_object_text_set(_bottom, _("Print removed"));
- evas_object_smart_callback_add(_bottom, "clicked", _cleared_bed_cb, eulogium);
+ evas_object_smart_callback_add(_bottom, "clicked", _cleaned_bed_cb, eulogium);
evas_object_show(_bottom);
return eulogium_split_screen(eulogium->navi, _top, _bottom);
}
+struct _wifilist_data {
+ struct eulogium_data *eulogium;
+ struct network_data *network;
+};
+
struct _filelist_data {
struct eulogium_data *eulogium;
struct dir_entry_def *dir;
@@ -2380,6 +2571,39 @@ struct _filelist_entry_data {
char *filepath;
};
+static void _cb_select_wifi(void *data, Evas_Object *eo EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = ((struct _wifilist_data *)data)->eulogium;
+ Evas_Object *navi = eulogium->navi;
+ const struct network_data *network = ((struct _wifilist_data *)data)->network;
+ Evas_Object *content, *_top, *_bottom, *obj;
+
+ /* TODO replace with generic dialog code */
+ _top = elm_box_add(navi);
+ evas_object_show(_top);
+
+ obj = elm_label_add(_top);
+ elm_object_text_set(obj, _("Attempting to connect to Wifi:"));
+ evas_object_show(obj);
+ elm_box_pack_end(_top, obj);
+
+ obj = elm_label_add(_top);
+ elm_object_text_set(obj, network->ssid);
+ evas_object_show(obj);
+ elm_box_pack_end(_top, obj);
+ /* TODO add animation and 'connection finished' signal handler */
+
+ _bottom = elm_button_add(navi);
+ elm_object_text_set(_bottom, _("Ok"));
+ evas_object_smart_callback_add(_bottom, "clicked", _cb_content_prev_set, eulogium);
+ evas_object_show(_bottom);
+
+ content = eulogium_split_screen(navi, _top, _bottom);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
+
+ network_connect_wifi(network);
+};
+
static void _cb_select_file(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
struct eulogium_data *eulogium = ((struct _filelist_entry_data *)data)->filelist->eulogium;
@@ -2398,8 +2622,12 @@ static void _cb_select_file(void *data, Evas_Object *obj EINA_UNUSED, void *even
strncpy(new_dir->dir.path, filepath, new_dir_len);
menu_widget_list_push(eulogium, new_dir);
} else {
+ Evas_Object *content;
+
eulogium_print_data_set(eulogium, filepath);
- procedure_start_print(eulogium->dbus.proxy[PRINTER], &eulogium->print);
+ procedure_print_start(&eulogium->print);
+ content = eulogium_pre_print(eulogium->navi, eulogium);
+ ui_stack_push(eulogium, content, PAGE_PRINTING);
}
}
}
@@ -2465,10 +2693,10 @@ static void _cb_populate_filelist(const char *name, const char *path, void *data
ext = ecore_file_ext_get(name);
if (!ext)
return;
- if (!filelist->eulogium->printer.file_handlers)
- return;
- for (i = 0; filelist->eulogium->printer.file_handlers[i] != NULL; i++)
- if (strncmp(ext, filelist->eulogium->printer.file_handlers[i], strlen(ext)) == 0)
+// if (!filelist->eulogium->printer.file_handlers)
+// return;
+// for (i = 0; filelist->eulogium->printer.file_handlers[i] != NULL; i++)
+ if (strncmp(ext, /*filelist->eulogium->printer.file_handlers[i] */"gcode", strlen(ext)) == 0)
valid_ext++;
if (!valid_ext)
return;
@@ -2483,7 +2711,7 @@ static void _cb_populate_filelist(const char *name, const char *path, void *data
elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
evas_object_show(icon);
- filelist_entry = malloc(sizeof(struct _filelist_entry_data));
+ filelist_entry = malloc(sizeof(struct _filelist_entry_data)); /* XXX free on destroy */
filelist_entry->filelist = filelist;
filelist_entry->filepath = filepath;
eulogium_item_list_sorted_insert(filelist->list, icon, name, NULL, _cb_select_file, filelist_entry, _cb_dirfile_sort);
@@ -2558,9 +2786,35 @@ static void _set_hotspot_power_cb(void *data, Evas_Object *obj, void *event_info
eldbus_proxy_call(eulogium->dbus.proxy[NETWORK], "setHotspotPower", on_method_generic_ret, NULL, -1, "b", elm_check_state_get(obj));
}
-static void _menu_generate_wifilist(struct eulogium_data *eulogium, Evas_Object *list, struct wifi_def *wifi)
+static void network_wifi_list(struct eulogium_data *eulogium, Evas_Object *list, struct network_data *networks)
{
Evas_Object *icon;
+ uint_fast16_t i = 0;
+
+ if (!networks)
+ return;
+
+
+ icon = elm_icon_add(list);
+ elm_icon_standard_set(icon, "wifi-wpa-icon");
+ evas_object_show(icon);
+ for (i = 0; networks[i].obj_path; i++)
+ if (networks[i].tech == TECH_WIFI) {
+ struct _wifilist_data *wifilist;
+
+ wifilist = malloc(sizeof(struct _wifilist_data)); /* XXX free on destroy */
+ wifilist->eulogium = eulogium;
+ wifilist->network = &networks[i];
+
+ eulogium_item_list_append(list, NULL, networks[i].ssid, NULL, _cb_select_wifi, wifilist);
+ }
+}
+
+static void _menu_generate_wifilist(struct eulogium_data *eulogium, Evas_Object *list, struct network_data *networks)
+{
+ Evas_Object *icon;
+
+ network_wifi_list(eulogium, list, networks);
icon = elm_icon_add(list);
elm_icon_standard_set(icon, "user-home");
@@ -2637,7 +2891,7 @@ Evas_Object *menu_widget_list(struct eulogium_data *eulogium, Evas_Object *paren
if (menu->type == LIST_FILE)
_menu_generate_filelist(eulogium, list, &menu->dir);
if (menu->type == LIST_WIFI)
- _menu_generate_wifilist(eulogium, list, NULL);
+ _menu_generate_wifilist(eulogium, list, eulogium->networks);
eulogium_item_list_go(list);
evas_object_show(list);
elm_box_pack_end(box, list);
@@ -2681,8 +2935,7 @@ static void _eulogium_multi_screen_next_cb(void *data, Evas_Object *obj EINA_UNU
/* XXX what else? */
} else {
content = eulogium_multi_screen_menu(eulogium, eulogium->navi, screen_data, pagenum, pageindex);
- if (content)
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_NORMAL);
/* XXX what else? */
}
free(data);
@@ -2911,82 +3164,6 @@ Evas_Object *eulogium_tripple_button_menu(Evas_Object *parent, const struct butt
return eulogium_split_screen(parent, _top, _bottom);
}
-static Eina_Bool _dial_change_delay(void *data)
-{
- Evas_Object *dial = data;
- Ecore_Timer *delay;
-
- evas_object_data_set(dial, "delay", NULL);
- evas_object_smart_callback_call(dial, "delay,changed", NULL);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_Bool _dial_change(void *data, int type, void *event_info EINA_UNUSED)
-{
- Evas_Object *dial = data;
- Ecore_Timer *delay;
- double value, step;
-
-/* TODO XXX we call this dirty little hack because debian's v1.8 of elm does not offer us to actually call drag,left
- * evas_object_smart_callback_call(dial, "drag,left", NULL); would have been much cleaner and we didn't need to do
- * the val+step get/set thing and thus also benefit from delay,changed which we now 'fake' badly.
- */
- value = elm_slider_value_get(dial);
- step = elm_slider_step_get(dial);
- if (type == INPUT_MOUSE_WHEEL_UP)
- elm_slider_value_set(dial, value + step);
- if (type == INPUT_MOUSE_WHEEL_DOWN)
- elm_slider_value_set(dial, value - step);
- evas_object_smart_callback_call(dial, "changed", NULL);
- delay = evas_object_data_get(dial, "delay");
- ecore_timer_del(delay);
- delay = ecore_timer_add(0.5, _dial_change_delay, dial); /* TODO make define for delay */
- evas_object_data_set(dial, "delay", delay);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void _dial_send_update(void *data, Evas_Object *eo, void *event_info EINA_UNUSED)
-{
- Eldbus_Proxy *proxy = data;
-
- eldbus_proxy_call(proxy, "setBrightness", NULL, NULL, -1, "d", elm_slider_value_get(eo));
-}
-
-Evas_Object *eulogium_settings_dial(Evas_Object *parent, struct eulogium_data *eulogium)
-{
- Evas_Object *_top, *_bottom, *obj;
-
- /* if type is tar/cur do something different TODO */
- _top = elm_slider_add(parent);
- elm_object_text_set(_top, "Brightness:");
- elm_object_focus_allow_set(_top, EINA_FALSE);
- elm_slider_unit_format_set(_top, "%1.0f%");
- elm_slider_min_max_set(_top, 0, 100);
- elm_slider_step_set(_top, 1.0);
- evas_object_size_hint_weight_set(_top, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(_top, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(_top, "delay,changed", _dial_send_update, eulogium->dbus.proxy[LED]);
- eulogium->event_inc = ecore_event_handler_add(INPUT_MOUSE_WHEEL_UP, _dial_change, _top);
- eulogium->event_dec = ecore_event_handler_add(INPUT_MOUSE_WHEEL_DOWN, _dial_change, _top);
- evas_object_show(_top);
-
- obj = elm_label_add(_top);
- elm_object_text_set(obj, "100%");
- evas_object_show(obj);
- elm_object_part_content_set(_top, "end", obj);
-
- _bottom = elm_button_add(parent);
- elm_object_text_set(_bottom, _("Click when done")); /* TODO, make define for this text */
- evas_object_size_hint_weight_set(_bottom, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(_bottom, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(_bottom, "clicked", _cb_content_prev_set, eulogium);
- evas_object_show(_bottom);
-
- return eulogium_split_screen(parent, _top, _bottom);
-}
-
static struct multi_screen screen[] = {
{
.type = NONE,
@@ -3038,55 +3215,24 @@ static struct multi_screen_data screen_data = {
Evas_Object *eulogium_main_menu(Evas_Object *window, struct eulogium_data *eulogium)
{
Evas_Object *content;
+ Elm_Object_Item *navi_item;
eulogium->navi = elm_naviframe_add(window);
if (!eulogium->navi)
return NULL;
- elm_naviframe_prev_btn_auto_pushed_set(eulogium->navi, EINA_FALSE); /* We removed this from the theme, enabling it causes errors */
+ /* We removed the prev button from the theme, enabling it causes errors */
+ elm_naviframe_prev_btn_auto_pushed_set(eulogium->navi, EINA_FALSE);
+ /* Except the first frame, never safe any frames after pop */
+ elm_naviframe_content_preserve_on_pop_set(eulogium->navi, EINA_FALSE);
+ /* The main menu should be drawn first, consider changing this to 'get bottom, insert before bottom, pop_to
+ * instead of assuming the stack is empty */
content = eulogium_tripple_button_menu(eulogium->navi, &but_main_print, &but_main_mathot, &but_main_system);
- if (!content)
- return NULL;
- elm_naviframe_item_simple_push(eulogium->navi, content);
+ ui_stack_push(eulogium, content, PAGE_BOTTOM);
return eulogium->navi;
}
-static void eulogium_setup(struct eulogium_data *eulogium)
-{
- while (screen_data.screen[screen_data.count].type != END)
- screen_data.count++;
-
- /* This is silly, barding redonkylous and will get fixed in the refactoring */
- eulogium->procedures = procedures_init();
- eulogium_button_cb_data_set(&but_return, eulogium);
- eulogium_button_cb_data_set(&but_print_abort_confirm, eulogium);
- eulogium_button_cb_data_set(&but_print_abort, eulogium);
- eulogium_button_cb_data_set(&but_print_tune, eulogium);
- eulogium_button_cb_data_set(&but_main_print, eulogium);
- eulogium_button_cb_data_set(&but_print_ignore, eulogium);
- eulogium_button_cb_data_set(&but_print_local, eulogium);
- eulogium_button_cb_data_set(&but_print_usb, eulogium);
- eulogium_button_cb_data_set(&but_main_mathot, eulogium);
- eulogium_button_cb_data_set(&but_main_system, eulogium);
- eulogium_button_cb_data_set(&but_system_maintenance, eulogium);
- eulogium_button_cb_data_set(&but_system_settings, eulogium);
- eulogium_button_cb_data_set(&but_material_change, eulogium);
- eulogium_button_cb_data_set(&but_material_settings, eulogium);
- eulogium_button_cb_data_set(&but_settings_material_1, eulogium);
- eulogium_button_cb_data_set(&but_settings_material_2, eulogium);
- eulogium_button_cb_data_set(&but_change_material_1, eulogium);
- eulogium_button_cb_data_set(&but_change_material_2, eulogium);
- eulogium_button_cb_data_set(&but_mathot_material, eulogium);
- eulogium_button_cb_data_set(&but_mathot_hotend, eulogium);
- eulogium_button_cb_data_set(&but_hotend_change, eulogium);
- eulogium_button_cb_data_set(&but_hotend_settings, eulogium);
- eulogium_button_cb_data_set(&but_settings_hotend_1, eulogium);
- eulogium_button_cb_data_set(&but_settings_hotend_2, eulogium);
- eulogium_button_cb_data_set(&but_change_hotend_1, eulogium);
- eulogium_button_cb_data_set(&but_change_hotend_2, eulogium);
-}
-
static void _on_get_print_name_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
struct eulogium_data *eulogium = data;
@@ -3105,11 +3251,12 @@ static void _on_get_print_name_ret(void *data, const Eldbus_Message *msg, Eldbus
/* TODO Call generic error screen in case of trouble here? */
}
+#if 0
static void eulogium_printer_status_set(struct eulogium_data *eulogium, struct _status_msg *status)
{
Evas_Object *content = NULL;
- EINA_LOG_WARN("Printer status: %s", status->s);
+ EINA_LOG_ERR("Printer status: %s", status->s);
if (eulogium->printer.status != status->i) {
switch (status->i) {
@@ -3180,6 +3327,7 @@ static void eulogium_printer_status_set(struct eulogium_data *eulogium, struct _
eulogium->printer.status = status->i;
}
}
+#endif
static void _on_get_file_handlers_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
@@ -3212,7 +3360,7 @@ static void _on_get_file_handlers_ret(void *data, const Eldbus_Message *msg, Eld
strncpy(file_handlers[i], file_handler, fhandler_size);
}
file_handlers[i] = NULL; /* sentinel */
- eulogium->printer.file_handlers = file_handlers;
+ eulogium->printer.file_handlers = file_handlers; /* TODO do directly, only pass **file_handlers as data */
}
static void _on_status_changed_ret(void *data, const Eldbus_Message *msg)
@@ -3220,6 +3368,7 @@ static void _on_status_changed_ret(void *data, const Eldbus_Message *msg)
_on_get_status_ret(data, msg, NULL);
}
+/* XXX TODO: this is being called somewhere where it shouldn't, making only hotplug usb events work */
static void eulogium_disk_free(struct mount_data *mount)
{
eeze_disk_free(mount->disk);
@@ -3253,10 +3402,10 @@ static void _on_where_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending
return;
/* Never use a medium that is mounted under dev, proc, run or sys. */
- if (!(strncmp(where, "/dev/", 5) &&
- strncmp(where, "/proc/", 6) &&
- strncmp(where, "/run/", 5) &&
- strncmp(where, "/sys/", 5)))
+ if (!(strncmp(where, "/dev/", sizeof("/dev/") - 1) &&
+ strncmp(where, "/proc/", sizeof("/proc/") - 1) &&
+ strncmp(where, "/run/", sizeof("/run/") - 1) &&
+ strncmp(where, "/sys/", sizeof("/sys/") - 1)))
return;
mount->disk = eeze_disk_new_from_mount(where);
@@ -3316,7 +3465,7 @@ static void _on_unit_new_ret(void *data, const Eldbus_Message *msg)
return;
}
ext = ecore_file_ext_get(id);
- if (strncmp(ext, "mount", 5))
+ if (strcmp(ext, "mount"))
return;
obj = eldbus_object_get(eulogium->dbus.conn, "org.freedesktop.systemd1", unit);
@@ -3432,7 +3581,7 @@ static void _on_unit_removed_ret(void *data, const Eldbus_Message *msg)
return;
}
ext = ecore_file_ext_get(id);
- if (strncmp(ext, "mount", 5))
+ if (strcmp(ext, "mount"))
return;
obj = eldbus_object_get(eulogium->dbus.conn, "org.freedesktop.systemd1", unit);
@@ -3472,8 +3621,8 @@ static void _on_get_available_procedures_ret(void *data, const Eldbus_Message *m
if (eldbus_message_iter_arguments_get(avail_proc_struct, "sb", &key, &executable)) {
uint_fast16_t i;
- for (i = 0; eulogium->procedures[i].key ; i++) {
- if (strncmp(key, eulogium->procedures[i].key, eulogium->procedures[i].keylen)) {
+ for (i = 0; eulogium->procedures[i].key ; i++) { /* XXX use enum/null rather then i to iterate over array */
+ if (strcmp(key, eulogium->procedures[i].key)) {
eulogium->procedures[i].executable = executable;
eulogium->procedures[i].available = EINA_TRUE;
} else {
@@ -3496,28 +3645,36 @@ static void _on_get_active_procedures_ret(void *data, const Eldbus_Message *msg,
return;
}
if (!eldbus_message_arguments_get(msg, "a(ss)", &array)) {
- EINA_LOG_ERR("Message content does not match expected \"a(ss)\" signature.");
+ EINA_LOG_ERR("Message content does not match expected \"a(ss)\" signature."); /* TODO make macro/function of this as we re-use it often */
return;
}
while (eldbus_message_iter_get_and_next(array, 'r', &act_proc_struct)) {
if (eldbus_message_iter_arguments_get(act_proc_struct, "ss", &key, &step)) {
- uint_fast16_t i;
+ struct procedure_data *procedure;
- for (i = 0; eulogium->procedures[i].key ; i++) {
- if (strncmp(key, eulogium->procedures[i].key, eulogium->procedures[i].keylen)) {
- printf("Step: %s\n", step);
- } else {
- EINA_LOG_WARN("Procedure not found: '%s'", key);
- }
+ EINA_LOG_ERR("Key '%s' step '%s'", key, step);
+ procedure = procedure_get(key);
+ if (!procedure) {
+ EINA_LOG_ERR("Unknown procedure %s", key);
+ return;
+ }
+ procedure->status = PROC_ACTIVE;
+ procedure->step_active = procedure_step_get(procedure, step);
+
+ if (!procedure->step_active) {
+ EINA_LOG_ERR("Unknown step %s in procedure %s", step, key);
+ return;
}
+ procedure_process_step(data, procedure);
}
}
}
-static void _on_procedure_start_ret(void *data EINA_UNUSED, const Eldbus_Message *msg)
+static void _on_procedure_start_ret(void *data, const Eldbus_Message *msg)
{
const char *errname, *errmsg;
const char *key, *step;
+ struct procedure_data *procedure;
if (eldbus_message_error_get(msg, &errname, &errmsg)) {
EINA_LOG_ERR("%s %s", errname, errmsg);
@@ -3527,13 +3684,28 @@ static void _on_procedure_start_ret(void *data EINA_UNUSED, const Eldbus_Message
EINA_LOG_ERR("Message content does not match expected \"ss\" signature. (%s)", eldbus_message_signature_get(msg));
return;
}
- EINA_LOG_ERR("Key '%s' step %s", key, step);
+ EINA_LOG_ERR("Key '%s' step '%s'", key, step);
+ procedure = procedure_get(key);
+ if (!procedure) {
+ EINA_LOG_ERR("Unknown procedure %s", key);
+ return;
+ }
+ procedure->status = PROC_ACTIVE;
+ procedure->step_active = procedure_step_get(procedure, step);
+
+ if (!procedure->step_active) {
+ EINA_LOG_ERR("Unknown step %s in procedure %s", step, key);
+ return;
+ }
+ procedure_process_step(data, procedure);
}
static void _on_procedure_next_step_ret(void *data EINA_UNUSED, const Eldbus_Message *msg)
{
+ struct eulogium_data *eulogium = data;
const char *errname, *errmsg;
const char *key, *step;
+ struct procedure_data *procedure;
if (eldbus_message_error_get(msg, &errname, &errmsg)) {
EINA_LOG_ERR("%s %s", errname, errmsg);
@@ -3543,13 +3715,25 @@ static void _on_procedure_next_step_ret(void *data EINA_UNUSED, const Eldbus_Mes
EINA_LOG_ERR("Message content does not match expected \"ss\" signature. (%s)", eldbus_message_signature_get(msg));
return;
}
- EINA_LOG_ERR("next: Key '%s' step %s", key, step);
+ EINA_LOG_ERR("next: Key '%s' step '%s'", key, step);
+ procedure = procedure_get(key);
+ if (!procedure) {
+ EINA_LOG_WARN("Unknown procedure, %s.", key);
+ return;
+ }
+ procedure->step_active = procedure_step_get(procedure, step);
+ if (!procedure->step_active) {
+ EINA_LOG_ERR("Unknown step %s in procedure %s", step, key);
+ return;
+ }
+ procedure_process_step(data, procedure);
}
static void _on_procedure_finished_ret(void *data EINA_UNUSED, const Eldbus_Message *msg)
{
const char *errname, *errmsg;
const char *key;
+ struct procedure_data *procedure;
if (eldbus_message_error_get(msg, &errname, &errmsg)) {
EINA_LOG_ERR("%s %s", errname, errmsg);
@@ -3560,6 +3744,14 @@ static void _on_procedure_finished_ret(void *data EINA_UNUSED, const Eldbus_Mess
return;
}
EINA_LOG_ERR("finshed Key '%s'", key);
+ procedure = procedure_get(key);
+ if (!procedure) {
+ EINA_LOG_ERR("Unknown procedure %s", key);
+ return;
+ }
+ procedure->status = PROC_FINISHED;
+ procedure->step_active = NULL;
+ procedure_process_step(data, procedure);
}
static void _on_get_error_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
@@ -3598,6 +3790,7 @@ static uint_fast16_t _dbus_members_map(Eldbus_Proxy *proxy, struct menu_entry_de
return i;
}
+/* move this to dbus_common */
static int eulogium_dbus_init(struct eulogium_data *eulogium)
{
Eldbus_Object *obj;
@@ -3657,6 +3850,36 @@ static int eulogium_dbus_init(struct eulogium_data *eulogium)
EINA_LOG_WARN("Could not get dbus network proxy.");
return -EFAULT;
}
+
+ /* Find a nice home for these */
+ eldbus_proxy_signal_handler_add(proxy, "UnitNew", _on_unit_new_ret, eulogium);
+ eldbus_proxy_signal_handler_add(proxy, "UnitRemoved", _on_unit_removed_ret, eulogium);
+ msg = eldbus_proxy_method_call_new(proxy, "ListUnitsFiltered");
+ iter = eldbus_message_iter_get(msg);
+ array = eldbus_message_iter_container_new(iter, 'a', "s");
+ if (!array)
+ EINA_LOG_ERR("Empty container");
+ eldbus_message_iter_basic_append(array, 's', "mounted");
+ eldbus_message_iter_container_close(iter, array);
+ eldbus_proxy_send(proxy, msg, _on_list_units_ret, eulogium, -1);
+ /* eldbus_proxy_call(proxy, "ListUnitsFiltered", _on_list_units_ret, eulogium, -1, "as", "{mounted}"); */
+
+ return 0;
+}
+
+static void eulogium_setup(struct eulogium_data *eulogium)
+{
+ struct print_data *print;
+
+ while (screen_data.screen[screen_data.count].type != END)
+ screen_data.count++;
+
+ /* This is silly, barding redonkylous and will get fixed in the refactoring */
+ if (eulogium_dbus_init(eulogium))
+ EINA_LOG_CRIT("Griffin D-Bus initialization failed!");
+ eulogium->procedures = procedures_init(eulogium->dbus.proxy[PRINTER]);
+ network_init(eulogium->dbus.proxy[NETWORK]);
+
_dbus_members_map(eulogium->dbus.proxy[NETWORK], menu_settings_network.entry);
/* TODO: put signal/method name strings in macro/LUT */
eldbus_proxy_call(eulogium->dbus.proxy[NETWORK], "getNetworkInfo", on_method_get_network_info_ret, eulogium, -1, "");
@@ -3673,25 +3896,50 @@ static int eulogium_dbus_init(struct eulogium_data *eulogium)
//eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "getStatus", _on_get_status_ret, eulogium, -1, "");
//eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "getPrintName", _on_get_print_name_ret, eulogium, -1, "");
//eldbus_proxy_signal_handler_add(eulogium->dbus.proxy[PRINTER], "statusChanged", _on_status_changed_ret, eulogium);
+ eldbus_proxy_call(eulogium->dbus.proxy[PRINTER], "getProcedureMetaData", on_method_get_procedure_metadata_ret, &eulogium->procedures[PROC_PRINT], -1, "s", eulogium->procedures[PROC_PRINT].key);
- eldbus_proxy_signal_handler_add(proxy, "UnitNew", _on_unit_new_ret, eulogium);
- eldbus_proxy_signal_handler_add(proxy, "UnitRemoved", _on_unit_removed_ret, eulogium);
- msg = eldbus_proxy_method_call_new(proxy, "ListUnitsFiltered");
- iter = eldbus_message_iter_get(msg);
- array = eldbus_message_iter_container_new(iter, 'a', "s");
- if (!array)
- EINA_LOG_ERR("Empty container");
- eldbus_message_iter_basic_append(array, 's', "mounted");
- eldbus_message_iter_container_close(iter, array);
- eldbus_proxy_send(proxy, msg, _on_list_units_ret, eulogium, -1);
- /* eldbus_proxy_call(proxy, "ListUnitsFiltered", _on_list_units_ret, eulogium, -1, "as", "{mounted}"); */
+ eulogium_button_cb_data_set(&but_return, eulogium);
+ eulogium_button_cb_data_set(&but_print_abort_confirm, eulogium);
+ eulogium_button_cb_data_set(&but_print_abort, eulogium);
+ eulogium_button_cb_data_set(&but_print_tune, eulogium);
+ eulogium_button_cb_data_set(&but_main_print, eulogium);
+ eulogium_button_cb_data_set(&but_print_ignore, eulogium);
+ eulogium_button_cb_data_set(&but_print_local, eulogium);
+ eulogium_button_cb_data_set(&but_print_usb, eulogium);
+ eulogium_button_cb_data_set(&but_main_mathot, eulogium);
+ eulogium_button_cb_data_set(&but_main_system, eulogium);
+ eulogium_button_cb_data_set(&but_system_maintenance, eulogium);
+ eulogium_button_cb_data_set(&but_system_settings, eulogium);
+ eulogium_button_cb_data_set(&but_material_change, eulogium);
+ eulogium_button_cb_data_set(&but_material_settings, eulogium);
+ eulogium_button_cb_data_set(&but_settings_material_1, eulogium);
+ eulogium_button_cb_data_set(&but_settings_material_2, eulogium);
+ eulogium_button_cb_data_set(&but_change_material_1, eulogium);
+ eulogium_button_cb_data_set(&but_change_material_2, eulogium);
+ eulogium_button_cb_data_set(&but_mathot_material, eulogium);
+ eulogium_button_cb_data_set(&but_mathot_hotend, eulogium);
+ eulogium_button_cb_data_set(&but_hotend_change, eulogium);
+ eulogium_button_cb_data_set(&but_hotend_settings, eulogium);
+ eulogium_button_cb_data_set(&but_settings_hotend_1, eulogium);
+ eulogium_button_cb_data_set(&but_settings_hotend_2, eulogium);
+ eulogium_button_cb_data_set(&but_change_hotend_1, eulogium);
+ eulogium_button_cb_data_set(&but_change_hotend_2, eulogium);
- return 0;
+ print = malloc(sizeof(struct print_data)); /* TODO this needs a better place, together with dials */
+ procedure_meta_set(&eulogium->procedures[PROC_PRINT], print);
+ procedure_meta_set(&eulogium->procedures[PROC_BED_HEATUP], &dials[PROC_BED_HEATUP]);
+ procedure_meta_set(&eulogium->procedures[PROC_HOTEND_HEATUP_0], &dials[PROC_HOTEND_HEATUP_0]);
+ procedure_meta_set(&eulogium->procedures[PROC_HOTEND_HEATUP_1], &dials[PROC_HOTEND_HEATUP_1]);
+ procedure_meta_set(&eulogium->procedures[PROC_PRINT_SPEED], &dials[PROC_PRINT_SPEED]);
+ procedure_meta_set(&eulogium->procedures[PROC_FAN_SPEED], &dials[PROC_FAN_SPEED]);
+ procedure_meta_set(&eulogium->procedures[PROC_FLOW_RATE], &dials[PROC_FLOW_RATE]);
+ procedure_meta_getall();
}
EAPI_MAIN int elm_main(int argc, char **argv)
{
Eina_Bool quit_option = EINA_FALSE;
+ Eina_Bool verbose = EINA_FALSE;
static const Ecore_Getopt optdesc = {
PACKAGE_NAME,
"%prog [options]",
@@ -3701,6 +3949,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
"eulogium program",
0,
{
+ ECORE_GETOPT_STORE_TRUE('v', "verbose", "Enable debug output"),
ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_VERSION('V', "version"),
@@ -3709,6 +3958,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
}
};
Ecore_Getopt_Value values[] = {
+ ECORE_GETOPT_VALUE_BOOL(verbose),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
@@ -3720,6 +3970,8 @@ EAPI_MAIN int elm_main(int argc, char **argv)
struct eulogium_data eulogium = {
.mounts = NULL,
.progress_data_refresh = NULL,
+ .event_inc = NULL,
+ .event_dec = NULL,
.print = {
.name = NULL,
.url = NULL,
@@ -3730,26 +3982,30 @@ EAPI_MAIN int elm_main(int argc, char **argv)
.status = DISCONNECTED,
.file_handlers = NULL,
},
+ .networks = NULL,
.footer = NULL,
};
Evas_Object *window, *object;
// Evas_Object *splash_window;
// Eina_List *engines, *l;
- eeze_init();
- eeze_disk_function();
- if (!(eeze_disk_can_mount() && eeze_disk_can_unmount()))
- EINA_LOG_ERR("No disk (u)mount support available");
- elm_need_eldbus();
-
args = ecore_getopt_parse(&optdesc, values, argc, argv);
if (args < 0) {
EINA_LOG_CRIT("Could not parse arguments.");
return EXIT_FAILURE;
}
- INPUT_MOUSE_WHEEL_UP = ecore_event_type_new();
- INPUT_MOUSE_WHEEL_DOWN = ecore_event_type_new();
+ /* TODO: Fix logging domain stuff */
+ if (verbose)
+ eina_log_domain_level_set(PACKAGE_NAME, EINA_LOG_LEVEL_DBG);
+ else
+ eina_log_domain_level_set(PACKAGE_NAME, EINA_LOG_LEVEL_INFO);
+
+ eeze_init();
+ eeze_disk_function();
+ elm_need_eldbus();
+
+ input_init();
// elm_prefs_data_new(); /* TODO */
elm_policy_set(ELM_POLICY_QUIT, /* ELM_POLICY_QUIT_NONE */ ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -3769,7 +4025,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 10)
elm_config_accel_preference_set("accel");
#endif
- elm_theme_overlay_add(NULL, "./default.edj");
+ elm_theme_overlay_add(NULL, "/usr/local/share/eulogium/default.edj");
#if 0 /* TODO make icon */
icon = evas_object_image_add(evas_object_evas_get(win));
@@ -3781,9 +4037,6 @@ EAPI_MAIN int elm_main(int argc, char **argv)
elm_config_focus_highlight_animate_set(EINA_FALSE);
elm_config_softcursor_mode_set(ELM_SOFTCURSOR_MODE_OFF);
- if (eulogium_dbus_init(&eulogium))
- EINA_LOG_CRIT("Griffin D-Bus initialization failed!");
-
/* TODO: move into its own init */
window = elm_win_add(NULL, PACKAGE_NAME, ELM_WIN_BASIC);
if (!window)
@@ -3821,7 +4074,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
evas_object_size_hint_weight_set(object, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_color_set(object, 0, 0, 0, 0);
evas_object_repeat_events_set(object, EINA_TRUE);
- evas_object_event_callback_add(object, EVAS_CALLBACK_MOUSE_WHEEL, _cb_eulogium_input_wheel, window); /* TODO elm_obj_ev? event propagation issues? */
+ evas_object_event_callback_add(object, EVAS_CALLBACK_MOUSE_WHEEL, input_mouse_wheel_cb, window); /* TODO elm_obj_ev? event propagation issues? */
/* TODO: don't these two input events repeat/fall through, everything else, may/should. */
evas_object_show(object);
elm_win_resize_object_add(window, object);
@@ -3838,6 +4091,8 @@ EAPI_MAIN int elm_main(int argc, char **argv)
free(eulogium.printer.file_handlers[i]);
free(eulogium.printer.file_handlers); /* TODO: Cleanup function? */
+ procedures_shutdown();
+
elm_shutdown();
eeze_shutdown();
diff --git a/src/eulogium.h b/src/eulogium.h
index ea16cbd..6842250 100644
--- a/src/eulogium.h
+++ b/src/eulogium.h
@@ -16,11 +16,10 @@
#include <stdint.h>
#include "eulogium_item_list.h"
+#include "network.h"
+#include "print_data.h"
#include "procedures.h"
-
-#define IPV4_MAX_LEN 16 /* 255.255.255.255\0 */
-#define IPV6_MAX_LEN 40 /* ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff\0 */
-#define SSID_MAX_LEN 33 /* Section 7.3.2.1 SSID element of IEE802.11-2007 + \0 */
+#include "settings_data.h"
#include "ui_widgets.h"
enum screen_type {
@@ -61,22 +60,6 @@ struct mount_data {
Eina_List **mounts;
};
-#define _TECH_ETHERNET "ethernet"
-#define _TECH_WIFI "wifi"
-
-enum network_tech {
- ETHERNET,
- WIFI,
-};
-
-struct network_data {
- char *obj_path;
- enum network_tech tech;
- char ipv4[IPV4_MAX_LEN];
- char ipv6[IPV6_MAX_LEN];
- char ssid[SSID_MAX_LEN];
-};
-
struct eulogium_data {
Evas_Object *navi;
Evas_Object *time;
@@ -85,6 +68,8 @@ struct eulogium_data {
Evas_Object *progress;
Ecore_Timer *progress_data_refresh;
Evas_Object *footer; /* XXX this really shows why we need per window persistent data */
+ Ecore_Event_Handler *event_inc; /* TODO put in seperate event struct and generally find a better place (seperate file etc) */
+ Ecore_Event_Handler *event_dec;
struct printer_data printer;
struct print_data print;
struct dbus_data dbus;
@@ -115,7 +100,7 @@ struct multi_screen_data {
struct multi_screen *screen;
};
-Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, uint8_t eulogium_error);
+Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, int_fast16_t eulogium_error);
void eulogium_print_data_set(struct eulogium_data *eulogium, char *filepath);
@@ -125,10 +110,14 @@ Evas_Object *eulogium_tripple_button_menu(Evas_Object *parent, const struct butt
Evas_Object *eulogium_dual_button_add(Evas_Object *parent, const struct button_def *left, const struct button_def *right);
Evas_Object *eulogium_print_menu(struct eulogium_data *eulogium, char *filepath);
Evas_Object *eulogium_print_ignore(struct eulogium_data *eulogium);
-Evas_Object *eulogium_print_progress(struct eulogium_data *eulogium);
+Evas_Object *eulogium_print_progress(Evas_Object *parent, struct eulogium_data *eulogium, const struct print_data *print);
+Evas_Object *eulogium_pre_print(Evas_Object *parent, struct eulogium_data *eulogium);
+Evas_Object *eulogium_settings_dial(Evas_Object *parent, struct eulogium_data *eulogium, struct settings_dial_data *dial_data);
Evas_Object *eulogium_multi_text_menu(struct eulogium_data *eulogium, Evas_Object *parent, struct button_def *button, struct multi_text *data, const uint_fast8_t pagenum, Eina_Bool pageindex);
Evas_Object *menu_widget_list(struct eulogium_data *eulogium, Evas_Object *parent, struct menu_def *menu);
Evas_Object *eulogium_multi_screen_menu(struct eulogium_data *eulogium, Evas_Object *parent, struct multi_screen_data *screen_data, const uint_fast8_t pagenum, Eina_Bool pageindex);
Evas_Object *eulogium_menu_confirm(Evas_Object *parent, const char *msg, const char *prev, const struct button_def *next);
+Evas_Object *eulogium_clean_print_bed(struct eulogium_data *eulogium);
+void eulogium_print_data_clear(struct eulogium_data *eulogium);
#endif /* _EULOGIUM_H */
diff --git a/src/eulogium_private.h b/src/eulogium_private.h
index 3735b70..d5fd2a2 100644
--- a/src/eulogium_private.h
+++ b/src/eulogium_private.h
@@ -1,5 +1,5 @@
/*
- * eulogium_private, some common private helpers
+ * eulogium_private, some common private helpers XXX Rename to something more appropiate
*
* Copyright (c) 2015 Ultimaker B.V.
* Author: Olliver Schinagl <o.schinagl@ultimaker.com>
@@ -16,6 +16,7 @@
#if HAVE_GETTEXT && ENABLE_NLS
#define _(string) gettext(string)
+#define N_(string) gettext_noop(string)
#else
#define _(string) (string)
#endif
diff --git a/src/network.c b/src/network.c
new file mode 100644
index 0000000..20f3aae
--- /dev/null
+++ b/src/network.c
@@ -0,0 +1,38 @@
+/*
+ * functions and data types for networking calls
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Eldbus.h>
+
+#include "dbus_common.h"
+#include "network.h"
+
+#define _TECH_ETHERNET "ethernet"
+#define _TECH_WIFI "wifi"
+
+static Eldbus_Proxy *__proxy;
+
+Eldbus_Pending *network_connect_wifi(const struct network_data *network)
+{
+ if (!network)
+ return NULL;
+ if (!network->obj_path)
+ return NULL;
+
+ return eldbus_proxy_call(__proxy, "connectWifiNetwork", on_method_generic_bool_ret, "connectWifiNetwork", -1, "o", network->obj_path);
+}
+
+void network_init(Eldbus_Proxy *proxy)
+{
+ __proxy = proxy;
+};
+
+void network_shutdown(void)
+{
+ eldbus_proxy_unref(__proxy);
+};
diff --git a/src/network.h b/src/network.h
new file mode 100644
index 0000000..db95412
--- /dev/null
+++ b/src/network.h
@@ -0,0 +1,39 @@
+/*
+ * functions and data types for networking calls
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#ifndef _NETWORK_H
+#define _NETWORK_H
+
+#include <Eina.h>
+#include <Eldbus.h>
+#include <stdint.h>
+
+#define IPV4_MAX_LEN 16 /* 255.255.255.255\0 */
+#define IPV6_MAX_LEN 40 /* ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff\0 */
+#define SSID_MAX_LEN 33 /* Section 7.3.2.1 SSID element of IEE802.11-2007 + \0 */
+
+enum network_tech {
+ TECH_UNKNOWN,
+ TECH_ETHERNET,
+ TECH_WIFI,
+};
+
+struct network_data {
+ char *obj_path;
+ enum network_tech tech;
+ char ipv4[IPV4_MAX_LEN];
+ char ipv6[IPV6_MAX_LEN];
+ char ssid[SSID_MAX_LEN];
+};
+
+Eldbus_Pending *network_connect_wifi(const struct network_data *network);
+void network_init(Eldbus_Proxy *proxy);
+void network_shutdown(void);
+
+#endif /* _NETWORK_H */
diff --git a/src/print_data.c b/src/print_data.c
new file mode 100644
index 0000000..3416995
--- /dev/null
+++ b/src/print_data.c
@@ -0,0 +1,23 @@
+/*
+ * function and data types for print information
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Eina.h>
+
+#include "print_data.h"
+
+void print_clear(struct print_data *print)
+{
+ print->jobname_changed = EINA_FALSE;
+ free(print->jobname);
+ print->jobname = NULL;
+
+ print->time = 0;
+ print->total_time = 0;
+ print->progress = 0.0;
+}
diff --git a/src/print_data.h b/src/print_data.h
index adebb20..b3c5d7f 100644
--- a/src/print_data.h
+++ b/src/print_data.h
@@ -11,18 +11,29 @@
#define _PRINT_DATA_H
#include <Eina.h>
+#include <Eldbus.h>
#include <stdint.h>
+#include "procedures.h"
+#include "settings_data.h"
+#include "ui_widgets.h"
+
struct print_data {
- uint_fast32_t time;
- double progress;
+ char *jobname;
char *url;
- char *name;
- Eina_Bool name_changed;
+ int_fast32_t time;
+ int_fast32_t total_time;
+ double progress;
+ char *name; /* TODO deletion pending */
char *flags;
double material;
+ Eina_Bool name_changed;
+ Eina_Bool jobname_changed;
Eina_Bool block;
Eina_Bool block_active;
+ Eldbus_Pending *(*method_set)(struct settings_dial_data *dial_data);
+ Eldbus_Pending *(*method_get)(struct procedure_data *procedure);
+ enum procedure_key proc_key;
};
enum printer_status {
@@ -39,4 +50,6 @@ enum printer_status {
PAUSED,
};
+void print_clear(struct print_data *print);
+
#endif /* _PRINT_DATA_H */
diff --git a/src/procedures.c b/src/procedures.c
index be3ab5e..13ca6f3 100644
--- a/src/procedures.c
+++ b/src/procedures.c
@@ -1,4 +1,5 @@
/*
+ * TODO: rename this to dbus_procedures.c
* eulogium_procedures, available procedures
*
* Copyright (c) 2015 Ultimaker B.V.
@@ -11,57 +12,174 @@
#include <Eldbus.h>
#include <stdint.h>
-#include "procedures.h"
-
#include "dbus_common.h"
+#include "eulogium.h"
#include "print_data.h"
+#include "procedures.h"
+#include "settings_data.h"
+#include "ui_widgets.h"
#define _PROC_PRINT "PRINT"
-#define _PROC_HEATUP_HOTEND "HEATUP_HOTEND"
+#define _META_PRINT_JOBNAME "jobname"
+#define _META_PRINT_JOBNAME_TYPE VALUE_STR
+#define _META_PRINT_TIME "time"
+#define _META_PRINT_TIME_TYPE VALUE_DOUBLE
+#define _META_PRINT_TIME_TOTAL "time_total"
+#define _META_PRINT_TIME_TOTAL_TYPE VALUE_DOUBLE
+#define _META_PRINT_PROGRESS "progress"
+#define _META_PRINT_PROGRESS_TYPE VALUE_DOUBLE
+
#define _PROC_POST_PRINT "POST_PRINT"
#define _PROC_PRE_PRINT_SETUP "PRE_PRINT_SETUP"
+#define _PROC_RUN_PRE_PRINT_SETUP "RUN_PRE_PRINT_SETUP"
+#define _PROC_WAIT_FOR_CLEANUP "WAIT_FOR_CLEANUP"
+
+#define _PROC_BED_HEATUP "HEATUP_BED"
+#define _PROC_HOTEND_HEATUP_0 "HEATUP_HOTEND_0"
+#define _PROC_HOTEND_HEATUP_1 "HEATUP_HOTEND_1"
+#define _PROC_PRINT_SPEED "PRINT_SPEED"
+#define _PROC_FAN_SPEED "FAN_SPEED"
+#define _PROC_FLOW_RATE "MATERIAL_FLOW"
+#define _META_CURRENT "current"
+#define _META_TARGET "target"
+
+#define _STEP_PRINTING "PRINTING"
+#define _STEP_PRINT_SPEEDING "PRINT_SPEEDING"
+#define _STEP_HOTEND_HEATING "HOTEND_HEATING"
+#define _STEP_BED_HEATING "BED_HEATING"
+#define _STEP_FAN_SPEEDING "FAN_SPEEDING"
+#define _STEP_MATERIAL_FLOWING "MATERIAL_FLOWING"
+#define _STEP_HOTEND_HOMEING "HOTEND_HOMEING"
+#define _STEP_BED_HOMEING "HOTEND_HOMEING"
-void _container_basic_variant(Eldbus_Message_Iter *parent, const char type, void *data)
+#define _PROC_MSG_PRINTER_CLEANED "PRINTER_CLEANED"
+
+static Eldbus_Proxy *__proxy = NULL;
+
+static void _container_basic_variant(Eldbus_Message_Iter *parent, int type, ...)
{
Eldbus_Message_Iter *child;
+ va_list value;
char sig[2] = { '\0' };
sig[0] = type;
child = eldbus_message_iter_container_new(parent, 'v', sig);
- eldbus_message_iter_basic_append(child, type, data);
+ va_start(value, type);
+ eldbus_message_iter_arguments_vappend(child, sig, value);
+ va_end(value);
eldbus_message_iter_container_close(parent, child);
}
-static struct procedure_data procedures[] = {
- {
- .key = _PROC_PRINT,
- .keylen = sizeof(_PROC_PRINT),
- .executable = EINA_FALSE,
- .available = EINA_FALSE,
- }, {
- .key = _PROC_HEATUP_HOTEND,
- .keylen = sizeof(_PROC_HEATUP_HOTEND),
- .executable = EINA_FALSE,
- .available = EINA_FALSE,
- }, {
- .key = _PROC_POST_PRINT,
- .keylen = sizeof(_PROC_POST_PRINT),
- .executable = EINA_FALSE,
- .available = EINA_FALSE,
- }, {
- .key = _PROC_PRE_PRINT_SETUP,
- .keylen = sizeof(_PROC_PRE_PRINT_SETUP),
- .executable = EINA_FALSE,
- .available = EINA_FALSE,
- }, {
- NULL /* sentinel */
+static void _container_dict_basic_variant_append(Eldbus_Message_Iter *array, int type, const char *key, ...) /* TODO rename something key/value */
+{
+ Eldbus_Message_Iter *value, *dict;
+ va_list ap;
+ char sig[2] = { '\0' };
+
+ sig[0] = type;
+
+ dict = eldbus_message_iter_container_new(array, 'e', NULL); /* { */
+ eldbus_message_iter_basic_append(dict, 's', key); /* s (key) */
+ value = eldbus_message_iter_container_new(dict, 'v', sig); /* start variant */
+ va_start(ap, key);
+ eldbus_message_iter_arguments_vappend(value, sig, ap); /* v (value) */
+ va_end(ap);
+ eldbus_message_iter_container_close(dict, value); /* end variant */
+ eldbus_message_iter_container_close(array, dict); /* } */
+}
+
+/* TODO move to ui_invalidate_navi_items ?? */
+static void _invalidate_navi_items(Evas_Object *navi, const enum navi_page_state page_state)
+{
+ Eina_List *navi_list, *l;
+ Elm_Object_Item *navi_item;
+ enum navi_page_state page;
+
+ navi_list = elm_naviframe_items_get(navi);
+ EINA_LIST_FOREACH(navi_list, l, navi_item) {
+ page = (enum navi_page_state)(uintptr_t)elm_object_item_data_get(navi_item);
+ if (page == page_state)
+ elm_object_item_data_set(navi_item, (void *)PAGE_INVALID);
}
-};
+ eina_list_free(navi_list);
+}
-struct procedure_data *procedures_init(void)
+static void _get_meta_print(void *data, const void *key, Eldbus_Message_Iter *var)
{
- return procedures;
-};
+ struct print_data *print = data;
+ const char *skey = key;
+ char *var_sig;
+
+ if (!print) {
+ EINA_LOG_ERR("dial_data should not be null");
+ return;
+ }
+
+ var_sig = eldbus_message_iter_signature_get(var);
+ if (!strcmp(skey, _META_PRINT_JOBNAME)) {
+ char *value = NULL;
+
+ if (!eldbus_message_iter_arguments_get(var, "s", &value)) {/* TODO: check if value is leaking mem here */
+ EINA_LOG_ERR("Message signature does not match \"s\", got %s", var_sig);
+ } else {
+ uint_fast16_t value_size = strlen(value) + 1;
+
+ print->jobname = realloc(print->jobname, value_size);
+ strncpy(print->jobname, value, value_size);
+ }
+
+ } else if (!strcmp(skey, _META_PRINT_TIME)) {
+ int32_t value = 0;
+
+ if (!eldbus_message_iter_arguments_get(var, "i", &value))
+ EINA_LOG_ERR("Message signature does not match \"i\", got %s", var_sig);
+ else
+ print->time = value;
+ } else if (!strcmp(skey, _META_PRINT_TIME_TOTAL)) {
+ int32_t value = 0;
+
+ if (!eldbus_message_iter_arguments_get(var, "i", &value))
+ EINA_LOG_ERR("Message signature does not match \"i\", got %s", var_sig);
+ else
+ print->total_time = value;
+ }
+ if (!strcmp(skey, _META_PRINT_PROGRESS)) {
+ double value = 0.0;
+
+ if (!eldbus_message_iter_arguments_get(var, "d", &value))
+ EINA_LOG_ERR("Message signature does not match \"d\", got %s", var_sig);
+ else
+ print->progress = value;
+ }
+ free(var_sig);
+}
+
+static void _get_meta_cur_tar(void *data, const void *key, Eldbus_Message_Iter *var)
+{
+ struct settings_dial_data *dial_data = data;
+ const char *skey = key;
+ char *var_sig;
+ double value;
+
+ if (!dial_data) {
+ EINA_LOG_ERR("dial_data should not be null");
+ return;
+ }
+
+ var_sig = eldbus_message_iter_signature_get(var);
+ if (!strcmp(skey, _META_TARGET)) {
+ if (!eldbus_message_iter_arguments_get(var, "d", &value))
+ EINA_LOG_ERR("Message signature does not match \"d\", got %s", var_sig);
+ else
+ dial_data->value = value;
+ } else if (!strcmp(skey, _META_CURRENT)) {
+ if (!eldbus_message_iter_arguments_get(var, "d", &value))
+ EINA_LOG_ERR("Message signature does not match \"d\", got %s", var_sig);
+ else
+ dial_data->value_end = value;
+ }
+ free(var_sig);
+}
static void _on_start_print_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
@@ -74,7 +192,7 @@ static void _on_start_print_ret(void *data, const Eldbus_Message *msg, Eldbus_Pe
return;
}
if (!eldbus_message_arguments_get(msg, "b", &print_started)) {
- EINA_LOG_ERR("Failed to start print.");
+ EINA_LOG_ERR("Signature mistmatch, \"b\".");
return;
}
if (print_started == EINA_TRUE) {
@@ -82,32 +200,327 @@ static void _on_start_print_ret(void *data, const Eldbus_Message *msg, Eldbus_Pe
print->block = EINA_FALSE;
} else {
EINA_LOG_ERR("Unable to start print");
+ /* TODO, if print start failed, invalidate all PRINTING pages */
+ //_invalidate_navi_items(eulogium->navi, PAGE_PRINTING);
+ }
+}
+
+static void _on_start_dial_ret(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+{
+ char *label = data;
+ const char *errname, *errmsg;
+ Eina_Bool procedure_started = EINA_FALSE;
+
+ if (eldbus_message_error_get(msg, &errname, &errmsg)) {
+ EINA_LOG_ERR("%s %s", errname, errmsg);
+ return;
+ }
+ if (!eldbus_message_arguments_get(msg, "b", &procedure_started)) {
+ EINA_LOG_ERR("Signature mistmatch, \"b\".");
+ return;
+ }
+ if (procedure_started == EINA_TRUE) {
+ EINA_LOG_INFO("Procedure %s has been successfully started", label);
+ } else {
+ EINA_LOG_ERR("Unable to start procedure %s", label);
+ /* TODO, if tuning failed .. */
+ }
+}
+
+Eina_Bool _print_progress_cleanup(void *data, Elm_Object_Item *eoi EINA_UNUSED)
+{
+ eulogium_print_data_clear(data);
+
+ return EINA_TRUE;
+}
+
+void procedure_process_step(struct eulogium_data *eulogium, struct procedure_data *procedure)
+{
+ Evas_Object *content = NULL;
+ Elm_Object_Item *navi_item = NULL;
+ enum navi_page_state page_state = PAGE_NORMAL;
+
+ if (!procedure)
+ return;
+ if (!procedure->step_active)
+ return;
+
+ /* TODO build 'remember previous screen so we don't redraw the same' */
+ EINA_LOG_CRIT("%s", procedure->step_active->key);
+ if (procedure->step_active->step == STEP_PRINTING) {
+ content = eulogium_print_progress(eulogium->navi, eulogium, (struct print_data *)procedure->meta);
+ page_state = PAGE_PRINTING;
+ }
+ if (procedure->step_active->step == PROC_WAIT_FOR_CLEANUP) {
+ _invalidate_navi_items(eulogium->navi, PAGE_PRINTING);
+ content = eulogium_clean_print_bed(eulogium);
+ }
+
+ if (!content)
+ return;
+
+ navi_item = elm_naviframe_item_simple_push(eulogium->navi, content);
+ elm_object_item_data_set(navi_item, (void *)page_state);
+ if (page_state == PAGE_PRINTING)
+ elm_naviframe_item_pop_cb_set(navi_item, _print_progress_cleanup, eulogium);
+}
+
+static struct procedure_msg print_msgs[] = {
+ {
+ .key = _PROC_MSG_PRINTER_CLEANED,
+ .msg = PROC_MSG_PRINTER_CLEANED,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_print[] = {
+ {
+ .key = _PROC_RUN_PRE_PRINT_SETUP,
+ .step = PROC_RUN_PRE_PRINT_SETUP,
+ }, {
+ .key = _STEP_PRINTING,
+ .step = STEP_PRINTING,
+ }, {
+ .key = _PROC_POST_PRINT,
+ .step = PROC_POST_PRINT,
+ }, {
+ .key = _PROC_WAIT_FOR_CLEANUP,
+ .step = PROC_WAIT_FOR_CLEANUP,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_bed_temp_set[] = {
+ {
+ .key = _STEP_BED_HEATING,
+ .step = STEP_HEATING,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_hotend_temp_set[] = {
+ {
+ .key = _STEP_HOTEND_HEATING,
+ .step = STEP_HEATING,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_fan_speed_set[] = {
+ {
+ .key = _STEP_FAN_SPEEDING,
+ .step = STEP_SPEEDING,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_flow_rate_set[] = {
+ {
+ .key = _STEP_MATERIAL_FLOWING,
+ .step = STEP_SPEEDING,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_step steps_print_speed_set[] = {
+ {
+ .key = _STEP_PRINT_SPEEDING,
+ .step = STEP_SPEEDING,
+ }, { NULL }, /* sentinel */
+};
+
+static struct procedure_data procedures[] = {
+ [PROC_PRINT] = {
+ .key = _PROC_PRINT,
+ .status = PROC_READY,
+ .parser = _get_meta_print,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_print,
+ .step_active = NULL,
+ .meta = NULL, /* struct print_data * */
+ },
+ [PROC_BED_HEATUP] = {
+ .key = _PROC_BED_HEATUP,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_bed_temp_set,
+ .step_active = NULL,
+ .meta = NULL,
+ },
+ [PROC_HOTEND_HEATUP_0] = {
+ .key = _PROC_HOTEND_HEATUP_0,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_hotend_temp_set,
+ .step_active = NULL,
+ .meta = NULL,
+ },
+ [PROC_HOTEND_HEATUP_1] = {
+ .key = _PROC_HOTEND_HEATUP_1,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_hotend_temp_set,
+ .step_active = NULL,
+ .meta = NULL,
+ },
+ [PROC_PRINT_SPEED] = {
+ .key = _PROC_PRINT_SPEED,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_print_speed_set,
+ .step_active = NULL,
+ .meta = NULL,
+ },
+ [PROC_FAN_SPEED] = {
+ .key = _PROC_FAN_SPEED,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_fan_speed_set,
+ .step_active = NULL,
+ .meta = NULL,
+ },
+ [PROC_FLOW_RATE] = {
+ .key = _PROC_FLOW_RATE,
+ .status = PROC_READY,
+ .parser = _get_meta_cur_tar,
+ .executable = EINA_FALSE,
+ .available = EINA_FALSE,
+ ._steps = steps_flow_rate_set,
+ .step_active = NULL,
+ .meta = NULL,
+ }, { NULL }, /* sentinel */
+};
+
+void procedure_meta_set(struct procedure_data *procedure, void *data)
+{
+ procedure->meta = data;
+}
+
+void *procedure_meta_get(struct procedure_data *procedure)
+{
+ return procedure->meta;
+}
+
+const struct procedure_step *procedure_step_get(const struct procedure_data *proc, const char *key)
+{
+ uint_fast16_t i;
+
+ if (!proc)
+ return NULL;
+
+ for (i = 0; proc->_steps[i].key; i++) {
+ if (!strcmp(proc->_steps[i].key, key))
+ return &proc->_steps[i];
+ }
+
+ return NULL;
+};
+
+const struct procedure_data *procedure_get(const char *key)
+{
+ enum procedure_key i;
+
+ for (i = PROC_PRINT; procedures[i].key; i++) {
+ if (!strcmp(procedures[i].key, key))
+ return &procedures[i];
}
+
+ return NULL;
+};
+
+Eldbus_Pending *procedure_message(const struct procedure_data *proc, const struct procedure_msg *msg)
+{
+ return eldbus_proxy_call(__proxy, "messageProcedure", NULL, NULL, -1, "ss", proc->key, msg->key);
}
-Eldbus_Pending *procedure_start_print(Eldbus_Proxy *proxy, struct print_data *print)
+Eldbus_Pending *procedure_led_brightness_set(const Evas_Object *dial)
+{
+ //struct settings_dial_data *dial_data;
+
+// dial_data = evas_object_data_get(dial, "dial_data");
+// eldbus_proxy_call(dial_data->proxy, "SetBrightness", _on_dial_units_update_ret, dial, -1, "");
+}
+
+Eldbus_Pending *procedure_print_printer_cleaned(void) /* XXX pass procedure step? */
+{
+ return eldbus_proxy_call(__proxy, "messageProcedure", on_method_generic_bool_ret, NULL, -1, "ss", _PROC_PRINT, _PROC_MSG_PRINTER_CLEANED);
+}
+
+/* TODO half of the content of this procedure is generic and could be gotten from the procedure if it where a parameter. This can be made much more generic. */
+Eldbus_Pending *procedure_print_start(const struct print_data *print)
{
Eldbus_Message *msg;
- Eldbus_Message_Iter *iter, *dict, *array;
+ Eldbus_Message_Iter *iter, *array;
- msg = eldbus_proxy_method_call_new(proxy, "startProcedure");
+ msg = eldbus_proxy_method_call_new(__proxy, "startProcedure");
iter = eldbus_message_iter_get(msg);
/* Compose msg sa{sv} */
eldbus_message_iter_basic_append(iter, 's', "PRINT");
array = eldbus_message_iter_container_new(iter, 'a', "{sv}");
- dict = eldbus_message_iter_container_new(array, 'e', NULL);
- eldbus_message_iter_basic_append(dict, 's', "name");
- _container_basic_variant(dict, 's', print->name);
- eldbus_message_iter_container_close(array, dict);
+ _container_dict_basic_variant_append(array, 's', "name", print->name);
+ _container_dict_basic_variant_append(array, 's', "url", print->url);
+
+ eldbus_message_iter_container_close(iter, array);
+
+ return eldbus_proxy_send(__proxy, msg, _on_start_print_ret, print, -1);
+}
+
+/* TODO, add resend/retry if actual value does not match current value */
+Eldbus_Pending *procedure_target_set(const enum procedure_key proc_key)
+{
+ Eldbus_Message *msg;
+ Eldbus_Message_Iter *iter, *array;
+ struct procedure_data *procedure = &procedures[proc_key];
+ struct settings_dial_data *dial_data = procedure->meta;
+
+ msg = eldbus_proxy_method_call_new(__proxy, "startProcedure");
+ iter = eldbus_message_iter_get(msg);
+
+ /* Compose msg sa{sv} */
+ printf("Prockey: %s\n", procedure->key);
+ eldbus_message_iter_basic_append(iter, 's', procedure->key);
+ array = eldbus_message_iter_container_new(iter, 'a', "{sv}");
- dict = eldbus_message_iter_container_new(array, 'e', NULL);
- eldbus_message_iter_basic_append(dict, 's', "url");
- _container_basic_variant(dict, 's', print->url);
- eldbus_message_iter_container_close(array, dict);
+ _container_dict_basic_variant_append(array, 'd', "target", dial_data->value);
eldbus_message_iter_container_close(iter, array);
- return eldbus_proxy_send(proxy, msg, &_on_start_print_ret, print, -1);
+ return eldbus_proxy_send(__proxy, msg, _on_start_dial_ret, dial_data->label, -1);
+}
+
+Eldbus_Pending *procedure_metadata_get(enum procedure_key proc_key)
+{
+ return eldbus_proxy_call(__proxy, "getProcedureMetaData", on_method_get_procedure_metadata_ret, &procedures[proc_key], -1, "s", procedures[proc_key].key);
}
+
+void procedure_meta_getall(void)
+{
+ enum procedure_key i;
+
+ for (i = PROC_NONE; i < PROC_LAST; i++)
+ if (procedures[i].key)
+ procedure_metadata_get(i);
+};
+
+struct procedure_data *procedures_init(Eldbus_Proxy *proxy)
+{
+ __proxy = proxy;
+
+ /* TODO: we probably should do something here to prepare all procedures and their meta data
+ * so that we can do the getall here and drop the function altogether.
+ */
+ return procedures;
+};
+
+void procedures_shutdown(void)
+{
+ free(procedures[PROC_PRINT].meta);
+ eldbus_proxy_unref(__proxy);
+};
diff --git a/src/procedures.h b/src/procedures.h
index 79e23eb..08ce1d6 100644
--- a/src/procedures.h
+++ b/src/procedures.h
@@ -1,5 +1,5 @@
/*
- * eulogium_procedures, available procedures
+ * procedures, available procedures
*
* Copyright (c) 2015 Ultimaker B.V.
* Author: Olliver Schinagl <o.schinagl@ultimaker.com>
@@ -7,23 +7,100 @@
* SPDX-License-Identifier: AGPL-3.0+
*/
-#ifndef _EULOGIUM_PROCEDURES_H
-#define _EULOGIUM_PROCEDURES_H
+#ifndef _PROCEDURES_H
+#define _PROCEDURES_H
#include <Eina.h>
#include <Eldbus.h>
#include <stdint.h>
-#include "print_data.h"
+enum procedure_status {
+ PROC_READY,
+ PROC_ACTIVE,
+ PROC_FINISHED,
+};
+
+enum procedure_key {
+ PROC_NONE,
+ PROC_BED_HOME,
+ PROC_BED_LEVEL,
+ PROC_HOTEND_SWITCH,
+ PROC_HOTEND_LEVEL,
+ PROC_PRINT,
+ PROC_BED_HEATUP,
+ PROC_HOTEND_HEATUP_0,
+ PROC_HOTEND_HEATUP_1,
+ PROC_PRINT_SPEED,
+ PROC_FAN_SPEED,
+ PROC_FLOW_RATE,
+ PROC_LAST, /* sentinel */
+};
+
+enum steps {
+ PROC_RUN_PRE_PRINT_SETUP,
+ STEP_PRINTING,
+ PROC_POST_PRINT,
+ PROC_WAIT_FOR_CLEANUP,
+ STEP_HEATING,
+ STEP_SPEEDING,
+ STEP_FLOWING,
+ STEP_HOMEING,
+};
+
+struct procedure_step {
+ const char *key;
+ const enum steps step;
+};
+
+enum msgs {
+ PROC_MSG_PRINTER_CLEANED,
+};
+
+struct procedure_msg {
+ const char *key;
+ const enum msgs msg;
+};
+
+enum meta_type {
+ PROC_META_NONE,
+ PROC_META_PRINT,
+ PROC_META_DIAL,
+};
struct procedure_data {
- char *key;
- uint_fast16_t keylen;
+ const char *key;
+ enum procedure_status status;
+ const char *sig;
+ const char *para; /* TODO va_list to go with sig? */
Eina_Bool available;
Eina_Bool executable;
+ void (*parser)(void *data, const void *key, Eldbus_Message_Iter *variant);
+ void *meta; /* TODO every proc. has meta data, some needs to be periodically updated (print_data), others on signal changes */
+ const struct procedure_msg *msgs;
+ const struct procedure_step *_steps; /* TODO optional? maybe we don't even have to know the list */
+ struct procedure_step *step_active;
};
-struct procedure_data *procedures_init(void);
-Eldbus_Pending *procedure_start_print(Eldbus_Proxy *proxy, struct print_data *print);
+struct eulogium_data; /* XXX remove later when struct eulogium gets refactored. */
+
+struct procedure_data *procedures_init(Eldbus_Proxy *proxy);
+void procedure_meta_getall(void);
+const struct procedure_data *procedure_get(const char *key);
+const struct procedure_step *procedure_step_get(const struct procedure_data *proc, const char *key);
+void procedure_process_step(struct eulogium_data *eulogium, struct procedure_data *procedure);
+Eldbus_Pending *procedure_message(const struct procedure_data *proc, const struct procedure_msg *msg);
+
+struct print_data; /* XXX only here until print_start gets simplified */
+Eldbus_Pending *procedure_print_start(const struct print_data *print);
+Eldbus_Pending *procedure_print_printer_cleaned(void);
+Eldbus_Pending *procedure_print_progress_get(struct procedure_data *procedure);
+
+void *procedure_meta_get(struct procedure_data *procedure);
+void procedure_meta_set(struct procedure_data *procedure, void *data);
+
+Eldbus_Pending *procedure_metadata_get(enum procedure_key proc_key);
+Eldbus_Pending *procedure_target_set(const enum procedure_key proc_key);
+
+void procedures_shutdown(void);
-#endif /* _EULOGIUM_PRIVATE_H */
+#endif /* _PROCEDURES_H */
diff --git a/src/settings_data.h b/src/settings_data.h
new file mode 100644
index 0000000..16cbb5f
--- /dev/null
+++ b/src/settings_data.h
@@ -0,0 +1,34 @@
+/*
+ * function and data types for settings information
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#ifndef _SETTINGS_DATA_H
+#define _SETTINGS_DATA_H
+
+#include <Eldbus.h>
+
+#include "procedures.h"
+
+struct settings_dial_data {
+ const char *label;
+ double step;
+ double min;
+ double max;
+ double value;
+ double value_end;
+ char *(*indicator_func)(double value);
+ void (*free_func)(char *str);
+ const char *format;
+ const char *format_end;
+ const char *unit;
+ Eldbus_Pending *(*method_set)(enum procedure_key proc_key);
+ Eldbus_Pending *(*method_get)(enum procedure_key proc_key);
+ enum procedure_key proc_key;
+};
+
+#endif /* _SETTINGS_DATA_H */
diff --git a/src/ui_input.c b/src/ui_input.c
new file mode 100644
index 0000000..1de5e4e
--- /dev/null
+++ b/src/ui_input.c
@@ -0,0 +1,40 @@
+/*
+ * functions, callbacks and data types for user input
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Ecore.h>
+#include <Elementary.h>
+#include <Evas.h>
+
+#include "ui_input.h"
+
+int INPUT_MOUSE_WHEEL_UP = 0; /* For custom ecore_event handling */
+int INPUT_MOUSE_WHEEL_DOWN = 0; /* For custom ecore_event handling */
+
+/* Function to make the Z-axis of any wheel focus the next/previous focusable widget */
+void input_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Wheel *ev = event_info;
+ Ecore_Event *event = NULL;
+
+ if (ev->z > 0) {
+ elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_NEXT);
+ event = ecore_event_add(INPUT_MOUSE_WHEEL_DOWN, NULL, NULL, NULL);
+ } else {
+ elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_PREVIOUS);
+ event = ecore_event_add(INPUT_MOUSE_WHEEL_UP, NULL, NULL, NULL);
+ }
+ if (!event)
+ EINA_LOG_ERR("Wheel event failed to queue.");
+}
+
+void input_init()
+{
+ INPUT_MOUSE_WHEEL_UP = ecore_event_type_new();
+ INPUT_MOUSE_WHEEL_DOWN = ecore_event_type_new();
+}
diff --git a/src/ui_input.h b/src/ui_input.h
new file mode 100644
index 0000000..d036055
--- /dev/null
+++ b/src/ui_input.h
@@ -0,0 +1,19 @@
+/*
+ * functions, callbacks and data types for user input
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#ifndef _UI_INPUT_H
+#define _UI_INPUT_H
+
+extern int INPUT_MOUSE_WHEEL_UP;
+extern int INPUT_MOUSE_WHEEL_DOWN;
+
+void input_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
+void input_init(void);
+
+#endif /* _UI_INPUT_H */
diff --git a/src/ui_widgets.c b/src/ui_widgets.c
new file mode 100644
index 0000000..226a759
--- /dev/null
+++ b/src/ui_widgets.c
@@ -0,0 +1,262 @@
+/*
+ * functions, callbacks and data types for widgets
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Elementary.h>
+#include <stdarg.h>
+#include <stdint.h>
+
+#include "eulogium.h"
+#include "eulogium_private.h"
+#include "ui_input.h"
+#include "ui_widgets.h"
+
+Elm_Object_Item *ui_stack_push(const struct eulogium_data *eulogium, Evas_Object *content, const enum navi_page_state page_state) /* TODO replace with just the navi pointer */
+{
+ Elm_Object_Item *navi_item;
+ if ((!eulogium->navi) || (!content)) {
+ EINA_LOG_CRIT("navi or content where NULL");
+ return NULL;
+ }
+
+ navi_item = elm_naviframe_item_simple_push(eulogium->navi, content);
+ if (!navi_item) {
+ EINA_LOG_CRIT("Unable to push item onto navistack");
+ return NULL;
+ }
+
+ elm_object_item_data_set(navi_item, (void *)(uintptr_t)page_state);
+
+ return navi_item;
+}
+
+/* Search through the navistack in reverse order. This loop is almost always
+ * aborted very early on. We basically 'abuse' the loop to skip over invalid
+ * pages, which is actually unlikely and thus the first item of the stack
+ * (the tail) gets popped immediately. Additionally there is a safeguard in
+ * place to not pop the very first page of the stack, as that is our
+ * 'main-menu'. TODO Improve doc, this is just an early note.
+ */
+Eina_Bool ui_stack_pop(const struct eulogium_data *eulogium) /* TODO replace with just the navi pointer */
+{
+ Eina_List *navi_list, *l;
+ Elm_Object_Item *navi_item;
+ enum navi_page_state page_state;
+
+ if (!eulogium->navi) {
+ EINA_LOG_CRIT("Naviframe was NULL");
+ return EINA_FALSE;
+ }
+
+ /* FIXME: bug here, when we start eulogium and start a print job,
+ * eulogium restarts midway the print job, the dialog with the
+ * print cleaned pops up, but apparently no bottom has been generated
+ * yet. Make sure to call eulogium_main_menu (new name) first before
+ * process handling. Call moved, but we may still have init issues.
+ */
+ navi_item = elm_naviframe_top_item_get(eulogium->navi);
+ page_state = (enum navi_page_state)(uintptr_t)elm_object_item_data_get(navi_item);
+ if (page_state == PAGE_BOTTOM) {
+ EINA_LOG_WARN("Not popping bottom frame cowboy");
+ return EINA_TRUE;
+ }
+
+ navi_list = elm_naviframe_items_get(eulogium->navi);
+ l = eina_list_last(navi_list);
+ l = eina_list_prev(l);
+ /* Skip the top entry, it is the currently displayed window and thus
+ * always valid, we also know the last item is not the bottom of the
+ * stack. Because we are looking 1 item ahead, if l becomes NULL, we
+ * must be on the bottom page, which may never be invalid by
+ * definition. */
+ for (; l; l = eina_list_prev(l)) {
+ navi_item = eina_list_data_get(l);
+ if (!navi_item) {
+ EINA_LOG_ERR("No item in list?!");
+ continue;
+ }
+ page_state = (enum navi_page_state)(uintptr_t)elm_object_item_data_get(navi_item);
+ if (page_state == PAGE_INVALID) {
+ EINA_LOG_WARN("Page on stack invalid, skipping");
+ continue;
+ }
+ /* All other page_states, PAGE_NORMAL, PAGE_PRINTING */
+ elm_naviframe_item_pop_to(navi_item);
+ eina_list_free(navi_list);
+ return EINA_TRUE;
+
+ }
+ eina_list_free(navi_list);
+
+ return EINA_FALSE;
+}
+
+void _event_handler_from_navi_del(Evas_Object *navi, const char *str)
+{
+ Ecore_Event_Handler *event;
+
+ event = evas_object_data_get(navi, str);
+ if (event)
+ ecore_event_handler_del(event);
+}
+
+void ui_stack_pop_cb(void *data, Evas_Object *eo EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ struct eulogium_data *eulogium = data; /* XXX replace this with passing just the navi and event handlers */
+ Evas_Object *navi = eulogium->navi;
+
+ _event_handler_from_navi_del(navi, "event_inc"); /* TODO possibly use an array of event handlers if we get more then 3 */
+ _event_handler_from_navi_del(navi, "event_dec"); /* TODO possibly use an array of event handlers if we get more then 3 */
+
+ ui_stack_pop(eulogium); /* XXX replace with just the navi */
+}
+
+static Eina_Bool _dial_change_delay(void *data)
+{
+ Evas_Object *dial = data;
+
+ evas_object_data_set(dial, "delay", NULL);
+ evas_object_smart_callback_call(dial, "delay,changed", NULL);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool _dial_change(void *data, int type, void *event_info EINA_UNUSED)
+{
+ Evas_Object *dial = data;
+ Ecore_Timer *delay;
+ double value, step;
+
+/* TODO XXX we call this dirty little hack because debian's v1.8 of elm does not offer us to actually call drag,left
+ * evas_object_smart_callback_call(dial, "drag,left", NULL); would have been much cleaner and we didn't need to do
+ * the val+step get/set thing and thus also benefit from delay,changed which we now 'fake' badly. Also a common user,changed
+ * signal handler on the other end would help on making it less ugly.
+ */
+ value = elm_slider_value_get(dial);
+ step = elm_slider_step_get(dial);
+ if (type == INPUT_MOUSE_WHEEL_UP)
+ elm_slider_value_set(dial, value + step);
+ if (type == INPUT_MOUSE_WHEEL_DOWN)
+ elm_slider_value_set(dial, value - step);
+ evas_object_smart_callback_call(dial, "changed", NULL);
+ delay = evas_object_data_get(dial, "delay");
+ ecore_timer_del(delay);
+ delay = ecore_timer_add(0.25, _dial_change_delay, dial); /* TODO make define for delay */
+ evas_object_data_set(dial, "delay", delay);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void _dial_send_update(void *data, Evas_Object *eo, void *event_info EINA_UNUSED)
+{
+ struct settings_dial_data *dial_data = data;
+
+ dial_data->value = elm_slider_value_get(eo);
+ if (dial_data->method_set)
+ dial_data->method_set(dial_data->proc_key);
+}
+
+/* HACK for some reason elm_slider_units_format_function_set does not supply us with any other variables
+ * other then the value. Doing anything fancy thus becomes impossible. We therefore create these local
+ * pointers which we set whenever a dial screen is generated. This brings us to the big caveat. Right
+ * now, we only support one single active dial (unit/format) because of this XXX */
+static const char *__dial_units_format = NULL;
+
+static char *_dial_units_format(double val)
+{
+ char *buf;
+ uint_fast32_t buf_size;
+
+ buf_size = DIAL_MAX_FORMAT_SIZE;
+ buf = malloc(buf_size);
+ snprintf(buf, buf_size, __dial_units_format, val);
+
+ return buf;
+}
+
+static void _dial_units_format_free(char *buf)
+{
+ free(buf);
+}
+
+static void _dial_units_end_object_text_set(Evas_Object *end, struct settings_dial_data *dial_data)
+{
+ char *buf;
+
+ buf = malloc(DIAL_MAX_FORMAT_SIZE * sizeof(char));
+ if (dial_data->value_end < 0)
+ snprintf(buf, DIAL_MAX_FORMAT_SIZE, "%s", dial_data->unit);
+ else
+ snprintf(buf, DIAL_MAX_FORMAT_SIZE, dial_data->format_end, dial_data->value_end, dial_data->unit);
+ elm_object_text_set(end, buf);
+ free(buf);
+}
+
+static Eina_Bool _timer_dial_units_update(void *data)
+{
+ Evas_Object *dial = data;
+ struct settings_dial_data *dial_data;
+
+ dial_data = evas_object_data_get(dial, "dial_data");
+ if (dial_data->proc_key > PROC_NONE)
+ procedure_metadata_get(dial_data->proc_key);
+ _dial_units_end_object_text_set(dial, dial_data);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void _timer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Ecore_Timer *timer = data;
+
+ if (timer)
+ ecore_timer_del(timer);
+}
+
+Evas_Object *ui_widget_dial(Evas_Object *parent, struct eulogium_data *eulogium, struct settings_dial_data *dial_data)
+{
+ Evas_Object *_top, *_bottom, *obj;
+ Ecore_Timer *timer_value_end = NULL;
+ Ecore_Event_Handler *handler;
+
+ _top = elm_slider_add(parent);
+ elm_object_text_set(_top, _(dial_data->label));
+ elm_object_focus_allow_set(_top, EINA_FALSE);
+ __dial_units_format = dial_data->format;
+ elm_slider_units_format_function_set(_top, _dial_units_format, _dial_units_format_free);
+ elm_slider_min_max_set(_top, dial_data->min, dial_data->max);
+ elm_slider_step_set(_top, dial_data->step);
+ elm_slider_value_set(_top, dial_data->value);
+ evas_object_size_hint_weight_set(_top, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(_top, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(_top, "delay,changed", _dial_send_update, dial_data);
+ handler = ecore_event_handler_add(INPUT_MOUSE_WHEEL_UP, _dial_change, _top);
+ evas_object_data_set(parent, "event_inc", handler);
+ handler = ecore_event_handler_add(INPUT_MOUSE_WHEEL_DOWN, _dial_change, _top);
+ evas_object_data_set(parent, "event_dec", handler);
+ evas_object_show(_top);
+
+ /* if type is tar/cur do something different TODO */
+ obj = elm_label_add(_top);
+ evas_object_data_set(obj, "dial_data", dial_data);
+ _dial_units_end_object_text_set(obj, dial_data);
+ elm_object_part_content_set(_top, "end", obj);
+ evas_object_show(obj);
+ timer_value_end = ecore_timer_add(0.5, _timer_dial_units_update, obj); /* XXX replace with signal? */
+ /* XXX also we only want to pass the obj (dial) to the screen update timer */
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _timer_del, timer_value_end);
+
+ _bottom = elm_button_add(parent);
+ elm_object_text_set(_bottom, _("Click when done")); /* TODO, make define for this text */
+ evas_object_size_hint_weight_set(_bottom, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(_bottom, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(_bottom, "clicked", ui_stack_pop_cb, eulogium);
+ evas_object_show(_bottom);
+
+ return eulogium_split_screen(parent, _top, _bottom);
+}
diff --git a/src/ui_widgets.h b/src/ui_widgets.h
index a32eea3..a184f4a 100644
--- a/src/ui_widgets.h
+++ b/src/ui_widgets.h
@@ -1,5 +1,5 @@
/*
- * function and data types for widgets
+ * functions, callbacks and data types for widgets
*
* Copyright (c) 2015 Ultimaker B.V.
* Author: Olliver Schinagl <o.schinagl@ultimaker.com>
@@ -7,8 +7,8 @@
* SPDX-License-Identifier: AGPL-3.0+
*/
-#ifndef _WIDGET_DATA_H
-#define _WIDGET_DATA_H
+#ifndef _UI_WIDGETS_H
+#define _UI_WIDGETS_H
#include <Ecore.h>
#include <Eina.h>
@@ -17,6 +17,9 @@
#include "dbus_common.h"
#include "eulogium_item_list.h"
+#include "settings_data.h"
+
+#define DIAL_MAX_FORMAT_SIZE 10 /* Maximally allowed characters on a dial, inc comma and \0 */
struct button_cb {
void (*func)(void *data, Evas_Object *object, void *event_info);
@@ -25,7 +28,8 @@ struct button_cb {
};
struct button_def {
- const char *text;
+ const char *label;
+ const char *text; /* TODO remove */
struct button_cb cb;
void *data;
};
@@ -35,11 +39,6 @@ struct dir_entry_def {
char *path;
};
-struct wifi_entry_def {
- void *data;
- char *ssid;
-};
-
struct menu_entry_def {
const char *icon;
const char *label;
@@ -48,7 +47,7 @@ struct menu_entry_def {
Eina_Bool *end; /* remove me */
const char *footer; /* Primary footer */
const char *footer_alt; /* Alternating footer */
- Ecore_Timer *toggle_timer;
+ Ecore_Timer *toggle_timer; /*TODO, this may better go one level up into the menu */
void (*func)(void *data, Evas_Object *object, void *event_info);
void *data;
};
@@ -63,35 +62,34 @@ struct menu_def {
const char *title;
enum list_type type;
void *data;
- struct dir_entry_def dir;
- struct wifi_entry_def wifi; /* TODO see if we can put this into a union somehow */
+ struct dir_entry_def dir; /* TODO check if we need this here at all */
struct menu_entry_def entry[];
};
-struct settings_dial_data {
- const char *label;
- double step;
- double min;
- double max;
- double value;
- double value_actual;
- char *(*indicator_func)(double value);
- void (*free_func)(char *str);
- const char *format;
- Evas_Object *slider;
-};
-
struct screen_def {
const char *title;
Evas_Object *widget;
- struct settings_dial_data screen[];
};
-extern int INPUT_MOUSE_WHEEL_UP;
-extern int INPUT_MOUSE_WHEEL_UP;
+/* WARNING! This enum is stored in a void * via an (uintptr_t) typecast.
+ * Always make sure that it fits into that. At birth, this enum was intended
+ * to never have more then a handful of states.
+ */
+enum navi_page_state {
+ PAGE_NORMAL,
+ PAGE_BOTTOM,
+ PAGE_PRINTING,
+ PAGE_INVALID,
+};
void eulogium_button_cb_set(struct button_def *button, struct button_cb *cb);
void eulogium_button_cb_data_set(struct button_def *button, void *data);
void eulogium_button_data_set(struct button_def *button, void *data);
-#endif /* _WIDGET_DATA_H */
+struct eulogium_data; /* XXX remove when we pass a navi */
+Elm_Object_Item *ui_stack_push(const struct eulogium_data *eulogium, Evas_Object *content, const enum navi_page_state page_state);
+Eina_Bool ui_stack_pop(const struct eulogium_data *eulogium);
+void ui_stack_pop_cb(void *data, Evas_Object *eo EINA_UNUSED, void *event_info EINA_UNUSED);
+Evas_Object *ui_widget_dial(Evas_Object *parent, struct eulogium_data *eulogium, struct settings_dial_data *dial_data);
+
+#endif /* _UI_WIDGETS_H */
diff --git a/src/ui_widgets_cb.c b/src/ui_widgets_cb.c
new file mode 100644
index 0000000..9fbd836
--- /dev/null
+++ b/src/ui_widgets_cb.c
@@ -0,0 +1,24 @@
+/*
+ * widgets callbacks
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Eina.h>
+#include <Elementary>
+#include <Evas.h>
+
+#include "ui_widgets.h"
+
+void settings_dial_increase_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+
+}
+
+void settings_dial_decrease_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+
+}