sys: Added "New File..." menu item and shortcut
This commit is contained in:
parent
a620400e4e
commit
33a375910a
@ -20,11 +20,12 @@ namespace hex::plugin::builtin {
|
|||||||
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1050, [&] {
|
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1050, [&] {
|
||||||
bool taskRunning = TaskManager::getRunningTaskCount() > 0;
|
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) {
|
if (ImGui::MenuItem("hex.builtin.menu.file.open_file"_lang, "CTRL + O", false, !taskRunning)) {
|
||||||
EventManager::post<RequestOpenFile>(path);
|
EventManager::post<RequestOpenWindow>("Open File");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("hex.builtin.menu.file.open_other"_lang, !taskRunning)) {
|
if (ImGui::BeginMenu("hex.builtin.menu.file.open_other"_lang, !taskRunning)) {
|
||||||
|
@ -4,11 +4,14 @@
|
|||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
void registerShortcuts() {
|
void registerShortcuts() {
|
||||||
|
// New file
|
||||||
|
ShortcutManager::addGlobalShortcut(CTRL + Keys::N, [] {
|
||||||
|
EventManager::post<RequestOpenWindow>("Create File");
|
||||||
|
});
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
ShortcutManager::addGlobalShortcut(CTRL + Keys::O, [] {
|
ShortcutManager::addGlobalShortcut(CTRL + Keys::O, [] {
|
||||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
EventManager::post<RequestOpenWindow>("Open File");
|
||||||
EventManager::post<RequestOpenFile>(path);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
|
@ -105,6 +105,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "Failed to create new file!" },
|
{ "hex.builtin.popup.error.create", "Failed to create new file!" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "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_file", "Open File..." },
|
||||||
{ "hex.builtin.menu.file.open_recent", "Open Recent" },
|
{ "hex.builtin.menu.file.open_recent", "Open Recent" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "Clear" },
|
{ "hex.builtin.menu.file.clear_recent", "Clear" },
|
||||||
|
@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "Impossibile creare il nuovo File!" },
|
{ "hex.builtin.popup.error.create", "Impossibile creare il nuovo File!" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "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_file", "Apri File..." },
|
||||||
{ "hex.builtin.menu.file.open_recent", "File recenti" },
|
{ "hex.builtin.menu.file.open_recent", "File recenti" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "Pulisci" },
|
{ "hex.builtin.menu.file.clear_recent", "Pulisci" },
|
||||||
|
@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "新しいファイルを作成できませんでした。" },
|
{ "hex.builtin.popup.error.create", "新しいファイルを作成できませんでした。" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "ファイル" },
|
{ "hex.builtin.menu.file", "ファイル" },
|
||||||
|
//{ "hex.builtin.menu.file.create_file", "New File..." },
|
||||||
{ "hex.builtin.menu.file.open_file", "ファイルを開く…" },
|
{ "hex.builtin.menu.file.open_file", "ファイルを開く…" },
|
||||||
{ "hex.builtin.menu.file.open_recent", "最近使用したファイル" },
|
{ "hex.builtin.menu.file.open_recent", "最近使用したファイル" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "リストをクリア" },
|
{ "hex.builtin.menu.file.clear_recent", "リストをクリア" },
|
||||||
|
@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "Falha ao criar um novo arquivo!" },
|
{ "hex.builtin.popup.error.create", "Falha ao criar um novo arquivo!" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "File" },
|
{ "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_file", "Abrir Arquivo..." },
|
||||||
{ "hex.builtin.menu.file.open_recent", "Abrir Recentes" },
|
{ "hex.builtin.menu.file.open_recent", "Abrir Recentes" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "Limpar" },
|
{ "hex.builtin.menu.file.clear_recent", "Limpar" },
|
||||||
|
@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "创建新文件失败!" },
|
{ "hex.builtin.popup.error.create", "创建新文件失败!" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "文件" },
|
{ "hex.builtin.menu.file", "文件" },
|
||||||
|
//{ "hex.builtin.menu.file.create_file", "New File..." },
|
||||||
{ "hex.builtin.menu.file.open_file", "打开文件..." },
|
{ "hex.builtin.menu.file.open_file", "打开文件..." },
|
||||||
{ "hex.builtin.menu.file.open_recent", "最近打开" },
|
{ "hex.builtin.menu.file.open_recent", "最近打开" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "清除" },
|
{ "hex.builtin.menu.file.clear_recent", "清除" },
|
||||||
|
@ -103,6 +103,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.popup.error.create", "無法建立新檔案!" },
|
{ "hex.builtin.popup.error.create", "無法建立新檔案!" },
|
||||||
|
|
||||||
{ "hex.builtin.menu.file", "檔案" },
|
{ "hex.builtin.menu.file", "檔案" },
|
||||||
|
//{ "hex.builtin.menu.file.create_file", "New File..." },
|
||||||
{ "hex.builtin.menu.file.open_file", "開啟檔案..." },
|
{ "hex.builtin.menu.file.open_file", "開啟檔案..." },
|
||||||
{ "hex.builtin.menu.file.open_recent", "開啟近期" },
|
{ "hex.builtin.menu.file.open_recent", "開啟近期" },
|
||||||
{ "hex.builtin.menu.file.clear_recent", "清除" },
|
{ "hex.builtin.menu.file.clear_recent", "清除" },
|
||||||
|
Loading…
Reference in New Issue
Block a user