impr: Added path tooltips to accept pattern popup
This commit is contained in:
parent
dc77d81e1b
commit
391c8acfe4
@ -37,7 +37,9 @@ namespace hex::plugin::builtin {
|
|||||||
else
|
else
|
||||||
ImGui::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.prompt"_lang);
|
ImGui::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.prompt"_lang);
|
||||||
} else {
|
} else {
|
||||||
|
int id = 1;
|
||||||
for (auto &[type, text] : this->m_answer) {
|
for (auto &[type, text] : this->m_answer) {
|
||||||
|
ImGui::PushID(id);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TextBlockType::Text:
|
case TextBlockType::Text:
|
||||||
ImGui::TextFormattedWrapped("{}", text);
|
ImGui::TextFormattedWrapped("{}", text);
|
||||||
@ -54,6 +56,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
|
id += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -47,6 +47,8 @@ namespace hex::plugin::builtin {
|
|||||||
PopupAcceptPattern(ViewPatternEditor *view) : Popup("hex.builtin.view.pattern_editor.accept_pattern"), m_view(view) {}
|
PopupAcceptPattern(ViewPatternEditor *view) : Popup("hex.builtin.view.pattern_editor.accept_pattern"), m_view(view) {}
|
||||||
|
|
||||||
void drawContent() override {
|
void drawContent() override {
|
||||||
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
ImGui::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.desc"_lang));
|
ImGui::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.desc"_lang));
|
||||||
|
|
||||||
std::vector<std::string> entries;
|
std::vector<std::string> entries;
|
||||||
@ -59,8 +61,14 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImGui::BeginListBox("##patterns_accept", ImVec2(-FLT_MIN, 0))) {
|
if (ImGui::BeginListBox("##patterns_accept", ImVec2(-FLT_MIN, 0))) {
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
for (auto &path : this->m_view->m_possiblePatternFiles) {
|
for (auto &path : this->m_view->m_possiblePatternFiles) {
|
||||||
if (ImGui::Selectable(wolv::util::toUTF8String(path.filename()).c_str(), index == this->m_view->m_selectedPatternFile))
|
if (ImGui::Selectable(wolv::util::toUTF8String(path.filename()).c_str(), index == this->m_view->m_selectedPatternFile, ImGuiSelectableFlags_DontClosePopups))
|
||||||
this->m_view->m_selectedPatternFile = index;
|
this->m_view->m_selectedPatternFile = index;
|
||||||
|
|
||||||
|
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
|
||||||
|
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles[this->m_view->m_selectedPatternFile], provider);
|
||||||
|
|
||||||
|
ImGui::InfoTooltip(wolv::util::toUTF8String(path).c_str());
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +78,6 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang);
|
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang);
|
||||||
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
|
||||||
|
|
||||||
confirmButtons(
|
confirmButtons(
|
||||||
"hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [this, provider] {
|
"hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [this, provider] {
|
||||||
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles[this->m_view->m_selectedPatternFile], provider);
|
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles[this->m_view->m_selectedPatternFile], provider);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user