Add menu items for projects and closing files

This commit is contained in:
Jeremy Soller 2023-11-13 07:32:20 -07:00
parent e278317565
commit 5032f74356
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
4 changed files with 33 additions and 5 deletions

View file

@ -12,11 +12,14 @@ pub const CONFIG_VERSION: u64 = 1;
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum Action {
CloseFile,
CloseProject,
Copy,
Cut,
NewFile,
NewWindow,
OpenFileDialog,
OpenProjectDialog,
Paste,
Quit,
Save,
@ -28,11 +31,14 @@ pub enum Action {
impl Action {
pub fn message(&self) -> Message {
match self {
Self::CloseFile => Message::CloseFile,
Self::CloseProject => Message::CloseProject,
Self::Copy => Message::Copy,
Self::Cut => Message::Cut,
Self::NewFile => Message::NewFile,
Self::NewWindow => Message::NewWindow,
Self::OpenFileDialog => Message::OpenFileDialog,
Self::OpenProjectDialog => Message::OpenProjectDialog,
Self::Paste => Message::Paste,
Self::Quit => Message::Quit,
Self::Save => Message::Save,
@ -74,12 +80,14 @@ impl KeyBind {
}};
}
bind!([Ctrl], W, CloseFile);
bind!([Ctrl], X, Cut);
bind!([Ctrl], C, Copy);
bind!([Ctrl], V, Paste);
bind!([Ctrl], N, NewFile);
bind!([Ctrl, Shift], N, NewWindow);
bind!([Ctrl], T, NewFile);
bind!([Ctrl], N, NewWindow);
bind!([Ctrl], O, OpenFileDialog);
bind!([Ctrl, Shift], O, OpenProjectDialog);
bind!([Ctrl], Q, Quit);
bind!([Ctrl], S, Save);
bind!([Ctrl], A, SelectAll);