| ... | ... | @@ -504,7 +504,13 @@ impl State { |
| 504 | 504 | Target::Section { library, path } | Target::Group { library, path } => { |
| 505 | 505 | let section = matches!(target, Target::Section { .. }); |
| 506 | 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 | 514 | if section { |
| 509 | 515 | actions.push(item(Action::SaveAs, "Save As", false, false)); |
| 510 | 516 | } |
| ... | ... | @@ -516,10 +522,11 @@ impl State { |
| 516 | 522 | let link = self.section_link(library, path).is_none(); |
| 517 | 523 | actions.push(item(Action::CopyLink, "Copy Link to Section", link, true)); |
| 518 | 524 | } |
| 519 | | actions.extend([ |
| 520 | | item(Action::NewSection, "New Section", !cataloged, true), |
| 521 | | item(Action::NewGroup, "New Section Group", !cataloged, false), |
| 522 | | ]); |
| 525 | if section { |
| 526 | let [mut first, rest] = new; |
| 527 | first.1.separated = true; |
| 528 | actions.extend([first, rest]); |
| 529 | } |
| 523 | 530 | if section { |
| 524 | 531 | actions.extend([ |
| 525 | 532 | item( |
| ... | ... | @@ -549,8 +556,21 @@ impl State { |
| 549 | 556 | let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library)); |
| 550 | 557 | let last = self.notebooks.len().saturating_sub(1); |
| 551 | 558 | let unread = self.unread_notebook(library); |
| 559 | // It leads with what it makes, as Windows' menus do. |
| 552 | 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 | 574 | item( |
| 555 | 575 | Action::SaveAs, |
| 556 | 576 | "Save As", |
| ... | ... | @@ -588,18 +608,6 @@ impl State { |
| 588 | 608 | library.catalog().is_none() || library.joined.is_some(), |
| 589 | 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 | 611 | item( |
| 604 | 612 | Action::MarkNotebookRead, |
| 605 | 613 | "Mark Notebook as Read", |