mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-04 06:28:11 +08:00
Event broadcasting system (#692)
* broadcast system implemented but not everywhere * unused types * code review with keavon * - optional signal mappings - tool.rs simplification * Cleanup * reduced code duplication in `tool.rs` * ran cargo fmt * code review changes * fix merge error Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
c343aaa3ab
commit
a6c91204d6
@@ -0,0 +1,26 @@
|
||||
use crate::message_prelude::*;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[impl_message(Message, Broadcast)]
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum BroadcastMessage {
|
||||
SubscribeSignal {
|
||||
on: BroadcastSignal,
|
||||
send: Box<Message>,
|
||||
},
|
||||
UnsubscribeSignal {
|
||||
on: BroadcastSignal,
|
||||
message: Box<Message>,
|
||||
},
|
||||
#[child]
|
||||
TriggerSignal(BroadcastSignal),
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize, Hash)]
|
||||
#[impl_message(Message, BroadcastMessage, TriggerSignal)]
|
||||
pub enum BroadcastSignal {
|
||||
DocumentIsDirty,
|
||||
ToolAbort,
|
||||
SelectionChanged,
|
||||
}
|
||||
Reference in New Issue
Block a user