Files
pokerfreak/cockpit/ui/cash.slint
T
mmintelandClaude Opus 4.8 6d068f2c73 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>
2026-11-10 17:31:08 +01:00

373 lines
14 KiB
Plaintext

// Der Inhalt des Reiters "Cash": Modus, die drei Statuskarten, Tischzahl und -form, "Was spielen",
// Status, Hauptknopf mit Not-Aus und die Werkzeugleiste (Wurzel.swift `Kopfzeile`, ab ModusSchalter).
// Alles Gezeigte steht in `CashZustand`; was geschieht, geht ueber die Rueckrufe an Rust (bruecke.rs).
import { Farbe, Icon, Segmentschalter, Statuskarte, Auswahl, Stepper, Toggle, Formatkarte, Werkzeugknopf } from "bausteine.slint";
export struct KartenZeile {
id: string,
name: string,
hinweis: string,
symbol: string,
anzahl: int,
voll: bool,
rang: int,
}
export struct CashZustand {
modus: int, // 0 Zuschauer, 1 Uebung, 2 Echtgeld
modus-gesperrt: bool,
cash-frage: bool,
cash: bool,
tische-wert: string,
tische-fuss: string,
geld-titel: string,
geld-wert: string,
geld-fuss: string,
plan-titel: string,
plan-fuss: string,
plan-unendlich: bool,
sitzung-art: int, // 0 "immer N", 1 "ausgelost"
sitzung-immer: string,
stepper-text: string,
stepper-auf-ok: bool,
stepper-ab-ok: bool,
form: int, // 0 Multiway, 1 Heads-Up, 2 Beide
micro-only: bool,
zusammen: string,
ausweichen: bool,
ziel-text: string,
status-satz: string,
status-ton: color,
knopf-titel: string,
knopf-symbol: string,
knopf-farbe: color,
knopf-aktiv: bool,
beschaeftigt: bool,
not-aus: bool,
werkzeuge-aktiv: bool,
meldung: string,
meldung-ok: bool,
}
export component CashInhalt inherits VerticalLayout {
in property <CashZustand> lage;
in property <[KartenZeile]> karten;
in-out property <string> budget-feld;
in-out property <bool> budget-tippt;
callback modus-gewaehlt(int);
callback cash-bestaetigt();
callback cash-abgebrochen();
callback budget-gesetzt(string);
callback geld-oeffnen();
callback plan-oeffnen();
callback sitzung-art-gewaehlt(int);
callback stepper-auf();
callback stepper-ab();
callback form-gewaehlt(int);
callback micro-umschalten();
callback ausweichen-umschalten();
callback ziel-auf();
callback ziel-ab();
callback karte-plus(string);
callback karte-minus(string);
callback karte-vor(string);
callback knopf-gedrueckt();
callback not-aus();
callback werkzeug(string);
property <length> spalte: (self.width - 28px - 8px) / 2;
padding-left: 14px;
padding-right: 14px;
padding-top: 8px;
padding-bottom: 18px;
spacing: 12px;
// 2) Modus-Leiste
Segmentschalter {
titel: ["Zuschauer", "Übung", "Echtgeld"];
farben: [Farbe.akzent, Farbe.akzent, Farbe.rot];
aktuell: root.lage.modus;
gesperrt: root.lage.modus-gesperrt;
gewaehlt(i) => { root.modus-gewaehlt(i); }
}
// Rueckfrage, bevor Echtgeld einschaltet (ModusLeiste.swift `LiveFrage`)
if root.lage.cash-frage: Rectangle {
background: #c42b1c24;
border-radius: 8px;
VerticalLayout {
padding: 12px;
spacing: 8px;
HorizontalLayout {
spacing: 6px;
alignment: start;
Text { text: "⚠"; color: Farbe.rot; font-size: 14px; font-weight: 700; vertical-alignment: center; }
Text { text: "Echtgeld heißt echtes Geld"; color: Farbe.rot; font-size: 14px; font-weight: 700; vertical-alignment: center; }
}
Text {
text: "Der Läufer öffnet selbst Tische und setzt Geld.";
color: Farbe.gedaempft;
font-size: 12px;
wrap: word-wrap;
}
HorizontalLayout {
spacing: 8px;
Rectangle {
height: 32px;
border-radius: 4px;
background: abta.pressed ? Farbe.feld-druck : abta.has-hover ? Farbe.feld-schwebe : Farbe.feld;
border-width: 1px;
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: 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; }
bsta := TouchArea { clicked => { root.cash-bestaetigt(); } }
}
}
}
}
if !(root.lage.modus == 0): VerticalLayout {
spacing: 12px;
// 3) die drei Statuskarten
HorizontalLayout {
spacing: 8px;
Statuskarte {
titel: "Tische";
wert: root.lage.tische-wert;
fuss: root.lage.tische-fuss;
wert-groesse: root.lage.tische-wert.character-count > 3 ? 20px : 26px;
}
budget := Statuskarte {
titel: root.lage.geld-titel;
wert: root.lage.geld-wert;
fuss: root.lage.geld-fuss;
pfeil: true;
eingabe: root.lage.cash;
feld <=> root.budget-feld;
wert-groesse: root.lage.cash ? 26px : 20px;
wert-farbe: root.lage.cash ? Farbe.text : Farbe.gedaempft;
geklickt => { root.geld-oeffnen(); }
angenommen(t) => { root.budget-gesetzt(t); }
changed tippt => { root.budget-tippt = self.tippt; }
}
Statuskarte {
titel: "Plan";
wert: (root.lage.plan-unendlich && root.lage.plan-titel == "Dauerlauf" ? "∞ " : "") + root.lage.plan-titel;
fuss: root.lage.plan-fuss;
wert-groesse: 15px;
pfeil: true;
geklickt => { root.plan-oeffnen(); }
}
}
// 4) Tische je Sitzung
HorizontalLayout {
spacing: 8px;
height: 30px;
Text { text: "Tische je Sitzung"; color: Farbe.hell; font-size: 13px; font-weight: 600; vertical-alignment: center; }
Auswahl {
width: 112px;
optionen: [root.lage.sitzung-immer, "ausgelost"];
index: root.lage.sitzung-art;
gewaehlt(i) => { root.sitzung-art-gewaehlt(i); }
}
Rectangle { }
Stepper {
text: root.lage.stepper-text;
auf-ok: root.lage.stepper-auf-ok;
ab-ok: root.lage.stepper-ab-ok;
auf => { root.stepper-auf(); }
ab => { root.stepper-ab(); }
}
}
// 5) Tischform
HorizontalLayout {
spacing: 8px;
height: 30px;
Text { text: "Tischform"; color: Farbe.hell; font-size: 13px; font-weight: 600; vertical-alignment: center; }
Auswahl {
width: 112px;
optionen: ["Multiway", "Heads-Up", "Beide"];
index: root.lage.form;
gewaehlt(i) => { root.form-gewaehlt(i); }
}
Rectangle { }
Text { text: "Micro only"; color: Farbe.hell; font-size: 13px; font-weight: 600; vertical-alignment: center; }
Toggle {
y: (parent.height - self.height) / 2;
an: root.lage.micro-only;
umgeschaltet => { root.micro-umschalten(); }
}
}
// 6) Was spielen
VerticalLayout {
spacing: 8px;
HorizontalLayout {
spacing: 10px;
height: 24px;
Text { text: "Was spielen"; color: Farbe.gedaempft; font-size: 12px; font-weight: 600; vertical-alignment: center; }
Rectangle { }
Text { text: root.lage.zusammen; color: Farbe.gedaempft; font-size: 12px; vertical-alignment: center; }
Rectangle {
width: ausw-text.preferred-width + 22px;
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;
}
awc := TouchArea { clicked => { root.ausweichen-umschalten(); } }
}
}
if root.lage.ausweichen: HorizontalLayout {
spacing: 8px;
height: 30px;
Text {
text: root.lage.ziel-text;
color: Farbe.gedaempft;
font-size: 11px;
vertical-alignment: center;
overflow: elide;
}
Stepper { auf => { root.ziel-auf(); } ab => { root.ziel-ab(); } text: ""; }
}
Rectangle {
height: Math.ceil(root.karten.length / 2) * 64px - 8px;
for k[i] in root.karten: Formatkarte {
x: Math.mod(i, 2) * (root.spalte + 8px);
y: Math.floor(i / 2) * 64px;
width: root.spalte;
name: k.name;
hinweis: k.hinweis;
symbol: k.symbol;
anzahl: k.anzahl;
voll: k.voll;
rang: k.rang;
plus => { root.karte-plus(k.id); }
minus => { root.karte-minus(k.id); }
vorziehen => { root.karte-vor(k.id); }
}
}
}
}
// 7) Statuszeile
HorizontalLayout {
spacing: 9px;
alignment: start;
Rectangle {
width: 10px;
Rectangle {
width: 10px;
height: 10px;
y: 5px;
border-radius: 5px;
background: root.lage.status-ton;
}
}
Text {
text: root.lage.status-satz;
color: Farbe.text;
font-size: 15px;
font-weight: 600;
wrap: word-wrap;
horizontal-stretch: 1;
}
}
if root.lage.meldung != "": Text {
text: root.lage.meldung;
color: root.lage.meldung-ok ? Farbe.gruen : Farbe.bernstein;
font-size: 12px;
wrap: word-wrap;
}
// 8) Hauptknopf und Not-Aus
HorizontalLayout {
spacing: 10px;
height: 56px;
Rectangle {
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)
: kta.has-hover ? Farbe.knopf.brighter(0.16)
: Farbe.knopf;
border-width: 1px;
border-color: Farbe.linie;
opacity: root.lage.knopf-aktiv ? 1 : 0.55;
animate background { duration: 100ms; }
HorizontalLayout {
alignment: center;
spacing: 8px;
Icon {
art: root.lage.beschaeftigt ? "punkte" : root.lage.knopf-symbol;
farbe: root.lage.knopf-farbe;
groesse: 20px;
y: (parent.height - self.height) / 2;
}
Text {
text: root.lage.knopf-titel;
color: Farbe.text;
font-size: 16px;
font-weight: 700;
vertical-alignment: center;
}
}
kta := TouchArea { enabled: root.lage.knopf-aktiv; clicked => { root.knopf-gedrueckt(); } }
}
Rectangle {
width: 56px;
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)
: (nta.pressed ? Farbe.rot.darker(0.12) : nta.has-hover ? Farbe.rot.brighter(0.12) : Farbe.rot);
border-width: 1px;
border-color: root.lage.not-aus ? Farbe.gruen : #ffffff59;
animate background { duration: 100ms; }
Icon {
art: root.lage.not-aus ? "play" : "hand";
farbe: root.lage.not-aus ? Farbe.gruen : white;
groesse: 26px;
}
nta := TouchArea { clicked => { root.not-aus(); } }
}
}
// 9) Werkzeugleiste
Rectangle {
height: 60px;
border-radius: 8px;
background: Farbe.karte;
HorizontalLayout {
padding: 4px;
spacing: 2px;
Werkzeugknopf { art: "pause"; titel: "Pause"; aktiv: root.lage.werkzeuge-aktiv; geklickt => { root.werkzeug("pause"); } }
Werkzeugknopf { art: "nach-vorn"; titel: "Nach vorn"; aktiv: root.lage.werkzeuge-aktiv; geklickt => { root.werkzeug("tische_vorn"); } }
Werkzeugknopf { art: "anordnen"; titel: "Anordnen"; aktiv: root.lage.werkzeuge-aktiv; geklickt => { root.werkzeug("tische_anordnen"); } }
Werkzeugknopf { art: "foto"; titel: "Foto"; aktiv: root.lage.werkzeuge-aktiv; geklickt => { root.werkzeug("foto"); } }
Werkzeugknopf { art: "schliessen"; titel: "Schließen"; rot: true; aktiv: root.lage.werkzeuge-aktiv; geklickt => { root.werkzeug("tische_schliessen"); } }
}
}
}