Cockpit: echtes transluzentes Mica + Fluent-Dunkel-Tokens und Win11-Controls
Zweiter Durchgang: das Fenster wird jetzt transparent praesentiert, damit der
DWM-Mica-Backdrop wirklich durchscheint - nicht mehr nur eine opake Nachbildung.
- femtovg (GPU/GL) als Renderer unter Windows: der Software-Renderer praesentiert
ueber softbuffer/GDI ohne Alpha, der Backdrop kaeme nie durch. Faellt der GL-Start
fehl, bleibt es opak (durchscheinend=false) - Mac/headless unveraendert.
- schale.rs: DwmExtendFrameIntoClientArea mit Rand {-1,-1,-1,-1} ("sheet of glass")
zusaetzlich zu DWMSBT_MAINWINDOW; erst dadurch fuellt DWM die durchsichtigen Pixel
mit Mica statt mit dem Fenster dahinter.
- Fluent-Dunkel-Tokens statt Mac-Palette: transluzente Kartenfuellungen, Text
100/78.6/54.4 %, Akzent #60CDFF mit #0078D4-Fuellungen, Rot #C42B1C semantisch.
- Win11-Controls: Segmentschalter -> SelectorBar (kurzer Akzent-Indikator),
Toggle -> ToggleSwitch (40x20), Karten 8px / Knoepfe 4px, Caption-Tasten rechts.
Mac-Build unberuehrt (DWM/Schale hinter cfg(windows)); cargo test gruen (90).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Generated
+76
@@ -1045,6 +1045,26 @@ dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "femtovg"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31eebf3ab1b76359ccd5f850c07a7c6b2722c64d9127c40e02358e83f3ff9b1a"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"bytemuck",
|
||||
"fnv",
|
||||
"glow",
|
||||
"imgref",
|
||||
"itertools 0.15.0",
|
||||
"log",
|
||||
"rgb",
|
||||
"slotmap",
|
||||
"swash",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "field-offset"
|
||||
version = "0.3.6"
|
||||
@@ -1105,6 +1125,12 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
@@ -1296,6 +1322,28 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gbm"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"drm",
|
||||
"drm-fourcc",
|
||||
"gbm-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gbm-sys"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
@@ -1590,13 +1638,17 @@ dependencies = [
|
||||
"calloop 0.14.5",
|
||||
"cfg_aliases",
|
||||
"drm",
|
||||
"gbm",
|
||||
"glutin",
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-renderer-femtovg",
|
||||
"i-slint-renderer-software",
|
||||
"input",
|
||||
"libseat",
|
||||
"memmap2",
|
||||
"nix",
|
||||
"raw-window-handle",
|
||||
"xkbcommon",
|
||||
]
|
||||
|
||||
@@ -1614,6 +1666,7 @@ dependencies = [
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-femtovg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1646,6 +1699,7 @@ dependencies = [
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-femtovg",
|
||||
"i-slint-renderer-skia",
|
||||
"i-slint-renderer-software",
|
||||
"imgref",
|
||||
@@ -1786,6 +1840,27 @@ dependencies = [
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-femtovg"
|
||||
version = "1.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb0de504d57cdadf80c2abf7bcb8b7135a3716aee1f41b6ebb90ea93e3649d7c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"const-field-offset",
|
||||
"femtovg",
|
||||
"glow",
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"imgref",
|
||||
"lyon_path",
|
||||
"pin-weak",
|
||||
"rgb",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-skia"
|
||||
version = "1.18.1"
|
||||
@@ -3838,6 +3913,7 @@ dependencies = [
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-femtovg",
|
||||
"i-slint-renderer-software",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
|
||||
+5
-2
@@ -15,11 +15,14 @@ tungstenite = { version = "0.24", default-features = false, features = ["handsha
|
||||
ureq = { version = "2", default-features = false, features = ["json"] }
|
||||
# software-renderer-systemfonts: damit Segoe UI (Variable) echt gerendert wird, nicht die Notschrift.
|
||||
# raw-window-handle-06: gibt den rohen HWND her, damit die Windows-Schale DWM/Mica setzen kann.
|
||||
slint = { version = "1", default-features = false, features = ["std", "compat-1-2", "backend-winit", "renderer-software", "software-renderer-systemfonts", "raw-window-handle-06"] }
|
||||
# renderer-femtovg (GPU/GL): einziger Weg zu ECHTEM transluzentem Mica - der Software-Renderer
|
||||
# praesentiert unter Windows ueber softbuffer/GDI ohne Alpha, der Backdrop kaeme nie durch.
|
||||
# Das headless-Vorschaubild nutzt weiter den Software-Renderer (eigene Plattform in bild.rs).
|
||||
slint = { version = "1", default-features = false, features = ["std", "compat-1-2", "backend-winit", "renderer-software", "software-renderer-systemfonts", "renderer-femtovg", "raw-window-handle-06"] }
|
||||
|
||||
# Windows-Schale: Mica, dunkler Modus und runde Ecken per DWM auf dem rohen HWND.
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Graphics_Dwm"] }
|
||||
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Graphics_Dwm", "Win32_UI_Controls"] }
|
||||
raw-window-handle = "0.6"
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@@ -515,9 +515,26 @@ fn anlegen(adresse: Adresse, verbindung: Verbindung, ansicht: Ansicht) -> Result
|
||||
Ok(f)
|
||||
}
|
||||
|
||||
/// Versucht den GPU-Renderer (femtovg) zu waehlen - Voraussetzung fuer ECHTES transluzentes Mica,
|
||||
/// weil der Software-Renderer unter Windows ueber softbuffer/GDI ohne Alpha praesentiert. Gelingt es,
|
||||
/// darf das Fenster durchscheinend werden; sonst bleibt es beim deckenden Fluent-Grund.
|
||||
/// Muss vor dem ersten Fenster laufen (BackendSelector setzt das globale Backend).
|
||||
fn gpu_renderer_waehlen() -> bool {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
slint::BackendSelector::new().renderer_name("femtovg".into()).select().is_ok()
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Das Fenster mit einer festen Ansicht (ohne Server).
|
||||
pub fn fest(ansicht: Ansicht) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let durchscheinend = gpu_renderer_waehlen();
|
||||
let f = anlegen(Adresse::default(), Verbindung::Getrennt("kein Server (cockpit --live starten)".into()), ansicht)?;
|
||||
f.set_durchscheinend(durchscheinend);
|
||||
// Windows-Schale (Mica, dunkler Modus, runde Ecken); der Timer muss bis zum run()-Ende leben.
|
||||
#[cfg(target_os = "windows")]
|
||||
let _schale = crate::schale::einrichten(&f);
|
||||
@@ -527,7 +544,9 @@ pub fn fest(ansicht: Ansicht) -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
/// Das Fenster, live über `/ws`: der ws-Thread schiebt die Ansicht in den Event-Loop.
|
||||
pub fn live(url: String) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let durchscheinend = gpu_renderer_waehlen();
|
||||
let f = anlegen(adresse_aus(&url), Verbindung::Startet, Ansicht::default())?;
|
||||
f.set_durchscheinend(durchscheinend);
|
||||
// Windows-Schale (Mica, dunkler Modus, runde Ecken); der Timer muss bis zum run()-Ende leben.
|
||||
#[cfg(target_os = "windows")]
|
||||
let _schale = crate::schale::einrichten(&f);
|
||||
|
||||
@@ -7,7 +7,8 @@ use std::ffi::c_void;
|
||||
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
|
||||
use slint::ComponentHandle;
|
||||
use windows_sys::Win32::Foundation::HWND;
|
||||
use windows_sys::Win32::Graphics::Dwm::DwmSetWindowAttribute;
|
||||
use windows_sys::Win32::Graphics::Dwm::{DwmExtendFrameIntoClientArea, DwmSetWindowAttribute};
|
||||
use windows_sys::Win32::UI::Controls::MARGINS;
|
||||
|
||||
// DWM-Attribute als rohe Nummern: windows-sys benennt sie je Fassung anders, die Zahlen stehen fest.
|
||||
const DWMWA_USE_IMMERSIVE_DARK_MODE: u32 = 20;
|
||||
@@ -28,6 +29,12 @@ fn setze_attr(hwnd: HWND, attr: u32, wert: u32) {
|
||||
fn mica_auf(hwnd: HWND) {
|
||||
setze_attr(hwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
|
||||
setze_attr(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, DWMWCP_ROUND);
|
||||
// Rahmen in die GANZE Clientflaeche ziehen ("sheet of glass", Raender -1). Erst dadurch fuellt
|
||||
// DWM die durchsichtigen Pixel mit dem Backdrop (Mica) statt mit dem Fenster dahinter.
|
||||
let rand = MARGINS { cxLeftWidth: -1, cxRightWidth: -1, cyTopHeight: -1, cyBottomHeight: -1 };
|
||||
unsafe {
|
||||
DwmExtendFrameIntoClientArea(hwnd, &rand);
|
||||
}
|
||||
setze_attr(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, DWMSBT_MAINWINDOW);
|
||||
}
|
||||
|
||||
|
||||
+106
-56
@@ -2,25 +2,50 @@
|
||||
// Grundbausteine. Nichts hier kennt Poker; die Inhalte stehen in cash.slint und fenster.slint.
|
||||
// Masse und Farben sind aus einem Screenshot der Mac-App abgelesen (Radius 12, Karten #22252b ...).
|
||||
|
||||
// Fluent-Dark-Tokens (Windows 11). Die Flaechen sind TRANSLUZENTE Weiss-Schleier, damit der
|
||||
// Mica-Hintergrund durchscheint; scheint er nicht durch (Software-Renderer), sitzen dieselben
|
||||
// Schleier auf dem deckenden Grund #202020 und lesen genauso. Keine Apple-Nahschwarz-Hex mehr.
|
||||
export global Farbe {
|
||||
out property <color> grund: #16181c;
|
||||
out property <color> karte: #22252b;
|
||||
out property <color> feld: #2a2e35; // Auswahl, kleine Knoepfe auf Karten
|
||||
out property <color> knopf: #2f333b; // der Hauptknopf
|
||||
out property <color> linie: #ffffff14;
|
||||
out property <color> text: #e8eaed;
|
||||
out property <color> hell: #c7cbd1;
|
||||
out property <color> gedaempft: #8a8f98;
|
||||
out property <color> rot: #e5484d; // Echtgeld, Not-Aus
|
||||
out property <color> blau: #2d6cdf; // ausgewaehlt
|
||||
out property <color> blau-hell: #4f8cf0; // Werte, Icon der aktiven Karte
|
||||
out property <color> teal: #3fb98f; // Schalter, aktiver Reiter, Zuschauer
|
||||
out property <color> gruen: #57c78a;
|
||||
out property <color> bernstein: #e3b341;
|
||||
// Fluent (Win11): Akzent und die beiden Zustandsschleier fuer Hover/Pressed auf Flaechen.
|
||||
out property <color> akzent: #4cc2ff; // Win11-Akzent: Fokusrahmen, Hervorhebung
|
||||
out property <color> schwebe: #ffffff14; // Hover: zarter heller Schleier
|
||||
out property <color> druck: #ffffff0a; // Pressed: noch zarter (die Flaeche tritt zurueck)
|
||||
// Deckender Ersatzgrund, wenn Mica nicht durchscheint (Win11 Mica-Fallback SolidBackground #202020).
|
||||
out property <color> grund: #202020;
|
||||
|
||||
// Fluent-Textrampe dunkel: primaer 100 %, sekundaer 78.6 %, tertiaer 54.4 %, gesperrt 36.4 %.
|
||||
out property <color> text: #ffffff;
|
||||
out property <color> text2: #ffffffc9;
|
||||
out property <color> text3: #ffffff8b;
|
||||
out property <color> text-aus: #ffffff5d;
|
||||
// Alte Namen, auf die Rampe gelegt, damit der Inhalt unveraendert bleibt.
|
||||
out property <color> hell: #ffffffc9; // = sekundaerer Text
|
||||
out property <color> gedaempft: #ffffff8b; // = tertiaerer Text
|
||||
|
||||
// Schichten ueber Mica: zarte, transluzente Fuellungen + feine Striche (Fluent Layer/Card/Control).
|
||||
out property <color> karte: #ffffff0d; // CardBackgroundFillColorDefault ~5 %
|
||||
out property <color> karte-stark: #ffffff17; // gehobene/aktive Karte
|
||||
out property <color> feld: #ffffff10; // ControlFillColorDefault ~6 %
|
||||
out property <color> feld-schwebe: #ffffff17; // ControlFillColorSecondary (Hover)
|
||||
out property <color> feld-druck: #ffffff0a; // ControlFillColorTertiary (Pressed)
|
||||
out property <color> knopf: #ffffff10; // Hauptknopf: Fluent-Control-Fuellung
|
||||
out property <color> strich: #ffffff14; // ControlStrokeColorDefault
|
||||
out property <color> strich-stark: #ffffff9b; // ControlStrongStroke (Toggle-Rand aus)
|
||||
out property <color> linie: #ffffff12; // Card-Stroke / Trennlinien ~7 %
|
||||
|
||||
// Zustandsschleier fuer Flaechen ohne eigene Fuellung.
|
||||
out property <color> schwebe: #ffffff14; // Hover
|
||||
out property <color> druck: #ffffff0a; // Pressed (Flaeche tritt zurueck)
|
||||
|
||||
// Akzent (Win11): heller Akzent fuer Indikator/Fokus/Werte, #0078D4-Familie fuer Fuellungen.
|
||||
out property <color> akzent: #60cdff;
|
||||
out property <color> akzent-fuell: #0078d4;
|
||||
// Alte Namen -> Akzent (kein macOS-Blau/Teal mehr).
|
||||
out property <color> blau: #0078d4; // Auswahl-/Primaerfuellung
|
||||
out property <color> blau-hell: #60cdff; // Werte, Icon der aktiven Karte
|
||||
out property <color> teal: #60cdff; // aktiver Reiter / Zuschauer / Schalter
|
||||
|
||||
// Semantik: Echtgeld / Not-Aus (Win11-Rot-Familie), Meldungen gruen/bernstein.
|
||||
out property <color> rot: #c42b1c;
|
||||
out property <color> rot-hell: #e8605a;
|
||||
out property <color> gruen: #6ccb5a;
|
||||
out property <color> bernstein: #fce100;
|
||||
}
|
||||
|
||||
// ---- Zeichen -------------------------------------------------------------------------------
|
||||
@@ -98,6 +123,9 @@ export component Icon inherits Rectangle {
|
||||
// ---- Segmentschalter -----------------------------------------------------------------------
|
||||
// Die Kapsel "Zuschauer | Übung | Echtgeld": das gewaehlte Segment ist in seiner Farbe gefuellt.
|
||||
|
||||
// WinUI-SelectorBar: eine schlichte Reihe, das gewaehlte Item traegt unten einen kurzen
|
||||
// Akzent-Indikator (Farbe des Items - Echtgeld bleibt rot), Hover ist ein zarter Schleier.
|
||||
// KEINE grosse gefuellte Kapsel mehr (das war der macOS/iOS-Segmentschalter).
|
||||
export component Segmentschalter inherits Rectangle {
|
||||
in property <[string]> titel;
|
||||
in property <[color]> farben;
|
||||
@@ -105,23 +133,32 @@ export component Segmentschalter inherits Rectangle {
|
||||
in property <bool> gesperrt: false;
|
||||
callback gewaehlt(int);
|
||||
|
||||
height: 40px;
|
||||
border-radius: self.height / 2;
|
||||
background: #ffffff12;
|
||||
height: 36px;
|
||||
opacity: gesperrt ? 0.55 : 1;
|
||||
|
||||
HorizontalLayout {
|
||||
padding: 3px;
|
||||
spacing: 0px;
|
||||
spacing: 2px;
|
||||
for t[i] in titel: Rectangle {
|
||||
border-radius: (root.height - 6px) / 2;
|
||||
background: i == root.aktuell ? root.farben[i] : seg.has-hover ? Farbe.schwebe : transparent;
|
||||
border-radius: 4px;
|
||||
background: seg.pressed ? Farbe.feld-druck : seg.has-hover ? Farbe.schwebe : transparent;
|
||||
animate background { duration: 100ms; }
|
||||
Text {
|
||||
text: t;
|
||||
color: i == root.aktuell ? white : seg.has-hover ? Farbe.text : Farbe.gedaempft;
|
||||
color: i == root.aktuell ? Farbe.text : (seg.has-hover ? Farbe.text2 : Farbe.text3);
|
||||
font-size: 14px;
|
||||
font-weight: i == root.aktuell ? 700 : 600;
|
||||
font-weight: i == root.aktuell ? 600 : 400;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
// Akzent-Indikator unten mittig, nur am gewaehlten Item.
|
||||
Rectangle {
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: parent.height - 4px;
|
||||
width: 16px;
|
||||
height: 2.5px;
|
||||
border-radius: 1.25px;
|
||||
background: i == root.aktuell ? root.farben[i] : transparent;
|
||||
animate background { duration: 120ms; }
|
||||
}
|
||||
seg := TouchArea {
|
||||
enabled: !root.gesperrt;
|
||||
@@ -150,7 +187,9 @@ export component Statuskarte inherits Rectangle {
|
||||
callback angenommen(string);
|
||||
|
||||
background: Farbe.karte;
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
border-width: 1px;
|
||||
border-color: Farbe.linie;
|
||||
min-height: 84px;
|
||||
|
||||
VerticalLayout {
|
||||
@@ -240,10 +279,10 @@ export component Auswahl inherits Rectangle {
|
||||
callback gewaehlt(int);
|
||||
|
||||
height: 30px;
|
||||
background: aw.has-hover ? #333843 : Farbe.feld;
|
||||
border-radius: 6px;
|
||||
background: aw.pressed ? Farbe.feld-druck : aw.has-hover ? Farbe.feld-schwebe : Farbe.feld;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: Farbe.linie;
|
||||
border-color: Farbe.strich;
|
||||
animate background { duration: 100ms; }
|
||||
|
||||
HorizontalLayout {
|
||||
@@ -267,7 +306,8 @@ export component Auswahl inherits Rectangle {
|
||||
y: root.height + 2px;
|
||||
width: max(root.width, root.menue-breite);
|
||||
Rectangle {
|
||||
background: Farbe.feld;
|
||||
// Flyout: eigene, fast deckende Flaeche (Mica darf hier nicht durchwaschen).
|
||||
background: #2c2c2c;
|
||||
border-radius: 8px;
|
||||
border-width: 1px;
|
||||
border-color: Farbe.linie;
|
||||
@@ -275,14 +315,14 @@ export component Auswahl inherits Rectangle {
|
||||
padding: 4px;
|
||||
for o[i] in root.optionen: Rectangle {
|
||||
height: 30px;
|
||||
border-radius: 6px;
|
||||
background: ta.has-hover ? #ffffff14 : transparent;
|
||||
border-radius: 4px;
|
||||
background: ta.has-hover ? Farbe.schwebe : transparent;
|
||||
Text {
|
||||
x: 8px;
|
||||
text: o;
|
||||
color: i == root.index ? Farbe.blau-hell : Farbe.text;
|
||||
color: i == root.index ? Farbe.akzent : Farbe.text;
|
||||
font-size: 13px;
|
||||
font-weight: i == root.index ? 700 : 400;
|
||||
font-weight: i == root.index ? 600 : 400;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
ta := TouchArea { clicked => { root.gewaehlt(i); menue.close(); } }
|
||||
@@ -316,7 +356,9 @@ export component Stepper inherits Rectangle {
|
||||
Rectangle {
|
||||
width: 26px;
|
||||
background: Farbe.feld;
|
||||
border-radius: 8px;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: Farbe.strich;
|
||||
VerticalLayout {
|
||||
Rectangle {
|
||||
opacity: root.auf-ok ? 1 : 0.3;
|
||||
@@ -335,26 +377,34 @@ export component Stepper inherits Rectangle {
|
||||
|
||||
// ---- Toggle --------------------------------------------------------------------------------
|
||||
|
||||
// Win11 ToggleSwitch: aus = transparent mit 1px-Rand und gedaempftem Knauf; an = Akzent-Fuellung
|
||||
// mit weissem Knauf. 40x20 mit kleinem 12px-Knauf (nicht die macOS-Pille).
|
||||
export component Toggle inherits Rectangle {
|
||||
in property <bool> an;
|
||||
callback umgeschaltet();
|
||||
|
||||
width: 42px;
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
background: an ? Farbe.teal : #3a3e46;
|
||||
animate background { duration: 120ms; }
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
background: an ? Farbe.akzent-fuell : transparent;
|
||||
border-width: an ? 0px : 1px;
|
||||
border-color: Farbe.strich-stark;
|
||||
animate background { duration: 150ms; }
|
||||
|
||||
Rectangle {
|
||||
y: 2px;
|
||||
x: root.an ? root.width - self.width - 2px : 2px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
background: white;
|
||||
animate x { duration: 120ms; }
|
||||
y: (parent.height - self.height) / 2;
|
||||
x: root.an ? root.width - self.width - 4px : 4px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 6px;
|
||||
background: root.an ? white : Farbe.text2;
|
||||
animate x { duration: 150ms; }
|
||||
}
|
||||
TouchArea { clicked => { root.umgeschaltet(); } }
|
||||
ta := TouchArea { clicked => { root.umgeschaltet(); } }
|
||||
|
||||
states [
|
||||
schwebt when ta.has-hover && !root.an: { border-color: Farbe.text3; }
|
||||
]
|
||||
}
|
||||
|
||||
// ---- Formatkarte ---------------------------------------------------------------------------
|
||||
@@ -374,10 +424,10 @@ export component Formatkarte inherits Rectangle {
|
||||
property <bool> aktiv: anzahl > 0;
|
||||
|
||||
height: 56px;
|
||||
border-radius: 10px;
|
||||
background: aktiv ? #2d6cdf24 : Farbe.karte;
|
||||
border-width: 1.5px;
|
||||
border-color: aktiv ? Farbe.blau : transparent;
|
||||
border-radius: 8px;
|
||||
background: aktiv ? #0078d42e : Farbe.karte;
|
||||
border-width: 1px;
|
||||
border-color: aktiv ? Farbe.akzent : Farbe.linie;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: 10px;
|
||||
@@ -450,8 +500,8 @@ export component Werkzeugknopf inherits Rectangle {
|
||||
callback geklickt();
|
||||
|
||||
height: 52px;
|
||||
border-radius: 9px;
|
||||
background: ta.has-hover && aktiv ? #ffffff0d : transparent;
|
||||
border-radius: 4px;
|
||||
background: (ta.pressed && aktiv) ? Farbe.feld-druck : (ta.has-hover && aktiv) ? Farbe.schwebe : transparent;
|
||||
opacity: aktiv ? 1 : 0.4;
|
||||
|
||||
VerticalLayout {
|
||||
|
||||
+16
-13
@@ -88,7 +88,7 @@ export component CashInhalt inherits VerticalLayout {
|
||||
// 2) Modus-Leiste
|
||||
Segmentschalter {
|
||||
titel: ["Zuschauer", "Übung", "Echtgeld"];
|
||||
farben: [Farbe.teal, Farbe.blau, Farbe.rot];
|
||||
farben: [Farbe.akzent, Farbe.akzent, Farbe.rot];
|
||||
aktuell: root.lage.modus;
|
||||
gesperrt: root.lage.modus-gesperrt;
|
||||
gewaehlt(i) => { root.modus-gewaehlt(i); }
|
||||
@@ -96,8 +96,8 @@ export component CashInhalt inherits VerticalLayout {
|
||||
|
||||
// Rueckfrage, bevor Echtgeld einschaltet (ModusLeiste.swift `LiveFrage`)
|
||||
if root.lage.cash-frage: Rectangle {
|
||||
background: #e5484d1f;
|
||||
border-radius: 12px;
|
||||
background: #c42b1c24;
|
||||
border-radius: 8px;
|
||||
VerticalLayout {
|
||||
padding: 12px;
|
||||
spacing: 8px;
|
||||
@@ -117,17 +117,17 @@ export component CashInhalt inherits VerticalLayout {
|
||||
spacing: 8px;
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
background: abta.pressed ? Farbe.feld.darker(0.12) : abta.has-hover ? #333843 : Farbe.feld;
|
||||
border-radius: 4px;
|
||||
background: abta.pressed ? Farbe.feld-druck : abta.has-hover ? Farbe.feld-schwebe : Farbe.feld;
|
||||
border-width: 1px;
|
||||
border-color: Farbe.linie;
|
||||
border-color: Farbe.strich;
|
||||
animate background { duration: 100ms; }
|
||||
Text { text: "Abbrechen"; color: Farbe.text; font-size: 13px; font-weight: 600; }
|
||||
abta := TouchArea { clicked => { root.cash-abgebrochen(); } }
|
||||
}
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
border-radius: 4px;
|
||||
background: bsta.pressed ? Farbe.rot.darker(0.12) : bsta.has-hover ? Farbe.rot.brighter(0.12) : Farbe.rot;
|
||||
animate background { duration: 100ms; }
|
||||
Text { text: "Echtgeld einschalten"; color: white; font-size: 13px; font-weight: 700; }
|
||||
@@ -224,15 +224,18 @@ export component CashInhalt inherits VerticalLayout {
|
||||
Text { text: root.lage.zusammen; color: Farbe.gedaempft; font-size: 12px; vertical-alignment: center; }
|
||||
Rectangle {
|
||||
width: ausw-text.preferred-width + 22px;
|
||||
border-radius: 12px;
|
||||
background: root.lage.ausweichen ? Farbe.blau : #ffffff14;
|
||||
border-radius: 4px;
|
||||
background: root.lage.ausweichen ? Farbe.akzent-fuell : (awc.has-hover ? Farbe.feld-schwebe : Farbe.feld);
|
||||
border-width: root.lage.ausweichen ? 0px : 1px;
|
||||
border-color: Farbe.strich;
|
||||
animate background { duration: 100ms; }
|
||||
ausw-text := Text {
|
||||
text: "Ausweichen";
|
||||
color: root.lage.ausweichen ? white : Farbe.hell;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
TouchArea { clicked => { root.ausweichen-umschalten(); } }
|
||||
awc := TouchArea { clicked => { root.ausweichen-umschalten(); } }
|
||||
}
|
||||
}
|
||||
if root.lage.ausweichen: HorizontalLayout {
|
||||
@@ -303,7 +306,7 @@ export component CashInhalt inherits VerticalLayout {
|
||||
spacing: 10px;
|
||||
height: 56px;
|
||||
Rectangle {
|
||||
border-radius: 10px;
|
||||
border-radius: 4px;
|
||||
// Fluent: ruhend Farbe.knopf, beim Schweben heller, beim Druecken tritt die Flaeche zurueck.
|
||||
background: !root.lage.knopf-aktiv ? Farbe.knopf
|
||||
: kta.pressed ? Farbe.knopf.darker(0.12)
|
||||
@@ -334,7 +337,7 @@ export component CashInhalt inherits VerticalLayout {
|
||||
}
|
||||
Rectangle {
|
||||
width: 56px;
|
||||
border-radius: 10px;
|
||||
border-radius: 6px;
|
||||
// Not-Aus aktiv: der Knopf loest ihn (gruen, Play); sonst rot mit der Hand.
|
||||
background: root.lage.not-aus
|
||||
? (nta.has-hover ? #ffffff26 : #ffffff1a)
|
||||
@@ -354,7 +357,7 @@ export component CashInhalt inherits VerticalLayout {
|
||||
// 9) Werkzeugleiste
|
||||
Rectangle {
|
||||
height: 60px;
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
background: Farbe.karte;
|
||||
HorizontalLayout {
|
||||
padding: 4px;
|
||||
|
||||
@@ -66,7 +66,9 @@ export component Cockpit inherits Window {
|
||||
preferred-height: 900px;
|
||||
min-width: 380px;
|
||||
min-height: 520px;
|
||||
background: Farbe.grund;
|
||||
// Durchscheinend (echtes Mica) nur, wenn die Windows-Schale den GPU-Renderer bekommen hat;
|
||||
// sonst ein ehrlich deckender Fluent-Dunkelgrund. Siehe bruecke::backdrop_moeglich.
|
||||
background: root.durchscheinend ? transparent : Farbe.grund;
|
||||
|
||||
in property <CashZustand> lage <=> cash.lage;
|
||||
in property <[KartenZeile]> karten <=> cash.karten;
|
||||
@@ -74,6 +76,7 @@ export component Cockpit inherits Window {
|
||||
in-out property <bool> budget-tippt <=> cash.budget-tippt;
|
||||
in-out property <int> reiter: 0;
|
||||
in-out property <bool> maximiert: false;
|
||||
in-out property <bool> durchscheinend: false;
|
||||
|
||||
callback modus-gewaehlt <=> cash.modus-gewaehlt;
|
||||
callback cash-bestaetigt <=> cash.cash-bestaetigt;
|
||||
@@ -103,10 +106,13 @@ export component Cockpit inherits Window {
|
||||
callback ziehen(length, length);
|
||||
|
||||
// Der Schimmer oben: weinrot in Echtgeld und bei Not-Aus, sonst ein kuehles Blau.
|
||||
// Durchscheinend: eine transluzente Toenung ueber Mica, die nach unten klar wird.
|
||||
Rectangle {
|
||||
y: 0px;
|
||||
height: 180px;
|
||||
background: @linear-gradient(180deg, (root.lage.cash || root.lage.not-aus) ? #3b2026 : #1b2638 0%, Farbe.grund 100%);
|
||||
background: root.durchscheinend
|
||||
? @linear-gradient(180deg, (root.lage.cash || root.lage.not-aus) ? #3b2026cc : #1b2638cc 0%, #00000000 100%)
|
||||
: @linear-gradient(180deg, (root.lage.cash || root.lage.not-aus) ? #3b2026 : #1b2638 0%, Farbe.grund 100%);
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
|
||||
Reference in New Issue
Block a user