1
0
mirror of synced 2025-02-20 04:01:01 +01:00

ux: Add close file button to file menu

This commit is contained in:
WerWolv 2021-03-29 22:44:35 +02:00
parent 0cc7004d0d
commit 147aefc7e5
5 changed files with 11 additions and 1 deletions

View File

@ -155,6 +155,7 @@ namespace hex::plugin::builtin {
{ "hex.view.hexeditor.menu.file.open_file", "Datei öffnen..." },
{ "hex.view.hexeditor.menu.file.save", "Speichern" },
{ "hex.view.hexeditor.menu.file.save_as", "Speichern unter..." },
{ "hex.view.hexeditor.menu.file.close", "Schliessen" },
{ "hex.view.hexeditor.menu.file.open_project", "Projekt öffnen..." },
{ "hex.view.hexeditor.menu.file.save_project", "Projekt speichern..." },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Custom encoding laden..." },

View File

@ -155,6 +155,7 @@ namespace hex::plugin::builtin {
{ "hex.view.hexeditor.menu.file.open_file", "Open File..." },
{ "hex.view.hexeditor.menu.file.save", "Save" },
{ "hex.view.hexeditor.menu.file.save_as", "Save As..." },
{ "hex.view.hexeditor.menu.file.close", "Close" },
{ "hex.view.hexeditor.menu.file.open_project", "Open Project..." },
{ "hex.view.hexeditor.menu.file.save_project", "Save Project..." },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Load custom encoding..." },

View File

@ -155,6 +155,7 @@ namespace hex::plugin::builtin {
{ "hex.view.hexeditor.menu.file.open_file", "Apri File..." },
{ "hex.view.hexeditor.menu.file.save", "Salva" },
{ "hex.view.hexeditor.menu.file.save_as", "Salva come..." },
// { "hex.view.hexeditor.menu.file.close", "" },
{ "hex.view.hexeditor.menu.file.open_project", "Apri un Progetto..." },
{ "hex.view.hexeditor.menu.file.save_project", "Salva Progetto..." },
{ "hex.view.hexeditor.menu.file.load_encoding_file", "Carica una codifica personalizzata..." },

View File

@ -97,6 +97,7 @@ namespace hex {
/* Default Events */
EVENT_DEF(EventFileLoaded, std::string);
EVENT_DEF(EventFileUnloaded);
EVENT_DEF(EventDataChanged);
EVENT_DEF(EventPatternChanged);
EVENT_DEF(EventFileDropped, std::string);

View File

@ -347,7 +347,7 @@ namespace hex {
}
void ViewHexEditor::drawMenu() {
auto provider = SharedData::currentProvider;
auto &provider = SharedData::currentProvider;
if (ImGui::BeginMenu("hex.menu.file"_lang)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_file"_lang, "CTRL + O")) {
@ -366,6 +366,12 @@ namespace hex {
saveAs();
}
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.close", "", false, provider != nullptr && provider->isAvailable())) {
EventManager::post<EventFileUnloaded>();
delete SharedData::currentProvider;
SharedData::currentProvider = nullptr;
}
ImGui::Separator();
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_project"_lang, "")) {