This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository evisum.
View the commit online.
commit 7267a983c06596021931413cc022cd7d2985600f
Author: Alastair Poole <[email protected]>
AuthorDate: Tue Dec 1 14:41:00 2026 +0000
themes: improve selector
---
data/themes/atelier/theme-icon.svg | 4 +
data/themes/crazy_lab/theme-icon.svg | 4 +
data/themes/evisum.edc | 12 ++
data/themes/folio/theme-icon.svg | 4 +
data/themes/frequency/theme-icon.svg | 4 +
data/themes/gant/theme-icon.svg | 4 +
data/themes/meson.build | 7 +-
data/themes/midnight/theme-icon.svg | 4 +
data/themes/nocturne/theme-icon.svg | 4 +
data/themes/observatory/theme-icon.svg | 4 +
data/themes/shared/preview.edc | 79 +++++++++++
data/themes/shared/theme.edc | 4 +
data/themes/shared/window-corners.svg | 3 +
data/themes/shared/window-outline.svg | 3 +
data/themes/shared/window.edc | 48 ++++---
data/themes/undertow/theme-icon.svg | 4 +
data/themes/voltage/theme-icon.svg | 4 +
src/bin/ui/evisum_ui_theme.c | 241 +++++++++++++++++++++++++++------
18 files changed, 378 insertions(+), 59 deletions(-)
diff --git a/data/themes/atelier/theme-icon.svg b/data/themes/atelier/theme-icon.svg
new file mode 100644
index 0000000..cef8a82
--- /dev/null
+++ b/data/themes/atelier/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#f7f2e7" stroke="#c7bead"/>
+ <path d="M5 18 15 8l3 3L8 21H5z M15 8l2-3 4 4-3 2 M5 6h5M5 9h3" fill="none" stroke="#b35136" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/crazy_lab/theme-icon.svg b/data/themes/crazy_lab/theme-icon.svg
new file mode 100644
index 0000000..d38f3d7
--- /dev/null
+++ b/data/themes/crazy_lab/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#203334" stroke="#5c6251"/>
+ <path d="M9 4h6m-5 0v7l-5 7v2h14v-2l-5-7V4 M8 15h8" fill="none" stroke="#ffa252" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/evisum.edc b/data/themes/evisum.edc
index 29d87e1..e019a2b 100644
--- a/data/themes/evisum.edc
+++ b/data/themes/evisum.edc
@@ -406,3 +406,15 @@ collections {
}
}
}
+
+#define BG 36 36 36 255
+#define PANEL 53 53 53 255
+#define EDGE 84 84 84 255
+#define INK 238 238 238 255
+#define MUTED 172 172 172 255
+#define ACCENT 51 153 255 255
+#define SECONDARY 127 207 221 255
+#define SELECTED 47 73 101 255
+#define PREVIEW_ICON "evisum.png"
+#define PREVIEW_ICON_DECLARED 1
+#include "shared/preview.edc"
diff --git a/data/themes/folio/theme-icon.svg b/data/themes/folio/theme-icon.svg
new file mode 100644
index 0000000..edbb02f
--- /dev/null
+++ b/data/themes/folio/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#f6efdf" stroke="#c9b99c"/>
+ <path d="M7 4h7l4 4v12H7z M14 4v5h4 M10 12h5m-5 3h5" fill="none" stroke="#8c563c" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/frequency/theme-icon.svg b/data/themes/frequency/theme-icon.svg
new file mode 100644
index 0000000..fb8c6b4
--- /dev/null
+++ b/data/themes/frequency/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#414946" stroke="#756b53"/>
+ <path d="M3 12h4l2-6 4 12 2-6h6" fill="none" stroke="#e0ad65" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/gant/theme-icon.svg b/data/themes/gant/theme-icon.svg
new file mode 100644
index 0000000..d5fcb62
--- /dev/null
+++ b/data/themes/gant/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#486f8b" stroke="#648aa5"/>
+ <path d="M5 8h14v3H5z M7 11v7h10v-7 M9 15h6" fill="none" stroke="#c1efff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/meson.build b/data/themes/meson.build
index 919131c..009de2c 100644
--- a/data/themes/meson.build
+++ b/data/themes/meson.build
@@ -10,16 +10,17 @@ cmd = [ edje_cmd,
custom_target('evisum.edj',
input : 'evisum.edc',
output : 'evisum.edj',
+ depend_files : files('shared/preview.edc', '../icons/evisum.png'),
command : cmd,
install_dir : join_paths(dir_data, 'evisum', 'themes'),
install : true
)
-theme_sources = files('shared/theme.edc', 'shared/window.edc', 'shared/widgets.edc',
+theme_sources = files('shared/preview.edc', 'shared/theme.edc', 'shared/window.edc', 'shared/widgets.edc',
'shared/meters.edc', 'shared/meter-bezel.svg', 'shared/meter-fill.svg', 'shared/tabs.edc', 'shared/minimize.svg', 'shared/maximize.svg',
'shared/restore.svg', 'shared/close.svg', 'shared/menu.svg',
'shared/sort-up.svg', 'shared/sort-down.svg',
- 'shared/window-shadow.png', 'shared/button-glint.svg', 'shared/window-edge-light.svg', 'shared/column-key.svg',
+ 'shared/window-shadow.png', 'shared/button-glint.svg', 'shared/window-corners.svg', 'shared/window-outline.svg', 'shared/column-key.svg',
'shared/column-key-outline.svg')
foreach icon : ['proc', 'cpu', 'memory', 'storage', 'sensor', 'network', 'effects', 'evisum']
theme_sources += files('shared/action-' + icon + '.svg')
@@ -29,7 +30,7 @@ theme_sources += files('shared/process-stop.svg', 'shared/process-start.svg',
foreach theme : ['gant', 'nocturne', 'folio', 'frequency', 'voltage', 'undertow', 'midnight', 'atelier', 'observatory', 'crazy_lab']
artwork = files(theme / 'about.svg', theme / 'button.svg',
theme / 'hover.svg', theme / 'pressed.svg',
- theme / 'selected-outline.svg')
+ theme / 'selected-outline.svg', theme / 'theme-icon.svg')
custom_target(theme + '.edj',
input : theme + '.edc',
output : theme + '.edj',
diff --git a/data/themes/midnight/theme-icon.svg b/data/themes/midnight/theme-icon.svg
new file mode 100644
index 0000000..b1674f7
--- /dev/null
+++ b/data/themes/midnight/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#1c263a" stroke="#30415b"/>
+ <path d="M12 4l1.7 6.3 6.3 1.7-6.3 1.7L12 20l-1.7-6.3L4 12l6.3-1.7Z M18 4v4m-2-2h4" fill="none" stroke="#7bb1ff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/nocturne/theme-icon.svg b/data/themes/nocturne/theme-icon.svg
new file mode 100644
index 0000000..00d08e5
--- /dev/null
+++ b/data/themes/nocturne/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#262c42" stroke="#3a435c"/>
+ <path d="M17 16A7 7 0 0 1 9 6a7 7 0 1 0 8 10Z M16 5v4m-2-2h4" fill="none" stroke="#c0adeb" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/observatory/theme-icon.svg b/data/themes/observatory/theme-icon.svg
new file mode 100644
index 0000000..9672725
--- /dev/null
+++ b/data/themes/observatory/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#19283c" stroke="#32465e"/>
+ <path d="M5 10l12-5 2 4-12 5z M12 12v3m0 0-5 5m5-5 5 5" fill="none" stroke="#72dbd0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/shared/preview.edc b/data/themes/shared/preview.edc
new file mode 100644
index 0000000..7d44c10
--- /dev/null
+++ b/data/themes/shared/preview.edc
@@ -0,0 +1,79 @@
+#ifndef PREVIEW_ICON_DECLARED
+images { image: PREVIEW_ICON COMP; }
+#endif
+
+#define PREVIEW_RECT(ID, COLOR, X1, Y1, X2, Y2) \
+ part { name: ID; type: RECT; mouse_events: 0; \
+ description { state: "default" 0.0; color: COLOR; \
+ rel1.relative: X1 Y1; rel2.relative: X2 Y2; } }
+
+#define PREVIEW_TEXT(ID, COLOR, X1, Y1, X2, Y2, ALIGN) \
+ part { name: ID; type: TEXT; mouse_events: 0; scale: 1; \
+ description { state: "default" 0.0; color: COLOR; \
+ rel1.relative: X1 Y1; rel2.relative: X2 Y2; \
+ text { font: "Sans"; size: 11; align: ALIGN 0.5; ellipsis: 1; } } }
+
+#define PREVIEW_CONTROL(ID, ICON_GROUP, ANCHOR, ALIGN, OFFSET) \
+ part { name: ID; type: GROUP; source: ICON_GROUP; mouse_events: 0; scale: 1; \
+ description { state: "default" 0.0; offset_scale: 1; \
+ rel1 { to: ANCHOR; relative: ALIGN .5; offset: (OFFSET - 8) -8; } \
+ rel2 { to: ANCHOR; relative: ALIGN .5; offset: (OFFSET + 7) 7; } } }
+
+collections {
+#ifdef PREVIEW_CUSTOM_FRAME
+ group { name: "evisum/theme/preview"; inherit: "evisum/window"; min: 235 188;
+ parts {
+ PREVIEW_CONTROL("preview.menu", "evisum/icon/menu", "evisum.menu", .5, 0)
+ PREVIEW_CONTROL("preview.minimize", "evisum/icon/minimize", "evisum.controls", 1, -81)
+ PREVIEW_CONTROL("preview.maximize", "evisum/icon/maximize", "evisum.controls", 1, -48)
+ PREVIEW_CONTROL("preview.close", "evisum/icon/close", "evisum.controls", 1, -15)
+ }
+ }
+#else
+ group { name: "evisum/theme/preview"; min: 235 188;
+ parts {
+ PREVIEW_RECT("edge", EDGE, 0,0,1,1)
+ PREVIEW_RECT("body", BG, .006,.008,.994,.992)
+ PREVIEW_RECT("titlebar", PANEL, .006,.008,.994,.17)
+ PREVIEW_TEXT("title", INK, .06,.01,.77,.17,0)
+ PREVIEW_TEXT("controls", MUTED, .77,.01,.95,.17,1)
+ part { name: "evisum.content"; type: SWALLOW;
+ description { state: "default" 0.0;
+ rel1.relative: .006 .17; rel2.relative: .994 .992; } }
+ }
+ }
+#endif
+ group { name: "evisum/theme/preview/content";
+ parts {
+ PREVIEW_RECT("graph", PANEL, .06,0.072,.94,0.410)
+ PREVIEW_RECT("bar.1", ACCENT, .12,0.289,.18,0.373)
+ PREVIEW_RECT("bar.2", ACCENT, .22,0.217,.28,0.373)
+ PREVIEW_RECT("bar.3", ACCENT, .32,0.265,.38,0.373)
+ PREVIEW_RECT("bar.4", SECONDARY, .42,0.145,.48,0.373)
+ PREVIEW_RECT("bar.5", ACCENT, .52,0.205,.58,0.373)
+ PREVIEW_RECT("bar.6", ACCENT, .62,0.120,.68,0.373)
+ PREVIEW_RECT("bar.7", ACCENT, .72,0.241,.78,0.373)
+ PREVIEW_RECT("bar.8", SECONDARY, .82,0.169,.88,0.373)
+ PREVIEW_RECT("columns", PANEL, .06,0.482,.94,0.614)
+ PREVIEW_RECT("selection", SELECTED, .06,0.614,.94,0.759)
+ PREVIEW_TEXT("process", MUTED, .09,0.482,.62,0.614,0)
+ PREVIEW_TEXT("cpu", MUTED, .62,0.482,.91,0.614,1)
+ PREVIEW_TEXT("row.1", INK, .09,0.614,.62,0.759,0)
+ PREVIEW_TEXT("value.1", INK, .62,0.614,.91,0.759,1)
+ PREVIEW_TEXT("row.2", INK, .09,0.759,.62,0.904,0)
+ PREVIEW_TEXT("value.2", INK, .62,0.759,.91,0.904,1)
+ }
+ }
+ group { name: "evisum/theme/icon";
+ parts {
+ part { name: "icon"; type: IMAGE; mouse_events: 0;
+ description { state: "default" 0.0; image.normal: PREVIEW_ICON;
+ aspect: 1 1; aspect_preference: BOTH; }
+ }
+ }
+ }
+}
+
+#undef PREVIEW_RECT
+#undef PREVIEW_TEXT
+#undef PREVIEW_CONTROL
diff --git a/data/themes/shared/theme.edc b/data/themes/shared/theme.edc
index a02916c..72b2a99 100644
--- a/data/themes/shared/theme.edc
+++ b/data/themes/shared/theme.edc
@@ -79,3 +79,7 @@ THEME_ICON("evisum/icon/action/evisum", "action-evisum.svg", 17)
#include "tabs.edc"
#undef STATE
}
+
+#define PREVIEW_ICON "theme-icon.svg"
+#define PREVIEW_CUSTOM_FRAME 1
+#include "preview.edc"
diff --git a/data/themes/shared/window-corners.svg b/data/themes/shared/window-corners.svg
new file mode 100644
index 0000000..83922ed
--- /dev/null
+++ b/data/themes/shared/window-corners.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
+ <rect width="32" height="32" rx="8" fill="#fff"/>
+</svg>
diff --git a/data/themes/shared/window-outline.svg b/data/themes/shared/window-outline.svg
new file mode 100644
index 0000000..39310b7
--- /dev/null
+++ b/data/themes/shared/window-outline.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
+ <rect x=".5" y=".5" width="31" height="31" rx="7.5" fill="none" stroke="#fff"/>
+</svg>
diff --git a/data/themes/shared/window.edc b/data/themes/shared/window.edc
index ea9cd94..3205d1a 100644
--- a/data/themes/shared/window.edc
+++ b/data/themes/shared/window.edc
@@ -6,7 +6,7 @@
rel1 { relative: X1 Y1; offset: A B; } \
rel2 { relative: X2 Y2; offset: C D; } } }
-#define HEADER_HEIGHT 45
+#define HEADER_HEIGHT 40
#define GRIP(ID, X1, Y1, X2, Y2, A, B, C, D) \
part { name: ID; type: RECT; scale: 1; \
@@ -18,7 +18,8 @@
group { name: "evisum/window"; min: 190 80;
images {
image: "window-shadow.png" COMP;
- image: "window-edge-light.svg" COMP;
+ image: "window-corners.svg" COMP;
+ image: "window-outline.svg" COMP;
}
parts {
part { name: "shadow"; type: IMAGE; mouse_events: 0; scale: 1;
@@ -32,18 +33,29 @@ group { name: "evisum/window"; min: 190 80;
description { state: "maximized" 0.0; inherit: "default" 0.0;
rel1.offset: 0 0; rel2.offset: -1 -1; }
}
- WINDOW_RECT("edge.top", EDGE, 0,0,1,0, 0,0,-1,0, 0)
- WINDOW_RECT("edge.bottom", EDGE, 0,1,1,1, 0,-1,-1,-1, 0)
- WINDOW_RECT("edge.left", EDGE, 0,0,0,1, 0,1,0,-2, 0)
- WINDOW_RECT("edge.right", EDGE, 1,0,1,1, -1,1,-1,-2, 0)
- part { name: "surface"; type: RECT; mouse_events: 0; scale: 1;
- description { state: "default" 0.0; offset_scale: 1; color: BG;
- color_class: "evisum/window/surface"; rel.to: "edge";
- rel1.offset: 1 1; rel2.offset: -2 -2; }
+ part { name: "outline"; type: IMAGE; mouse_events: 0; scale: 1;
+ description { state: "default" 0.0; color: EDGE; rel.to: "edge";
+ image.normal: "window-outline.svg";
+ image.border: 9 9 9 9; image.border_scale: 1; }
+ description { state: "maximized" 0.0; inherit: "default" 0.0; visible: 0; }
}
- part { name: "edge-light"; type: IMAGE; mouse_events: 0; scale: 1;
- description { state: "default" 0.0; rel.to: "edge.top"; color: ACCENT;
- image.normal: "window-edge-light.svg"; }
+ part { name: "surface"; type: IMAGE; mouse_events: 0; scale: 1;
+ description { state: "default" 0.0; offset_scale: 1; color: BG;
+ color_class: "evisum/window/surface";
+ rel.to: "edge"; rel1.offset: 1 1; rel2.offset: -2 -2;
+ image.normal: "window-corners.svg";
+ image.border: 9 9 9 9; image.border_scale: 1; }
+ description { state: "maximized" 0.0; inherit: "default" 0.0; visible: 0; }
+ }
+ part { name: "maximized.surface"; type: RECT; mouse_events: 0;
+ description { state: "default" 0.0; visible: 0; color: BG; rel.to: "edge"; color_class: "evisum/window/surface"; }
+ description { state: "maximized" 0.0; inherit: "default" 0.0; visible: 1; }
+ }
+ part { name: "edge-light"; type: RECT; mouse_events: 0; scale: 1;
+ description { state: "default" 0.0; offset_scale: 1; color: ACCENT;
+ rel.to: "edge";
+ rel1.offset: 11 2;
+ rel2 { relative: 0 0; offset: 45 2; } }
description { state: "maximized" 0.0; inherit: "default" 0.0; visible: 0; }
}
WINDOW_RECT("move", 0 0 0 0, 0,0,1,0, 5,5,-6,(HEADER_HEIGHT - 1), 1)
@@ -51,20 +63,20 @@ group { name: "evisum/window"; min: 190 80;
description { state: "default" 0.0; offset_scale: 1; color: INK;
rel.to: "edge"; rel1.offset: 12 5;
rel2 { relative: 0 0; to_x: "evisum.controls"; offset: -9 (HEADER_HEIGHT - 1); }
- text { font: "Sans:style=Bold"; size: 13; text_class: "label"; align: 0 0.5; ellipsis: 1; }
+ text { font: "Sans:style=Bold"; size: 12; text_class: "label"; align: 0 0.5; ellipsis: 1; }
}
description { state: "with_menu" 0.0; inherit: "default" 0.0;
rel1 { to_x: "evisum.menu"; relative: 1 0; offset: 5 5; } }
}
part { name: "evisum.menu"; type: SWALLOW; scale: 1;
description { state: "default" 0.0; offset_scale: 1; rel.to: "edge";
- rel1.offset: 6 8;
+ rel1.offset: 6 5;
rel2 { relative: 0 0; offset: 35 (HEADER_HEIGHT - 4); }
align: 0.5 0.5; fixed: 1 1; }
}
part { name: "evisum.controls"; type: SWALLOW; scale: 1;
description { state: "default" 0.0; offset_scale: 1; rel.to: "edge";
- rel1 { relative: 1 0; offset: -105 8; }
+ rel1 { relative: 1 0; offset: -101 5; }
rel2 { relative: 1 0; offset: -6 (HEADER_HEIGHT - 4); }
fixed: 1 1; align: 1 0.5;
}
@@ -89,12 +101,14 @@ group { name: "evisum/window"; min: 190 80;
program { signal: "evisum,maximized"; source: "evisum";
action: STATE_SET "maximized" 0.0;
target: "shadow"; target: "edge"; target: "edge-light";
+ target: "outline"; target: "surface"; target: "maximized.surface";
target: "top"; target: "bottom"; target: "left"; target: "right";
target: "tl"; target: "tr"; target: "bl"; target: "br";
}
program { signal: "evisum,restored"; source: "evisum";
action: STATE_SET "default" 0.0;
target: "shadow"; target: "edge"; target: "edge-light";
+ target: "outline"; target: "surface"; target: "maximized.surface";
target: "top"; target: "bottom"; target: "left"; target: "right";
target: "tl"; target: "tr"; target: "bl"; target: "br";
}
@@ -103,7 +117,7 @@ group { name: "evisum/window"; min: 190 80;
group { name: "evisum/window/dialog"; inherit: "evisum/window";
parts {
part { name: "evisum.controls";
- description { state: "default" 0.0; rel1.offset: -35 8; }
+ description { state: "default" 0.0; rel1.offset: -35 5; }
}
}
}
diff --git a/data/themes/undertow/theme-icon.svg b/data/themes/undertow/theme-icon.svg
new file mode 100644
index 0000000..c48d87d
--- /dev/null
+++ b/data/themes/undertow/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#193d45" stroke="#446b71"/>
+ <path d="M4 10c3-4 5-4 8 0s5 4 8 0 M4 15c3-4 5-4 8 0s5 4 8 0" fill="none" stroke="#77d8bd" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/data/themes/voltage/theme-icon.svg b/data/themes/voltage/theme-icon.svg
new file mode 100644
index 0000000..902ed30
--- /dev/null
+++ b/data/themes/voltage/theme-icon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24">
+ <rect x=".5" y=".5" width="23" height="23" rx="6" fill="#171a2d" stroke="#4d9798"/>
+ <path d="M13 3 6 13h5l-1 8 8-11h-5z" fill="none" stroke="#5bd9d1" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/src/bin/ui/evisum_ui_theme.c b/src/bin/ui/evisum_ui_theme.c
index cf2f819..d0470c5 100644
--- a/src/bin/ui/evisum_ui_theme.c
+++ b/src/bin/ui/evisum_ui_theme.c
@@ -11,7 +11,7 @@ typedef struct
/* Keep these indices stable for the stored preference. */
static const Theme themes[] = {
- { N_("Default"), NULL },
+ { N_("Default"), "evisum.edj" },
{ "Gant", "gant.edj" },
{ "Nocturne", "nocturne.edj" },
{ "Folio", "folio.edj" },
@@ -36,7 +36,8 @@ _theme_file_find(unsigned int theme)
{
const char *path = eina_slstr_printf("%s/%s", directories[_theme_from_build ? 1 - i : i],
themes[theme].file);
- if (edje_file_group_exists(path, "evisum/window")) return path;
+ const char *group = theme ? "evisum/window" : "evisum/theme/preview";
+ if (edje_file_group_exists(path, group)) return path;
}
return NULL;
}
@@ -131,59 +132,221 @@ evisum_ui_theme_shutdown(void)
eina_stringshare_replace(&_theme_path, NULL);
}
-static void
-_theme_selected(void *data, Evas_Object *radio, void *event_info EINA_UNUSED)
+typedef struct
{
- unsigned int theme = elm_radio_value_get(radio);
+ Evisum_Ui *ui;
+ Evas_Object *parent;
+ Evas_Object *preview;
+ Evas_Object *sample;
+ Evas_Object *status;
+ Evas_Object *apply;
+ unsigned int selected;
+} Theme_Picker;
- if (theme == config()->global.theme) return;
- if (theme >= EINA_C_ARRAY_LENGTH(themes) || (theme && !_theme_file_find(theme)))
+static void
+_theme_picker_deleted(void *data, Evas *canvas EINA_UNUSED, Evas_Object *object EINA_UNUSED,
+ void *event EINA_UNUSED)
+{
+ Theme_Picker *picker = data;
+ if (picker->parent)
{
- elm_radio_value_set(radio, config()->global.theme);
- return;
+ evas_object_data_del(picker->parent, "theme_picker_window");
+ efl_wref_del(picker->parent, &picker->parent);
}
- config()->global.theme = theme;
- evisum_ui_restart(data);
+ free(picker);
}
static void
-_theme_picker_close(void *data, Evas_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+_theme_picker_close(void *data, Evas_Object *object EINA_UNUSED, void *event EINA_UNUSED)
{
evas_object_del(data);
}
+static void
+_theme_picker_apply(void *data, Evas_Object *object EINA_UNUSED, void *event EINA_UNUSED)
+{
+ Theme_Picker *picker = data;
+
+ if (picker->selected == config()->global.theme || !_theme_file_find(picker->selected)) return;
+ config()->global.theme = picker->selected;
+ evisum_ui_restart(picker->ui);
+}
+
+static void
+_theme_picker_preview(Theme_Picker *picker, unsigned int theme)
+{
+ const char *path = _theme_file_find(theme);
+ Eina_Bool ready = path &&
+ elm_layout_file_set(picker->preview, path, "evisum/theme/preview") &&
+ elm_layout_file_set(picker->sample, path, "evisum/theme/preview/content") &&
+ elm_layout_content_set(picker->preview, "evisum.content", picker->sample);
+
+ picker->selected = theme;
+ elm_object_disabled_set(picker->apply, !ready || theme == config()->global.theme);
+ if (!ready)
+ {
+ evas_object_hide(picker->preview);
+ elm_object_text_set(picker->status, _("Preview unavailable"));
+ return;
+ }
+
+ if (theme)
+ {
+ elm_layout_text_set(picker->preview, "evisum.title", _("Evisum"));
+ elm_layout_signal_emit(picker->preview, "evisum,menu,show", "evisum");
+ }
+ else
+ {
+ elm_layout_text_set(picker->preview, "title", _("Evisum"));
+ elm_layout_text_set(picker->preview, "controls", "− □ ×");
+ }
+ elm_layout_text_set(picker->sample, "process", _("Process"));
+ elm_layout_text_set(picker->sample, "cpu", _("CPU"));
+ elm_layout_text_set(picker->sample, "row.1", "evisum");
+ elm_layout_text_set(picker->sample, "value.1", "3.2%");
+ elm_layout_text_set(picker->sample, "row.2", "explore");
+ elm_layout_text_set(picker->sample, "value.2", "1.1%");
+ elm_object_text_set(picker->status, theme == config()->global.theme ?
+ _("Current theme") : _("Preview"));
+ evas_object_show(picker->sample);
+ evas_object_show(picker->preview);
+}
+
+static void
+_theme_picker_selected(void *data, Evas_Object *list, void *event)
+{
+ Theme_Picker *picker = evas_object_data_get(list, "theme_picker");
+
+ if (event) _theme_picker_preview(picker, (uintptr_t) data);
+}
+
+static void
+_theme_picker_pack(Evas_Object *box, Evas_Object *child, double x, double y)
+{
+ evas_object_size_hint_weight_set(child, x, y);
+ evas_object_size_hint_align_set(child, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, child);
+ evas_object_show(child);
+}
+
static void
_theme_picker_open(void *data, Evas_Object *selector, void *event_info EINA_UNUSED)
{
- Evas_Object *popup = elm_popup_add(elm_object_top_widget_get(selector));
- Evas_Object *table = elm_table_add(popup);
- Evas_Object *group = NULL;
- unsigned int position = 0;
+ Evas_Object *parent = elm_object_top_widget_get(selector);
+ Evas_Object *existing = evas_object_data_get(parent, "theme_picker_window");
+ if (existing)
+ {
+ elm_win_raise(existing);
+ return;
+ }
- elm_object_part_text_set(popup, "title,text", _("Theme"));
- elm_popup_scrollable_set(popup, EINA_TRUE);
- evas_object_smart_callback_add(popup, "block,clicked", _theme_picker_close, popup);
- elm_table_homogeneous_set(table, EINA_TRUE);
- elm_table_padding_set(table, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(3));
+ Theme_Picker *picker = calloc(1, sizeof(*picker));
+ if (!picker) return;
+ Evas_Object *win = evisum_ui_window_add(parent, "themes", ELM_WIN_DIALOG_BASIC,
+ _("Evisum Themes"), EINA_FALSE);
+ if (!win)
+ {
+ free(picker);
+ return;
+ }
+
+ picker->ui = data;
+ efl_wref_add(parent, &picker->parent);
+ evas_object_data_set(parent, "theme_picker_window", win);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _theme_picker_deleted, picker);
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+
+ Evas_Object *content = elm_table_add(win);
+ evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evisum_ui_window_content_add(win, content, EINA_TRUE);
+ evas_object_show(content);
+
+ Evas_Object *bg = elm_bg_add(content);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(content, bg, 0, 0, 1, 1);
+ evas_object_show(bg);
+
+ Evas_Object *box = elm_box_add(content);
+ elm_box_padding_set(box, 0, ELM_SCALE_SIZE(8));
+ evas_object_size_hint_padding_set(box, ELM_SCALE_SIZE(8), ELM_SCALE_SIZE(8),
+ ELM_SCALE_SIZE(8), ELM_SCALE_SIZE(8));
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(content, box, 0, 0, 1, 1);
+ evas_object_show(box);
+
+ Evas_Object *body = elm_box_add(box);
+ elm_box_horizontal_set(body, EINA_TRUE);
+ elm_box_padding_set(body, ELM_SCALE_SIZE(12), 0);
+ _theme_picker_pack(box, body, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object *sidebar = elm_box_add(body);
+ _theme_picker_pack(body, sidebar, 0, EVAS_HINT_EXPAND);
+ Evas_Object *width_guide = evas_object_rectangle_add(evas_object_evas_get(sidebar));
+ evas_object_color_set(width_guide, 0, 0, 0, 0);
+ evas_object_pass_events_set(width_guide, EINA_TRUE);
+ evas_object_size_hint_min_set(width_guide, ELM_SCALE_SIZE(150), 0);
+ _theme_picker_pack(sidebar, width_guide, EVAS_HINT_EXPAND, 0);
+
+ Evas_Object *list = elm_list_add(sidebar);
+ elm_list_mode_set(list, ELM_LIST_COMPRESS);
+ evas_object_data_set(list, "theme_picker", picker);
+ _theme_picker_pack(sidebar, list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object *panel = elm_box_add(body);
+ elm_box_padding_set(panel, 0, ELM_SCALE_SIZE(6));
+ _theme_picker_pack(body, panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ picker->status = elm_label_add(panel);
+ _theme_picker_pack(panel, picker->status, EVAS_HINT_EXPAND, 0);
+ picker->preview = elm_layout_add(panel);
+ picker->sample = elm_layout_add(picker->preview);
+ evas_object_size_hint_min_set(picker->preview, ELM_SCALE_SIZE(235), ELM_SCALE_SIZE(188));
+ _theme_picker_pack(panel, picker->preview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ Evas_Object *buttons = elm_box_add(box);
+ elm_box_horizontal_set(buttons, EINA_TRUE);
+ elm_box_align_set(buttons, 1, 0.5);
+ elm_box_padding_set(buttons, ELM_SCALE_SIZE(6), 0);
+ _theme_picker_pack(box, buttons, EVAS_HINT_EXPAND, 0);
+ Evas_Object *close = elm_button_add(buttons);
+ elm_object_text_set(close, _("Close"));
+ evas_object_smart_callback_add(close, "clicked", _theme_picker_close, win);
+ _theme_picker_pack(buttons, close, 0, 0);
+ picker->apply = elm_button_add(buttons);
+ elm_object_text_set(picker->apply, _("Apply Theme"));
+ evas_object_smart_callback_add(picker->apply, "clicked", _theme_picker_apply, picker);
+ _theme_picker_pack(buttons, picker->apply, 0, 0);
+
+ Elm_Object_Item *current = NULL;
for (unsigned int i = 0; i < EINA_C_ARRAY_LENGTH(themes); i++)
{
- if (i && !_theme_file_find(i)) continue;
- Evas_Object *radio = elm_radio_add(table);
- elm_object_text_set(radio, _(themes[i].name));
- elm_radio_state_value_set(radio, i);
- if (group) elm_radio_group_add(radio, group);
- else group = radio;
- evas_object_size_hint_align_set(radio, 0, 0.5);
- evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, 0);
- elm_table_pack(table, radio, position % 2, position / 2, 1, 1);
- position++;
- evas_object_smart_callback_add(radio, "changed", _theme_selected, data);
- evas_object_show(radio);
+ const char *path = _theme_file_find(i);
+ if (i && !path) continue;
+ Evas_Object *icon = elm_icon_add(list);
+ if (path && elm_image_file_set(icon, path, "evisum/theme/icon"))
+ evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(24), ELM_SCALE_SIZE(24));
+ else
+ elm_icon_standard_set(icon, "preferences-desktop-theme");
+ Elm_Object_Item *item = elm_list_item_append(list, _(themes[i].name), icon, NULL,
+ _theme_picker_selected, (void *)(uintptr_t) i);
+ if (i == config()->global.theme) current = item;
}
- elm_radio_value_set(group, config()->global.theme);
- elm_object_content_set(popup, table);
- evas_object_show(table);
- evas_object_show(popup);
+ elm_list_go(list);
+ _theme_picker_preview(picker, config()->global.theme);
+ if (current)
+ {
+ elm_list_item_selected_set(current, EINA_TRUE);
+ elm_list_item_show(current);
+ }
+
+ evas_object_size_hint_min_set(win, ELM_SCALE_SIZE(440), ELM_SCALE_SIZE(280));
+ evas_object_resize(win, ELM_SCALE_SIZE(540), ELM_SCALE_SIZE(475));
+ elm_win_center(win, EINA_TRUE, EINA_TRUE);
+ evas_object_show(win);
+ elm_object_focus_set(list, EINA_TRUE);
}
void
@@ -314,7 +477,7 @@ _window_control_add(Evas_Object *controls, const char *style,
Evas_Object *button = elm_button_add(controls);
elm_object_style_set(button, style);
int button_size = ELM_SCALE_SIZE(30);
- int icon_size = ELM_SCALE_SIZE(19);
+ int icon_size = ELM_SCALE_SIZE(16);
evas_object_size_hint_min_set(button, button_size, button_size);
evas_object_size_hint_max_set(button, button_size, button_size);
evas_object_size_hint_align_set(button, 0.5, 0.5);
@@ -371,7 +534,7 @@ _window_frame_add(Evas_Object *win)
evas_object_data_set(win, "evisum_body", body);
Evas_Object *controls = elm_table_add(frame);
- elm_table_padding_set(controls, ELM_SCALE_SIZE(5), 0);
+ elm_table_padding_set(controls, ELM_SCALE_SIZE(3), 0);
if (!dialog)
{
Evas_Object *minimize = _window_control_add(controls, "evisum/window",
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.