Restructure action macro to assign a namespace to every action

Also, allow arbitrary types to be used as Actions via the impl_actions macro

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-04-07 16:20:49 -07:00
parent 206b0f0f8c
commit 5242a3a6dc
33 changed files with 432 additions and 306 deletions

View file

@ -12,8 +12,9 @@ pub use contacts_panel;
use contacts_panel::ContactsPanel;
pub use editor;
use gpui::{
action,
actions,
geometry::vector::vec2f,
impl_actions,
keymap::Binding,
platform::{WindowBounds, WindowOptions},
ModelHandle, ViewContext,
@ -29,10 +30,12 @@ use std::{path::PathBuf, sync::Arc};
pub use workspace;
use workspace::{AppState, Workspace, WorkspaceParams};
action!(About);
action!(Quit);
action!(OpenSettings);
action!(AdjustBufferFontSize, f32);
actions!(zed, [About, Quit, OpenSettings]);
#[derive(Clone)]
pub struct AdjustBufferFontSize(pub f32);
impl_actions!(zed, [AdjustBufferFontSize]);
const MIN_FONT_SIZE: f32 = 6.0;