mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
Use ImGui-Addons by gallickgunner as file picker instead
This commit is contained in:
@@ -77,11 +77,8 @@ namespace hex {
|
||||
this->drawGotoPopup();
|
||||
}
|
||||
|
||||
this->m_fileBrowser.Display();
|
||||
|
||||
if (this->m_fileBrowser.HasSelected()) {
|
||||
this->openFile(this->m_fileBrowser.GetSelected().string());
|
||||
this->m_fileBrowser.ClearSelected();
|
||||
if (this->m_fileBrowser.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN)) {
|
||||
this->openFile(this->m_fileBrowser.selected_path);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,8 +125,7 @@ namespace hex {
|
||||
|
||||
if (ImGui::BeginMenu("File")) {
|
||||
if (ImGui::MenuItem("Open File...", "CTRL + O")) {
|
||||
this->m_fileBrowser.SetTitle("Open File");
|
||||
this->m_fileBrowser.Open();
|
||||
View::doLater([]{ ImGui::OpenPopup("Open File"); });
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
@@ -171,8 +167,7 @@ namespace hex {
|
||||
ImGui::OpenPopup("Goto");
|
||||
return true;
|
||||
} else if (mods == GLFW_MOD_CONTROL && key == GLFW_KEY_O) {
|
||||
this->m_fileBrowser.SetTitle("Open File");
|
||||
this->m_fileBrowser.Open();
|
||||
ImGui::OpenPopup("Open File");
|
||||
return true;
|
||||
} else if (mods == (GLFW_MOD_CONTROL | GLFW_MOD_ALT) && key == GLFW_KEY_C) {
|
||||
this->copyBytes();
|
||||
|
||||
@@ -22,9 +22,7 @@ namespace hex {
|
||||
void ViewPattern::createMenu() {
|
||||
if (ImGui::BeginMenu("File")) {
|
||||
if (ImGui::MenuItem("Load pattern...")) {
|
||||
this->m_fileBrowser.SetTitle("Open Hex Pattern");
|
||||
this->m_fileBrowser.SetTypeFilters({ ".hexpat" });
|
||||
this->m_fileBrowser.Open();
|
||||
View::doLater([]{ ImGui::OpenPopup("Open Hex Pattern"); });
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@@ -62,12 +60,9 @@ namespace hex {
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
this->m_fileBrowser.Display();
|
||||
if (this->m_fileBrowser.showFileDialog("Open Hex Pattern", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(0, 0), ".hexpat")) {
|
||||
|
||||
if (this->m_fileBrowser.HasSelected()) {
|
||||
|
||||
FILE *file = fopen(this->m_fileBrowser.GetSelected().string().c_str(), "rb");
|
||||
this->m_fileBrowser.ClearSelected();
|
||||
FILE *file = fopen(this->m_fileBrowser.selected_path.c_str(), "rb");
|
||||
|
||||
if (file != nullptr) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
|
||||
Reference in New Issue
Block a user