Make 'Close All Documents' not confirm if all open documents are already saved (#1423)
* Adding blank PortfolioMessage to close docs * Connected new PortfolioMessage to Menu Bar * Adding functionality to new PortfolioMessage * Amending outdated tests in color.rs
This commit is contained in:
parent
9667e5173b
commit
b9027883a8
|
|
@ -71,8 +71,8 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||||
},
|
},
|
||||||
MenuBarEntry {
|
MenuBarEntry {
|
||||||
label: "Close All".into(),
|
label: "Close All".into(),
|
||||||
shortcut: action_keys!(DialogMessageDiscriminant::CloseAllDocumentsWithConfirmation),
|
shortcut: action_keys!(PortfolioMessageDiscriminant::CloseAllDocumentsWithConfirmation),
|
||||||
action: MenuBarEntry::create_action(|_| DialogMessage::CloseAllDocumentsWithConfirmation.into()),
|
action: MenuBarEntry::create_action(|_| PortfolioMessage::CloseAllDocumentsWithConfirmation.into()),
|
||||||
disabled: no_active_document,
|
disabled: no_active_document,
|
||||||
..MenuBarEntry::default()
|
..MenuBarEntry::default()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ pub enum PortfolioMessage {
|
||||||
},
|
},
|
||||||
CloseActiveDocumentWithConfirmation,
|
CloseActiveDocumentWithConfirmation,
|
||||||
CloseAllDocuments,
|
CloseAllDocuments,
|
||||||
|
CloseAllDocumentsWithConfirmation,
|
||||||
CloseDocument {
|
CloseDocument {
|
||||||
document_id: u64,
|
document_id: u64,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,13 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
|
||||||
responses.add(PortfolioMessage::DestroyAllDocuments);
|
responses.add(PortfolioMessage::DestroyAllDocuments);
|
||||||
responses.add(PortfolioMessage::UpdateOpenDocumentsList);
|
responses.add(PortfolioMessage::UpdateOpenDocumentsList);
|
||||||
}
|
}
|
||||||
|
PortfolioMessage::CloseAllDocumentsWithConfirmation => {
|
||||||
|
if self.unsaved_document_names().is_empty() {
|
||||||
|
responses.add(PortfolioMessage::CloseAllDocuments)
|
||||||
|
} else {
|
||||||
|
responses.add(DialogMessage::CloseAllDocumentsWithConfirmation)
|
||||||
|
}
|
||||||
|
}
|
||||||
PortfolioMessage::CloseDocument { document_id } => {
|
PortfolioMessage::CloseDocument { document_id } => {
|
||||||
// Is this the last document?
|
// Is this the last document?
|
||||||
if self.documents.len() == 1 && self.document_ids[0] == document_id {
|
if self.documents.len() == 1 && self.document_ids[0] == document_id {
|
||||||
|
|
@ -549,6 +556,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
|
||||||
GraphViewOverlayToggleDisabled,
|
GraphViewOverlayToggleDisabled,
|
||||||
CloseActiveDocumentWithConfirmation,
|
CloseActiveDocumentWithConfirmation,
|
||||||
CloseAllDocuments,
|
CloseAllDocuments,
|
||||||
|
CloseAllDocumentsWithConfirmation,
|
||||||
Import,
|
Import,
|
||||||
NextDocument,
|
NextDocument,
|
||||||
OpenDocument,
|
OpenDocument,
|
||||||
|
|
|
||||||
|
|
@ -739,7 +739,7 @@ impl Color {
|
||||||
/// ```
|
/// ```
|
||||||
/// use graphene_core::raster::color::Color;
|
/// use graphene_core::raster::color::Color;
|
||||||
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61).to_gamma_srgb();
|
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61).to_gamma_srgb();
|
||||||
/// assert_eq!("5267FA61", color.rgba_hex())
|
/// assert_eq!("3240A261", color.rgba_hex())
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub fn rgba_hex(&self) -> String {
|
pub fn rgba_hex(&self) -> String {
|
||||||
|
|
@ -756,7 +756,7 @@ impl Color {
|
||||||
/// ```
|
/// ```
|
||||||
/// use graphene_core::raster::color::Color;
|
/// use graphene_core::raster::color::Color;
|
||||||
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61).to_gamma_srgb();
|
/// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61).to_gamma_srgb();
|
||||||
/// assert_eq!("5267FA", color.rgb_hex())
|
/// assert_eq!("3240A2", color.rgb_hex())
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub fn rgb_hex(&self) -> String {
|
pub fn rgb_hex(&self) -> String {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue