authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-03 01:42:34-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-03 05:19:31-07:00
log1035fa1f6367df0e9e86af83631aef9356ab593c
tree851c9033de3ae92ef4fd00f2fc993879f95944f7
parent5c06254186b809c75c62d772681c40f0cb9152d4
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

fix: the Themes dialog says what taking a theme away leaves: the section's theme, the notebook's, or the pages as they are

Assisted-by: claude-opus-5.5

1 files changed, 19 insertions(+), 5 deletions(-)

crates/snowbound/src/themes.rs+19-5
...@@ -29,6 +29,16 @@ impl Scope {...@@ -29,6 +29,16 @@ impl Scope {
29 Self::Notebook => "This Notebook",29 Self::Notebook => "This Notebook",
30 }30 }
31 }31 }
32
33 /// What taking away the scope's own theme leaves it wearing.
34 fn without(self) -> &'static str {
35 match self {
36 Self::Page => "Use Section's Theme",
37 Self::Section => "Use Notebook's Theme",
38 // Pages keep the styles the theme gave them.
39 Self::Notebook => "Remove Notebook Theme",
40 }
41 }
32}42}
3343
34/// The Themes dialog while it is open.44/// The Themes dialog while it is open.
...@@ -226,7 +236,7 @@ impl State {...@@ -226,7 +236,7 @@ impl State {
226 }236 }
227237
228 /// Builds the Themes dialog while it is open. Save keeps the edits and gives the theme to238 /// Builds the Themes dialog while it is open. Save keeps the edits and gives the theme to
229 /// the scope it then asks for, This Page first; No Theme takes that scope's own away;239 /// the scope it then asks for, This Page first; Remove Theme takes that scope's own away;
230 /// Cancel, Escape or a press outside leave everything as it was.240 /// Cancel, Escape or a press outside leave everything as it was.
231 pub(crate) fn themes_dialog(&mut self) {241 pub(crate) fn themes_dialog(&mut self) {
232 let Some(dialog) = &mut self.themes else {242 let Some(dialog) = &mut self.themes else {
...@@ -601,7 +611,7 @@ impl State {...@@ -601,7 +611,7 @@ impl State {
601 );611 );
602 // Each button gives its choice to the one place there is, else asks where.612 // Each button gives its choice to the one place there is, else asks where.
603 let targets = &dialog.targets;613 let targets = &dialog.targets;
604 let place = |ui: &mut Ui, part: &str, label: &str| -> Option<usize> {614 let place = |ui: &mut Ui, part: &str, label: &str, item: fn(Scope) -> &'static str| {
605 let clicked = ui::button(ui, part, label).clicked;615 let clicked = ui::button(ui, part, label).clicked;
606 if targets.len() == 1 {616 if targets.len() == 1 {
607 return clicked.then_some(0);617 return clicked.then_some(0);
...@@ -614,7 +624,7 @@ impl State {...@@ -614,7 +624,7 @@ impl State {
614 .iter()624 .iter()
615 .enumerate()625 .enumerate()
616 .map(|(at, (scope, _))| Item {626 .map(|(at, (scope, _))| Item {
617 text: scope.name(),627 text: item(*scope),
618 icon: Some(match scope {628 icon: Some(match scope {
619 Scope::Page => crate::art::PAGE,629 Scope::Page => crate::art::PAGE,
620 Scope::Section => crate::art::SECTION,630 Scope::Section => crate::art::SECTION,
...@@ -627,7 +637,11 @@ impl State {...@@ -627,7 +637,11 @@ impl State {
627 let anchor = Anchor::Below(ui.rect(ui.id(part)).unwrap_or_default());637 let anchor = Anchor::Below(ui.rect(ui.id(part)).unwrap_or_default());
628 ui::popup::menu(ui, menu, anchor, &items, None)638 ui::popup::menu(ui, menu, anchor, &items, None)
629 };639 };
630 let none = place(ui, "none", "No Theme");640 let remove = match targets[..] {
641 [(scope, _)] => scope.without(),
642 _ => "Remove Theme",
643 };
644 let none = place(ui, "none", remove, Scope::without);
631 ui.leaf(645 ui.leaf(
632 "space",646 "space",
633 Spec {647 Spec {
...@@ -636,7 +650,7 @@ impl State {...@@ -636,7 +650,7 @@ impl State {
636 },650 },
637 );651 );
638 let cancel = ui::button(ui, "cancel", "Cancel").clicked;652 let cancel = ui::button(ui, "cancel", "Cancel").clicked;
639 let save = place(ui, "save", "Save");653 let save = place(ui, "save", "Save", Scope::name);
640 ui.close();654 ui.close();
641 ui.close();655 ui.close();
642656