4aa314b3ab
* add quick -save project- action * translation for -save project as- added * removed machine translations; header file name extension fixed * moved openProject() for consistency
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#include <hex/api/keybinding.hpp>
|
|
#include <hex/api/event.hpp>
|
|
|
|
#include <hex/providers/provider.hpp>
|
|
#include "content/global_actions.hpp"
|
|
|
|
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, [] {
|
|
EventManager::post<RequestOpenWindow>("Open File");
|
|
});
|
|
|
|
// Close file
|
|
ShortcutManager::addGlobalShortcut(CTRL + Keys::W, [] {
|
|
if (ImHexApi::Provider::isValid())
|
|
ImHexApi::Provider::remove(ImHexApi::Provider::get());
|
|
});
|
|
|
|
// Reload file
|
|
ShortcutManager::addGlobalShortcut(CTRL + Keys::R, [] {
|
|
if (ImHexApi::Provider::isValid()) {
|
|
auto provider = ImHexApi::Provider::get();
|
|
|
|
provider->close();
|
|
if (!provider->open())
|
|
ImHexApi::Provider::remove(provider, true);
|
|
}
|
|
});
|
|
|
|
// Save project
|
|
ShortcutManager::addGlobalShortcut(ALT + Keys::S, [] {
|
|
saveProject();
|
|
});
|
|
|
|
// Save project as...
|
|
ShortcutManager::addGlobalShortcut(ALT + SHIFT + Keys::S, [] {
|
|
saveProjectAs();
|
|
});
|
|
}
|
|
|
|
} |