add file menu
};
#[cfg(target_os = "macos")]
use druid::{Menu, MenuItem, SysMods};
+#[cfg(target_os = "macos")]
+use lapce_core::command::FocusCommand;
use lapce_core::meta;
use lapce_data::{
command::{LapceUICommand, LAPCE_UI_COMMAND},
@@ -245,7 +247,8 @@ fn macos_window_desc<T: druid::Data>(desc: WindowDesc<T>) -> WindowDesc<T> {
};
desc.menu(|_, _, _| {
- Menu::new("Lapce").entry(
+ Menu::new("Lapce")
+ .entry(
Menu::new("")
.entry(MenuItem::new("About Lapce").command(Command::new(
LAPCE_COMMAND,
@@ -270,6 +273,49 @@ fn macos_window_desc<T: druid::Data>(desc: WindowDesc<T>) -> WindowDesc<T> {
.hotkey(SysMods::Cmd, "q"),
),
)
+ .entry(
+ Menu::new("File")
+ .entry(MenuItem::new("New File").command(Command::new(
+ LAPCE_COMMAND,
+ LapceCommand {
+ kind: CommandKind::Workbench(
+ LapceWorkbenchCommand::NewFile,
+ ),
+ data: None,
+ },
+ Target::Auto,
+ )))
+ .separator()
+ .entry(MenuItem::new("Open").command(Command::new(
+ LAPCE_COMMAND,
+ LapceCommand {
+ kind: CommandKind::Workbench(
+ LapceWorkbenchCommand::OpenFile,
+ ),
+ data: None,
+ },
+ Target::Auto,
+ )))
+ .entry(MenuItem::new("Open Folder").command(Command::new(
+ LAPCE_COMMAND,
+ LapceCommand {
+ kind: CommandKind::Workbench(
+ LapceWorkbenchCommand::OpenFolder,
+ ),
+ data: None,
+ },
+ Target::Auto,
+ )))
+ .separator()
+ .entry(MenuItem::new("Save").command(Command::new(
+ LAPCE_COMMAND,
+ LapceCommand {
+ kind: CommandKind::Focus(FocusCommand::Save),
+ data: None,
+ },
+ Target::Auto,
+ ))),
+ )
})
}
