From f28e46c2e3d1a79c90f0c68b4adef58a62ac0f82 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 20 Sep 2015 18:18:19 -0700 Subject: [PATCH] Add a Close command to the file menu on OS X --- src/command/subtitle.cpp | 14 ++++++++++++++ src/libresrc/osx/default_hotkey.json | 5 ++++- src/libresrc/osx/default_menu.json | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/command/subtitle.cpp b/src/command/subtitle.cpp index 646d77a39..5c9876f5b 100644 --- a/src/command/subtitle.cpp +++ b/src/command/subtitle.cpp @@ -36,6 +36,7 @@ #include "../compat.h" #include "../dialog_search_replace.h" #include "../dialogs.h" +#include "../frame_main.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" #include "../main.h" @@ -249,6 +250,18 @@ struct subtitle_new final : public Command { } }; +struct subtitle_close final : public Command { + CMD_NAME("subtitle/close") + CMD_ICON(new_toolbutton) + STR_MENU("Close") + STR_DISP("Close") + STR_HELP("Close") + + void operator()(agi::Context *c) override { + c->frame->Close(); + } +}; + struct subtitle_open final : public Command { CMD_NAME("subtitle/open") CMD_ICON(open_toolbutton) @@ -447,6 +460,7 @@ namespace cmd { reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); + reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); diff --git a/src/libresrc/osx/default_hotkey.json b/src/libresrc/osx/default_hotkey.json index f1e1a6f85..b7050cf52 100644 --- a/src/libresrc/osx/default_hotkey.json +++ b/src/libresrc/osx/default_hotkey.json @@ -167,6 +167,9 @@ "subtitle/new" : [ "Ctrl-N" ], + "subtitle/close" : [ + "Ctrl-W" + ], "subtitle/open" : [ "Ctrl-O" ], @@ -363,4 +366,4 @@ "J" ] } -} \ No newline at end of file +} diff --git a/src/libresrc/osx/default_menu.json b/src/libresrc/osx/default_menu.json index 4f1e6ea11..7b82d053b 100644 --- a/src/libresrc/osx/default_menu.json +++ b/src/libresrc/osx/default_menu.json @@ -45,6 +45,8 @@ { "command" : "subtitle/open/video" }, { "command" : "subtitle/open/autosave" }, { "recent" : "Subtitle" }, + {}, + { "command" : "subtitle/close" }, { "command" : "subtitle/save" }, { "command" : "subtitle/save/as" }, { "command" : "tool/export", "text" : "&Export As..." }, @@ -53,7 +55,6 @@ { "command" : "subtitle/attachment" }, { "command" : "tool/font_collector" }, {}, - { "command" : "app/new_window" }, { "command" : "app/exit", "special" : "exit" } ], "main/edit" : [