| ... | @@ -504,7 +504,13 @@ impl State { | ... | @@ -504,7 +504,13 @@ impl State { |
| 504 | Target::Section { library, path } | Target::Group { library, path } => { | 504 | Target::Section { library, path } | Target::Group { library, path } => { |
| 505 | let section = matches!(target, Target::Section { .. }); | 505 | let section = matches!(target, Target::Section { .. }); |
| 506 | let cataloged = library.catalog().is_some(); | 506 | let cataloged = library.catalog().is_some(); |
| 507 | let mut actions = vec![item(Action::Rename, "Rename", false, false)]; | 507 | let new = [ |
| | 508 | item(Action::NewSection, "New Section", !cataloged, false), |
| | 509 | item(Action::NewGroup, "New Section Group", !cataloged, false), |
| | 510 | ]; |
| | 511 | // A group's menu leads with what it makes, as Windows' menus do. |
| | 512 | let mut actions = if section { Vec::new() } else { new.to_vec() }; |
| | 513 | actions.push(item(Action::Rename, "Rename", false, !section)); |
| 508 | if section { | 514 | if section { |
| 509 | actions.push(item(Action::SaveAs, "Save As", false, false)); | 515 | actions.push(item(Action::SaveAs, "Save As", false, false)); |
| 510 | } | 516 | } |
| ... | @@ -516,10 +522,11 @@ impl State { | ... | @@ -516,10 +522,11 @@ impl State { |
| 516 | let link = self.section_link(library, path).is_none(); | 522 | let link = self.section_link(library, path).is_none(); |
| 517 | actions.push(item(Action::CopyLink, "Copy Link to Section", link, true)); | 523 | actions.push(item(Action::CopyLink, "Copy Link to Section", link, true)); |
| 518 | } | 524 | } |
| 519 | actions.extend([ | 525 | if section { |
| 520 | item(Action::NewSection, "New Section", !cataloged, true), | 526 | let [mut first, rest] = new; |
| 521 | item(Action::NewGroup, "New Section Group", !cataloged, false), | 527 | first.1.separated = true; |
| 522 | ]); | 528 | actions.extend([first, rest]); |
| | 529 | } |
| 523 | if section { | 530 | if section { |
| 524 | actions.extend([ | 531 | actions.extend([ |
| 525 | item( | 532 | item( |
| ... | @@ -549,8 +556,21 @@ impl State { | ... | @@ -549,8 +556,21 @@ impl State { |
| 549 | let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library)); | 556 | let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library)); |
| 550 | let last = self.notebooks.len().saturating_sub(1); | 557 | let last = self.notebooks.len().saturating_sub(1); |
| 551 | let unread = self.unread_notebook(library); | 558 | let unread = self.unread_notebook(library); |
| | 559 | // It leads with what it makes, as Windows' menus do. |
| 552 | let mut actions = vec![ | 560 | let mut actions = vec![ |
| 553 | item(Action::Rename, "Rename", false, false), | 561 | item( |
| | 562 | Action::NewSection, |
| | 563 | "New Section", |
| | 564 | library.catalog().is_none(), |
| | 565 | false, |
| | 566 | ), |
| | 567 | item( |
| | 568 | Action::NewGroup, |
| | 569 | "New Section Group", |
| | 570 | library.catalog().is_none(), |
| | 571 | false, |
| | 572 | ), |
| | 573 | item(Action::Rename, "Rename", false, true), |
| 554 | item( | 574 | item( |
| 555 | Action::SaveAs, | 575 | Action::SaveAs, |
| 556 | "Save As", | 576 | "Save As", |
| ... | @@ -588,18 +608,6 @@ impl State { | ... | @@ -588,18 +608,6 @@ impl State { |
| 588 | library.catalog().is_none() || library.joined.is_some(), | 608 | library.catalog().is_none() || library.joined.is_some(), |
| 589 | false, | 609 | false, |
| 590 | ), | 610 | ), |
| 591 | item( | | |
| 592 | Action::NewSection, | | |
| 593 | "New Section", | | |
| 594 | library.catalog().is_none(), | | |
| 595 | true, | | |
| 596 | ), | | |
| 597 | item( | | |
| 598 | Action::NewGroup, | | |
| 599 | "New Section Group", | | |
| 600 | library.catalog().is_none(), | | |
| 601 | false, | | |
| 602 | ), | | |
| 603 | item( | 611 | item( |
| 604 | Action::MarkNotebookRead, | 612 | Action::MarkNotebookRead, |
| 605 | "Mark Notebook as Read", | 613 | "Mark Notebook as Read", |