1
0
mirror of synced 2024-11-25 00:00:27 +01:00

sys: Added "New File..." menu item and shortcut

This commit is contained in:
WerWolv 2022-08-28 20:55:48 +02:00
parent a620400e4e
commit 33a375910a
8 changed files with 17 additions and 7 deletions

View File

@ -20,11 +20,12 @@ namespace hex::plugin::builtin {
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1050, [&] {
bool taskRunning = TaskManager::getRunningTaskCount() > 0;
if (ImGui::MenuItem("hex.builtin.menu.file.open_file"_lang, "CTRL + O", false, !taskRunning)) {
if (ImGui::MenuItem("hex.builtin.menu.file.create_file"_lang, "CTRL + N", false, !taskRunning)) {
EventManager::post<RequestOpenWindow>("Create File");
}
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
EventManager::post<RequestOpenFile>(path);
});
if (ImGui::MenuItem("hex.builtin.menu.file.open_file"_lang, "CTRL + O", false, !taskRunning)) {
EventManager::post<RequestOpenWindow>("Open File");
}
if (ImGui::BeginMenu("hex.builtin.menu.file.open_other"_lang, !taskRunning)) {

View File

@ -4,11 +4,14 @@
namespace hex::plugin::builtin {
void registerShortcuts() {
// New file
ShortcutManager::addGlobalShortcut(CTRL + Keys::N, [] {
EventManager::post<RequestOpenWindow>("Create File");
});
// Open file
ShortcutManager::addGlobalShortcut(CTRL + Keys::O, [] {
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
EventManager::post<RequestOpenFile>(path);
});
EventManager::post<RequestOpenWindow>("Open File");
});
// Close file

View File

@ -105,6 +105,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "Failed to create new file!" },
{ "hex.builtin.menu.file", "File" },
{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "Open File..." },
{ "hex.builtin.menu.file.open_recent", "Open Recent" },
{ "hex.builtin.menu.file.clear_recent", "Clear" },

View File

@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "Impossibile creare il nuovo File!" },
{ "hex.builtin.menu.file", "File" },
//{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "Apri File..." },
{ "hex.builtin.menu.file.open_recent", "File recenti" },
{ "hex.builtin.menu.file.clear_recent", "Pulisci" },

View File

@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "新しいファイルを作成できませんでした。" },
{ "hex.builtin.menu.file", "ファイル" },
//{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "ファイルを開く…" },
{ "hex.builtin.menu.file.open_recent", "最近使用したファイル" },
{ "hex.builtin.menu.file.clear_recent", "リストをクリア" },

View File

@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "Falha ao criar um novo arquivo!" },
{ "hex.builtin.menu.file", "File" },
//{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "Abrir Arquivo..." },
{ "hex.builtin.menu.file.open_recent", "Abrir Recentes" },
{ "hex.builtin.menu.file.clear_recent", "Limpar" },

View File

@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "创建新文件失败!" },
{ "hex.builtin.menu.file", "文件" },
//{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "打开文件..." },
{ "hex.builtin.menu.file.open_recent", "最近打开" },
{ "hex.builtin.menu.file.clear_recent", "清除" },

View File

@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.popup.error.create", "無法建立新檔案!" },
{ "hex.builtin.menu.file", "檔案" },
//{ "hex.builtin.menu.file.create_file", "New File..." },
{ "hex.builtin.menu.file.open_file", "開啟檔案..." },
{ "hex.builtin.menu.file.open_recent", "開啟近期" },
{ "hex.builtin.menu.file.clear_recent", "清除" },