The last cards change out of the old dress
Browse files at this commitd0ddef046458532f82456c9d495c0b3f7eb61a5cParent: d57e5d1- style
- the last cards change out of the old dress
1 changed file +534 -286
- crates/app/src/ui/cards.rs +534 -286
crates/app/src/ui/cards.rsmodified+534 -286
| @@ -1009,6 +1009,7 @@ impl Player { | |||
| 1009 | /// chord as well ([`cancels_export`]). | 1009 | /// chord as well ([`cancels_export`]). |
| 1010 | pub(crate) fn export_progress_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { | 1010 | pub(crate) fn export_progress_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 1011 | let export = self.exporting()?; | 1011 | let export = self.exporting()?; |
| 1012 | + let dark = self.darkroom; | ||
| 1012 | let progress = export.progress().clamp(0., 1.); | 1013 | let progress = export.progress().clamp(0., 1.); |
| 1013 | let elapsed = self | 1014 | let elapsed = self |
| 1014 | .export_started | 1015 | .export_started |
| @@ -1026,15 +1027,23 @@ impl Player { | |||
| 1026 | [one] => file_name(&one.path), | 1027 | [one] => file_name(&one.path), |
| 1027 | [first, rest @ ..] => format!("{} +{} more", file_name(&first.path), rest.len()), | 1028 | [first, rest @ ..] => format!("{} +{} more", file_name(&first.path), rest.len()), |
| 1028 | }; | 1029 | }; |
| 1029 | - let note = |text: SharedString| { | 1030 | + let note = |text: SharedString| match dark { |
| 1030 | - div() | 1031 | + true => dark_help(text).into_any_element(), |
| 1032 | + false => div() | ||
| 1031 | .flex_none() | 1033 | .flex_none() |
| 1032 | .px(px(6.)) | 1034 | .px(px(6.)) |
| 1033 | .text_size(px(11.)) | 1035 | .text_size(px(11.)) |
| 1034 | .text_color(rgb(FG_SECONDARY())) | 1036 | .text_color(rgb(FG_SECONDARY())) |
| 1035 | .child(text) | 1037 | .child(text) |
| 1038 | + .into_any_element(), | ||
| 1036 | }; | 1039 | }; |
| 1037 | let armed = self.cancel_armed; | 1040 | let armed = self.cancel_armed; |
| 1041 | + let percent_line: SharedString = format!( | ||
| 1042 | + "{}% · {} elapsed · {left}", | ||
| 1043 | + (progress * 100.) as u32, | ||
| 1044 | + clock(elapsed), | ||
| 1045 | + ) | ||
| 1046 | + .into(); | ||
| 1038 | Some( | 1047 | Some( |
| 1039 | scrim() | 1048 | scrim() |
| 1040 | .flex() | 1049 | .flex() |
| @@ -1054,8 +1063,10 @@ impl Player { | |||
| 1054 | .gap(px(6.)) | 1063 | .gap(px(6.)) |
| 1055 | .p(px(12.)) | 1064 | .p(px(12.)) |
| 1056 | .rounded(px(6.)) | 1065 | .rounded(px(6.)) |
| 1057 | - .bg(rgb(BG_RAISED())) | 1066 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1058 | - .child(div().flex_none().px(px(6.)).child("Exporting")) | 1067 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1068 | + .when(dark, |d| d.child(dark_card_head("Exporting", None))) | ||
| 1069 | + .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting"))) | ||
| 1059 | // The bar itself: the same number as the percentage | 1070 | // The bar itself: the same number as the percentage |
| 1060 | // below it, and it only ever moves forward -- the | 1071 | // below it, and it only ever moves forward -- the |
| 1061 | // worker's progress is a monotone `fetch_max`. | 1072 | // worker's progress is a monotone `fetch_max`. |
| @@ -1065,7 +1076,7 @@ impl Player { | |||
| 1065 | .mx(px(6.)) | 1076 | .mx(px(6.)) |
| 1066 | .h(px(6.)) | 1077 | .h(px(6.)) |
| 1067 | .rounded(px(3.)) | 1078 | .rounded(px(3.)) |
| 1068 | - .bg(rgb(BG_PANEL())) | 1079 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_PANEL() })) |
| 1069 | .child( | 1080 | .child( |
| 1070 | div() | 1081 | div() |
| 1071 | .h_full() | 1082 | .h_full() |
| @@ -1074,13 +1085,16 @@ impl Player { | |||
| 1074 | .bg(rgb(STATUS_PROGRESS())), | 1085 | .bg(rgb(STATUS_PROGRESS())), |
| 1075 | ), | 1086 | ), |
| 1076 | ) | 1087 | ) |
| 1077 | - .child(div().flex_none().px(px(6.)).text_size(px(11.)).child( | 1088 | + .when(dark, |d| d.child(dark_row_value(percent_line.clone()))) |
| 1078 | - SharedString::from(format!( | 1089 | + .when(!dark, |d| { |
| 1079 | - "{}% · {} elapsed · {left}", | 1090 | + d.child( |
| 1080 | - (progress * 100.) as u32, | 1091 | + div() |
| 1081 | - clock(elapsed), | 1092 | + .flex_none() |
| 1082 | - )), | 1093 | + .px(px(6.)) |
| 1083 | - )) | 1094 | + .text_size(px(11.)) |
| 1095 | + .child(percent_line.clone()), | ||
| 1096 | + ) | ||
| 1097 | + }) | ||
| 1084 | // The row that was picked, then the seats the worker | 1098 | // The row that was picked, then the seats the worker |
| 1085 | // actually opened -- so a fallback to the software | 1099 | // actually opened -- so a fallback to the software |
| 1086 | // encoder shows here rather than being invisible. | 1100 | // encoder shows here rather than being invisible. |
| @@ -1118,7 +1132,19 @@ impl Player { | |||
| 1118 | .flex() | 1132 | .flex() |
| 1119 | .gap(px(6.)) | 1133 | .gap(px(6.)) |
| 1120 | .justify_end() | 1134 | .justify_end() |
| 1121 | - .when(armed, |d| { | 1135 | + .when(armed && dark, |d| { |
| 1136 | + d.child(dark_ghost_button( | ||
| 1137 | + "export-keep", | ||
| 1138 | + "Keep exporting", | ||
| 1139 | + "", | ||
| 1140 | + true, | ||
| 1141 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1142 | + this.cancel_armed = false; | ||
| 1143 | + cx.notify(); | ||
| 1144 | + }), | ||
| 1145 | + )) | ||
| 1146 | + }) | ||
| 1147 | + .when(armed && !dark, |d| { | ||
| 1122 | d.child(control( | 1148 | d.child(control( |
| 1123 | "export-keep", | 1149 | "export-keep", |
| 1124 | 140., | 1150 | 140., |
| @@ -1133,27 +1159,44 @@ impl Player { | |||
| 1133 | }), | 1159 | }), |
| 1134 | )) | 1160 | )) |
| 1135 | }) | 1161 | }) |
| 1136 | - .child(control( | 1162 | + .when(dark, |d| { |
| 1137 | - "export-cancel", | 1163 | + d.child(dark_ghost_button( |
| 1138 | - 140., | 1164 | + "export-cancel", |
| 1139 | - BG_RAISED(), | 1165 | + "Cancel export", |
| 1140 | - None, | 1166 | + "", |
| 1141 | - "Cancel export", | 1167 | + armed, |
| 1142 | - match armed { | 1168 | + cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1143 | - true => "stops the worker and deletes the part file" | 1169 | + match this.cancel_armed { |
| 1144 | - .to_string(), | 1170 | + true => this.cancel_export(), |
| 1145 | - false => "asks first -- one press only offers the choice" | 1171 | + false => this.cancel_armed = true, |
| 1146 | - .to_string(), | 1172 | + } |
| 1147 | - }, | 1173 | + cx.notify(); |
| 1148 | - true, | 1174 | + }), |
| 1149 | - cx.listener(move |this, _: &ClickEvent, _, cx| { | 1175 | + )) |
| 1150 | - match this.cancel_armed { | 1176 | + }) |
| 1151 | - true => this.cancel_export(), | 1177 | + .when(!dark, |d| { |
| 1152 | - false => this.cancel_armed = true, | 1178 | + d.child(control( |
| 1153 | - } | 1179 | + "export-cancel", |
| 1154 | - cx.notify(); | 1180 | + 140., |
| 1155 | - }), | 1181 | + BG_RAISED(), |
| 1156 | - )), | 1182 | + None, |
| 1183 | + "Cancel export", | ||
| 1184 | + match armed { | ||
| 1185 | + true => "stops the worker and deletes the part file" | ||
| 1186 | + .to_string(), | ||
| 1187 | + false => "asks first -- one press only offers the choice" | ||
| 1188 | + .to_string(), | ||
| 1189 | + }, | ||
| 1190 | + true, | ||
| 1191 | + cx.listener(move |this, _: &ClickEvent, _, cx| { | ||
| 1192 | + match this.cancel_armed { | ||
| 1193 | + true => this.cancel_export(), | ||
| 1194 | + false => this.cancel_armed = true, | ||
| 1195 | + } | ||
| 1196 | + cx.notify(); | ||
| 1197 | + }), | ||
| 1198 | + )) | ||
| 1199 | + }), | ||
| 1157 | ), | 1200 | ), |
| 1158 | ), | 1201 | ), |
| 1159 | ) | 1202 | ) |
| @@ -1213,6 +1256,7 @@ impl Player { | |||
| 1213 | cx: &mut Context<Self>, | 1256 | cx: &mut Context<Self>, |
| 1214 | ) -> Option<impl IntoElement> { | 1257 | ) -> Option<impl IntoElement> { |
| 1215 | let (lane, idx) = self.eq_open?; | 1258 | let (lane, idx) = self.eq_open?; |
| 1259 | + let dark = self.darkroom; | ||
| 1216 | // The rate the engine filters this timeline at, so the drawn curve is | 1260 | // The rate the engine filters this timeline at, so the drawn curve is |
| 1217 | // the one those coefficients make -- near the top of the axis a 44.1 kHz | 1261 | // the one those coefficients make -- near the top of the axis a 44.1 kHz |
| 1218 | // clip and a 48 kHz one are not the same shape. | 1262 | // clip and a 48 kHz one are not the same shape. |
| @@ -1247,9 +1291,11 @@ impl Player { | |||
| 1247 | .w(px(EQ_HANDLE)) | 1291 | .w(px(EQ_HANDLE)) |
| 1248 | .h(px(EQ_HANDLE)) | 1292 | .h(px(EQ_HANDLE)) |
| 1249 | .rounded(px(EQ_HANDLE / 2.)) | 1293 | .rounded(px(EQ_HANDLE / 2.)) |
| 1250 | - .bg(rgb(match i == self.eq_band { | 1294 | + .bg(rgb(match (dark, i == self.eq_band) { |
| 1251 | - true => ACCENT_PRIMARY(), | 1295 | + (true, true) => INK1(), |
| 1252 | - false => FG_SECONDARY(), | 1296 | + (true, false) => INK3(), |
| 1297 | + (false, true) => ACCENT_PRIMARY(), | ||
| 1298 | + (false, false) => FG_SECONDARY(), | ||
| 1253 | })) | 1299 | })) |
| 1254 | }) | 1300 | }) |
| 1255 | .collect(); | 1301 | .collect(); |
| @@ -1262,7 +1308,7 @@ impl Player { | |||
| 1262 | .flex_none() | 1308 | .flex_none() |
| 1263 | .h(px(EQ_GRAPH_H)) | 1309 | .h(px(EQ_GRAPH_H)) |
| 1264 | .rounded(px(3.)) | 1310 | .rounded(px(3.)) |
| 1265 | - .bg(rgb(BG_HOVER_DIM())) | 1311 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() })) |
| 1266 | .cursor_pointer() | 1312 | .cursor_pointer() |
| 1267 | // The press picks the band under it *and* is already the first | 1313 | // The press picks the band under it *and* is already the first |
| 1268 | // sample of the drag, so a plain click sets a value. A second click | 1314 | // sample of the drag, so a plain click sets a value. A second click |
| @@ -1297,7 +1343,7 @@ impl Player { | |||
| 1297 | .left(relative(eq_x(*freq))) | 1343 | .left(relative(eq_x(*freq))) |
| 1298 | .w(px(1.)) | 1344 | .w(px(1.)) |
| 1299 | .h_full() | 1345 | .h_full() |
| 1300 | - .bg(rgb(EQ_GRID())) | 1346 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { EQ_GRID() })) |
| 1301 | }) | 1347 | }) |
| 1302 | .collect::<Vec<_>>(), | 1348 | .collect::<Vec<_>>(), |
| 1303 | ) | 1349 | ) |
| @@ -1309,14 +1355,22 @@ impl Player { | |||
| 1309 | .top(relative(eq_y(db))) | 1355 | .top(relative(eq_y(db))) |
| 1310 | .w_full() | 1356 | .w_full() |
| 1311 | .h(px(1.)) | 1357 | .h(px(1.)) |
| 1312 | - .bg(rgb(EQ_GRID())) | 1358 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { EQ_GRID() })) |
| 1313 | .child( | 1359 | .child( |
| 1314 | div() | 1360 | div() |
| 1315 | .absolute() | 1361 | .absolute() |
| 1316 | .left(px(4.)) | 1362 | .left(px(4.)) |
| 1317 | .top(px(-11.)) | 1363 | .top(px(-11.)) |
| 1318 | - .text_size(px(9.)) | 1364 | + .when(dark, |d| { |
| 1319 | - .text_color(rgb(FG_SECONDARY())) | 1365 | + d.type_style(type_scale::mono( |
| 1366 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 1367 | + gpui::FontWeight::MEDIUM, | ||
| 1368 | + )) | ||
| 1369 | + .text_color(rgb(INK3())) | ||
| 1370 | + }) | ||
| 1371 | + .when(!dark, |d| { | ||
| 1372 | + d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())) | ||
| 1373 | + }) | ||
| 1320 | .child(format!("{db:+.0}")), | 1374 | .child(format!("{db:+.0}")), |
| 1321 | ) | 1375 | ) |
| 1322 | })) | 1376 | })) |
| @@ -1327,7 +1381,7 @@ impl Player { | |||
| 1327 | .top(relative(0.5)) | 1381 | .top(relative(0.5)) |
| 1328 | .w_full() | 1382 | .w_full() |
| 1329 | .h(px(1.)) | 1383 | .h(px(1.)) |
| 1330 | - .bg(rgb(BG_HOVER())), | 1384 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER() })), |
| 1331 | ) | 1385 | ) |
| 1332 | .child(eq_curve(self.eq_params.clone(), sample_rate)) | 1386 | .child(eq_curve(self.eq_params.clone(), sample_rate)) |
| 1333 | .children(handles) | 1387 | .children(handles) |
| @@ -1341,8 +1395,14 @@ impl Player { | |||
| 1341 | .bottom(px(1.)) | 1395 | .bottom(px(1.)) |
| 1342 | .w(px(24.)) | 1396 | .w(px(24.)) |
| 1343 | .text_align(TextAlign::Center) | 1397 | .text_align(TextAlign::Center) |
| 1344 | - .text_size(px(9.)) | 1398 | + .when(dark, |d| { |
| 1345 | - .text_color(rgb(FG_SECONDARY())) | 1399 | + d.type_style(type_scale::mono( |
| 1400 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 1401 | + gpui::FontWeight::MEDIUM, | ||
| 1402 | + )) | ||
| 1403 | + .text_color(rgb(INK3())) | ||
| 1404 | + }) | ||
| 1405 | + .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY()))) | ||
| 1346 | .child(label) | 1406 | .child(label) |
| 1347 | })) | 1407 | })) |
| 1348 | .child( | 1408 | .child( |
| @@ -1350,8 +1410,14 @@ impl Player { | |||
| 1350 | .absolute() | 1410 | .absolute() |
| 1351 | .top(px(2.)) | 1411 | .top(px(2.)) |
| 1352 | .left(px(4.)) | 1412 | .left(px(4.)) |
| 1353 | - .text_size(px(9.)) | 1413 | + .when(dark, |d| { |
| 1354 | - .text_color(rgb(FG_SECONDARY())) | 1414 | + d.type_style(type_scale::mono( |
| 1415 | + type_scale::CHORD_METADATA_MIN_PX, | ||
| 1416 | + gpui::FontWeight::MEDIUM, | ||
| 1417 | + )) | ||
| 1418 | + .text_color(rgb(INK3())) | ||
| 1419 | + }) | ||
| 1420 | + .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY()))) | ||
| 1355 | .child(format!("+{EQ_GAIN_LIMIT:.0} dB")), | 1421 | .child(format!("+{EQ_GAIN_LIMIT:.0} dB")), |
| 1356 | ); | 1422 | ); |
| 1357 | // The bottom of the axis is not named: -12 dB would land in the same | 1423 | // The bottom of the axis is not named: -12 dB would land in the same |
| @@ -1404,7 +1470,8 @@ impl Player { | |||
| 1404 | .gap(px(2.)) | 1470 | .gap(px(2.)) |
| 1405 | .p(px(12.)) | 1471 | .p(px(12.)) |
| 1406 | .rounded(px(6.)) | 1472 | .rounded(px(6.)) |
| 1407 | - .bg(rgb(BG_RAISED())) | 1473 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1474 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) | ||
| 1408 | .child( | 1475 | .child( |
| 1409 | div() | 1476 | div() |
| 1410 | .id("eq-card-rows") | 1477 | .id("eq-card-rows") |
| @@ -1419,21 +1486,36 @@ impl Player { | |||
| 1419 | .gap(px(2.)) | 1486 | .gap(px(2.)) |
| 1420 | // Which clip, because the card is modal and the lane it | 1487 | // Which clip, because the card is modal and the lane it |
| 1421 | // was opened from is behind a scrim by the time it is up. | 1488 | // was opened from is behind a scrim by the time it is up. |
| 1422 | - .child(div().flex_none().px(px(6.)).child(format!( | 1489 | + .when(dark, |d| { |
| 1423 | - "Equalizer — {} clip {}", | 1490 | + d.child(dark_card_head( |
| 1424 | - lane.label(), | 1491 | + "Equalizer", |
| 1425 | - idx + 1 | 1492 | + Some(format!("{} clip {}", lane.label(), idx + 1).into()), |
| 1426 | - ))) | 1493 | + )) |
| 1427 | - .child( | 1494 | + }) |
| 1428 | - div() | 1495 | + .when(!dark, |d| { |
| 1429 | - .flex_none() | 1496 | + d.child(div().flex_none().px(px(6.)).child(format!( |
| 1430 | - .px(px(6.)) | 1497 | + "Equalizer — {} clip {}", |
| 1431 | - .text_size(px(11.)) | 1498 | + lane.label(), |
| 1432 | - .text_color(rgb(FG_SECONDARY())) | 1499 | + idx + 1 |
| 1433 | - .child(self.notices.front().cloned().unwrap_or_else(|| { | 1500 | + ))) |
| 1434 | - "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into() | 1501 | + }) |
| 1435 | - })), | 1502 | + .when(dark, |d| { |
| 1436 | - ) | 1503 | + d.child(dark_help(self.notices.front().cloned().unwrap_or_else(|| { |
| 1504 | + "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into() | ||
| 1505 | + }))) | ||
| 1506 | + }) | ||
| 1507 | + .when(!dark, |d| { | ||
| 1508 | + d.child( | ||
| 1509 | + div() | ||
| 1510 | + .flex_none() | ||
| 1511 | + .px(px(6.)) | ||
| 1512 | + .text_size(px(11.)) | ||
| 1513 | + .text_color(rgb(FG_SECONDARY())) | ||
| 1514 | + .child(self.notices.front().cloned().unwrap_or_else(|| { | ||
| 1515 | + "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into() | ||
| 1516 | + })), | ||
| 1517 | + ) | ||
| 1518 | + }) | ||
| 1437 | .child(graph) | 1519 | .child(graph) |
| 1438 | // Which band the keyboard is holding and every number it | 1520 | // Which band the keyboard is holding and every number it |
| 1439 | // is set to, each with the pair of buttons that moves it: | 1521 | // is set to, each with the pair of buttons that moves it: |
| @@ -1452,98 +1534,163 @@ impl Player { | |||
| 1452 | // by its key alone. | 1534 | // by its key alone. |
| 1453 | .flex_wrap() | 1535 | .flex_wrap() |
| 1454 | .gap(px(4.)) | 1536 | .gap(px(4.)) |
| 1455 | - .child( | 1537 | + .when(dark, |d| { |
| 1456 | - div() | 1538 | + d.child(dark_ghost_button( |
| 1457 | - .id("eq-reset") | 1539 | + "eq-reset", |
| 1458 | - .flex() | 1540 | + "Flatten all", |
| 1459 | - .flex_1() | 1541 | + "r", |
| 1460 | - .h(px(CONTROL_H)) | 1542 | + false, |
| 1461 | - .items_center() | 1543 | + cx.listener(|this, _: &ClickEvent, _, cx| { |
| 1462 | - .justify_center() | ||
| 1463 | - .rounded(px(3.)) | ||
| 1464 | - .bg(rgb(BG_SELECTED())) | ||
| 1465 | - .cursor_pointer() | ||
| 1466 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1467 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1468 | for band in &mut this.eq_params.bands { | 1544 | for band in &mut this.eq_params.bands { |
| 1469 | band.gain_db = 0.; | 1545 | band.gain_db = 0.; |
| 1470 | } | 1546 | } |
| 1471 | this.commit_eq(cx); | 1547 | this.commit_eq(cx); |
| 1472 | - })) | 1548 | + }), |
| 1473 | - .child("Flatten all"), | 1549 | + )) |
| 1474 | - ) | 1550 | + }) |
| 1551 | + .when(!dark, |d| { | ||
| 1552 | + d.child( | ||
| 1553 | + div() | ||
| 1554 | + .id("eq-reset") | ||
| 1555 | + .flex() | ||
| 1556 | + .flex_1() | ||
| 1557 | + .h(px(CONTROL_H)) | ||
| 1558 | + .items_center() | ||
| 1559 | + .justify_center() | ||
| 1560 | + .rounded(px(3.)) | ||
| 1561 | + .bg(rgb(BG_SELECTED())) | ||
| 1562 | + .cursor_pointer() | ||
| 1563 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1564 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1565 | + for band in &mut this.eq_params.bands { | ||
| 1566 | + band.gain_db = 0.; | ||
| 1567 | + } | ||
| 1568 | + this.commit_eq(cx); | ||
| 1569 | + })) | ||
| 1570 | + .child("Flatten all"), | ||
| 1571 | + ) | ||
| 1572 | + }) | ||
| 1475 | // The two that change how many bands there are. | 1573 | // The two that change how many bands there are. |
| 1476 | // The engine takes any cascade -- the count was | 1574 | // The engine takes any cascade -- the count was |
| 1477 | // only ever fixed because this card had no way | 1575 | // only ever fixed because this card had no way |
| 1478 | // to say otherwise. | 1576 | // to say otherwise. |
| 1479 | - .child( | 1577 | + .when(dark, |d| { |
| 1480 | - div() | 1578 | + d.child(dark_ghost_button( |
| 1481 | - .id("eq-add") | 1579 | + "eq-add", |
| 1482 | - .flex() | 1580 | + "Add band", |
| 1483 | - .flex_1() | 1581 | + "a", |
| 1484 | - .h(px(CONTROL_H)) | 1582 | + false, |
| 1485 | - .items_center() | 1583 | + cx.listener(|this, _: &ClickEvent, _, cx| { |
| 1486 | - .justify_center() | ||
| 1487 | - .rounded(px(3.)) | ||
| 1488 | - .bg(rgb(BG_PANEL())) | ||
| 1489 | - .cursor_pointer() | ||
| 1490 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1491 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1492 | this.add_band(cx) | 1584 | this.add_band(cx) |
| 1493 | - })) | 1585 | + }), |
| 1494 | - .child("Add band"), | 1586 | + )) |
| 1495 | - ) | 1587 | + }) |
| 1496 | - .child( | 1588 | + .when(!dark, |d| { |
| 1497 | - div() | 1589 | + d.child( |
| 1498 | - .id("eq-remove") | 1590 | + div() |
| 1499 | - .flex() | 1591 | + .id("eq-add") |
| 1500 | - .flex_1() | 1592 | + .flex() |
| 1501 | - .h(px(CONTROL_H)) | 1593 | + .flex_1() |
| 1502 | - .items_center() | 1594 | + .h(px(CONTROL_H)) |
| 1503 | - .justify_center() | 1595 | + .items_center() |
| 1504 | - .rounded(px(3.)) | 1596 | + .justify_center() |
| 1505 | - .bg(rgb(BG_PANEL())) | 1597 | + .rounded(px(3.)) |
| 1506 | - .cursor_pointer() | 1598 | + .bg(rgb(BG_PANEL())) |
| 1507 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 1599 | + .cursor_pointer() |
| 1508 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | 1600 | + .hover(|s| s.bg(rgb(BG_HOVER()))) |
| 1601 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1602 | + this.add_band(cx) | ||
| 1603 | + })) | ||
| 1604 | + .child("Add band"), | ||
| 1605 | + ) | ||
| 1606 | + }) | ||
| 1607 | + .when(dark, |d| { | ||
| 1608 | + d.child(dark_ghost_button( | ||
| 1609 | + "eq-remove", | ||
| 1610 | + "Remove band", | ||
| 1611 | + "x", | ||
| 1612 | + false, | ||
| 1613 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1509 | this.remove_band(cx) | 1614 | this.remove_band(cx) |
| 1510 | - })) | 1615 | + }), |
| 1511 | - .child("Remove band"), | 1616 | + )) |
| 1512 | - ) | 1617 | + }) |
| 1618 | + .when(!dark, |d| { | ||
| 1619 | + d.child( | ||
| 1620 | + div() | ||
| 1621 | + .id("eq-remove") | ||
| 1622 | + .flex() | ||
| 1623 | + .flex_1() | ||
| 1624 | + .h(px(CONTROL_H)) | ||
| 1625 | + .items_center() | ||
| 1626 | + .justify_center() | ||
| 1627 | + .rounded(px(3.)) | ||
| 1628 | + .bg(rgb(BG_PANEL())) | ||
| 1629 | + .cursor_pointer() | ||
| 1630 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1631 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1632 | + this.remove_band(cx) | ||
| 1633 | + })) | ||
| 1634 | + .child("Remove band"), | ||
| 1635 | + ) | ||
| 1636 | + }) | ||
| 1513 | // The analyser's switch, next to the one other | 1637 | // The analyser's switch, next to the one other |
| 1514 | // button the card has: `s` does the same, and a | 1638 | // button the card has: `s` does the same, and a |
| 1515 | // toggle only a keystroke can reach is one most | 1639 | // toggle only a keystroke can reach is one most |
| 1516 | // people never find. | 1640 | // people never find. |
| 1517 | - .child( | 1641 | + .when(dark, |d| { |
| 1518 | - div() | 1642 | + d.child(dark_ghost_button( |
| 1519 | - .id("eq-spectrum") | 1643 | + "eq-spectrum", |
| 1520 | - .flex() | 1644 | + match self.eq_spectrum { |
| 1521 | - .flex_1() | ||
| 1522 | - .h(px(CONTROL_H)) | ||
| 1523 | - .items_center() | ||
| 1524 | - .justify_center() | ||
| 1525 | - .rounded(px(3.)) | ||
| 1526 | - .bg(rgb(match self.eq_spectrum { | ||
| 1527 | - true => BG_SELECTED(), | ||
| 1528 | - false => BG_HOVER_DIM(), | ||
| 1529 | - })) | ||
| 1530 | - .cursor_pointer() | ||
| 1531 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1532 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1533 | - this.eq_spectrum = !this.eq_spectrum; | ||
| 1534 | - cx.notify(); | ||
| 1535 | - })) | ||
| 1536 | - .child(match self.eq_spectrum { | ||
| 1537 | true => "Spectrum on", | 1645 | true => "Spectrum on", |
| 1538 | false => "Spectrum off", | 1646 | false => "Spectrum off", |
| 1647 | + }, | ||
| 1648 | + "s", | ||
| 1649 | + self.eq_spectrum, | ||
| 1650 | + cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1651 | + this.eq_spectrum = !this.eq_spectrum; | ||
| 1652 | + cx.notify(); | ||
| 1539 | }), | 1653 | }), |
| 1540 | - ), | 1654 | + )) |
| 1655 | + }) | ||
| 1656 | + .when(!dark, |d| { | ||
| 1657 | + d.child( | ||
| 1658 | + div() | ||
| 1659 | + .id("eq-spectrum") | ||
| 1660 | + .flex() | ||
| 1661 | + .flex_1() | ||
| 1662 | + .h(px(CONTROL_H)) | ||
| 1663 | + .items_center() | ||
| 1664 | + .justify_center() | ||
| 1665 | + .rounded(px(3.)) | ||
| 1666 | + .bg(rgb(match self.eq_spectrum { | ||
| 1667 | + true => BG_SELECTED(), | ||
| 1668 | + false => BG_HOVER_DIM(), | ||
| 1669 | + })) | ||
| 1670 | + .cursor_pointer() | ||
| 1671 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1672 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | ||
| 1673 | + this.eq_spectrum = !this.eq_spectrum; | ||
| 1674 | + cx.notify(); | ||
| 1675 | + })) | ||
| 1676 | + .child(match self.eq_spectrum { | ||
| 1677 | + true => "Spectrum on", | ||
| 1678 | + false => "Spectrum off", | ||
| 1679 | + }), | ||
| 1680 | + ) | ||
| 1681 | + }), | ||
| 1541 | ), | 1682 | ), |
| 1542 | ) | 1683 | ) |
| 1543 | // The column's own line, on the card that needs it for | 1684 | // The column's own line, on the card that needs it for |
| 1544 | // the column's reason: a row nobody knows is under the | 1685 | // the column's reason: a row nobody knows is under the |
| 1545 | // fold is a row that is not there. | 1686 | // fold is a row that is not there. |
| 1546 | - .when(can_scroll, |d| { | 1687 | + .when(can_scroll && dark, |d| { |
| 1688 | + d.child(dark_help(match below > 1. { | ||
| 1689 | + true => "more below — scroll the card", | ||
| 1690 | + false => "the end — scroll up for the rest", | ||
| 1691 | + })) | ||
| 1692 | + }) | ||
| 1693 | + .when(can_scroll && !dark, |d| { | ||
| 1547 | d.child( | 1694 | d.child( |
| 1548 | div() | 1695 | div() |
| 1549 | .flex_none() | 1696 | .flex_none() |
| @@ -1573,6 +1720,7 @@ impl Player { | |||
| 1573 | /// value a hand on the pointer cannot reach at all, which is the same reason | 1720 | /// value a hand on the pointer cannot reach at all, which is the same reason |
| 1574 | /// [`Player::mbps_steppers`] exists. | 1721 | /// [`Player::mbps_steppers`] exists. |
| 1575 | pub(crate) fn eq_numbers(&self, picked: Option<&Band>, cx: &mut Context<Self>) -> impl IntoElement { | 1722 | pub(crate) fn eq_numbers(&self, picked: Option<&Band>, cx: &mut Context<Self>) -> impl IntoElement { |
| 1723 | + let dark = self.darkroom; | ||
| 1576 | let row = div() | 1724 | let row = div() |
| 1577 | .flex_none() | 1725 | .flex_none() |
| 1578 | .flex() | 1726 | .flex() |
| @@ -1583,29 +1731,37 @@ impl Player { | |||
| 1583 | .items_center() | 1731 | .items_center() |
| 1584 | .gap(px(10.)) | 1732 | .gap(px(10.)) |
| 1585 | .px(px(6.)) | 1733 | .px(px(6.)) |
| 1586 | - .text_size(px(11.)); | 1734 | + .when(!dark, |d| d.text_size(px(11.))); |
| 1587 | let Some(band) = picked.copied() else { | 1735 | let Some(band) = picked.copied() else { |
| 1588 | - return row.child("no bands — a adds one"); | 1736 | + return match dark { |
| 1737 | + true => row.child(dark_help("no bands — a adds one")), | ||
| 1738 | + false => row.child("no bands — a adds one"), | ||
| 1739 | + }; | ||
| 1589 | }; | 1740 | }; |
| 1590 | let step = |id: &'static str, | 1741 | let step = |id: &'static str, |
| 1591 | label: &'static str, | 1742 | label: &'static str, |
| 1592 | change: fn(&mut Band), | 1743 | change: fn(&mut Band), |
| 1593 | cx: &mut Context<Self>| { | 1744 | cx: &mut Context<Self>| { |
| 1594 | - div() | 1745 | + let on_click = cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1595 | - .id(id) | 1746 | + this.nudge_band(change, cx) |
| 1596 | - .flex() | 1747 | + }); |
| 1597 | - .w(px(HIT_MIN)) | 1748 | + match dark { |
| 1598 | - .h(px(HIT_MIN)) | 1749 | + true => dark_step_glyph(id, label == "+", on_click).into_any_element(), |
| 1599 | - .items_center() | 1750 | + false => div() |
| 1600 | - .justify_center() | 1751 | + .id(id) |
| 1601 | - .rounded(px(3.)) | 1752 | + .flex() |
| 1602 | - .bg(rgb(BG_PANEL())) | 1753 | + .w(px(HIT_MIN)) |
| 1603 | - .cursor_pointer() | 1754 | + .h(px(HIT_MIN)) |
| 1604 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 1755 | + .items_center() |
| 1605 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 1756 | + .justify_center() |
| 1606 | - this.nudge_band(change, cx) | 1757 | + .rounded(px(3.)) |
| 1607 | - })) | 1758 | + .bg(rgb(BG_PANEL())) |
| 1608 | - .child(label) | 1759 | + .cursor_pointer() |
| 1760 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 1761 | + .on_click(on_click) | ||
| 1762 | + .child(label) | ||
| 1763 | + .into_any_element(), | ||
| 1764 | + } | ||
| 1609 | }; | 1765 | }; |
| 1610 | let number = |value: String, | 1766 | let number = |value: String, |
| 1611 | ids: (&'static str, &'static str), | 1767 | ids: (&'static str, &'static str), |
| @@ -1615,15 +1771,23 @@ impl Player { | |||
| 1615 | .flex() | 1771 | .flex() |
| 1616 | .items_center() | 1772 | .items_center() |
| 1617 | .gap(px(4.)) | 1773 | .gap(px(4.)) |
| 1618 | - .child(div().child(value)) | 1774 | + .child(match dark { |
| 1775 | + true => dark_row_value(value).into_any_element(), | ||
| 1776 | + false => div().child(value).into_any_element(), | ||
| 1777 | + }) | ||
| 1619 | .child(step(ids.0, "−", by.0, cx)) | 1778 | .child(step(ids.0, "−", by.0, cx)) |
| 1620 | .child(step(ids.1, "+", by.1, cx)) | 1779 | .child(step(ids.1, "+", by.1, cx)) |
| 1621 | }; | 1780 | }; |
| 1622 | - row.child(format!( | 1781 | + row.child(match dark { |
| 1623 | - "Band {} of {}", | 1782 | + true => dark_help(format!( |
| 1624 | - self.eq_band + 1, | 1783 | + "Band {} of {}", |
| 1625 | - self.eq_params.bands.len() | 1784 | + self.eq_band + 1, |
| 1626 | - )) | 1785 | + self.eq_params.bands.len() |
| 1786 | + )) | ||
| 1787 | + .into_any_element(), | ||
| 1788 | + false => format!("Band {} of {}", self.eq_band + 1, self.eq_params.bands.len()) | ||
| 1789 | + .into_any_element(), | ||
| 1790 | + }) | ||
| 1627 | .child(number( | 1791 | .child(number( |
| 1628 | band_label(&band), | 1792 | band_label(&band), |
| 1629 | ("eq-freq-down", "eq-freq-up"), | 1793 | ("eq-freq-down", "eq-freq-up"), |
| @@ -2414,6 +2578,8 @@ impl Player { | |||
| 2414 | if !self.subtitle_style_open { | 2578 | if !self.subtitle_style_open { |
| 2415 | return None; | 2579 | return None; |
| 2416 | } | 2580 | } |
| 2581 | + let dark = self.darkroom; | ||
| 2582 | + let size_picked = self.subtitle_style_field == 0; | ||
| 2417 | let size_row = div() | 2583 | let size_row = div() |
| 2418 | .id("subtitle-size-row") | 2584 | .id("subtitle-size-row") |
| 2419 | .flex() | 2585 | .flex() |
| @@ -2423,40 +2589,62 @@ impl Player { | |||
| 2423 | .justify_between() | 2589 | .justify_between() |
| 2424 | .px(px(6.)) | 2590 | .px(px(6.)) |
| 2425 | .rounded(px(3.)) | 2591 | .rounded(px(3.)) |
| 2426 | - .bg(rgb(match self.subtitle_style_field == 0 { | 2592 | + .when(dark && size_picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 2427 | - true => BG_SELECTED(), | 2593 | + .when(!dark, |d| { |
| 2428 | - false => BG_PANEL(), | 2594 | + d.bg(rgb(match size_picked { |
| 2429 | - })) | 2595 | + true => BG_SELECTED(), |
| 2430 | - .child(div().text_color(rgb(FG_SECONDARY())).child("Size")) | 2596 | + false => BG_PANEL(), |
| 2597 | + })) | ||
| 2598 | + }) | ||
| 2599 | + .child( | ||
| 2600 | + div() | ||
| 2601 | + .when(dark, |d| d.child(dark_row_label("Size", size_picked))) | ||
| 2602 | + .when(!dark, |d| d.text_color(rgb(FG_SECONDARY())).child("Size")), | ||
| 2603 | + ) | ||
| 2431 | .child( | 2604 | .child( |
| 2432 | div() | 2605 | div() |
| 2433 | .flex() | 2606 | .flex() |
| 2434 | .items_center() | 2607 | .items_center() |
| 2435 | .gap(px(4.)) | 2608 | .gap(px(4.)) |
| 2436 | - .child(format!("{:.0}px", self.sub_text)) | 2609 | + .when(dark, |d| d.child(dark_row_value(format!("{:.0}px", self.sub_text)))) |
| 2610 | + .when(!dark, |d| d.child(format!("{:.0}px", self.sub_text))) | ||
| 2437 | .children([-1, 1].map(|steps: i32| { | 2611 | .children([-1, 1].map(|steps: i32| { |
| 2438 | - div() | 2612 | + let id = ("subtitle-size-step", usize::from(steps > 0)); |
| 2439 | - .id(("subtitle-size-step", usize::from(steps > 0))) | 2613 | + match dark { |
| 2440 | - .flex_none() | 2614 | + true => dark_step_glyph( |
| 2441 | - .w(px(HIT_MIN)) | 2615 | + id, |
| 2442 | - .h(px(KEYS_ROW_H)) | 2616 | + steps > 0, |
| 2443 | - .flex() | 2617 | + cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2444 | - .items_center() | 2618 | + this.subtitle_style_field = 0; |
| 2445 | - .justify_center() | 2619 | + this.nudge_sub_size(steps, cx); |
| 2446 | - .rounded(px(3.)) | 2620 | + }), |
| 2447 | - .bg(rgb(BG_PANEL())) | 2621 | + ) |
| 2448 | - .cursor_pointer() | 2622 | + .into_any_element(), |
| 2449 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2623 | + false => div() |
| 2450 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2624 | + .id(id) |
| 2451 | - this.subtitle_style_field = 0; | 2625 | + .flex_none() |
| 2452 | - this.nudge_sub_size(steps, cx); | 2626 | + .w(px(HIT_MIN)) |
| 2453 | - })) | 2627 | + .h(px(KEYS_ROW_H)) |
| 2454 | - .child(match steps > 0 { | 2628 | + .flex() |
| 2455 | - true => "+", | 2629 | + .items_center() |
| 2456 | - false => "−", | 2630 | + .justify_center() |
| 2457 | - }) | 2631 | + .rounded(px(3.)) |
| 2632 | + .bg(rgb(BG_PANEL())) | ||
| 2633 | + .cursor_pointer() | ||
| 2634 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 2635 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | ||
| 2636 | + this.subtitle_style_field = 0; | ||
| 2637 | + this.nudge_sub_size(steps, cx); | ||
| 2638 | + })) | ||
| 2639 | + .child(match steps > 0 { | ||
| 2640 | + true => "+", | ||
| 2641 | + false => "−", | ||
| 2642 | + }) | ||
| 2643 | + .into_any_element(), | ||
| 2644 | + } | ||
| 2458 | })), | 2645 | })), |
| 2459 | ); | 2646 | ); |
| 2647 | + let default_picked = self.subtitle_style_field == 1; | ||
| 2460 | let default_row = div() | 2648 | let default_row = div() |
| 2461 | .id("subtitle-family-row-default") | 2649 | .id("subtitle-family-row-default") |
| 2462 | .flex() | 2650 | .flex() |
| @@ -2465,17 +2653,23 @@ impl Player { | |||
| 2465 | .items_center() | 2653 | .items_center() |
| 2466 | .px(px(6.)) | 2654 | .px(px(6.)) |
| 2467 | .rounded(px(3.)) | 2655 | .rounded(px(3.)) |
| 2468 | - .bg(rgb(match self.subtitle_style_field == 1 { | 2656 | + .when(dark && default_picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 2469 | - true => BG_SELECTED(), | 2657 | + .when(!dark, |d| { |
| 2470 | - false => BG_PANEL(), | 2658 | + d.bg(rgb(match default_picked { |
| 2471 | - })) | 2659 | + true => BG_SELECTED(), |
| 2660 | + false => BG_PANEL(), | ||
| 2661 | + })) | ||
| 2662 | + }) | ||
| 2472 | .cursor_pointer() | 2663 | .cursor_pointer() |
| 2473 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2664 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) |
| 2474 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | 2665 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { |
| 2475 | this.set_sub_family(None, cx); | 2666 | this.set_sub_family(None, cx); |
| 2476 | })) | 2667 | })) |
| 2477 | - .child("System default"); | 2668 | + .when(dark, |d| d.child(dark_row_label("System default", default_picked))) |
| 2669 | + .when(!dark, |d| d.child("System default")); | ||
| 2478 | let family_rows = self.subtitle_fonts.iter().enumerate().map(|(n, name)| { | 2670 | let family_rows = self.subtitle_fonts.iter().enumerate().map(|(n, name)| { |
| 2671 | + let picked = self.subtitle_style_field == n + 2 | ||
| 2672 | + || self.sub_family.as_deref() == Some(name.as_str()); | ||
| 2479 | div() | 2673 | div() |
| 2480 | .id(("subtitle-family-row", n)) | 2674 | .id(("subtitle-family-row", n)) |
| 2481 | .flex() | 2675 | .flex() |
| @@ -2484,22 +2678,25 @@ impl Player { | |||
| 2484 | .items_center() | 2678 | .items_center() |
| 2485 | .px(px(6.)) | 2679 | .px(px(6.)) |
| 2486 | .rounded(px(3.)) | 2680 | .rounded(px(3.)) |
| 2487 | - .bg(rgb( | 2681 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 2488 | - match (self.subtitle_style_field == n + 2, self.sub_family.as_deref() == Some(name.as_str())) { | 2682 | + .when(!dark, |d| { |
| 2489 | - (true, _) | (false, true) => BG_SELECTED(), | 2683 | + d.bg(rgb(match picked { |
| 2490 | - _ => BG_PANEL(), | 2684 | + true => BG_SELECTED(), |
| 2491 | - }, | 2685 | + false => BG_PANEL(), |
| 2492 | - )) | 2686 | + })) |
| 2687 | + }) | ||
| 2493 | .cursor_pointer() | 2688 | .cursor_pointer() |
| 2494 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2689 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) |
| 2495 | .on_click(cx.listener({ | 2690 | .on_click(cx.listener({ |
| 2496 | let name = name.clone(); | 2691 | let name = name.clone(); |
| 2497 | move |this, _: &ClickEvent, _, cx| { | 2692 | move |this, _: &ClickEvent, _, cx| { |
| 2498 | this.set_sub_family(Some(name.clone()), cx); | 2693 | this.set_sub_family(Some(name.clone()), cx); |
| 2499 | } | 2694 | } |
| 2500 | })) | 2695 | })) |
| 2501 | - .child(name.clone()) | 2696 | + .when(dark, |d| d.child(dark_row_label(name.clone(), picked))) |
| 2697 | + .when(!dark, |d| d.child(name.clone())) | ||
| 2502 | }); | 2698 | }); |
| 2699 | + let help_text = "− and + move the size, or ↑↓ picks a row and ←→ moves it (held or pressed); a family row picks it outright — a click away or esc closes"; | ||
| 2503 | Some( | 2700 | Some( |
| 2504 | scrim() | 2701 | scrim() |
| 2505 | .flex() | 2702 | .flex() |
| @@ -2525,23 +2722,28 @@ impl Player { | |||
| 2525 | .gap(px(6.)) | 2722 | .gap(px(6.)) |
| 2526 | .p(px(12.)) | 2723 | .p(px(12.)) |
| 2527 | .rounded(px(6.)) | 2724 | .rounded(px(6.)) |
| 2528 | - .bg(rgb(BG_RAISED())) | 2725 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2529 | - .child( | 2726 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2530 | - div() | 2727 | + .when(dark, |d| d.child(dark_card_head("Subtitle style", None))) |
| 2531 | - .flex_none() | 2728 | + .when(!dark, |d| { |
| 2532 | - .px(px(6.)) | 2729 | + d.child( |
| 2533 | - .child("Subtitle style — font and size of the cue plate"), | 2730 | + div() |
| 2534 | - ) | 2731 | + .flex_none() |
| 2535 | - .child( | 2732 | + .px(px(6.)) |
| 2536 | - div() | 2733 | + .child("Subtitle style — font and size of the cue plate"), |
| 2537 | - .flex_none() | 2734 | + ) |
| 2538 | - .px(px(6.)) | 2735 | + }) |
| 2539 | - .text_size(px(11.)) | 2736 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 2540 | - .text_color(rgb(FG_SECONDARY())) | 2737 | + .when(!dark, |d| { |
| 2541 | - .child( | 2738 | + d.child( |
| 2542 | - "− and + move the size, or ↑↓ picks a row and ←→ moves it (held or pressed); a family row picks it outright — a click away or esc closes", | 2739 | + div() |
| 2543 | - ), | 2740 | + .flex_none() |
| 2544 | - ) | 2741 | + .px(px(6.)) |
| 2742 | + .text_size(px(11.)) | ||
| 2743 | + .text_color(rgb(FG_SECONDARY())) | ||
| 2744 | + .child(help_text), | ||
| 2745 | + ) | ||
| 2746 | + }) | ||
| 2545 | .child(size_row) | 2747 | .child(size_row) |
| 2546 | .child( | 2748 | .child( |
| 2547 | div() | 2749 | div() |
| @@ -2566,6 +2768,7 @@ impl Player { | |||
| 2566 | /// than over the lanes. | 2768 | /// than over the lanes. |
| 2567 | pub(crate) fn silence_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { | 2769 | pub(crate) fn silence_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 2568 | let (lane, idx) = self.silence_open?; | 2770 | let (lane, idx) = self.silence_open?; |
| 2771 | + let dark = self.darkroom; | ||
| 2569 | let cfg = self.silence; | 2772 | let cfg = self.silence; |
| 2570 | // The unit is a label, never a conversion: the threshold is a level | 2773 | // The unit is a label, never a conversion: the threshold is a level |
| 2571 | // below full scale whichever of the two the row says (`silence_dbfs`). | 2774 | // below full scale whichever of the two the row says (`silence_dbfs`). |
| @@ -2617,6 +2820,7 @@ impl Player { | |||
| 2617 | .into_iter() | 2820 | .into_iter() |
| 2618 | .enumerate() | 2821 | .enumerate() |
| 2619 | .map(|(n, (label, value))| { | 2822 | .map(|(n, (label, value))| { |
| 2823 | + let picked = n == self.silence_field; | ||
| 2620 | div() | 2824 | div() |
| 2621 | .id(("silence-row", n)) | 2825 | .id(("silence-row", n)) |
| 2622 | .flex() | 2826 | .flex() |
| @@ -2625,17 +2829,24 @@ impl Player { | |||
| 2625 | .justify_between() | 2829 | .justify_between() |
| 2626 | .px(px(6.)) | 2830 | .px(px(6.)) |
| 2627 | .rounded(px(3.)) | 2831 | .rounded(px(3.)) |
| 2628 | - .bg(rgb(match n == self.silence_field { | 2832 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 2629 | - true => BG_SELECTED(), | 2833 | + .when(!dark, |d| { |
| 2630 | - false => BG_PANEL(), | 2834 | + d.bg(rgb(match picked { |
| 2631 | - })) | 2835 | + true => BG_SELECTED(), |
| 2836 | + false => BG_PANEL(), | ||
| 2837 | + })) | ||
| 2838 | + }) | ||
| 2632 | .cursor_pointer() | 2839 | .cursor_pointer() |
| 2633 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2840 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) |
| 2634 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2841 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2635 | this.silence_field = n; | 2842 | this.silence_field = n; |
| 2636 | cx.notify(); | 2843 | cx.notify(); |
| 2637 | })) | 2844 | })) |
| 2638 | - .child(div().text_color(rgb(FG_SECONDARY())).child(label)) | 2845 | + .child( |
| 2846 | + div() | ||
| 2847 | + .when(dark, |d| d.child(dark_row_label(label, picked))) | ||
| 2848 | + .when(!dark, |d| d.text_color(rgb(FG_SECONDARY())).child(label)), | ||
| 2849 | + ) | ||
| 2639 | // The value and the two steps that move it. Every other | 2850 | // The value and the two steps that move it. Every other |
| 2640 | // card has something to drag or press; this one had the | 2851 | // card has something to drag or press; this one had the |
| 2641 | // arrow keys and nothing else, so a row was a setting a | 2852 | // arrow keys and nothing else, so a row was a setting a |
| @@ -2647,32 +2858,47 @@ impl Player { | |||
| 2647 | .flex() | 2858 | .flex() |
| 2648 | .items_center() | 2859 | .items_center() |
| 2649 | .gap(px(4.)) | 2860 | .gap(px(4.)) |
| 2650 | - .child(value) | 2861 | + .when(dark, |d| d.child(dark_row_value(value.clone()))) |
| 2862 | + .when(!dark, |d| d.child(value)) | ||
| 2651 | .children([-1, 1].map(|steps: i32| { | 2863 | .children([-1, 1].map(|steps: i32| { |
| 2652 | - div() | 2864 | + let id = ("silence-step", n * 2 + usize::from(steps > 0)); |
| 2653 | - .id(("silence-step", n * 2 + usize::from(steps > 0))) | 2865 | + match dark { |
| 2654 | - .flex_none() | 2866 | + true => dark_step_glyph( |
| 2655 | - .w(px(HIT_MIN)) | 2867 | + id, |
| 2656 | - .h(px(KEYS_ROW_H)) | 2868 | + steps > 0, |
| 2657 | - .flex() | 2869 | + cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2658 | - .items_center() | 2870 | + this.silence_field = n; |
| 2659 | - .justify_center() | 2871 | + this.nudge_silence(steps); |
| 2660 | - .rounded(px(3.)) | 2872 | + cx.notify(); |
| 2661 | - .bg(rgb(BG_PANEL())) | 2873 | + }), |
| 2662 | - .cursor_pointer() | 2874 | + ) |
| 2663 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2875 | + .into_any_element(), |
| 2664 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2876 | + false => div() |
| 2665 | - // Picked as well as moved: the row a | 2877 | + .id(id) |
| 2666 | - // press lands on is the row the arrows | 2878 | + .flex_none() |
| 2667 | - // carry on from. | 2879 | + .w(px(HIT_MIN)) |
| 2668 | - this.silence_field = n; | 2880 | + .h(px(KEYS_ROW_H)) |
| 2669 | - this.nudge_silence(steps); | 2881 | + .flex() |
| 2670 | - cx.notify(); | 2882 | + .items_center() |
| 2671 | - })) | 2883 | + .justify_center() |
| 2672 | - .child(match steps > 0 { | 2884 | + .rounded(px(3.)) |
| 2673 | - true => "+", | 2885 | + .bg(rgb(BG_PANEL())) |
| 2674 | - false => "−", | 2886 | + .cursor_pointer() |
| 2675 | - }) | 2887 | + .hover(|s| s.bg(rgb(BG_HOVER()))) |
| 2888 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | ||
| 2889 | + // Picked as well as moved: the row a | ||
| 2890 | + // press lands on is the row the arrows | ||
| 2891 | + // carry on from. | ||
| 2892 | + this.silence_field = n; | ||
| 2893 | + this.nudge_silence(steps); | ||
| 2894 | + cx.notify(); | ||
| 2895 | + })) | ||
| 2896 | + .child(match steps > 0 { | ||
| 2897 | + true => "+", | ||
| 2898 | + false => "−", | ||
| 2899 | + }) | ||
| 2900 | + .into_any_element(), | ||
| 2901 | + } | ||
| 2676 | })), | 2902 | })), |
| 2677 | ) | 2903 | ) |
| 2678 | }) | 2904 | }) |
| @@ -2680,23 +2906,37 @@ impl Player { | |||
| 2680 | // The two buttons the ask names, side by side: a mode toggle would hide | 2906 | // The two buttons the ask names, side by side: a mode toggle would hide |
| 2681 | // one of them behind the other, and there are only two. | 2907 | // one of them behind the other, and there are only two. |
| 2682 | let button = |n: usize, text: String, act: fn(&mut Self, &mut Context<Self>)| { | 2908 | let button = |n: usize, text: String, act: fn(&mut Self, &mut Context<Self>)| { |
| 2683 | - div() | 2909 | + let enabled = found != 0; |
| 2684 | - .id(("silence-apply", n)) | 2910 | + match dark { |
| 2685 | - .flex_1() | 2911 | + true => dark_ghost_button( |
| 2686 | - .flex() | 2912 | + ("silence-apply", n), |
| 2687 | - .min_h(px(KEYS_ROW_H)) | 2913 | + text, |
| 2688 | - .items_center() | 2914 | + "", |
| 2689 | - .justify_center() | 2915 | + enabled, |
| 2690 | - .rounded(px(3.)) | 2916 | + cx.listener(move |this, _: &ClickEvent, _, cx| act(this, cx)), |
| 2691 | - .bg(rgb(match found { | 2917 | + ) |
| 2692 | - 0 => BG_PANEL(), | 2918 | + .into_any_element(), |
| 2693 | - _ => BG_SELECTED(), | 2919 | + false => div() |
| 2694 | - })) | 2920 | + .id(("silence-apply", n)) |
| 2695 | - .cursor_pointer() | 2921 | + .flex_1() |
| 2696 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2922 | + .flex() |
| 2697 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| act(this, cx))) | 2923 | + .min_h(px(KEYS_ROW_H)) |
| 2698 | - .child(text) | 2924 | + .items_center() |
| 2925 | + .justify_center() | ||
| 2926 | + .rounded(px(3.)) | ||
| 2927 | + .bg(rgb(match found { | ||
| 2928 | + 0 => BG_PANEL(), | ||
| 2929 | + _ => BG_SELECTED(), | ||
| 2930 | + })) | ||
| 2931 | + .cursor_pointer() | ||
| 2932 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | ||
| 2933 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| act(this, cx))) | ||
| 2934 | + .child(text) | ||
| 2935 | + .into_any_element(), | ||
| 2936 | + } | ||
| 2699 | }; | 2937 | }; |
| 2938 | + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); | ||
| 2939 | + let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes"; | ||
| 2700 | Some( | 2940 | Some( |
| 2701 | scrim() | 2941 | scrim() |
| 2702 | .flex() | 2942 | .flex() |
| @@ -2726,33 +2966,41 @@ impl Player { | |||
| 2726 | .gap(px(6.)) | 2966 | .gap(px(6.)) |
| 2727 | .p(px(12.)) | 2967 | .p(px(12.)) |
| 2728 | .rounded(px(6.)) | 2968 | .rounded(px(6.)) |
| 2729 | - .bg(rgb(BG_RAISED())) | 2969 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2730 | - .child(div().flex_none().px(px(6.)).child(format!( | 2970 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2731 | - "Silences — {} clip {}", | 2971 | + .when(dark, |d| d.child(dark_card_head("Silences", Some(head_meta.clone())))) |
| 2732 | - lane.label(), | 2972 | + .when(!dark, |d| { |
| 2733 | - idx + 1 | 2973 | + d.child(div().flex_none().px(px(6.)).child(format!( |
| 2734 | - ))) | 2974 | + "Silences — {} clip {}", |
| 2735 | - .child( | 2975 | + lane.label(), |
| 2736 | - div() | 2976 | + idx + 1 |
| 2737 | - .flex_none() | 2977 | + ))) |
| 2738 | - .px(px(6.)) | 2978 | + }) |
| 2739 | - .text_size(px(11.)) | 2979 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 2740 | - .text_color(rgb(FG_SECONDARY())) | 2980 | + .when(!dark, |d| { |
| 2741 | - .child( | 2981 | + d.child( |
| 2742 | - "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes", | 2982 | + div() |
| 2743 | - ), | 2983 | + .flex_none() |
| 2744 | - ) | 2984 | + .px(px(6.)) |
| 2985 | + .text_size(px(11.)) | ||
| 2986 | + .text_color(rgb(FG_SECONDARY())) | ||
| 2987 | + .child(help_text), | ||
| 2988 | + ) | ||
| 2989 | + }) | ||
| 2745 | .children(rows) | 2990 | .children(rows) |
| 2746 | - .child( | 2991 | + .when(dark, |d| d.child(dark_help(status.clone()))) |
| 2747 | - div() | 2992 | + .when(!dark, |d| { |
| 2748 | - .flex_none() | 2993 | + d.child( |
| 2749 | - .px(px(6.)) | 2994 | + div() |
| 2750 | - .text_color(rgb(match (&self.silence_scan, found) { | 2995 | + .flex_none() |
| 2751 | - (None, 1..) => ACCENT_PRIMARY(), | 2996 | + .px(px(6.)) |
| 2752 | - _ => FG_SECONDARY(), | 2997 | + .text_color(rgb(match (&self.silence_scan, found) { |
| 2753 | - })) | 2998 | + (None, 1..) => ACCENT_PRIMARY(), |
| 2754 | - .child(status), | 2999 | + _ => FG_SECONDARY(), |
| 2755 | - ) | 3000 | + })) |
| 3001 | + .child(status), | ||
| 3002 | + ) | ||
| 3003 | + }) | ||
| 2756 | .child(div().flex().gap(px(4.)).children([ | 3004 | .child(div().flex().gap(px(4.)).children([ |
| 2757 | button(0, "Cut them out (enter)".into(), Self::cut_silences), | 3005 | button(0, "Cut them out (enter)".into(), Self::cut_silences), |
| 2758 | button( | 3006 | button( |