mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 21:47:40 -05:00
refactor: Move custom ImGui functions to ImGuiExt namespace (#1427)
Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
@@ -40,20 +40,20 @@ namespace hex::plugin::builtin {
|
||||
|
||||
static void link(const std::string &name, const std::string &author, const std::string &url) {
|
||||
// Draw the hyperlink and open the URL if clicked
|
||||
if (ImGui::BulletHyperlink(name.c_str()))
|
||||
if (ImGuiExt::BulletHyperlink(name.c_str()))
|
||||
hex::openWebpage(url);
|
||||
|
||||
// Show the URL as a tooltip
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextFormatted("{}", url);
|
||||
ImGuiExt::TextFormatted("{}", url);
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
// Show the author if there is one
|
||||
if (!author.empty()) {
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::TextFormatted("by {}", author);
|
||||
ImGuiExt::TextFormatted("by {}", author);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw the ImHex icon
|
||||
if (!this->m_logoTexture.isValid())
|
||||
this->m_logoTexture = ImGui::Texture(romfs::get("assets/common/logo.png").span());
|
||||
this->m_logoTexture = ImGuiExt::Texture(romfs::get("assets/common/logo.png").span());
|
||||
|
||||
ImGui::Image(this->m_logoTexture, scaled({ 64, 64 }));
|
||||
if (ImGui::IsItemHovered() && ImGui::IsItemClicked()) {
|
||||
@@ -74,16 +74,16 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Draw basic information about ImHex and its version
|
||||
ImGui::TextFormatted("ImHex Hex Editor v{} by WerWolv " ICON_FA_CODE_BRANCH, ImHexApi::System::getImHexVersion());
|
||||
ImGuiExt::TextFormatted("ImHex Hex Editor v{} by WerWolv " ICON_FA_CODE_BRANCH, ImHexApi::System::getImHexVersion());
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Draw a clickable link to the current commit
|
||||
if (ImGui::Hyperlink(hex::format("{0}@{1}", ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash()).c_str()))
|
||||
if (ImGuiExt::Hyperlink(hex::format("{0}@{1}", ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash()).c_str()))
|
||||
hex::openWebpage("https://github.com/WerWolv/ImHex/commit/" + ImHexApi::System::getCommitHash(true));
|
||||
|
||||
// Draw the build date and time
|
||||
ImGui::TextFormatted("{}, {}", __DATE__, __TIME__);
|
||||
ImGuiExt::TextFormatted("{}, {}", __DATE__, __TIME__);
|
||||
|
||||
// Draw the author of the current translation
|
||||
ImGui::TextUnformatted("hex.builtin.view.help.about.translator"_lang);
|
||||
@@ -94,7 +94,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SameLine();
|
||||
|
||||
// Draw a clickable link to the GitHub repository
|
||||
if (ImGui::Hyperlink("WerWolv/ImHex"))
|
||||
if (ImGuiExt::Hyperlink("WerWolv/ImHex"))
|
||||
hex::openWebpage("https://github.com/WerWolv/ImHex");
|
||||
|
||||
ImGui::EndTable();
|
||||
@@ -108,18 +108,18 @@ namespace hex::plugin::builtin {
|
||||
|
||||
constexpr std::array Links = { "https://werwolv.net/donate", "https://www.patreon.com/werwolv", "https://github.com/sponsors/WerWolv" };
|
||||
|
||||
ImGui::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.help.about.thanks"_lang));
|
||||
ImGuiExt::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.help.about.thanks"_lang));
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
for (auto &link : Links) {
|
||||
if (ImGui::Hyperlink(link))
|
||||
if (ImGuiExt::Hyperlink(link))
|
||||
hex::openWebpage(link);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewAbout::drawContributorPage() {
|
||||
ImGui::TextFormattedWrapped("These amazing people have contributed to ImHex in the past. If you'd like to become part of them, please submit a PR to the GitHub Repository!");
|
||||
ImGuiExt::TextFormattedWrapped("These amazing people have contributed to ImHex in the past. If you'd like to become part of them, please submit a PR to the GitHub Repository!");
|
||||
ImGui::NewLine();
|
||||
|
||||
// Draw main ImHex contributors
|
||||
@@ -214,11 +214,11 @@ namespace hex::plugin::builtin {
|
||||
for (auto &path : fs::getDefaultPaths(type, true)){
|
||||
// Draw hyperlink to paths that exist or red text if they don't
|
||||
if (wolv::io::fs::isDirectory(path)){
|
||||
if (ImGui::Hyperlink(wolv::util::toUTF8String(path).c_str())) {
|
||||
if (ImGuiExt::Hyperlink(wolv::util::toUTF8String(path).c_str())) {
|
||||
fs::openFolderExternal(path);
|
||||
}
|
||||
} else {
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), wolv::util::toUTF8String(path));
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), wolv::util::toUTF8String(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
} else {
|
||||
// Draw a spinner while the release notes are loading
|
||||
ImGui::TextSpinner("hex.builtin.common.loading"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.common.loading"_lang);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace hex::plugin::builtin {
|
||||
// Draw the line with the bold text highlighted
|
||||
ImGui::TextUnformatted(line.substr(0, boldStart).c_str());
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", line.substr(boldStart + 2, boldEnd - boldStart - 2).c_str());
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", line.substr(boldStart + 2, boldEnd - boldStart - 2).c_str());
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::TextUnformatted(line.substr(boldEnd + 2).c_str());
|
||||
} else {
|
||||
@@ -295,7 +295,7 @@ namespace hex::plugin::builtin {
|
||||
// Draw the release title
|
||||
if (!releaseTitle.empty()) {
|
||||
auto title = hex::format("v{}: {}", ImHexApi::System::getImHexVersion(false), releaseTitle);
|
||||
ImGui::Header(title.c_str(), true);
|
||||
ImGuiExt::Header(title.c_str(), true);
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
@@ -304,10 +304,10 @@ namespace hex::plugin::builtin {
|
||||
for (const auto &line : releaseNotes) {
|
||||
if (line.starts_with("## ")) {
|
||||
// Draw H2 Header
|
||||
ImGui::Header(line.substr(3).c_str());
|
||||
ImGuiExt::Header(line.substr(3).c_str());
|
||||
} else if (line.starts_with("### ")) {
|
||||
// Draw H3 Header
|
||||
ImGui::Header(line.substr(4).c_str());
|
||||
ImGuiExt::Header(line.substr(4).c_str());
|
||||
} else if (line.starts_with("- ")) {
|
||||
// Draw bullet point
|
||||
drawRegularLine(line.substr(2));
|
||||
@@ -400,7 +400,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
} else {
|
||||
// Draw a spinner while the commits are loading
|
||||
ImGui::TextSpinner("hex.builtin.common.loading"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.common.loading"_lang);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,14 +421,14 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ImGui::BeginTooltip()) {
|
||||
// Draw author and commit date
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", commit.author);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", commit.author);
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("@ {}", commit.date.c_str());
|
||||
ImGuiExt::TextFormatted("@ {}", commit.date.c_str());
|
||||
|
||||
// Draw description if there is one
|
||||
if (!commit.description.empty()) {
|
||||
ImGui::Separator();
|
||||
ImGui::TextFormatted("{}", commit.description);
|
||||
ImGuiExt::TextFormatted("{}", commit.description);
|
||||
}
|
||||
|
||||
ImGui::EndTooltip();
|
||||
@@ -438,7 +438,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw commit hash
|
||||
ImGui::SameLine(0, 0);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", commit.hash.substr(0, 7));
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight), "{}", commit.hash.substr(0, 7));
|
||||
|
||||
// Draw the commit message
|
||||
ImGui::TableNextColumn();
|
||||
@@ -449,7 +449,7 @@ namespace hex::plugin::builtin {
|
||||
else
|
||||
return ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
}();
|
||||
ImGui::TextFormattedColored(color, commit.message);
|
||||
ImGuiExt::TextFormattedColored(color, commit.message);
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
@@ -460,7 +460,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void ViewAbout::drawLicensePage() {
|
||||
ImGui::TextFormattedWrapped("{}", romfs::get("licenses/LICENSE").string());
|
||||
ImGuiExt::TextFormattedWrapped("{}", romfs::get("licenses/LICENSE").string());
|
||||
}
|
||||
|
||||
void ViewAbout::drawAboutPopup() {
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace hex::plugin::builtin {
|
||||
// Determine achievement border color based on unlock state
|
||||
const auto borderColor = [&] {
|
||||
if (achievement.isUnlocked())
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_AchievementUnlocked, 1.0F);
|
||||
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_AchievementUnlocked, 1.0F);
|
||||
else if (node->isUnlockable())
|
||||
return ImGui::GetColorU32(ImGuiCol_Button, 1.0F);
|
||||
else
|
||||
@@ -127,7 +127,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Separator();
|
||||
separator = true;
|
||||
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "[ {} ]", LangEntry("hex.builtin.view.achievements.click"));
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "[ {} ]", LangEntry("hex.builtin.view.achievements.click"));
|
||||
}
|
||||
|
||||
// Draw achievement description if available
|
||||
@@ -137,7 +137,7 @@ namespace hex::plugin::builtin {
|
||||
else
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::TextFormattedWrapped("{}", LangEntry(desc));
|
||||
ImGuiExt::TextFormattedWrapped("{}", LangEntry(desc));
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
@@ -424,7 +424,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
|
||||
|
||||
// Draw unlock text
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "{}", "hex.builtin.view.achievements.unlocked"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "{}", "hex.builtin.view.achievements.unlocked"_lang);
|
||||
|
||||
// Draw achievement icon
|
||||
ImGui::Image(this->m_currAchievement->getIcon(), scaled({ 20, 20 }));
|
||||
@@ -434,7 +434,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SameLine();
|
||||
|
||||
// Draw name of achievement
|
||||
ImGui::TextFormattedWrapped("{}", LangEntry(this->m_currAchievement->getUnlocalizedName()));
|
||||
ImGuiExt::TextFormattedWrapped("{}", LangEntry(this->m_currAchievement->getUnlocalizedName()));
|
||||
|
||||
// Handle clicking on the popup
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace hex::plugin::builtin {
|
||||
// Draw bookmark header
|
||||
ImGui::ColorButton("##color", ImColor(bookmark.color));
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::TextFormatted("{} ", bookmark.name);
|
||||
ImGuiExt::TextFormatted("{} ", bookmark.name);
|
||||
|
||||
// Draw extra information table when holding down shift
|
||||
if (ImGui::GetIO().KeyShift) {
|
||||
@@ -90,18 +90,18 @@ namespace hex::plugin::builtin {
|
||||
// Draw region
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang.get());
|
||||
ImGuiExt::TextFormatted("{}: ", "hex.builtin.common.region"_lang.get());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("[ 0x{:08X} - 0x{:08X} ] ", bookmark.region.getStartAddress(), bookmark.region.getEndAddress());
|
||||
ImGuiExt::TextFormatted("[ 0x{:08X} - 0x{:08X} ] ", bookmark.region.getStartAddress(), bookmark.region.getEndAddress());
|
||||
|
||||
// Draw comment if it's not empty
|
||||
if (!bookmark.comment.empty() && bookmark.comment[0] != '\x00') {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}: ", "hex.builtin.view.bookmarks.header.comment"_lang.get());
|
||||
ImGuiExt::TextFormatted("{}: ", "hex.builtin.view.bookmarks.header.comment"_lang.get());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushTextWrapPos(ImGui::CalcTextSize("X").x * 40);
|
||||
ImGui::TextFormattedWrapped("{}", bookmark.comment);
|
||||
ImGuiExt::TextFormattedWrapped("{}", bookmark.comment);
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
@@ -206,14 +206,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw filter input
|
||||
ImGui::PushItemWidth(-1);
|
||||
ImGui::InputTextIcon("##filter", ICON_VS_FILTER, this->m_currFilter);
|
||||
ImGuiExt::InputTextIcon("##filter", ICON_VS_FILTER, this->m_currFilter);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
if (ImGui::BeginChild("##bookmarks")) {
|
||||
if (this->m_bookmarks->empty()) {
|
||||
ImGui::TextFormattedCentered("hex.builtin.view.bookmarks.no_bookmarks"_lang);
|
||||
ImGuiExt::TextFormattedCentered("hex.builtin.view.bookmarks.no_bookmarks"_lang);
|
||||
}
|
||||
|
||||
int id = 1;
|
||||
@@ -279,11 +279,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw lock/unlock button
|
||||
if (locked) {
|
||||
if (ImGui::IconButton(ICON_VS_LOCK, ImGui::GetStyleColorVec4(ImGuiCol_Text))) locked = false;
|
||||
ImGui::InfoTooltip("hex.builtin.view.bookmarks.tooltip.unlock"_lang);
|
||||
if (ImGuiExt::IconButton(ICON_VS_LOCK, ImGui::GetStyleColorVec4(ImGuiCol_Text))) locked = false;
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.bookmarks.tooltip.unlock"_lang);
|
||||
} else {
|
||||
if (ImGui::IconButton(ICON_VS_UNLOCK, ImGui::GetStyleColorVec4(ImGuiCol_Text))) locked = true;
|
||||
ImGui::InfoTooltip("hex.builtin.view.bookmarks.tooltip.lock"_lang);
|
||||
if (ImGuiExt::IconButton(ICON_VS_UNLOCK, ImGui::GetStyleColorVec4(ImGuiCol_Text))) locked = true;
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.bookmarks.tooltip.lock"_lang);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@@ -293,7 +293,7 @@ namespace hex::plugin::builtin {
|
||||
if (!locked)
|
||||
ImGui::OpenPopup("hex.builtin.view.bookmarks.header.color"_lang);
|
||||
}
|
||||
ImGui::InfoTooltip("hex.builtin.view.bookmarks.header.color"_lang);
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.bookmarks.header.color"_lang);
|
||||
|
||||
// Draw color picker
|
||||
if (ImGui::BeginPopup("hex.builtin.view.bookmarks.header.color"_lang)) {
|
||||
@@ -321,14 +321,14 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Draw jump to address button
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_STEP_BACK, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_STEP_BACK, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
|
||||
ImHexApi::HexEditor::setSelection(region);
|
||||
ImGui::InfoTooltip("hex.builtin.view.bookmarks.tooltip.jump_to"_lang);
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.bookmarks.tooltip.jump_to"_lang);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Draw open in new view button
|
||||
if (ImGui::IconButton(ICON_VS_GO_TO_FILE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_GO_TO_FILE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
TaskManager::doLater([region, provider]{
|
||||
auto newProvider = ImHexApi::Provider::createProvider("hex.builtin.provider.view", true);
|
||||
if (auto *viewProvider = dynamic_cast<ViewProvider*>(newProvider); viewProvider != nullptr) {
|
||||
@@ -340,12 +340,12 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui::InfoTooltip("hex.builtin.view.bookmarks.tooltip.open_in_view"_lang);
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.bookmarks.tooltip.open_in_view"_lang);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Draw the address of the bookmark
|
||||
ImGui::TextFormatted("hex.builtin.view.bookmarks.address"_lang, region.getStartAddress(), region.getEndAddress());
|
||||
ImGuiExt::TextFormatted("hex.builtin.view.bookmarks.address"_lang, region.getStartAddress(), region.getEndAddress());
|
||||
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, rowHeight);
|
||||
ImGui::TableNextColumn();
|
||||
@@ -354,7 +354,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TextUnformatted("hex.builtin.common.size"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(hex::toByteString(region.size));
|
||||
ImGuiExt::TextFormatted(hex::toByteString(region.size));
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
@@ -362,12 +362,12 @@ namespace hex::plugin::builtin {
|
||||
// Draw comment if the bookmark is locked or an input text box if it's unlocked
|
||||
if (locked) {
|
||||
if (!comment.empty()) {
|
||||
ImGui::Header("hex.builtin.view.bookmarks.header.comment"_lang);
|
||||
ImGui::TextFormattedWrapped("{}", comment.data());
|
||||
ImGuiExt::Header("hex.builtin.view.bookmarks.header.comment"_lang);
|
||||
ImGuiExt::TextFormattedWrapped("{}", comment.data());
|
||||
}
|
||||
}
|
||||
else {
|
||||
ImGui::Header("hex.builtin.view.bookmarks.header.comment"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.bookmarks.header.comment"_lang);
|
||||
ImGui::InputTextMultiline("##commentInput", comment, ImVec2(ImGui::GetContentRegionAvail().x, 150_scaled));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::PushItemWidth(-1);
|
||||
|
||||
if (ImGui::InputTextIcon("##search", ICON_VS_FILTER, this->m_filter)) {
|
||||
if (ImGuiExt::InputTextIcon("##search", ICON_VS_FILTER, this->m_filter)) {
|
||||
this->m_filterIndices.clear();
|
||||
|
||||
// Filter the constants according to the entered value
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace hex::plugin::builtin {
|
||||
bool editing = false;
|
||||
if (this->m_editable) {
|
||||
// Draw name input field
|
||||
ImGui::InputTextIcon("##name", ICON_VS_SYMBOL_KEY, this->m_name);
|
||||
ImGuiExt::InputTextIcon("##name", ICON_VS_SYMBOL_KEY, this->m_name);
|
||||
|
||||
// Prevent editing mode from deactivating when the input field is focused
|
||||
editing = ImGui::IsItemActive();
|
||||
@@ -906,13 +906,13 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw the help text if no nodes have been placed yet
|
||||
if (workspace.nodes.empty())
|
||||
ImGui::TextFormattedCentered("{}", "hex.builtin.view.data_processor.help_text"_lang);
|
||||
ImGuiExt::TextFormattedCentered("{}", "hex.builtin.view.data_processor.help_text"_lang);
|
||||
|
||||
// Draw a close button if there is more than one workspace on the stack
|
||||
if (this->m_workspaceStack->size() > 1) {
|
||||
ImGui::SetCursorPos(ImVec2(ImGui::GetContentRegionAvail().x - ImGui::GetTextLineHeightWithSpacing() * 1.5F, ImGui::GetTextLineHeightWithSpacing() * 0.2F));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0F, 4.0F));
|
||||
if (ImGui::DimmedIconButton(ICON_VS_CLOSE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
if (ImGuiExt::DimmedIconButton(ICON_VS_CLOSE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
popWorkspace = true;
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
@@ -924,7 +924,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw the control bar at the bottom
|
||||
{
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_START, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen)) || this->m_continuousEvaluation)
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_START, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen)) || this->m_continuousEvaluation)
|
||||
this->processNodes(workspace);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -113,9 +113,9 @@ namespace hex::plugin::builtin {
|
||||
// Handle the case where one provider is larger than the other one
|
||||
if (address > otherProvider->getActualSize()) {
|
||||
if (otherIndex == 1)
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffAdded));
|
||||
return getDiffColor(ImGuiExt::GetCustomColorU32(ImGuiCustomCol_DiffAdded));
|
||||
else
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffRemoved));
|
||||
return getDiffColor(ImGuiExt::GetCustomColorU32(ImGuiCustomCol_DiffRemoved));
|
||||
}
|
||||
|
||||
// Read the current byte from the other provider
|
||||
@@ -124,7 +124,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Compare the two bytes, highlight both in yellow if they are different
|
||||
if (otherByte != *data)
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffChanged));
|
||||
return getDiffColor(ImGuiExt::GetCustomColorU32(ImGuiCustomCol_DiffChanged));
|
||||
|
||||
// No difference
|
||||
return std::nullopt;
|
||||
@@ -305,13 +305,13 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
switch (diff.type) {
|
||||
case DifferenceType::Modified:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffChanged), "hex.builtin.view.diff.modified"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DiffChanged), "hex.builtin.view.diff.modified"_lang);
|
||||
break;
|
||||
case DifferenceType::Added:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffAdded), "hex.builtin.view.diff.added"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DiffAdded), "hex.builtin.view.diff.added"_lang);
|
||||
break;
|
||||
case DifferenceType::Removed:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffRemoved), "hex.builtin.view.diff.removed"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DiffRemoved), "hex.builtin.view.diff.removed"_lang);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,24 +96,24 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
||||
ImGui::Header("hex.builtin.view.disassembler.position"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.view.disassembler.position"_lang, true);
|
||||
|
||||
// Draw base address input
|
||||
ImGui::InputHexadecimal("hex.builtin.view.disassembler.base"_lang, &this->m_baseAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.disassembler.base"_lang, &this->m_baseAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
||||
|
||||
// Draw region selection picker
|
||||
ui::regionSelectionPicker(&this->m_codeRegion, provider, &this->m_range);
|
||||
|
||||
// Draw settings
|
||||
{
|
||||
ImGui::Header("hex.builtin.common.settings"_lang);
|
||||
ImGuiExt::Header("hex.builtin.common.settings"_lang);
|
||||
|
||||
// Draw architecture selector
|
||||
if (ImGui::Combo("hex.builtin.view.disassembler.arch"_lang, reinterpret_cast<int *>(&this->m_architecture), Disassembler::ArchitectureNames.data(), Disassembler::getArchitectureSupportedCount()))
|
||||
this->m_mode = cs_mode(0);
|
||||
|
||||
// Draw sub-settings for each architecture
|
||||
if (ImGui::BeginBox()) {
|
||||
if (ImGuiExt::BeginBox()) {
|
||||
|
||||
// Draw endian radio buttons. This setting is available for all architectures
|
||||
static int littleEndian = true;
|
||||
@@ -373,7 +373,7 @@ namespace hex::plugin::builtin {
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::EndBox();
|
||||
ImGuiExt::EndBox();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace hex::plugin::builtin {
|
||||
// Draw a spinner if the disassembler is running
|
||||
if (this->m_disassemblerTask.isRunning()) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextSpinner("hex.builtin.view.disassembler.disassembling"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.view.disassembler.disassembling"_lang);
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
@@ -425,11 +425,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw instruction address
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("0x{0:X}", instruction.address);
|
||||
ImGuiExt::TextFormatted("0x{0:X}", instruction.address);
|
||||
|
||||
// Draw instruction offset
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:X}", instruction.offset);
|
||||
ImGuiExt::TextFormatted("0x{0:X}", instruction.offset);
|
||||
|
||||
// Draw instruction bytes
|
||||
ImGui::TableNextColumn();
|
||||
@@ -437,7 +437,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw instruction mnemonic and operands
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedColored(ImColor(0xFFD69C56), "{}", instruction.mnemonic);
|
||||
ImGuiExt::TextFormattedColored(ImColor(0xFFD69C56), "{}", instruction.mnemonic);
|
||||
ImGui::SameLine();
|
||||
ImGui::TextUnformatted(instruction.operators.c_str());
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewFind::ViewFind() : View("hex.builtin.view.find.name") {
|
||||
const static auto HighlightColor = [] { return (ImGui::GetCustomColorU32(ImGuiCustomCol_FindHighlight) & 0x00FFFFFF) | 0x70000000; };
|
||||
const static auto HighlightColor = [] { return (ImGuiExt::GetCustomColorU32(ImGuiCustomCol_FindHighlight) & 0x00FFFFFF) | 0x70000000; };
|
||||
|
||||
ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8* data, size_t size, bool) -> std::optional<color_t> {
|
||||
hex::unused(data, size);
|
||||
@@ -53,7 +53,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::ColorButton("##color", ImColor(HighlightColor()));
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::TextFormatted("{} ", value);
|
||||
ImGuiExt::TextFormatted("{} ", value);
|
||||
|
||||
if (ImGui::GetIO().KeyShift) {
|
||||
ImGui::Indent();
|
||||
@@ -61,18 +61,18 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}: ", "hex.builtin.common.region"_lang);
|
||||
ImGuiExt::TextFormatted("{}: ", "hex.builtin.common.region"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("[ 0x{:08X} - 0x{:08X} ]", region.getStartAddress(), region.getEndAddress());
|
||||
ImGuiExt::TextFormatted("[ 0x{:08X} - 0x{:08X} ]", region.getStartAddress(), region.getEndAddress());
|
||||
|
||||
auto demangledValue = llvm::demangle(value);
|
||||
|
||||
if (value != demangledValue) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}: ", "hex.builtin.view.find.demangled"_lang);
|
||||
ImGuiExt::TextFormatted("{}: ", "hex.builtin.view.find.demangled"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", demangledValue);
|
||||
ImGuiExt::TextFormatted("{}", demangledValue);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
@@ -549,7 +549,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginMenu("hex.builtin.view.find.context.replace"_lang)) {
|
||||
if (ImGui::BeginTabBar("##replace_tabs")) {
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.find.context.replace.hex"_lang)) {
|
||||
ImGui::InputTextIcon("##replace_input", ICON_VS_SYMBOL_NAMESPACE, this->m_replaceBuffer);
|
||||
ImGuiExt::InputTextIcon("##replace_input", ICON_VS_SYMBOL_NAMESPACE, this->m_replaceBuffer);
|
||||
|
||||
ImGui::BeginDisabled(this->m_replaceBuffer.empty());
|
||||
if (ImGui::Button("hex.builtin.view.find.context.replace"_lang)) {
|
||||
@@ -569,7 +569,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.find.context.replace.ascii"_lang)) {
|
||||
ImGui::InputTextIcon("##replace_input", ICON_VS_SYMBOL_KEY, this->m_replaceBuffer);
|
||||
ImGuiExt::InputTextIcon("##replace_input", ICON_VS_SYMBOL_KEY, this->m_replaceBuffer);
|
||||
|
||||
ImGui::BeginDisabled(this->m_replaceBuffer.empty());
|
||||
if (ImGui::Button("hex.builtin.view.find.context.replace"_lang)) {
|
||||
@@ -639,7 +639,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::CollapsingHeader("hex.builtin.view.find.strings.match_settings"_lang)) {
|
||||
ImGui::Checkbox("hex.builtin.view.find.strings.null_term"_lang, &settings.nullTermination);
|
||||
|
||||
ImGui::Header("hex.builtin.view.find.strings.chars"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.find.strings.chars"_lang);
|
||||
ImGui::Checkbox(hex::format("{} [a-z]", "hex.builtin.view.find.strings.lower_case"_lang.get()).c_str(), &settings.lowerCaseLetters);
|
||||
ImGui::Checkbox(hex::format("{} [A-Z]", "hex.builtin.view.find.strings.upper_case"_lang.get()).c_str(), &settings.upperCaseLetters);
|
||||
ImGui::Checkbox(hex::format("{} [0-9]", "hex.builtin.view.find.strings.numbers"_lang.get()).c_str(), &settings.numbers);
|
||||
@@ -658,7 +658,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
mode = SearchSettings::Mode::Sequence;
|
||||
|
||||
ImGui::InputTextIcon("hex.builtin.common.value"_lang, ICON_VS_SYMBOL_KEY, settings.sequence);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.common.value"_lang, ICON_VS_SYMBOL_KEY, settings.sequence);
|
||||
|
||||
this->m_settingsValid = !settings.sequence.empty() && !hex::decodeByteString(settings.sequence).empty();
|
||||
|
||||
@@ -687,7 +687,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::InputTextIcon("hex.builtin.view.find.regex.pattern"_lang, ICON_VS_REGEX, settings.pattern);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.view.find.regex.pattern"_lang, ICON_VS_REGEX, settings.pattern);
|
||||
|
||||
try {
|
||||
std::regex regex(settings.pattern);
|
||||
@@ -708,7 +708,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
mode = SearchSettings::Mode::BinaryPattern;
|
||||
|
||||
ImGui::InputTextIcon("hex.builtin.view.find.binary_pattern"_lang, ICON_VS_SYMBOL_NAMESPACE, settings.input);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.view.find.binary_pattern"_lang, ICON_VS_SYMBOL_NAMESPACE, settings.input);
|
||||
|
||||
constexpr static u32 min = 1, max = 0x1000;
|
||||
ImGui::SliderScalar("hex.builtin.view.find.binary_pattern.alignment"_lang, ImGuiDataType_U32, &settings.alignment, &min, &max);
|
||||
@@ -726,16 +726,16 @@ namespace hex::plugin::builtin {
|
||||
bool edited = false;
|
||||
|
||||
if (settings.range) {
|
||||
if (ImGui::InputTextIcon("hex.builtin.view.find.value.min"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMin)) edited = true;
|
||||
if (ImGui::InputTextIcon("hex.builtin.view.find.value.max"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMax)) edited = true;
|
||||
if (ImGuiExt::InputTextIcon("hex.builtin.view.find.value.min"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMin)) edited = true;
|
||||
if (ImGuiExt::InputTextIcon("hex.builtin.view.find.value.max"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMax)) edited = true;
|
||||
} else {
|
||||
if (ImGui::InputTextIcon("hex.builtin.common.value"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMin)) {
|
||||
if (ImGuiExt::InputTextIcon("hex.builtin.common.value"_lang, ICON_VS_SYMBOL_NUMERIC, settings.inputMin)) {
|
||||
edited = true;
|
||||
settings.inputMax = settings.inputMin;
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::InputTextIcon("##placeholder_value", ICON_VS_SYMBOL_NUMERIC, settings.inputMax);
|
||||
ImGuiExt::InputTextIcon("##placeholder_value", ICON_VS_SYMBOL_NUMERIC, settings.inputMax);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
@@ -818,7 +818,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("hex.builtin.view.find.search.entries"_lang, this->m_foundOccurrences->size());
|
||||
ImGuiExt::TextFormatted("hex.builtin.view.find.search.entries"_lang, this->m_foundOccurrences->size());
|
||||
|
||||
ImGui::BeginDisabled(this->m_foundOccurrences->empty());
|
||||
{
|
||||
@@ -842,7 +842,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::PushItemWidth(-1);
|
||||
auto prevFilterLength = this->m_currFilter->length();
|
||||
if (ImGui::InputTextIcon("##filter", ICON_VS_FILTER, *this->m_currFilter)) {
|
||||
if (ImGuiExt::InputTextIcon("##filter", ICON_VS_FILTER, *this->m_currFilter)) {
|
||||
if (prevFilterLength > this->m_currFilter->length())
|
||||
*this->m_sortedOccurrences = *this->m_foundOccurrences;
|
||||
|
||||
@@ -908,15 +908,15 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::TextFormatted("0x{:08X}", foundItem.region.getStartAddress());
|
||||
ImGuiExt::TextFormatted("0x{:08X}", foundItem.region.getStartAddress());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", hex::toByteString(foundItem.region.getSize()));
|
||||
ImGuiExt::TextFormatted("{}", hex::toByteString(foundItem.region.getSize()));
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::PushID(i);
|
||||
|
||||
auto value = this->decodeValue(provider, foundItem, 256);
|
||||
ImGui::TextFormatted("{}", value);
|
||||
ImGuiExt::TextFormatted("{}", value);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Selectable("##line", foundItem.selected, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
if (ImGui::GetIO().KeyCtrl) {
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace hex::plugin::builtin {
|
||||
m_hash(hash) { }
|
||||
|
||||
void drawContent() override {
|
||||
ImGui::Header(this->getUnlocalizedName().c_str(), true);
|
||||
ImGuiExt::Header(this->getUnlocalizedName().c_str(), true);
|
||||
|
||||
ImGui::PushItemWidth(-1);
|
||||
if (ImGui::InputTextMultiline("##input", this->m_input)) {
|
||||
@@ -85,14 +85,14 @@ namespace hex::plugin::builtin {
|
||||
for (auto &function : hashFunctions) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", function.getName());
|
||||
ImGuiExt::TextFormatted("{}", function.getName());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(" ");
|
||||
ImGuiExt::TextFormatted(" ");
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (provider != nullptr)
|
||||
ImGui::TextFormatted("{}", crypt::encode16(function.get(*selection, provider)));
|
||||
ImGuiExt::TextFormatted("{}", crypt::encode16(function.get(*selection, provider)));
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
@@ -166,18 +166,18 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Check if no elements have been added
|
||||
if (startPos == ImGui::GetCursorPosY()) {
|
||||
ImGui::TextFormattedCentered("hex.builtin.view.hashes.no_settings"_lang);
|
||||
ImGuiExt::TextFormattedCentered("hex.builtin.view.hashes.no_settings"_lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
|
||||
ImGui::InputTextIcon("##hash_name", ICON_VS_SYMBOL_KEY, this->m_newHashName);
|
||||
ImGuiExt::InputTextIcon("##hash_name", ICON_VS_SYMBOL_KEY, this->m_newHashName);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginDisabled(this->m_newHashName.empty() || this->m_selectedHash == nullptr);
|
||||
if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (this->m_selectedHash != nullptr) {
|
||||
this->m_hashFunctions->push_back(this->m_selectedHash->create(this->m_newHashName));
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.builtin.achievement.misc.create_hash.name");
|
||||
@@ -186,7 +186,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::HelpHover("hex.builtin.view.hashes.hover_info"_lang);
|
||||
ImGuiExt::HelpHover("hex.builtin.view.hashes.hover_info"_lang);
|
||||
|
||||
if (ImGui::BeginTable("##hashes", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) {
|
||||
ImGui::TableSetupColumn("hex.builtin.view.hashes.table.name"_lang);
|
||||
@@ -215,7 +215,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", LangEntry(function.getType()->getUnlocalizedName()));
|
||||
ImGuiExt::TextFormatted("{}", LangEntry(function.getType()->getUnlocalizedName()));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
std::string result;
|
||||
@@ -230,11 +230,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (ImGui::IconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
PopupTextHash::open(function);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::IconButton(ICON_VS_X, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_X, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
indexToRemove = i;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
this->m_requestFocus = false;
|
||||
}
|
||||
if (ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_OPERATOR, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
|
||||
if (ImGuiExt::InputTextIcon("##input", ICON_VS_SYMBOL_OPERATOR, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
|
||||
if (auto result = this->m_evaluator.evaluate(this->m_input); result.has_value()) {
|
||||
const auto inputResult = result.value();
|
||||
u64 newAddress = 0x00;
|
||||
@@ -115,8 +115,8 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.select.offset.region"_lang)) {
|
||||
u64 inputA = this->m_region.getStartAddress();
|
||||
u64 inputB = this->m_region.getEndAddress();
|
||||
ImGui::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGui::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.end"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.end"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
|
||||
if (inputB < inputA)
|
||||
inputB = inputA;
|
||||
@@ -129,8 +129,8 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.select.offset.size"_lang)) {
|
||||
u64 inputA = this->m_region.getStartAddress();
|
||||
u64 inputB = this->m_region.getSize();
|
||||
ImGui::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGui::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.size"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.size"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
|
||||
if (inputB <= 0)
|
||||
inputB = 1;
|
||||
@@ -171,7 +171,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.file.search"_lang);
|
||||
if (ImGui::BeginTabBar("##find_tabs")) {
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.search.hex"_lang)) {
|
||||
if (ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_NUMERIC, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_CharsHexadecimal)) {
|
||||
if (ImGuiExt::InputTextIcon("##input", ICON_VS_SYMBOL_NUMERIC, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_CharsHexadecimal)) {
|
||||
if (!this->m_input.empty()) {
|
||||
this->m_shouldSearch = true;
|
||||
this->m_backwards = false;
|
||||
@@ -188,7 +188,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.search.string"_lang)) {
|
||||
if (ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
|
||||
if (ImGuiExt::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
|
||||
if (!this->m_input.empty()) {
|
||||
this->m_shouldSearch = true;
|
||||
this->m_backwards = false;
|
||||
@@ -253,7 +253,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::BeginDisabled(this->m_searchTask.isRunning());
|
||||
{
|
||||
ImGui::SameLine();
|
||||
if (ImGui::IconButton(ICON_VS_SEARCH "##search", ButtonColor, ButtonSize)) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_SEARCH "##search", ButtonColor, ButtonSize)) {
|
||||
this->m_shouldSearch = true;
|
||||
this->m_backwards = false;
|
||||
this->m_reachedEnd = false;
|
||||
@@ -265,7 +265,7 @@ namespace hex::plugin::builtin {
|
||||
{
|
||||
ImGui::BeginDisabled(this->m_reachedEnd && this->m_backwards);
|
||||
{
|
||||
if (ImGui::IconButton(ICON_VS_ARROW_UP "##up", ButtonColor, ButtonSize)) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_ARROW_UP "##up", ButtonColor, ButtonSize)) {
|
||||
this->m_shouldSearch = true;
|
||||
this->m_backwards = true;
|
||||
this->m_reachedEnd = false;
|
||||
@@ -277,7 +277,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::BeginDisabled(this->m_reachedEnd && !this->m_backwards);
|
||||
{
|
||||
if (ImGui::IconButton(ICON_VS_ARROW_DOWN "##down", ButtonColor, ButtonSize)) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_ARROW_DOWN "##down", ButtonColor, ButtonSize)) {
|
||||
this->m_shouldSearch = true;
|
||||
this->m_backwards = false;
|
||||
this->m_reachedEnd = false;
|
||||
@@ -341,7 +341,7 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.set_base"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("##base_address", &this->m_baseAddress);
|
||||
ImGuiExt::InputHexadecimal("##base_address", &this->m_baseAddress);
|
||||
if (ImGui::IsItemFocused() && (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter))) {
|
||||
setBaseAddress(this->m_baseAddress);
|
||||
editor->closePopup();
|
||||
@@ -375,7 +375,7 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.set_page_size"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("##page_size", &this->m_pageSize);
|
||||
ImGuiExt::InputHexadecimal("##page_size", &this->m_pageSize);
|
||||
if (ImGui::IsItemFocused() && (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter))) {
|
||||
setPageSize(this->m_pageSize);
|
||||
editor->closePopup();
|
||||
@@ -413,7 +413,7 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.resize"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("##resize", &this->m_size);
|
||||
ImGuiExt::InputHexadecimal("##resize", &this->m_size);
|
||||
if (ImGui::IsItemFocused() && (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter))) {
|
||||
this->resize(this->m_size);
|
||||
editor->closePopup();
|
||||
@@ -446,8 +446,8 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.insert"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGui::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
|
||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||
[&, this]{
|
||||
@@ -477,8 +477,8 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.remove"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGui::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
|
||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||
[&, this]{
|
||||
@@ -508,12 +508,12 @@ namespace hex::plugin::builtin {
|
||||
void draw(ViewHexEditor *editor) override {
|
||||
ImGui::TextUnformatted("hex.builtin.view.hex_editor.menu.edit.fill"_lang);
|
||||
|
||||
ImGui::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGui::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::InputTextIcon("hex.builtin.common.bytes"_lang, ICON_VS_SYMBOL_NAMESPACE, this->m_input);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.common.bytes"_lang, ICON_VS_SYMBOL_NAMESPACE, this->m_input);
|
||||
|
||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||
[&, this] {
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
||||
ImGui::BeginDisabled(this->m_analyzerTask.isRunning());
|
||||
{
|
||||
ImGui::Header("hex.builtin.common.settings"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.common.settings"_lang, true);
|
||||
|
||||
ui::regionSelectionPicker(&this->m_analysisRegion, provider, &this->m_selectionType, false);
|
||||
ImGui::NewLine();
|
||||
@@ -156,7 +156,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (this->m_analyzerTask.isRunning()) {
|
||||
ImGui::TextSpinner("hex.builtin.view.information.analyzing"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.view.information.analyzing"_lang);
|
||||
} else {
|
||||
ImGui::NewLine();
|
||||
}
|
||||
@@ -164,7 +164,7 @@ namespace hex::plugin::builtin {
|
||||
if (!this->m_analyzerTask.isRunning() && this->m_dataValid) {
|
||||
|
||||
// Provider information
|
||||
ImGui::Header("hex.builtin.view.information.provider_information"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.view.information.provider_information"_lang, true);
|
||||
|
||||
if (ImGui::BeginTable("information", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoKeepColumnsVisible)) {
|
||||
ImGui::TableSetupColumn("type");
|
||||
@@ -174,22 +174,22 @@ namespace hex::plugin::builtin {
|
||||
|
||||
for (auto &[name, value] : provider->getDataDescription()) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", name);
|
||||
ImGuiExt::TextFormatted("{}", name);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedWrapped("{}", value);
|
||||
ImGuiExt::TextFormattedWrapped("{}", value);
|
||||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.region"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.region"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{:X} - 0x{:X}", this->m_analyzedRegion.getStartAddress(), this->m_analyzedRegion.getEndAddress());
|
||||
ImGuiExt::TextFormatted("0x{:X} - 0x{:X}", this->m_analyzedRegion.getStartAddress(), this->m_analyzedRegion.getEndAddress());
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
// Magic information
|
||||
if (!(this->m_dataDescription.empty() && this->m_dataMimeType.empty())) {
|
||||
ImGui::Header("hex.builtin.view.information.magic"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.information.magic"_lang);
|
||||
|
||||
if (ImGui::BeginTable("magic", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg)) {
|
||||
ImGui::TableSetupColumn("type");
|
||||
@@ -203,9 +203,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (this->m_dataDescription == "data") {
|
||||
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{} ({})", "hex.builtin.view.information.octet_stream_text"_lang, this->m_dataDescription);
|
||||
ImGuiExt::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{} ({})", "hex.builtin.view.information.octet_stream_text"_lang, this->m_dataDescription);
|
||||
} else {
|
||||
ImGui::TextFormattedWrapped("{}", this->m_dataDescription);
|
||||
ImGuiExt::TextFormattedWrapped("{}", this->m_dataDescription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,13 +215,13 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (this->m_dataMimeType == "application/octet-stream") {
|
||||
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{} ({})", "hex.builtin.view.information.octet_stream_text"_lang, this->m_dataMimeType);
|
||||
ImGuiExt::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{} ({})", "hex.builtin.view.information.octet_stream_text"_lang, this->m_dataMimeType);
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::HelpHover("hex.builtin.view.information.octet_stream_warning"_lang);
|
||||
ImGuiExt::HelpHover("hex.builtin.view.information.octet_stream_warning"_lang);
|
||||
ImGui::PopStyleVar();
|
||||
} else {
|
||||
ImGui::TextFormatted("{}", this->m_dataMimeType);
|
||||
ImGuiExt::TextFormatted("{}", this->m_dataMimeType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace hex::plugin::builtin {
|
||||
// Information analysis
|
||||
if (this->m_analyzedRegion.getSize() > 0) {
|
||||
|
||||
ImGui::Header("hex.builtin.view.information.info_analysis"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.information.info_analysis"_lang);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImGui::GetColorU32(ImGuiCol_WindowBg));
|
||||
ImPlot::PushStyleColor(ImPlotCol_FrameBg, ImGui::GetColorU32(ImGuiCol_WindowBg));
|
||||
@@ -276,20 +276,20 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.block_size"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.block_size"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("hex.builtin.view.information.block_size.desc"_lang, this->m_chunkBasedEntropy.getSize(), this->m_chunkBasedEntropy.getChunkSize());
|
||||
ImGuiExt::TextFormatted("hex.builtin.view.information.block_size.desc"_lang, this->m_chunkBasedEntropy.getSize(), this->m_chunkBasedEntropy.getChunkSize());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.file_entropy"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.file_entropy"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
if (this->m_averageEntropy < 0) ImGui::TextUnformatted("???");
|
||||
else ImGui::TextFormatted("{:.5f}", std::abs(this->m_averageEntropy));
|
||||
else ImGuiExt::TextFormatted("{:.5f}", std::abs(this->m_averageEntropy));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.highest_entropy"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.highest_entropy"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{:.5f} @", this->m_highestBlockEntropy);
|
||||
ImGuiExt::TextFormatted("{:.5f} @", this->m_highestBlockEntropy);
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
@@ -300,9 +300,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.lowest_entropy"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.lowest_entropy"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{:.5f} @", this->m_lowestBlockEntropy);
|
||||
ImGuiExt::TextFormatted("{:.5f} @", this->m_lowestBlockEntropy);
|
||||
ImGui::SameLine();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
@@ -313,10 +313,10 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", "hex.builtin.view.information.plain_text_percentage"_lang);
|
||||
ImGuiExt::TextFormatted("{}", "hex.builtin.view.information.plain_text_percentage"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
if (this->m_plainTextCharacterPercentage < 0) ImGui::TextUnformatted("???");
|
||||
else ImGui::TextFormatted("{:.2f}%", this->m_plainTextCharacterPercentage);
|
||||
else ImGuiExt::TextFormatted("{:.2f}%", this->m_plainTextCharacterPercentage);
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
@@ -330,12 +330,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (this->m_averageEntropy > 0.83 && this->m_highestBlockEntropy > 0.9) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.encrypted"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.encrypted"_lang);
|
||||
}
|
||||
|
||||
if (this->m_plainTextCharacterPercentage > 95) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.plain_text"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.plain_text"_lang);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
|
||||
@@ -14,15 +14,15 @@ namespace hex::plugin::builtin {
|
||||
|
||||
static ImColor getColor(std::string_view level) {
|
||||
if (level.contains("DEBUG"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerDebug);
|
||||
return ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_LoggerDebug);
|
||||
else if (level.contains("INFO"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerInfo);
|
||||
return ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_LoggerInfo);
|
||||
else if (level.contains("WARN"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerWarning);
|
||||
return ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_LoggerWarning);
|
||||
else if (level.contains("ERROR"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerError);
|
||||
return ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_LoggerError);
|
||||
else if (level.contains("FATAL"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerFatal);
|
||||
return ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_LoggerFatal);
|
||||
return ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto &patches = provider->getPatches();
|
||||
if (patches.contains(offset) && patches.at(offset) != byte)
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_Patches);
|
||||
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Patches);
|
||||
else
|
||||
return std::nullopt;
|
||||
});
|
||||
@@ -92,15 +92,15 @@ namespace hex::plugin::builtin {
|
||||
this->m_selectedPatch = address;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("0x{0:08X}", address);
|
||||
ImGuiExt::TextFormatted("0x{0:08X}", address);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
u8 previousValue = 0x00;
|
||||
provider->readRaw(address, &previousValue, sizeof(u8));
|
||||
ImGui::TextFormatted("0x{0:02X}", previousValue);
|
||||
ImGuiExt::TextFormatted("0x{0:02X}", previousValue);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:02X}", patch);
|
||||
ImGuiExt::TextFormatted("0x{0:02X}", patch);
|
||||
index += 1;
|
||||
|
||||
iter++;
|
||||
|
||||
@@ -216,19 +216,19 @@ namespace hex::plugin::builtin {
|
||||
auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
if (runtime.isRunning()) {
|
||||
if (this->m_breakpointHit) {
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_CONTINUE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow)))
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_CONTINUE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow)))
|
||||
this->m_breakpointHit = false;
|
||||
ImGui::SameLine();
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_STEP_INTO, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_STEP_INTO, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow))) {
|
||||
runtime.getInternals().evaluator->pauseNextLine();
|
||||
this->m_breakpointHit = false;
|
||||
}
|
||||
} else {
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_STOP, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed)))
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_STOP, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed)))
|
||||
runtime.abort();
|
||||
}
|
||||
} else {
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_START, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen)) || this->m_triggerEvaluation) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_START, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen)) || this->m_triggerEvaluation) {
|
||||
this->m_triggerEvaluation = false;
|
||||
this->evaluatePattern(this->m_textEditor.GetText(), provider);
|
||||
}
|
||||
@@ -240,9 +240,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SameLine();
|
||||
if (this->m_runningEvaluators > 0) {
|
||||
if (this->m_breakpointHit) {
|
||||
ImGui::TextFormatted("hex.builtin.view.pattern_editor.breakpoint_hit"_lang, runtime.getInternals().evaluator->getPauseLine().value_or(0));
|
||||
ImGuiExt::TextFormatted("hex.builtin.view.pattern_editor.breakpoint_hit"_lang, runtime.getInternals().evaluator->getPauseLine().value_or(0));
|
||||
} else {
|
||||
ImGui::TextSpinner("hex.builtin.view.pattern_editor.evaluating"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.view.pattern_editor.evaluating"_lang);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@@ -267,9 +267,9 @@ namespace hex::plugin::builtin {
|
||||
this->m_accessHistoryIndex = (this->m_accessHistoryIndex + 1) % this->m_accessHistory.size();
|
||||
};
|
||||
|
||||
insertPos(runtime.getLastReadAddress(), ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarBlue));
|
||||
insertPos(runtime.getLastWriteAddress(), ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
|
||||
insertPos(runtime.getLastPatternPlaceAddress(), ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarGreen));
|
||||
insertPos(runtime.getLastReadAddress(), ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarBlue));
|
||||
insertPos(runtime.getLastWriteAddress(), ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
|
||||
insertPos(runtime.getLastPatternPlaceAddress(), ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarGreen));
|
||||
|
||||
auto drawList = ImGui::GetWindowDrawList();
|
||||
for (const auto &[progress, color] : this->m_accessHistory) {
|
||||
@@ -294,11 +294,11 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SameLine();
|
||||
|
||||
if (auto max = runtime.getMaximumPatternCount(); max >= std::numeric_limits<u32>::max()) {
|
||||
ImGui::TextFormatted("{} / {}",
|
||||
ImGuiExt::TextFormatted("{} / {}",
|
||||
runtime.getCreatedPatternCount(),
|
||||
ICON_FA_INFINITY);
|
||||
} else {
|
||||
ImGui::TextFormatted("{} / {}",
|
||||
ImGuiExt::TextFormatted("{} / {}",
|
||||
runtime.getCreatedPatternCount(),
|
||||
runtime.getMaximumPatternCount());
|
||||
}
|
||||
@@ -447,7 +447,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
envVars.insert(std::next(iter), { envVarCounter++, "", i128(0), EnvVarType::Integer });
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::BeginDisabled(envVars.size() <= 1);
|
||||
{
|
||||
if (ImGui::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
bool isFirst = iter == envVars.begin();
|
||||
bool isLast = std::next(iter) == envVars.end();
|
||||
envVars.erase(iter);
|
||||
@@ -478,7 +478,7 @@ namespace hex::plugin::builtin {
|
||||
void ViewPatternEditor::drawVariableSettings(ImVec2 size, std::map<std::string, PatternVariable> &patternVariables) {
|
||||
if (ImGui::BeginChild("##settings", size, true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
if (patternVariables.empty()) {
|
||||
ImGui::TextFormattedCentered("hex.builtin.view.pattern_editor.no_in_out_vars"_lang);
|
||||
ImGuiExt::TextFormattedCentered("hex.builtin.view.pattern_editor.no_in_out_vars"_lang);
|
||||
} else {
|
||||
if (ImGui::BeginTable("##in_out_vars_table", 2, ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersInnerH | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_RowBg)) {
|
||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch, 0.25F);
|
||||
@@ -557,9 +557,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TextUnformatted(section.name.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} | 0x{:02X}", hex::toByteString(section.data.size()), section.data.size());
|
||||
ImGuiExt::TextFormatted("{} | 0x{:02X}", hex::toByteString(section.data.size()), section.data.size());
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::IconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
auto dataProvider = std::make_shared<MemoryFileProvider>();
|
||||
dataProvider->resize(section.data.size());
|
||||
dataProvider->writeRaw(0x00, section.data.data(), section.data.size());
|
||||
@@ -628,17 +628,17 @@ namespace hex::plugin::builtin {
|
||||
auto line = this->m_textEditor.GetCursorPosition().mLine + 1;
|
||||
|
||||
if (!breakpoints.contains(line)) {
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_BREAKPOINT, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_BREAKPOINT, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
evaluator->addBreakpoint(line);
|
||||
this->m_textEditor.SetBreakpoints(breakpoints);
|
||||
}
|
||||
ImGui::InfoTooltip("hex.builtin.view.pattern_editor.debugger.add_tooltip"_lang);
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.pattern_editor.debugger.add_tooltip"_lang);
|
||||
} else {
|
||||
if (ImGui::IconButton(ICON_VS_DEBUG_BREAKPOINT_UNVERIFIED, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_DEBUG_BREAKPOINT_UNVERIFIED, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
||||
evaluator->removeBreakpoint(line);
|
||||
this->m_textEditor.SetBreakpoints(breakpoints);
|
||||
}
|
||||
ImGui::InfoTooltip("hex.builtin.view.pattern_editor.debugger.remove_tooltip"_lang);
|
||||
ImGuiExt::InfoTooltip("hex.builtin.view.pattern_editor.debugger.remove_tooltip"_lang);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@@ -859,13 +859,13 @@ namespace hex::plugin::builtin {
|
||||
{
|
||||
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()));
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{} ", pattern->getFormattedName());
|
||||
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "{} ", pattern->getFormattedName());
|
||||
ImGui::SameLine(0, 5);
|
||||
ImGui::TextFormatted("{}", pattern->getDisplayName());
|
||||
ImGuiExt::TextFormatted("{}", pattern->getDisplayName());
|
||||
ImGui::SameLine();
|
||||
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("{} ", hex::limitStringLength(pattern->getFormattedValue(), 64));
|
||||
ImGuiExt::TextFormatted("{} ", hex::limitStringLength(pattern->getFormattedValue(), 64));
|
||||
|
||||
if (ImGui::GetIO().KeyShift) {
|
||||
ImGui::Indent();
|
||||
@@ -875,32 +875,32 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} ", "hex.builtin.common.type"_lang);
|
||||
ImGuiExt::TextFormatted("{} ", "hex.builtin.common.type"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(" {}", pattern->getTypeName());
|
||||
ImGuiExt::TextFormatted(" {}", pattern->getTypeName());
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} ", "hex.builtin.common.address"_lang);
|
||||
ImGuiExt::TextFormatted("{} ", "hex.builtin.common.address"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(" 0x{:08X}", pattern->getOffset());
|
||||
ImGuiExt::TextFormatted(" 0x{:08X}", pattern->getOffset());
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} ", "hex.builtin.common.size"_lang);
|
||||
ImGuiExt::TextFormatted("{} ", "hex.builtin.common.size"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(" {}", hex::toByteString(pattern->getSize()));
|
||||
ImGuiExt::TextFormatted(" {}", hex::toByteString(pattern->getSize()));
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} ", "hex.builtin.common.endian"_lang);
|
||||
ImGuiExt::TextFormatted("{} ", "hex.builtin.common.endian"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted(" {}", pattern->getEndian() == std::endian::little ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang);
|
||||
ImGuiExt::TextFormatted(" {}", pattern->getEndian() == std::endian::little ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang);
|
||||
|
||||
if (const auto &comment = pattern->getComment(); !comment.empty()) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{} ", "hex.builtin.common.comment"_lang);
|
||||
ImGuiExt::TextFormatted("{} ", "hex.builtin.common.comment"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextWrapped(" \"%s\"", comment.c_str());
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginTabItem(LangEntry(category.unlocalizedName))) {
|
||||
// Draw the category description
|
||||
if (!category.unlocalizedDescription.empty()) {
|
||||
ImGui::TextFormattedWrapped("{}", LangEntry(category.unlocalizedDescription));
|
||||
ImGuiExt::TextFormattedWrapped("{}", LangEntry(category.unlocalizedDescription));
|
||||
ImGui::NewLine();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace hex::plugin::builtin {
|
||||
if (subCategory.entries.empty())
|
||||
continue;
|
||||
|
||||
ImGui::BeginSubWindow(LangEntry(subCategory.unlocalizedName));
|
||||
ImGuiExt::BeginSubWindow(LangEntry(subCategory.unlocalizedName));
|
||||
{
|
||||
for (auto &setting : subCategory.entries) {
|
||||
ImGui::BeginDisabled(!setting.widget->isEnabled());
|
||||
@@ -70,7 +70,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (auto tooltip = setting.widget->getTooltip(); tooltip.has_value() && ImGui::IsItemHovered())
|
||||
ImGui::InfoTooltip(LangEntry(tooltip.value()));
|
||||
ImGuiExt::InfoTooltip(LangEntry(tooltip.value()));
|
||||
|
||||
auto &widget = setting.widget;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::EndSubWindow();
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void ViewStore::drawStore() {
|
||||
ImGui::Header("hex.builtin.view.store.desc"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.view.store.desc"_lang, true);
|
||||
|
||||
bool reloading = false;
|
||||
if (this->m_apiRequest.valid()) {
|
||||
@@ -184,13 +184,13 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (reloading) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextSpinner("hex.builtin.view.store.loading"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.view.store.loading"_lang);
|
||||
}
|
||||
|
||||
// Align the button to the right
|
||||
ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 25_scaled);
|
||||
ImGui::BeginDisabled(this->m_updateAllTask.isRunning() || this->m_updateCount == 0);
|
||||
if (ImGui::IconButton(ICON_VS_CLOUD_DOWNLOAD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_CLOUD_DOWNLOAD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
this->m_updateAllTask = TaskManager::createTask("Update All...", this->m_updateCount, [this](auto &task) {
|
||||
u32 progress = 0;
|
||||
for (auto &category : this->m_categories) {
|
||||
@@ -205,7 +205,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui::InfoTooltip(hex::format("hex.builtin.view.store.update_count"_lang, this->m_updateCount.load()).c_str());
|
||||
ImGuiExt::InfoTooltip(hex::format("hex.builtin.view.store.update_count"_lang, this->m_updateCount.load()).c_str());
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace hex::plugin::builtin {
|
||||
void ViewStore::drawContent() {
|
||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.store.name").c_str(), &this->getWindowOpenState())) {
|
||||
if (this->m_requestStatus == RequestStatus::Failed)
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.store.netfailed"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.store.netfailed"_lang);
|
||||
|
||||
this->drawStore();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void ViewThemeManager::drawContent() {
|
||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.theme_manager.name").c_str(), &this->m_viewOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking)) {
|
||||
ImGui::Header("hex.builtin.view.theme_manager.colors"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.view.theme_manager.colors"_lang, true);
|
||||
|
||||
// Draw theme handlers
|
||||
ImGui::PushID(1);
|
||||
@@ -79,7 +79,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopID();
|
||||
|
||||
|
||||
ImGui::Header("hex.builtin.view.theme_manager.styles"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.theme_manager.styles"_lang);
|
||||
|
||||
// Draw style handlers
|
||||
ImGui::PushID(2);
|
||||
@@ -111,8 +111,8 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopID();
|
||||
|
||||
// Draw export settings
|
||||
ImGui::Header("hex.builtin.view.theme_manager.export"_lang);
|
||||
ImGui::InputTextIcon("hex.builtin.view.theme_manager.export.name"_lang, ICON_VS_SYMBOL_KEY, this->m_themeName);
|
||||
ImGuiExt::Header("hex.builtin.view.theme_manager.export"_lang);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.view.theme_manager.export.name"_lang, ICON_VS_SYMBOL_KEY, this->m_themeName);
|
||||
|
||||
// Draw the export buttons
|
||||
if (ImGui::Button("hex.builtin.view.theme_manager.save_theme"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace hex::plugin::builtin {
|
||||
void ViewYara::drawContent() {
|
||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.yara.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||
|
||||
ImGui::Header("hex.builtin.view.yara.header.rules"_lang, true);
|
||||
ImGuiExt::Header("hex.builtin.view.yara.header.rules"_lang, true);
|
||||
|
||||
if (ImGui::BeginListBox("##rules", ImVec2(-FLT_MIN, ImGui::GetTextLineHeightWithSpacing() * 5))) {
|
||||
for (u32 i = 0; i < this->m_rules->size(); i++) {
|
||||
@@ -113,7 +113,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
const auto basePaths = fs::getDefaultPaths(fs::ImHexPath::Yara);
|
||||
std::vector<std::fs::path> paths;
|
||||
for (const auto &path : basePaths) {
|
||||
@@ -133,7 +133,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (ImGuiExt::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
if (this->m_selectedRule < this->m_rules->size()) {
|
||||
this->m_rules->erase(this->m_rules->begin() + this->m_selectedRule);
|
||||
this->m_selectedRule = std::min(this->m_selectedRule, u32(this->m_rules->size() - 1));
|
||||
@@ -146,10 +146,10 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (this->m_matcherTask.isRunning()) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextSpinner("hex.builtin.view.yara.matching"_lang);
|
||||
ImGuiExt::TextSpinner("hex.builtin.view.yara.matching"_lang);
|
||||
}
|
||||
|
||||
ImGui::Header("hex.builtin.view.yara.header.matches"_lang);
|
||||
ImGuiExt::Header("hex.builtin.view.yara.header.matches"_lang);
|
||||
|
||||
auto matchesTableSize = ImGui::GetContentRegionAvail();
|
||||
matchesTableSize.y *= 3.75 / 5.0;
|
||||
@@ -211,12 +211,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (!wholeDataMatch) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:X} : 0x{1:X}", address, address + size - 1);
|
||||
ImGuiExt::TextFormatted("0x{0:X} : 0x{1:X}", address, address + size - 1);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:X}", size);
|
||||
ImGuiExt::TextFormatted("0x{0:X}", size);
|
||||
} else {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.yara.whole_data"_lang);
|
||||
ImGuiExt::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.yara.whole_data"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user