A settings page for the project and the editor
Browse files at this commit5178f3fd3bdb6d2b3e6034f33b19d7ccebbc7573Parent: 0e6e486- feat
- a settings page for the project and the editor
9 changed files +326 -2
- crates/app/src/keymap.rs +18 -1
- crates/app/src/main.rs +6 -0
- crates/app/src/oracle.rs +5 -1
- crates/app/src/player/actions.rs +1 -0
- crates/app/src/player/cards.rs +18 -0
- crates/app/src/ui/mod.rs +1 -0
- crates/app/src/ui/settings_stance.rs +269 -0
- crates/app/src/ui/spine_stance.rs +6 -0
- crates/app/src/ui/stance.rs +2 -0
crates/app/src/keymap.rsmodified+18 -1
| @@ -210,6 +210,14 @@ actions! { | |||
| 210 | /// The cue plate's font and size -- a person's own preference, kept | 210 | /// The cue plate's font and size -- a person's own preference, kept |
| 211 | /// beside the theme and not the project, and opened the same way. | 211 | /// beside the theme and not the project, and opened the same way. |
| 212 | SubtitleStyle, | 212 | SubtitleStyle, |
| 213 | + /// The settings page: PROJECT rows (resolution, fps, sample-rate, HDR | ||
| 214 | + /// tonemap, the mix) beside EDITOR rows (proxies, auto-proxies, subtitle | ||
| 215 | + /// font) -- one door, two clearly-headed sections, per the split rule | ||
| 216 | + /// that "anything that changes the rendered output or lives in the | ||
| 217 | + /// project file is PROJECT; anything about this machine, this person, | ||
| 218 | + /// this window is EDITOR." Always answerable, same as `Theme`: it is | ||
| 219 | + /// about the editor and the project's own numbers, not about a clip. | ||
| 220 | + Settings, | ||
| 213 | } | 221 | } |
| 214 | 222 | ||
| 215 | impl ActionId { | 223 | impl ActionId { |
| @@ -290,6 +298,7 @@ impl ActionId { | |||
| 290 | ActionId::ShowActions => "All actions and their keys…", | 298 | ActionId::ShowActions => "All actions and their keys…", |
| 291 | ActionId::Screenshot => "Save the frame on screen as a PNG", | 299 | ActionId::Screenshot => "Save the frame on screen as a PNG", |
| 292 | ActionId::SubtitleStyle => "Subtitle style: font and size…", | 300 | ActionId::SubtitleStyle => "Subtitle style: font and size…", |
| 301 | + ActionId::Settings => "Settings: project and editor…", | ||
| 293 | } | 302 | } |
| 294 | } | 303 | } |
| 295 | 304 | ||
| @@ -368,6 +377,7 @@ impl ActionId { | |||
| 368 | ActionId::ShowActions => "show-actions", | 377 | ActionId::ShowActions => "show-actions", |
| 369 | ActionId::Screenshot => "screenshot", | 378 | ActionId::Screenshot => "screenshot", |
| 370 | ActionId::SubtitleStyle => "subtitle-style", | 379 | ActionId::SubtitleStyle => "subtitle-style", |
| 380 | + ActionId::Settings => "settings", | ||
| 371 | } | 381 | } |
| 372 | } | 382 | } |
| 373 | 383 | ||
| @@ -448,7 +458,10 @@ impl ActionId { | |||
| 448 | | ActionId::SubtitleStyle | 458 | | ActionId::SubtitleStyle |
| 449 | // ...and whether that window fills the screen: a way of looking, | 459 | // ...and whether that window fills the screen: a way of looking, |
| 450 | // same as the zoom and the theme beside it. | 460 | // same as the zoom and the theme beside it. |
| 451 | - | ActionId::Fullscreen => Category::View, | 461 | + | ActionId::Fullscreen |
| 462 | + // The settings page: it changes no clip and no lane, only the | ||
| 463 | + // project's own numbers and this window's preferences. | ||
| 464 | + | ActionId::Settings => Category::View, | ||
| 452 | ActionId::Cut | 465 | ActionId::Cut |
| 453 | | ActionId::Regroup | 466 | | ActionId::Regroup |
| 454 | | ActionId::Detach | 467 | | ActionId::Detach |
| @@ -1205,6 +1218,10 @@ impl Keymap { | |||
| 1205 | // opened as often as the theme, not a switch thrown once a | 1218 | // opened as often as the theme, not a switch thrown once a |
| 1206 | // session. | 1219 | // session. |
| 1207 | b(ActionId::SubtitleStyle, "y", false), | 1220 | b(ActionId::SubtitleStyle, "y", false), |
| 1221 | + // The consumer-editor convention (Cmd/Ctrl+,) -- free here: | ||
| 1222 | + // bare "," is WalkCutPrev, and nothing else answers to the | ||
| 1223 | + // ctrl chord. | ||
| 1224 | + b(ActionId::Settings, ",", true), | ||
| 1208 | ], | 1225 | ], |
| 1209 | } | 1226 | } |
| 1210 | } | 1227 | } |
crates/app/src/main.rsmodified+6 -0
| @@ -500,6 +500,11 @@ struct Player { | |||
| 500 | /// pointer: a stroke or a click meant for a row must not also cut the | 500 | /// pointer: a stroke or a click meant for a row must not also cut the |
| 501 | /// timeline. | 501 | /// timeline. |
| 502 | keys_open: bool, | 502 | keys_open: bool, |
| 503 | + /// The settings page is up (`?` overlay's sibling, but a latch rather | ||
| 504 | + /// than a hold -- it carries clickable rows, not a glance-and-release | ||
| 505 | + /// list). Cleared by [`Player::close_card`], the one reset list every | ||
| 506 | + /// opener routes through. | ||
| 507 | + settings_open: bool, | ||
| 503 | /// What has been typed into the card's search box, which is the card's own | 508 | /// What has been typed into the card's search box, which is the card's own |
| 504 | /// input exactly as the export card's digits are (nothing in it takes | 509 | /// input exactly as the export card's digits are (nothing in it takes |
| 505 | /// focus, so the root's key handler is the field). Emptied every time the | 510 | /// focus, so the root's key handler is the field). Emptied every time the |
| @@ -944,6 +949,7 @@ fn main() { | |||
| 944 | autosave_armed: false, | 949 | autosave_armed: false, |
| 945 | keymap: keymap.clone(), | 950 | keymap: keymap.clone(), |
| 946 | keys_open: false, | 951 | keys_open: false, |
| 952 | + settings_open: false, | ||
| 947 | keys_search: String::new(), | 953 | keys_search: String::new(), |
| 948 | keys_scroll: ScrollHandle::new(), | 954 | keys_scroll: ScrollHandle::new(), |
| 949 | lanes_scroll: ScrollHandle::new(), | 955 | lanes_scroll: ScrollHandle::new(), |
crates/app/src/oracle.rsmodified+5 -1
| @@ -102,7 +102,11 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { | |||
| 102 | // touching no timeline, live through an export the same way. | 102 | // touching no timeline, live through an export the same way. |
| 103 | // ...and the cue plate's own font and size: a reading preference like the | 103 | // ...and the cue plate's own font and size: a reading preference like the |
| 104 | // theme, never burned into an export, live the same way. | 104 | // theme, never burned into an export, live the same way. |
| 105 | - if action == ActionId::Theme || action == ActionId::Fullscreen || action == ActionId::SubtitleStyle { | 105 | + if action == ActionId::Theme |
| 106 | + || action == ActionId::Fullscreen | ||
| 107 | + || action == ActionId::SubtitleStyle | ||
| 108 | + || action == ActionId::Settings | ||
| 109 | + { | ||
| 106 | return Enable::Yes; | 110 | return Enable::Yes; |
| 107 | } | 111 | } |
| 108 | if action == ActionId::ShowActions { | 112 | if action == ActionId::ShowActions { |
crates/app/src/player/actions.rsmodified+1 -0
| @@ -163,6 +163,7 @@ impl Player { | |||
| 163 | // the key handler is what answers this one while there is. | 163 | // the key handler is what answers this one while there is. |
| 164 | ActionId::CancelExport => {} | 164 | ActionId::CancelExport => {} |
| 165 | ActionId::ShowActions => self.show_actions(cx), | 165 | ActionId::ShowActions => self.show_actions(cx), |
| 166 | + ActionId::Settings => self.open_settings(cx), | ||
| 166 | ActionId::Screenshot => self.take_screenshot(cx), | 167 | ActionId::Screenshot => self.take_screenshot(cx), |
| 167 | // Cut machinery (DESIGN.md §6): the subject cut is the marked | 168 | // Cut machinery (DESIGN.md §6): the subject cut is the marked |
| 168 | // clip ([`Selection::anchor`]) -- the oracle already refused | 169 | // clip ([`Selection::anchor`]) -- the oracle already refused |
crates/app/src/player/cards.rsmodified+18 -0
| @@ -853,6 +853,22 @@ impl Player { | |||
| 853 | /// Nothing here is a clip's or even the project's -- it never reaches the | 853 | /// Nothing here is a clip's or even the project's -- it never reaches the |
| 854 | /// export, which never burns a cue into the picture -- so like the mix | 854 | /// export, which never burns a cue into the picture -- so like the mix |
| 855 | /// card it opens with no timeline required and nothing to refuse. | 855 | /// card it opens with no timeline required and nothing to refuse. |
| 856 | + /// Opens the settings page (PROJECT rows beside EDITOR rows, | ||
| 857 | + /// `ui::settings_stance`): the one door for "edit project and editor | ||
| 858 | + /// settings" -- always answerable, since the oracle treats it like | ||
| 859 | + /// `Theme` (`oracle.rs`), and refused only while an export is running, | ||
| 860 | + /// same as every other card here. | ||
| 861 | + pub(crate) fn open_settings(&mut self, cx: &mut Context<Self>) { | ||
| 862 | + if self.exporting().is_some() { | ||
| 863 | + return; | ||
| 864 | + } | ||
| 865 | + // One card at a time -- `close_card`'s own rule. | ||
| 866 | + self.close_card(); | ||
| 867 | + self.settings_open = true; | ||
| 868 | + self.context_menu = None; | ||
| 869 | + cx.notify(); | ||
| 870 | + } | ||
| 871 | + | ||
| 856 | pub(crate) fn open_subtitle_style(&mut self, cx: &mut Context<Self>) { | 872 | pub(crate) fn open_subtitle_style(&mut self, cx: &mut Context<Self>) { |
| 857 | // One card at a time -- `close_card`'s own rule. | 873 | // One card at a time -- `close_card`'s own rule. |
| 858 | self.close_card(); | 874 | self.close_card(); |
| @@ -1241,6 +1257,7 @@ impl Player { | |||
| 1241 | 1257 | ||
| 1242 | pub(crate) fn modal(&self) -> bool { | 1258 | pub(crate) fn modal(&self) -> bool { |
| 1243 | self.keys_open | 1259 | self.keys_open |
| 1260 | + || self.settings_open | ||
| 1244 | || self.export_open | 1261 | || self.export_open |
| 1245 | || self.eq_open.is_some() | 1262 | || self.eq_open.is_some() |
| 1246 | || self.color_open.is_some() | 1263 | || self.color_open.is_some() |
| @@ -1262,6 +1279,7 @@ impl Player { | |||
| 1262 | /// "the" card and closing all of them are the same act. | 1279 | /// "the" card and closing all of them are the same act. |
| 1263 | pub(crate) fn close_card(&mut self) { | 1280 | pub(crate) fn close_card(&mut self) { |
| 1264 | self.keys_open = false; | 1281 | self.keys_open = false; |
| 1282 | + self.settings_open = false; | ||
| 1265 | self.keys_search.clear(); | 1283 | self.keys_search.clear(); |
| 1266 | self.rebinding = None; | 1284 | self.rebinding = None; |
| 1267 | self.export_open = false; | 1285 | self.export_open = false; |
crates/app/src/ui/mod.rsmodified+1 -0
| @@ -10,6 +10,7 @@ pub mod inspector; | |||
| 10 | pub mod library; | 10 | pub mod library; |
| 11 | pub mod overlays; | 11 | pub mod overlays; |
| 12 | pub mod preview; | 12 | pub mod preview; |
| 13 | +pub mod settings_stance; | ||
| 13 | pub mod spine_stance; | 14 | pub mod spine_stance; |
| 14 | pub mod stance; | 15 | pub mod stance; |
| 15 | pub mod theme; | 16 | pub mod theme; |
crates/app/src/ui/settings_stance.rsadded+269 -0
| @@ -0,0 +1,269 @@ | |||
| 1 | +//! The settings page (user complaint: "we should have a settings page that | ||
| 2 | +//! we can edit project and editor settings"). Two clearly-headed sections, | ||
| 3 | +//! per the split rule a rubric pass settled: | ||
| 4 | +//! | ||
| 5 | +//! - PROJECT: anything that changes the rendered output or is stored in the | ||
| 6 | +//! `.edith` file -- resolution, fps, sample-rate, the HDR tonemap, the mix. | ||
| 7 | +//! - EDITOR: anything about this machine, this person, this window -- | ||
| 8 | +//! proxies/auto-proxies (this window's decode/import policy) and the | ||
| 9 | +//! subtitle font (a reading preference, kept in `~/.config/edith` like the | ||
| 10 | +//! theme beside it, per [`crate::load_subtitle_style`]). | ||
| 11 | +//! | ||
| 12 | +//! Every row here reuses an opener or a picker this editor already has | ||
| 13 | +//! ([`Player::open_picker`], [`Player::open_mix`], [`Player::open_subtitle_style`], | ||
| 14 | +//! [`Player::toggle_proxies`], [`Player::toggle_auto_proxies`]) -- no new card | ||
| 15 | +//! body, no second source of truth for what a value is or how it is set. | ||
| 16 | +//! Values apply live through those same doors; there is no Apply button here | ||
| 17 | +//! to be inconsistent with the rest of the room. | ||
| 18 | +//! | ||
| 19 | +//! Seams left for other builders (this task's scope boundary): the HDR | ||
| 20 | +//! mastering-display target row (a monitor fact, not in `inspector.rs`'s own | ||
| 21 | +//! project section yet) has no row here either -- it plugs into | ||
| 22 | +//! `project_section` below, beside the tonemap row it is the pair of. A | ||
| 23 | +//! finer fps/sample-rate/tone picker is the same builder's to extend; this | ||
| 24 | +//! page only ever asks for [`Pick::Fps`]/[`Pick::SampleRate`]/[`Pick::Tone`] | ||
| 25 | +//! exactly as `inspector.rs`'s legacy panel already does. | ||
| 26 | + | ||
| 27 | +use crate::*; | ||
| 28 | +use crate::ui::type_scale; | ||
| 29 | + | ||
| 30 | +/// A 9px uppercase Archivo section head, `ink3` -- [`dock_stance::section_head`]'s | ||
| 31 | +/// exact shape, repeated rather than imported across a `pub(crate)` seam for | ||
| 32 | +/// one nine-line function. | ||
| 33 | +fn section_head(text: impl Into<SharedString>) -> impl IntoElement { | ||
| 34 | + let style = type_scale::head(); | ||
| 35 | + div() | ||
| 36 | + .flex_none() | ||
| 37 | + .pt(px(4.)) | ||
| 38 | + .font(style.font) | ||
| 39 | + .text_size(style.size) | ||
| 40 | + .text_color(rgb(INK3())) | ||
| 41 | + .child(text.into()) | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +/// One row: a ≤16-char label, its current value in mono (units carried, | ||
| 45 | +/// never a bare number -- the density rule this task's charter names), and | ||
| 46 | +/// a hover hint carrying the sentence a label must not. [`dock_stance::ghost_verb`]'s | ||
| 47 | +/// anatomy, with a live value where that row has a chord badge -- this room | ||
| 48 | +/// is a picker's own door, not a keystroke's. | ||
| 49 | +fn row( | ||
| 50 | + id: &'static str, | ||
| 51 | + label_text: &'static str, | ||
| 52 | + value: impl Into<SharedString>, | ||
| 53 | + hint: &'static str, | ||
| 54 | + player: &Player, | ||
| 55 | + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | ||
| 56 | +) -> impl IntoElement { | ||
| 57 | + let value: SharedString = value.into(); | ||
| 58 | + let hint: SharedString = hint.into(); | ||
| 59 | + let label_style = type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM); | ||
| 60 | + let value_style = type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM); | ||
| 61 | + let exporting = player.exporting().is_some(); | ||
| 62 | + div() | ||
| 63 | + .id(id) | ||
| 64 | + .flex_none() | ||
| 65 | + .flex() | ||
| 66 | + .items_center() | ||
| 67 | + .justify_between() | ||
| 68 | + .h(px(CONTROL_H)) | ||
| 69 | + .px(px(8.)) | ||
| 70 | + .rounded(px(3.)) | ||
| 71 | + .tooltip(move |_, cx| cx.new(|_| Tip(hint.clone())).into()) | ||
| 72 | + .when(exporting, |d| d.opacity(0.4).cursor_not_allowed()) | ||
| 73 | + .when(!exporting, |d| { | ||
| 74 | + d.cursor_pointer().hover(|s| s.bg(rgb(DARK_RAISED()))).on_click(on_click) | ||
| 75 | + }) | ||
| 76 | + .child( | ||
| 77 | + div() | ||
| 78 | + .font(label_style.font) | ||
| 79 | + .text_size(label_style.size) | ||
| 80 | + .text_color(rgb(INK2())) | ||
| 81 | + .child(label_text), | ||
| 82 | + ) | ||
| 83 | + .child( | ||
| 84 | + div() | ||
| 85 | + .flex_none() | ||
| 86 | + .font(value_style.font) | ||
| 87 | + .text_size(value_style.size) | ||
| 88 | + .text_color(rgb(INK1())) | ||
| 89 | + .child(value), | ||
| 90 | + ) | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +/// PROJECT: the canvas every clip is composed onto, the rate it is cut at, | ||
| 94 | +/// the HDR rendition it is watched in, and the mix everything sums into -- | ||
| 95 | +/// [`inspector.rs`]'s own four-plus-Mix list, ported rather than | ||
| 96 | +/// reimplemented (same `Pick`/`open_mix` doors). | ||
| 97 | +fn project_section(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 98 | + let resolution = player.session.as_ref().map(PlaybackSession::resolution); | ||
| 99 | + let res_val = match resolution.or(player.pending_settings.0) { | ||
| 100 | + Some((_, h)) => format!("{h}p"), | ||
| 101 | + None => "Size".to_string(), | ||
| 102 | + }; | ||
| 103 | + let fps_val = match (player.session.is_some(), player.pending_settings.1) { | ||
| 104 | + (true, _) => format!("{} fps", fps_label(player.fps)), | ||
| 105 | + (false, Some(fps)) => format!("{} fps", fps_label(fps)), | ||
| 106 | + (false, None) => "Rate".to_string(), | ||
| 107 | + }; | ||
| 108 | + let rate_val = match player.session.as_ref().map_or(player.pending_settings.2, |s| s.sample_rate()) { | ||
| 109 | + Some(rate) => format!("{rate} Hz"), | ||
| 110 | + None => "Source".to_string(), | ||
| 111 | + }; | ||
| 112 | + let tone_val = match &player.session { | ||
| 113 | + Some(session) => format!("HDR {}", tone_label(session.tone())), | ||
| 114 | + None => "HDR".to_string(), | ||
| 115 | + }; | ||
| 116 | + div() | ||
| 117 | + .flex_none() | ||
| 118 | + .flex() | ||
| 119 | + .flex_col() | ||
| 120 | + .gap(px(2.)) | ||
| 121 | + .child(section_head("PROJECT · stored in the .edith file")) | ||
| 122 | + .child(row( | ||
| 123 | + "settings-resolution", | ||
| 124 | + "Resolution", | ||
| 125 | + res_val, | ||
| 126 | + "the canvas every clip is composed onto, and the size the export comes out at", | ||
| 127 | + player, | ||
| 128 | + cx.listener(|this, event: &ClickEvent, _, cx| this.open_picker(Pick::Resolution, event.position(), cx)), | ||
| 129 | + )) | ||
| 130 | + .child(row( | ||
| 131 | + "settings-fps", | ||
| 132 | + "Frame rate", | ||
| 133 | + fps_val, | ||
| 134 | + "the rate the whole timeline is cut and written at", | ||
| 135 | + player, | ||
| 136 | + cx.listener(|this, event: &ClickEvent, _, cx| this.open_picker(Pick::Fps, event.position(), cx)), | ||
| 137 | + )) | ||
| 138 | + .child(row( | ||
| 139 | + "settings-sample-rate", | ||
| 140 | + "Sample rate", | ||
| 141 | + rate_val, | ||
| 142 | + "the rate the project's own sound mix is run at; source derives it from the first audio source", | ||
| 143 | + player, | ||
| 144 | + cx.listener(|this, event: &ClickEvent, _, cx| this.open_picker(Pick::SampleRate, event.position(), cx)), | ||
| 145 | + )) | ||
| 146 | + // hook: the mastering-display target (a monitor peak-nits fact, not | ||
| 147 | + // yet in `inspector.rs`'s own project section) is this row's pair -- | ||
| 148 | + // another builder's row, plugged in right here once it exists. | ||
| 149 | + .child(row( | ||
| 150 | + "settings-tonemap", | ||
| 151 | + "HDR tonemap", | ||
| 152 | + tone_val, | ||
| 153 | + "which rendition HDR media is watched in; SDR media is untouched", | ||
| 154 | + player, | ||
| 155 | + cx.listener(|this, event: &ClickEvent, _, cx| this.open_picker(Pick::Tone, event.position(), cx)), | ||
| 156 | + )) | ||
| 157 | + .child(row( | ||
| 158 | + "settings-mix", | ||
| 159 | + "Mix", | ||
| 160 | + "Tracks…", | ||
| 161 | + "a fader per track and the limiter over the sum of them", | ||
| 162 | + player, | ||
| 163 | + cx.listener(|this, _: &ClickEvent, _, cx| this.open_mix(None, cx)), | ||
| 164 | + )) | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +/// EDITOR: this window's own decode/import policy and this person's own | ||
| 168 | +/// reading preference -- never written into the `.edith` file. | ||
| 169 | +fn editor_section(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 170 | + div() | ||
| 171 | + .flex_none() | ||
| 172 | + .flex() | ||
| 173 | + .flex_col() | ||
| 174 | + .gap(px(2.)) | ||
| 175 | + .child(section_head("EDITOR · kept in ~/.config/edith")) | ||
| 176 | + .child(row( | ||
| 177 | + "settings-proxies", | ||
| 178 | + "Proxies", | ||
| 179 | + match player.proxies_on { | ||
| 180 | + true => format!("On{}", player.proxy_tail()), | ||
| 181 | + false => "Off".to_string(), | ||
| 182 | + }, | ||
| 183 | + "cuts on small stand-ins of the big films; the sound and every export stay the film's own", | ||
| 184 | + player, | ||
| 185 | + cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_proxies(cx)), | ||
| 186 | + )) | ||
| 187 | + .child(row( | ||
| 188 | + "settings-auto-proxies", | ||
| 189 | + "Auto proxies", | ||
| 190 | + if player.auto_proxies_on { "On" } else { "Off" }, | ||
| 191 | + "makes a stand-in for every big film as it is imported", | ||
| 192 | + player, | ||
| 193 | + cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_auto_proxies(cx)), | ||
| 194 | + )) | ||
| 195 | + .child(row( | ||
| 196 | + "settings-subtitle-style", | ||
| 197 | + "Subtitle font", | ||
| 198 | + "Font…", | ||
| 199 | + "the cue plate's own font and size", | ||
| 200 | + player, | ||
| 201 | + cx.listener(|this, _: &ClickEvent, _, cx| this.open_subtitle_style(cx)), | ||
| 202 | + )) | ||
| 203 | +} | ||
| 204 | + | ||
| 205 | +/// The page itself: a modal card, the same drag-scrim-and-click-away shape | ||
| 206 | +/// every other card in this room takes ([`crate::ui::cards`]'s | ||
| 207 | +/// eq/color/transform/speed cards) -- closed by a click away or `esc`, | ||
| 208 | +/// through [`Player::close_card`], exactly like them. | ||
| 209 | +pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 210 | + drag_scrim(cx) | ||
| 211 | + .flex() | ||
| 212 | + .justify_center() | ||
| 213 | + .items_center() | ||
| 214 | + .bg(rgba(SCRIM())) | ||
| 215 | + .on_mouse_down( | ||
| 216 | + MouseButton::Left, | ||
| 217 | + cx.listener(|this, _: &MouseDownEvent, _, cx| { | ||
| 218 | + this.close_card(); | ||
| 219 | + cx.notify(); | ||
| 220 | + cx.stop_propagation(); | ||
| 221 | + }), | ||
| 222 | + ) | ||
| 223 | + .child( | ||
| 224 | + div() | ||
| 225 | + .id("settings-card") | ||
| 226 | + .w_full() | ||
| 227 | + .max_w(px(360.)) | ||
| 228 | + .max_h(relative(0.86)) | ||
| 229 | + .on_mouse_down(MouseButton::Left, swallow) | ||
| 230 | + .flex() | ||
| 231 | + .flex_col() | ||
| 232 | + .gap(px(8.)) | ||
| 233 | + .p(px(12.)) | ||
| 234 | + .rounded(px(6.)) | ||
| 235 | + .bg(rgb(DARK_PANEL())) | ||
| 236 | + .border_1() | ||
| 237 | + .border_color(rgba(DARK_SEAM())) | ||
| 238 | + .child({ | ||
| 239 | + let head = type_scale::head(); | ||
| 240 | + div() | ||
| 241 | + .flex_none() | ||
| 242 | + .flex() | ||
| 243 | + .justify_between() | ||
| 244 | + .items_baseline() | ||
| 245 | + .font(head.font) | ||
| 246 | + .text_size(head.size) | ||
| 247 | + .text_color(rgb(INK3())) | ||
| 248 | + .child("SETTINGS") | ||
| 249 | + .child( | ||
| 250 | + div() | ||
| 251 | + .font(type_scale::mono(type_scale::CHORD_METADATA_MIN_PX, gpui::FontWeight::MEDIUM).font) | ||
| 252 | + .text_size(px(type_scale::CHORD_METADATA_MIN_PX)) | ||
| 253 | + .text_color(rgb(INK3())) | ||
| 254 | + .child(player.keymap.display(ActionId::Settings)), | ||
| 255 | + ) | ||
| 256 | + }) | ||
| 257 | + .child( | ||
| 258 | + div() | ||
| 259 | + .id("settings-rows") | ||
| 260 | + .min_h(px(0.)) | ||
| 261 | + .overflow_y_scroll() | ||
| 262 | + .flex() | ||
| 263 | + .flex_col() | ||
| 264 | + .gap(px(10.)) | ||
| 265 | + .child(project_section(player, cx)) | ||
| 266 | + .child(editor_section(player, cx)), | ||
| 267 | + ), | ||
| 268 | + ) | ||
| 269 | +} | ||
crates/app/src/ui/spine_stance.rsmodified+6 -0
| @@ -312,5 +312,11 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem | |||
| 312 | glyph("spine-fullscreen", "FS", ActionId::Fullscreen, false, true, player, cx), | 312 | glyph("spine-fullscreen", "FS", ActionId::Fullscreen, false, true, player, cx), |
| 313 | )) | 313 | )) |
| 314 | .child(glyph("spine-screenshot", "Sh", ActionId::Screenshot, false, true, player, cx)) | 314 | .child(glyph("spine-screenshot", "Sh", ActionId::Screenshot, false, true, player, cx)) |
| 315 | + // The settings page's own visible door (user complaint: "some | ||
| 316 | + // options are only reachable via keyboard shortcut") -- a chord | ||
| 317 | + // alone is a defect class this room has hit repeatedly, so this | ||
| 318 | + // glyph sits beside the other once-a-session ROOM acts even though | ||
| 319 | + // its chord (`^,`) is a preference, not a mnemonic. | ||
| 320 | + .child(glyph("spine-settings", "St", ActionId::Settings, player.settings_open, true, player, cx)) | ||
| 315 | .child(div().flex_1()) | 321 | .child(div().flex_1()) |
| 316 | } | 322 | } |
crates/app/src/ui/stance.rsmodified+2 -0
| @@ -11,6 +11,7 @@ | |||
| 11 | use crate::*; | 11 | use crate::*; |
| 12 | use crate::ui::bench_stance; | 12 | use crate::ui::bench_stance; |
| 13 | use crate::ui::dock_stance; | 13 | use crate::ui::dock_stance; |
| 14 | +use crate::ui::settings_stance; | ||
| 14 | use crate::ui::timeband_stance; | 15 | use crate::ui::timeband_stance; |
| 15 | use crate::ui::spine_stance; | 16 | use crate::ui::spine_stance; |
| 16 | use crate::ui::type_scale::{self, Typeset}; | 17 | use crate::ui::type_scale::{self, Typeset}; |
| @@ -759,6 +760,7 @@ pub(crate) fn render( | |||
| 759 | el.child(notice_plate(n)) | 760 | el.child(notice_plate(n)) |
| 760 | }) | 761 | }) |
| 761 | .when(player.keys_open, |el| el.child(keys_overlay(player))) | 762 | .when(player.keys_open, |el| el.child(keys_overlay(player))) |
| 763 | + .when(player.settings_open, |el| el.child(settings_stance::render(player, cx))) | ||
| 762 | // The two menus (DESIGN §9: "verbs of the thing under the | 764 | // The two menus (DESIGN §9: "verbs of the thing under the |
| 763 | // cursor", plate styling, the same scrim-and-row component | 765 | // cursor", plate styling, the same scrim-and-row component |
| 764 | // the legacy tree already uses -- `library.rs`'s own doc | 766 | // the legacy tree already uses -- `library.rs`'s own doc |