1
0
mirror of synced 2024-11-24 07:40:17 +01:00

refactor: Move custom ImGui functions to ImGuiExt namespace (#1427)

Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
iTrooz 2023-11-16 22:24:06 +01:00 committed by GitHub
parent 77c326d300
commit 39252dfe48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 644 additions and 622 deletions

View File

@ -140,14 +140,14 @@ namespace hex {
* @brief Returns the icon of the achievement
* @return Icon of the achievement
*/
[[nodiscard]] const ImGui::Texture &getIcon() const {
[[nodiscard]] const ImGuiExt::Texture &getIcon() const {
if (this->m_iconData.empty())
return this->m_icon;
if (this->m_icon.isValid())
return m_icon;
this->m_icon = ImGui::Texture(this->m_iconData.data(), this->m_iconData.size());
this->m_icon = ImGuiExt::Texture(this->m_iconData.data(), this->m_iconData.size());
return this->m_icon;
}
@ -280,7 +280,7 @@ namespace hex {
std::function<void(Achievement &)> m_clickCallback;
std::vector<u8> m_iconData;
mutable ImGui::Texture m_icon;
mutable ImGuiExt::Texture m_icon;
u32 m_progress = 0;
u32 m_maxProgress = 1;

View File

@ -29,7 +29,7 @@ namespace hex::dbg {
if constexpr (std::same_as<Type, bool>) {
ImGui::Checkbox(name.data(), &variable);
} else if constexpr (std::integral<Type> || std::floating_point<Type>) {
ImGui::InputScalar(name.data(), ImGui::getImGuiDataType<Type>(), &variable);
ImGui::InputScalar(name.data(), ImGuiExt::getImGuiDataType<Type>(), &variable);
} else if constexpr (std::same_as<Type, ImVec2>) {
ImGui::InputFloat2(name.data(), &variable.x);
} else if constexpr (std::same_as<Type, std::string>) {

View File

@ -67,7 +67,7 @@ enum ImGuiCustomStyle {
ImGuiCustomStyle_COUNT
};
namespace ImGui {
namespace ImGuiExt {
class Texture {
public:
@ -236,7 +236,9 @@ namespace ImGui {
ImGui::SetCursorPos(((availableSpace - textSize) / 2.0F));
ImGui::TextFormatted("{}", text);
ImGui::PushTextWrapPos(availableSpace.x * 0.75F);
ImGuiExt::TextFormattedWrapped("{}", text);
ImGui::PopTextWrapPos();
}
inline void TextFormattedCenteredHorizontal(const std::string &fmt, auto &&...args) {
@ -246,14 +248,12 @@ namespace ImGui {
ImGui::SetCursorPosX(((availableSpace - textSize) / 2.0F).x);
ImGui::TextFormattedWrapped("{}", text);
ImGui::PushTextWrapPos(availableSpace.x * 0.75F);
ImGuiExt::TextFormattedWrapped("{}", text);
ImGui::PopTextWrapPos();
}
bool InputText(const char* label, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextIcon(const char* label, const char *icon, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextMultiline(const char* label, std::string &buffer, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputScalarCallback(const char* label, ImGuiDataType data_type, void* p_data, const char* format, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data);
@ -301,4 +301,13 @@ namespace ImGui {
else static_assert(hex::always_false<T>::value, "Invalid data type!");
}
}
// these functions are exception because they just allow conversion from string to char*, they do not really add anything
namespace ImGui {
bool InputText(const char* label, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextMultiline(const char* label, std::string &buffer, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
}

View File

@ -347,7 +347,7 @@ namespace hex {
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_FOLDER_OPENED, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
if (ImGuiExt::IconButton(ICON_VS_FOLDER_OPENED, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
return fs::openFileBrowser(fs::DialogMode::Open, { { "TTF Font", "ttf" }, { "OTF Font", "otf" } },
[&](const std::fs::path &path) {
this->m_value = wolv::util::toUTF8String(path);
@ -356,7 +356,7 @@ namespace hex {
ImGui::SameLine();
ImGui::TextFormatted("{}", name);
ImGuiExt::TextFormatted("{}", name);
return changed;
}
@ -882,7 +882,7 @@ namespace hex {
};
ImGui::PushID(reinterpret_cast<void*>(address));
ImGui::InputScalarCallback("##editing_input", dataType, data, format, flags | TextInputFlags | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
ImGuiExt::InputScalarCallback("##editing_input", dataType, data, format, flags | TextInputFlags | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
auto &userData = *static_cast<UserData*>(data->UserData);
if (data->BufTextLen >= userData.maxChars)

View File

@ -13,8 +13,11 @@
#include <fonts/codicons_font.h>
namespace ImGui {
namespace ImGuiExt {
using namespace ImGui;
Texture::Texture(const ImU8 *buffer, int size, int width, int height) {
unsigned char *imageData = stbi_load_from_memory(buffer, size, &this->m_width, &this->m_height, nullptr, 4);
if (imageData == nullptr) {
@ -321,26 +324,26 @@ namespace ImGui {
}
void HelpHover(const char *text) {
const auto iconColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive);
const auto iconColor = GetStyleColorVec4(ImGuiCol_ButtonActive);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, ImGui::GetStyle().FramePadding.y));
PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, GetStyle().FramePadding.y));
ImGui::PushStyleColor(ImGuiCol_Text, iconColor);
ImGui::Button(ICON_VS_INFO);
ImGui::PopStyleColor();
PushStyleColor(ImGuiCol_Text, iconColor);
Button(ICON_VS_INFO);
PopStyleColor();
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetTextLineHeight() * 25, 0), ImVec2(ImGui::GetTextLineHeight() * 25, FLT_MAX));
ImGui::BeginTooltip();
ImGui::TextFormattedWrapped("{}", text);
ImGui::EndTooltip();
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
SetNextWindowSizeConstraints(ImVec2(GetTextLineHeight() * 25, 0), ImVec2(GetTextLineHeight() * 25, FLT_MAX));
BeginTooltip();
TextFormattedWrapped("{}", text);
EndTooltip();
}
ImGui::PopStyleVar();
ImGui::PopStyleColor(3);
PopStyleVar();
PopStyleColor(3);
}
void UnderlinedText(const char *label, ImColor color, const ImVec2 &size_arg) {
@ -358,28 +361,28 @@ namespace ImGui {
}
void TextSpinner(const char *label) {
ImGui::Text("[%c] %s", "|/-\\"[ImU32(ImGui::GetTime() * 20) % 4], label);
Text("[%c] %s", "|/-\\"[ImU32(GetTime() * 20) % 4], label);
}
void Header(const char *label, bool firstEntry) {
if (!firstEntry)
ImGui::NewLine();
ImGui::SeparatorText(label);
NewLine();
SeparatorText(label);
}
void HeaderColored(const char *label, ImColor color, bool firstEntry) {
if (!firstEntry)
ImGui::NewLine();
ImGui::TextFormattedColored(color, "{}", label);
ImGui::Separator();
NewLine();
TextFormattedColored(color, "{}", label);
Separator();
}
bool InfoTooltip(const char *text) {
static double lastMoveTime;
static ImGuiID lastHoveredID;
double currTime = ImGui::GetTime();
ImGuiID hoveredID = ImGui::GetHoveredID();
double currTime = GetTime();
ImGuiID hoveredID = GetHoveredID();
bool result = false;
if (IsItemHovered() && (currTime - lastMoveTime) >= 0.5 && hoveredID == lastHoveredID) {
@ -498,10 +501,10 @@ namespace ImGui {
}
void OpenPopupInWindow(const char *window_name, const char *popup_name) {
if (ImGui::Begin(window_name)) {
ImGui::OpenPopup(popup_name);
if (Begin(window_name)) {
OpenPopup(popup_name);
}
ImGui::End();
End();
}
@ -556,7 +559,7 @@ namespace ImGui {
ImVec2 pos = window->DC.CursorPos;
ImVec2 size = CalcItemSize(ImVec2(1, 1) * ImGui::GetCurrentWindow()->MenuBarHeight(), label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
ImVec2 size = CalcItemSize(ImVec2(1, 1) * GetCurrentWindow()->MenuBarHeight(), label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
const ImRect bb(pos, pos + size);
ItemSize(size, style.FramePadding.y);
@ -629,7 +632,7 @@ namespace ImGui {
}
bool InputIntegerPrefix(const char *label, const char *prefix, void *value, ImGuiDataType type, const char *format, ImGuiInputTextFlags flags) {
auto window = ImGui::GetCurrentWindow();
auto window = GetCurrentWindow();
const ImGuiID id = window->GetID(label);
const ImGuiStyle &style = GImGui->Style;
@ -638,7 +641,7 @@ namespace ImGui {
const ImVec2 frame_size = CalcItemSize(ImVec2(0, 0), CalcTextSize(prefix).x, label_size.y + style.FramePadding.y * 2.0f);
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + frame_size.x);
SetCursorPosX(GetCursorPosX() + frame_size.x);
char buf[64];
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), type, value, format);
@ -653,9 +656,9 @@ namespace ImGui {
RenderNavHighlight(frame_bb, id);
RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.6F);
PushStyleVar(ImGuiStyleVar_Alpha, 0.6F);
RenderText(ImVec2(frame_bb.Min.x + style.FramePadding.x, frame_bb.Min.y + style.FramePadding.y), prefix);
ImGui::PopStyleVar();
PopStyleVar();
return value_changed;
}
@ -690,12 +693,9 @@ namespace ImGui {
RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);
}
bool InputText(const char *label, std::string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputText(label, buffer.data(), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}
bool InputTextIcon(const char *label, const char *icon, std::string &buffer, ImGuiInputTextFlags flags) {
auto window = ImGui::GetCurrentWindow();
auto window = GetCurrentWindow();
const ImGuiID id = window->GetID(label);
const ImGuiStyle &style = GImGui->Style;
@ -705,9 +705,9 @@ namespace ImGui {
const ImVec2 frame_size = CalcItemSize(ImVec2(0, 0), icon_frame_size.x, label_size.y + style.FramePadding.y * 2.0f);
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + frame_size.x);
SetCursorPosX(GetCursorPosX() + frame_size.x);
bool value_changed = ImGui::InputTextEx(label, nullptr, buffer.data(), buffer.size() + 1, ImVec2(CalcItemWidth(), label_size.y + style.FramePadding.y * 2.0f), ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
bool value_changed = InputTextEx(label, nullptr, buffer.data(), buffer.size() + 1, ImVec2(CalcItemWidth(), label_size.y + style.FramePadding.y * 2.0f), ImGuiInputTextFlags_CallbackResize | flags, UpdateStringSizeCallback, &buffer);
if (value_changed)
MarkItemEdited(GImGui->LastItemData.ID);
@ -721,18 +721,6 @@ namespace ImGui {
return value_changed;
}
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputTextWithHint(label, hint, buffer.data(), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputText(label, reinterpret_cast<char *>(buffer.data()), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}
bool InputTextMultiline(const char *label, std::string &buffer, const ImVec2 &size, ImGuiInputTextFlags flags) {
return ImGui::InputTextMultiline(label, buffer.data(), buffer.size() + 1, size, ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}
bool InputScalarCallback(const char* label, ImGuiDataType data_type, void* p_data, const char* format, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) {
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
@ -752,7 +740,7 @@ namespace ImGui {
flags |= ImGuiInputTextFlags_AutoSelectAll;
flags |= ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
if (InputText(label, buf, IM_ARRAYSIZE(buf), flags, callback, user_data))
if (ImGui::InputText(label, buf, IM_ARRAYSIZE(buf), flags, callback, user_data))
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format);
if (value_changed)
@ -814,31 +802,31 @@ namespace ImGui {
}
bool DimmedButton(const char* label){
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonHovered));
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButton));
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_ButtonActive));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonActive));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
PushStyleColor(ImGuiCol_ButtonHovered, GetCustomColorU32(ImGuiCustomCol_DescButtonHovered));
PushStyleColor(ImGuiCol_Button, GetCustomColorU32(ImGuiCustomCol_DescButton));
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_ButtonActive));
PushStyleColor(ImGuiCol_ButtonActive, GetCustomColorU32(ImGuiCustomCol_DescButtonActive));
PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
bool res = ImGui::Button(label);
bool res = Button(label);
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(1);
PopStyleColor(4);
PopStyleVar(1);
return res;
}
bool DimmedIconButton(const char *symbol, ImVec4 color, ImVec2 size_arg){
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonHovered));
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButton));
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_ButtonActive));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonActive));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
PushStyleColor(ImGuiCol_ButtonHovered, GetCustomColorU32(ImGuiCustomCol_DescButtonHovered));
PushStyleColor(ImGuiCol_Button, GetCustomColorU32(ImGuiCustomCol_DescButton));
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_ButtonActive));
PushStyleColor(ImGuiCol_ButtonActive, GetCustomColorU32(ImGuiCustomCol_DescButtonActive));
PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
bool res = IconButton(symbol, color, size_arg);
ImGui::PopStyleColor(4);
ImGui::PopStyleVar(1);
PopStyleColor(4);
PopStyleVar(1);
return res;
}
@ -848,46 +836,46 @@ namespace ImGui {
bool toggled = false;
if (*v) {
ImGui::PushStyleColor(ImGuiCol_Border, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
PushStyleColor(ImGuiCol_Border, GetStyleColorVec4(ImGuiCol_ButtonActive));
pushed = true;
}
if (ImGui::DimmedIconButton(icon, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
if (DimmedIconButton(icon, GetStyleColorVec4(ImGuiCol_Text))) {
*v = !*v;
toggled = true;
}
if (pushed)
ImGui::PopStyleColor();
PopStyleColor();
return toggled;
}
void TextOverlay(const char *text, ImVec2 pos) {
const auto textSize = ImGui::CalcTextSize(text);
const auto textSize = CalcTextSize(text);
const auto textPos = pos - textSize / 2;
const auto margin = ImGui::GetStyle().FramePadding * 2;
const auto margin = GetStyle().FramePadding * 2;
const auto textRect = ImRect(textPos - margin, textPos + textSize + margin);
auto drawList = ImGui::GetForegroundDrawList();
auto drawList = GetForegroundDrawList();
drawList->AddRectFilled(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_WindowBg) | 0xFF000000);
drawList->AddRect(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_Border));
drawList->AddText(textPos, ImGui::GetColorU32(ImGuiCol_Text), text);
drawList->AddRectFilled(textRect.Min, textRect.Max, GetColorU32(ImGuiCol_WindowBg) | 0xFF000000);
drawList->AddRect(textRect.Min, textRect.Max, GetColorU32(ImGuiCol_Border));
drawList->AddText(textPos, GetColorU32(ImGuiCol_Text), text);
}
bool BeginBox() {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(5, 5));
auto result = ImGui::BeginTable("##box", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_SizingStretchSame);
ImGui::TableNextRow();
ImGui::TableNextColumn();
PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(5, 5));
auto result = BeginTable("##box", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_SizingStretchSame);
TableNextRow();
TableNextColumn();
return result;
}
void EndBox() {
ImGui::EndTable();
ImGui::PopStyleVar();
EndTable();
PopStyleVar();
}
void BeginSubWindow(const char *label, ImVec2 size, ImGuiChildFlags flags) {
@ -907,4 +895,24 @@ namespace ImGui {
ImGui::EndChild();
}
}
namespace ImGui {
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputText(label, reinterpret_cast<char *>(buffer.data()), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGuiExt::UpdateStringSizeCallback, &buffer);
}
bool InputText(const char *label, std::string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputText(label, buffer.data(), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGuiExt::UpdateStringSizeCallback, &buffer);
}
bool InputTextMultiline(const char *label, std::string &buffer, const ImVec2 &size, ImGuiInputTextFlags flags) {
return ImGui::InputTextMultiline(label, buffer.data(), buffer.size() + 1, size, ImGuiInputTextFlags_CallbackResize | flags, ImGuiExt::UpdateStringSizeCallback, &buffer);
}
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags) {
return ImGui::InputTextWithHint(label, hint, buffer.data(), buffer.size() + 1, ImGuiInputTextFlags_CallbackResize | flags, ImGuiExt::UpdateStringSizeCallback, &buffer);
}
}

View File

@ -53,8 +53,8 @@ namespace hex::init {
std::string m_gpuVendor;
ImGui::Texture splashBackgroundTexture;
ImGui::Texture splashTextTexture;
ImGuiExt::Texture splashBackgroundTexture;
ImGuiExt::Texture splashTextTexture;
std::future<bool> tasksSucceeded;
std::array<Highlight, 3> highlights;
float progressLerp = 0.0F;

View File

@ -58,7 +58,7 @@ namespace hex {
double m_lastFrameTime = 0;
ImGui::Texture m_logoTexture;
ImGuiExt::Texture m_logoTexture;
std::mutex m_popupMutex;
std::list<std::string> m_popupsToOpen;
@ -70,7 +70,7 @@ namespace hex {
bool m_frameRateTemporarilyUnlocked = false;
double m_frameRateUnlockTime = 0;
ImGui::ImHexCustomData m_imguiCustomData;
ImGuiExt::ImHexCustomData m_imguiCustomData;
};
}

View File

@ -436,8 +436,8 @@ namespace hex::init {
void WindowSplash::initMyself() {
// Load splash screen image from romfs
this->splashBackgroundTexture = ImGui::Texture(romfs::get("splash_background.png").span());
this->splashTextTexture = ImGui::Texture(romfs::get("splash_text.png").span());
this->splashBackgroundTexture = ImGuiExt::Texture(romfs::get("splash_background.png").span());
this->splashTextTexture = ImGuiExt::Texture(romfs::get("splash_text.png").span());
// If the image couldn't be loaded correctly, something went wrong during the build process
// Close the application since this would lead to errors later on anyway.

View File

@ -396,7 +396,7 @@ namespace hex {
GetProcAddress(user32Dll.get(), "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute != nullptr) {
ACCENTPOLICY policy = { ImGui::GetCustomStyle().WindowBlur > 0.5F ? 4U : 0U, 0, ImGui::GetCustomColorU32(ImGuiCustomCol_BlurBackground), 0 };
ACCENTPOLICY policy = { ImGuiExt::GetCustomStyle().WindowBlur > 0.5F ? 4U : 0U, 0, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_BlurBackground), 0 };
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) };
SetWindowCompositionAttribute(hwnd, &data);
}

View File

@ -82,7 +82,7 @@ namespace hex {
this->setupNativeWindow();
this->registerEventHandlers();
this->m_logoTexture = ImGui::Texture(romfs::get("logo.png").span());
this->m_logoTexture = ImGuiExt::Texture(romfs::get("logo.png").span());
ContentRegistry::Settings::impl::store();
EventManager::post<EventSettingsChanged>();
@ -263,22 +263,22 @@ namespace hex {
if (!titleBarButtons.empty()) {
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * float(4 + titleBarButtons.size()));
for (const auto &[icon, tooltip, callback]: titleBarButtons) {
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
if (ImGuiExt::TitleBarButton(icon.c_str(), buttonSize)) {
callback();
}
ImGui::InfoTooltip(LangEntry(tooltip));
ImGuiExt::InfoTooltip(LangEntry(tooltip));
}
}
// Draw minimize, restore and maximize buttons
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 3);
if (ImGui::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize))
if (ImGuiExt::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize))
glfwIconifyWindow(this->m_window);
if (glfwGetWindowAttrib(this->m_window, GLFW_MAXIMIZED)) {
if (ImGui::TitleBarButton(ICON_VS_CHROME_RESTORE, buttonSize))
if (ImGuiExt::TitleBarButton(ICON_VS_CHROME_RESTORE, buttonSize))
glfwRestoreWindow(this->m_window);
} else {
if (ImGui::TitleBarButton(ICON_VS_CHROME_MAXIMIZE, buttonSize))
if (ImGuiExt::TitleBarButton(ICON_VS_CHROME_MAXIMIZE, buttonSize))
glfwMaximizeWindow(this->m_window);
}
@ -287,7 +287,7 @@ namespace hex {
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, 0xFF2311E8);
// Draw close button
if (ImGui::TitleBarButton(ICON_VS_CHROME_CLOSE, buttonSize)) {
if (ImGuiExt::TitleBarButton(ICON_VS_CHROME_CLOSE, buttonSize)) {
ImHexApi::System::closeImHex();
}
@ -335,10 +335,10 @@ namespace hex {
if (!titleBarButtons.empty()) {
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (titleBarButtons.size() + 0.5F));
for (const auto &[icon, tooltip, callback]: titleBarButtons) {
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
if (ImGuiExt::TitleBarButton(icon.c_str(), buttonSize)) {
callback();
}
ImGui::InfoTooltip(LangEntry(tooltip));
ImGuiExt::InfoTooltip(LangEntry(tooltip));
}
}
@ -606,7 +606,7 @@ namespace hex {
// Plugin load error popups. These are not translated because they should always be readable, no matter if any localization could be loaded or not
{
auto drawPluginFolderTable = [] {
ImGui::UnderlinedText("Plugin folders");
ImGuiExt::UnderlinedText("Plugin folders");
if (ImGui::BeginTable("plugins", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY | ImGuiTableFlags_SizingFixedFit, ImVec2(0, 100_scaled))) {
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("Path", ImGuiTableColumnFlags_WidthStretch, 0.2);

View File

@ -35,23 +35,23 @@ namespace hex::plugin::builtin {
if (!this->m_requestTask.isRunning()) {
if (this->m_answer.empty()) {
if (this->m_noAnswer)
ImGui::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.no_answer"_lang);
ImGuiExt::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.no_answer"_lang);
else
ImGui::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.prompt"_lang);
ImGuiExt::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.prompt"_lang);
} else {
int id = 1;
for (auto &[type, text] : this->m_answer) {
ImGui::PushID(id);
switch (type) {
case TextBlockType::Text:
ImGui::TextFormattedWrapped("{}", text);
ImGuiExt::TextFormattedWrapped("{}", text);
break;
case TextBlockType::Code:
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyle().Colors[ImGuiCol_WindowBg]);
auto textWidth = 400_scaled - ImGui::GetStyle().FramePadding.x * 4 - ImGui::GetStyle().ScrollbarSize;
auto textHeight = ImGui::CalcTextSize(text.c_str(), nullptr, false, textWidth).y + ImGui::GetStyle().FramePadding.y * 6;
if (ImGui::BeginChild("##code", ImVec2(textWidth, textHeight), true)) {
ImGui::TextFormattedWrapped("{}", text);
ImGuiExt::TextFormattedWrapped("{}", text);
ImGui::EndChild();
}
ImGui::PopStyleColor();
@ -64,7 +64,7 @@ namespace hex::plugin::builtin {
}
}
} else {
ImGui::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.thinking"_lang);
ImGuiExt::TextFormattedCentered("{}", "hex.builtin.popup.docs_question.thinking"_lang);
}
}
ImGui::EndChild();

View File

@ -64,7 +64,7 @@ namespace hex::plugin::builtin {
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
doubleClicked = true;
ImGui::InfoTooltip(wolv::util::toUTF8String(path).c_str());
ImGuiExt::InfoTooltip(wolv::util::toUTF8String(path).c_str());
ImGui::PopID();
index++;

View File

@ -20,7 +20,7 @@ namespace hex::plugin::builtin {
m_message(std::move(message)), m_function(std::move(function)) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
ImGui::Separator();
if (ImGui::Button("hex.builtin.common.okay"_lang) || ImGui::IsKeyDown(ImGuiKey_Escape))

View File

@ -17,7 +17,7 @@ namespace hex::plugin::builtin {
m_yesFunction(std::move(yesFunction)), m_noFunction(std::move(noFunction)) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
ImGui::Separator();

View File

@ -18,7 +18,7 @@ namespace hex::plugin::builtin {
ImGui::Separator();
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("[-]").x) / 2);
ImGui::TextSpinner("");
ImGuiExt::TextSpinner("");
ImGui::NewLine();
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - 150_scaled) / 2);
if (ImGui::ButtonEx("hex.builtin.common.cancel"_lang, ImVec2(150, 0)) || ImGui::IsKeyDown(ImGuiKey_Escape))

View File

@ -26,7 +26,7 @@ namespace hex::plugin::builtin {
void drawContent() override {
static std::string message = "hex.builtin.welcome.server_contact_text"_lang;
ImGui::TextFormattedWrapped("{}", message.c_str());
ImGuiExt::TextFormattedWrapped("{}", message.c_str());
ImGui::NewLine();
if(ImGui::CollapsingHeader("hex.builtin.welcome.server_contact.data_collected_title"_lang)) {
@ -49,7 +49,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
ImGui::TextUnformatted("hex.builtin.welcome.server_contact.data_collected.version"_lang);
ImGui::TableNextColumn();
ImGui::TextFormattedWrapped("{}\n{}@{}\n{}",
ImGuiExt::TextFormattedWrapped("{}\n{}@{}\n{}",
ImHexApi::System::getImHexVersion(),
ImHexApi::System::getCommitHash(true),
ImHexApi::System::getCommitBranch(),
@ -60,7 +60,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
ImGui::TextUnformatted("hex.builtin.welcome.server_contact.data_collected.os"_lang);
ImGui::TableNextColumn();
ImGui::TextFormattedWrapped("{}\n{}\n{}\n{}",
ImGuiExt::TextFormattedWrapped("{}\n{}\n{}\n{}",
ImHexApi::System::getOSName(),
ImHexApi::System::getOSVersion(),
ImHexApi::System::getArchitecture(),

View File

@ -18,7 +18,7 @@ namespace hex::plugin::builtin {
m_message(std::move(message)), m_function(std::move(function)) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
ImGui::PushItemWidth(-1);
@ -28,7 +28,7 @@ namespace hex::plugin::builtin {
this->m_justOpened = false;
}
ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input);
ImGuiExt::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input);
ImGui::PopItemWidth();
ImGui::NewLine();

View File

@ -17,7 +17,7 @@ namespace hex::plugin::builtin {
m_yesFunction(std::move(yesFunction)), m_noFunction(std::move(noFunction)) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
if (ImGui::BeginTable("##unsaved_providers", 1, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 4))) {

View File

@ -34,7 +34,7 @@ namespace hex::plugin::builtin {
void drawCommitHistoryPage();
void drawLicensePage();
ImGui::Texture m_logoTexture;
ImGuiExt::Texture m_logoTexture;
std::future<HttpRequest::Result<std::string>> m_releaseNoteRequest, m_commitHistoryRequest;
u32 m_clickCount = 0;

View File

@ -46,7 +46,7 @@ namespace hex::plugin::builtin {
void drawContent() override {
auto* provider = ImHexApi::Provider::get();
ImGui::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.desc"_lang));
ImGuiExt::TextFormattedWrapped("{}", static_cast<const char *>("hex.builtin.view.pattern_editor.accept_pattern.desc"_lang));
std::vector<std::string> entries;
entries.resize(this->m_view->m_possiblePatternFiles.get(provider).size());
@ -64,7 +64,7 @@ namespace hex::plugin::builtin {
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles.get(provider)[this->m_selectedPatternFile], provider);
ImGui::InfoTooltip(wolv::util::toUTF8String(path).c_str());
ImGuiExt::InfoTooltip(wolv::util::toUTF8String(path).c_str());
index++;
}

View File

@ -17,7 +17,7 @@ namespace hex::plugin::builtin::ui {
inline void regionSelectionPicker(Region *region, prv::Provider *provider, RegionType *type, bool showHeader = true, bool firstEntry = false) {
if (showHeader)
ImGui::Header("hex.builtin.common.range"_lang, firstEntry);
ImGuiExt::Header("hex.builtin.common.range"_lang, firstEntry);
if (ImGui::RadioButton("hex.builtin.common.range.entire_data"_lang, *type == RegionType::EntireData))
*type = RegionType::EntireData;
@ -44,13 +44,13 @@ namespace hex::plugin::builtin::ui {
u64 start = region->getStartAddress(), end = region->getEndAddress();
ImGui::PushItemWidth(width);
ImGui::InputHexadecimal("##start", &start);
ImGuiExt::InputHexadecimal("##start", &start);
ImGui::PopItemWidth();
ImGui::SameLine();
ImGui::TextUnformatted(" - ");
ImGui::SameLine();
ImGui::PushItemWidth(width);
ImGui::InputHexadecimal("##end", &end);
ImGuiExt::InputHexadecimal("##end", &end);
ImGui::PopItemWidth();
*region = { start, (end - start) + 1 };

View File

@ -329,7 +329,7 @@ namespace hex::plugin::builtin {
hex::unused(endian, style);
auto value = makePrintable(*reinterpret_cast<char8_t *>(buffer.data()));
return [value] { ImGui::TextFormatted("'{0}'", value.c_str()); return value; };
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
hex::unused(endian);
@ -352,7 +352,7 @@ namespace hex::plugin::builtin {
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter("Invalid");
auto value = hex::format("{0}", c <= 255 ? makePrintable(c) : converter.to_bytes(c));
return [value] { ImGui::TextFormatted("'{0}'", value.c_str()); return value; };
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter("Invalid");
@ -414,7 +414,7 @@ namespace hex::plugin::builtin {
copyValue = "";
}
return [value, copyValue] { ImGui::TextFormatted("\"{0}\"", value.c_str()); return copyValue; };
return [value, copyValue] { ImGuiExt::TextFormatted("\"{0}\"", value.c_str()); return copyValue; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
hex::unused(endian);
@ -454,7 +454,7 @@ namespace hex::plugin::builtin {
copyValue = "";
}
return [value, copyValue] { ImGui::TextFormatted("L\"{0}\"", value.c_str()); return copyValue; };
return [value, copyValue] { ImGuiExt::TextFormatted("L\"{0}\"", value.c_str()); return copyValue; };
},
[](const std::string &value, std::endian endian) -> std::vector<u8> {
hex::unused(endian);

View File

@ -22,14 +22,14 @@ namespace hex::plugin::builtin {
if (size == ByteCount)
ImGui::Text(getFormatString(upperCase), *reinterpret_cast<const T*>(data));
else
ImGui::TextFormatted("{: {}s}", CharCount);
ImGuiExt::TextFormatted("{: {}s}", CharCount);
}
bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override {
hex::unused(address, startedEditing);
if (size == ByteCount) {
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGui::getImGuiDataType<T>(), data, ImGuiInputTextFlags_CharsHexadecimal);
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType<T>(), data, ImGuiInputTextFlags_CharsHexadecimal);
}
else
return false;
@ -39,8 +39,8 @@ namespace hex::plugin::builtin {
constexpr static inline auto ByteCount = sizeof(T);
constexpr static inline auto CharCount = ByteCount * 2;
const static inline auto FormattingUpperCase = hex::format("%0{}{}X", CharCount, ImGui::getFormatLengthSpecifier<T>());
const static inline auto FormattingLowerCase = hex::format("%0{}{}x", CharCount, ImGui::getFormatLengthSpecifier<T>());
const static inline auto FormattingUpperCase = hex::format("%0{}{}X", CharCount, ImGuiExt::getFormatLengthSpecifier<T>());
const static inline auto FormattingLowerCase = hex::format("%0{}{}x", CharCount, ImGuiExt::getFormatLengthSpecifier<T>());
const char *getFormatString(bool upperCase) {
if (upperCase)
@ -75,14 +75,14 @@ namespace hex::plugin::builtin {
}
}
else
ImGui::TextFormatted("{: {}s}", CharCount);
ImGuiExt::TextFormatted("{: {}s}", CharCount);
}
bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override {
hex::unused(address, startedEditing);
if (size == ByteCount) {
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGui::getImGuiDataType<u8>(), data, ImGuiInputTextFlags_None);
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType<u8>(), data, ImGuiInputTextFlags_None);
}
else
return false;
@ -92,8 +92,8 @@ namespace hex::plugin::builtin {
constexpr static inline auto ByteCount = 1;
constexpr static inline auto CharCount = ByteCount * 2;
const static inline auto FormattingUpperCase = hex::format("%0{}{}X", CharCount, ImGui::getFormatLengthSpecifier<u8>());
const static inline auto FormattingLowerCase = hex::format("%0{}{}x", CharCount, ImGui::getFormatLengthSpecifier<u8>());
const static inline auto FormattingUpperCase = hex::format("%0{}{}X", CharCount, ImGuiExt::getFormatLengthSpecifier<u8>());
const static inline auto FormattingLowerCase = hex::format("%0{}{}x", CharCount, ImGuiExt::getFormatLengthSpecifier<u8>());
static const char *getFormatString(bool upperCase) {
if (upperCase)
@ -118,14 +118,14 @@ namespace hex::plugin::builtin {
ImGui::Text(getFormatString(), static_cast<u64>(*reinterpret_cast<const T*>(data)));
}
else
ImGui::TextFormatted("{: {}s}", CharCount);
ImGuiExt::TextFormatted("{: {}s}", CharCount);
}
bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override {
hex::unused(address, upperCase, startedEditing);
if (size == ByteCount) {
return drawDefaultScalarEditingTextBox(address, FormatString.c_str(), ImGui::getImGuiDataType<T>(), data, ImGuiInputTextFlags_None);
return drawDefaultScalarEditingTextBox(address, FormatString.c_str(), ImGuiExt::getImGuiDataType<T>(), data, ImGuiInputTextFlags_None);
}
else
return false;
@ -135,7 +135,7 @@ namespace hex::plugin::builtin {
constexpr static inline auto ByteCount = sizeof(T);
constexpr static inline auto CharCount = std::numeric_limits<T>::digits10 + 2;
const static inline auto FormatString = hex::format("%{}{}{}", CharCount, ImGui::getFormatLengthSpecifier<T>(), std::is_signed_v<T> ? "d" : "u");
const static inline auto FormatString = hex::format("%{}{}{}", CharCount, ImGuiExt::getFormatLengthSpecifier<T>(), std::is_signed_v<T> ? "d" : "u");
const char *getFormatString() {
return FormatString.c_str();
@ -155,14 +155,14 @@ namespace hex::plugin::builtin {
if (size == ByteCount)
ImGui::Text(getFormatString(upperCase), *reinterpret_cast<const T*>(data));
else
ImGui::TextFormatted("{: {}s}", CharCount);
ImGuiExt::TextFormatted("{: {}s}", CharCount);
}
bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override {
hex::unused(address, upperCase, startedEditing);
if (size == ByteCount) {
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGui::getImGuiDataType<T>(), data, ImGuiInputTextFlags_CharsScientific);
return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType<T>(), data, ImGuiInputTextFlags_CharsScientific);
}
else
return false;
@ -194,7 +194,7 @@ namespace hex::plugin::builtin {
if (size == ByteCount)
ImGui::Text(getFormatString(upperCase), hex::float16ToFloat32(*reinterpret_cast<const u16*>(data)));
else
ImGui::TextFormatted("{: {}s}", CharCount);
ImGuiExt::TextFormatted("{: {}s}", CharCount);
}
bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override {
@ -267,7 +267,7 @@ namespace hex::plugin::builtin {
hex::unused(address);
if (size == 1)
ImGui::TextFormatted("{:08b}", *data);
ImGuiExt::TextFormatted("{:08b}", *data);
}
bool drawEditing(u64 address, u8 *data, size_t, bool, bool startedEditing) override {

View File

@ -91,7 +91,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGui::InputHexadecimal("##integer_value", &this->m_value);
ImGuiExt::InputHexadecimal("##integer_value", &this->m_value);
ImGui::PopItemWidth();
}

View File

@ -284,11 +284,11 @@ namespace hex::plugin::builtin {
void process() override {
const auto &rawData = this->getBufferOnInput(0);
this->m_texture = ImGui::Texture(rawData.data(), rawData.size());
this->m_texture = ImGuiExt::Texture(rawData.data(), rawData.size());
}
private:
ImGui::Texture m_texture;
ImGuiExt::Texture m_texture;
};
class NodeVisualizerImageRGBA : public dp::Node {
@ -315,11 +315,11 @@ namespace hex::plugin::builtin {
if (requiredBytes > rawData.size())
throwNodeError(hex::format("Image requires at least {} bytes of data, but only {} bytes are available", requiredBytes, rawData.size()));
this->m_texture = ImGui::Texture(rawData.data(), rawData.size(), width, height);
this->m_texture = ImGuiExt::Texture(rawData.data(), rawData.size(), width, height);
}
private:
ImGui::Texture m_texture;
ImGuiExt::Texture m_texture;
};
class NodeVisualizerByteDistribution : public dp::Node {

View File

@ -13,7 +13,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(150_scaled);
if (this->m_value.has_value())
ImGui::TextFormatted("0x{0:X}", this->m_value.value());
ImGuiExt::TextFormatted("0x{0:X}", this->m_value.value());
else
ImGui::TextUnformatted("???");
ImGui::PopItemWidth();
@ -37,7 +37,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(150_scaled);
if (this->m_value.has_value())
ImGui::TextFormatted("{0}", this->m_value.value());
ImGuiExt::TextFormatted("{0}", this->m_value.value());
else
ImGui::TextUnformatted("???");
ImGui::PopItemWidth();

View File

@ -112,9 +112,9 @@ namespace hex::plugin::builtin {
: Hash(name), m_crcFunction(crcFunction), m_polynomial(polynomial), m_initialValue(initialValue), m_xorOut(xorOut), m_reflectIn(reflectIn), m_reflectOut(reflectOut) {}
void draw() override {
ImGui::InputHexadecimal("hex.builtin.hash.crc.poly"_lang, &this->m_polynomial);
ImGui::InputHexadecimal("hex.builtin.hash.crc.iv"_lang, &this->m_initialValue);
ImGui::InputHexadecimal("hex.builtin.hash.crc.xor_out"_lang, &this->m_xorOut);
ImGuiExt::InputHexadecimal("hex.builtin.hash.crc.poly"_lang, &this->m_polynomial);
ImGuiExt::InputHexadecimal("hex.builtin.hash.crc.iv"_lang, &this->m_initialValue);
ImGuiExt::InputHexadecimal("hex.builtin.hash.crc.xor_out"_lang, &this->m_xorOut);
ImGui::NewLine();

View File

@ -96,14 +96,14 @@ namespace hex::plugin::builtin {
}
void drawImageVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
static ImGui::Texture texture;
static ImGuiExt::Texture texture;
static float scale = 1.0F;
if (shouldReset) {
auto pattern = arguments[0].toPattern();
auto data = pattern->getBytes();
texture = ImGui::Texture(data.data(), data.size());
texture = ImGuiExt::Texture(data.data(), data.size());
scale = 200_scaled / texture.getSize().x;
}
@ -120,7 +120,7 @@ namespace hex::plugin::builtin {
}
void drawBitmapVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
static ImGui::Texture texture;
static ImGuiExt::Texture texture;
static float scale = 1.0F;
if (shouldReset) {
@ -129,7 +129,7 @@ namespace hex::plugin::builtin {
auto height = arguments[2].toUnsigned();
auto data = pattern->getBytes();
texture = ImGui::Texture(data.data(), data.size(), width, height);
texture = ImGuiExt::Texture(data.data(), data.size(), width, height);
}
if (texture.isValid())
@ -186,7 +186,7 @@ namespace hex::plugin::builtin {
for (auto &entry : disassembly) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextFormatted("0x{0:08X}", entry.address);
ImGuiExt::TextFormatted("0x{0:08X}", entry.address);
ImGui::TableNextColumn();
std::string bytes;
for (auto byte : entry.bytes)
@ -204,7 +204,7 @@ namespace hex::plugin::builtin {
auto verticesPattern = arguments[0].toPattern();
auto indicesPattern = arguments[1].toPattern();
static ImGui::Texture texture;
static ImGuiExt::Texture texture;
static gl::Vector<float, 3> translation;
static gl::Vector<float, 3> rotation = { { 1.0F, -1.0F, 0.0F } };
@ -321,7 +321,7 @@ namespace hex::plugin::builtin {
shader.unbind();
frameBuffer.unbind();
texture = ImGui::Texture(renderTexture.release(), renderTexture.getWidth(), renderTexture.getHeight());
texture = ImGuiExt::Texture(renderTexture.release(), renderTexture.getWidth(), renderTexture.getHeight());
}
auto textureSize = texture.getSize();
@ -457,7 +457,7 @@ namespace hex::plugin::builtin {
bool playing = ma_device_is_started(&audioDevice);
if (ImGui::IconButton(playing ? ICON_VS_DEBUG_PAUSE : ICON_VS_PLAY, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
if (ImGuiExt::IconButton(playing ? ICON_VS_DEBUG_PAUSE : ICON_VS_PLAY, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
if (playing)
ma_device_stop(&audioDevice);
else
@ -466,7 +466,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_DEBUG_STOP, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
if (ImGuiExt::IconButton(ICON_VS_DEBUG_STOP, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
index = 0;
ma_device_stop(&audioDevice);
}
@ -476,9 +476,9 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
if (resetTask.isRunning())
ImGui::TextSpinner("");
ImGuiExt::TextSpinner("");
else
ImGui::TextFormatted("{:02d}:{:02d} / {:02d}:{:02d}",
ImGuiExt::TextFormatted("{:02d}:{:02d} / {:02d}:{:02d}",
(index / sampleRate) / 60, (index / sampleRate) % 60,
(waveData.size() / sampleRate) / 60, (waveData.size() / sampleRate) % 60);
}
@ -535,7 +535,7 @@ namespace hex::plugin::builtin {
static std::mutex addressMutex;
static TaskHolder addressTask;
static auto mapTexture = ImGui::Texture(romfs::get("assets/common/map.jpg").span());
static auto mapTexture = ImGuiExt::Texture(romfs::get("assets/common/map.jpg").span());
static ImVec2 mapSize = scaled(ImVec2(500, 500 / mapTexture.getAspectRatio()));
if (shouldReset) {
@ -557,7 +557,7 @@ namespace hex::plugin::builtin {
// Draw Longitude / Latitude text below image
ImGui::PushTextWrapPos(startPos.x + mapSize.x);
ImGui::TextFormattedWrapped("{}: {:.0f}° {:.0f}' {:.4f}\" {} | {}: {:.0f}° {:.0f}' {:.4f}\" {}",
ImGuiExt::TextFormattedWrapped("{}: {:.0f}° {:.0f}' {:.4f}\" {} | {}: {:.0f}° {:.0f}' {:.4f}\" {}",
"hex.builtin.pl_visualizer.coordinates.latitude"_lang,
std::floor(std::abs(latitude)),
std::floor(std::abs(latitude - std::floor(latitude)) * 60),
@ -572,9 +572,9 @@ namespace hex::plugin::builtin {
ImGui::PopTextWrapPos();
if (addressTask.isRunning()) {
ImGui::TextSpinner("hex.builtin.pl_visualizer.coordinates.querying"_lang);
ImGuiExt::TextSpinner("hex.builtin.pl_visualizer.coordinates.querying"_lang);
} else if (address.empty()) {
if (ImGui::DimmedButton("hex.builtin.pl_visualizer.coordinates.query"_lang)) {
if (ImGuiExt::DimmedButton("hex.builtin.pl_visualizer.coordinates.query"_lang)) {
addressTask = TaskManager::createBackgroundTask("hex.builtin.pl_visualizer.coordinates.querying"_lang, [lat = latitude, lon = longitude](auto &) {
constexpr static auto ApiURL = "https://geocode.maps.co/reverse?lat={}&lon={}&format=jsonv2";
@ -611,7 +611,7 @@ namespace hex::plugin::builtin {
}
} else {
ImGui::PushTextWrapPos(startPos.x + mapSize.x);
ImGui::TextFormattedWrapped("{}", address);
ImGuiExt::TextFormattedWrapped("{}", address);
ImGui::PopTextWrapPos();
}
@ -644,7 +644,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
// Draw centered month name and year
ImGui::TextFormattedCenteredHorizontal("{:%B %Y}", tm);
ImGuiExt::TextFormattedCenteredHorizontal("{:%B %Y}", tm);
if (ImGui::BeginTable("##days_table", 7, ImGuiTableFlags_Borders | ImGuiTableFlags_NoHostExtendX, ImVec2(160, 120) * scale)) {
constexpr static auto ColumnFlags = ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoReorder | ImGuiTableColumnFlags_NoHide;
@ -667,10 +667,10 @@ namespace hex::plugin::builtin {
// Draw days
for (u8 i = 1; i <= u32(lastMonthDay.day()); ++i) {
ImGui::TableNextColumn();
ImGui::TextFormatted("{:02}", i);
ImGuiExt::TextFormatted("{:02}", i);
if (std::chrono::day(i) == date.day())
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
if (std::chrono::weekday(std::chrono::year_month_day(date.year(), date.month(), std::chrono::day(i))) == std::chrono::Sunday)
ImGui::TableNextRow();
@ -685,7 +685,7 @@ namespace hex::plugin::builtin {
const auto size = ImVec2(120, 120) * scale;
if (ImGui::BeginChild("##clock", size + ImVec2(0, ImGui::GetTextLineHeightWithSpacing()))) {
// Draw centered digital hour, minute and seconds
ImGui::TextFormattedCenteredHorizontal("{:%H:%M:%S}", tm);
ImGuiExt::TextFormattedCenteredHorizontal("{:%H:%M:%S}", tm);
auto drawList = ImGui::GetWindowDrawList();
const auto center = ImGui::GetWindowPos() + ImVec2(0, ImGui::GetTextLineHeightWithSpacing()) + size / 2;
@ -710,7 +710,7 @@ namespace hex::plugin::builtin {
drawList->AddLine(center, center + sectionPos((float(tm.tm_min) / 5.0F) - 3) * size / 2.5, ImGui::GetColorU32(ImGuiCol_TextDisabled), 3_scaled);
// Draw second hand
drawList->AddLine(center, center + sectionPos((float(tm.tm_sec) / 5.0F) - 3) * size / 2.5, ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed), 2_scaled);
drawList->AddLine(center, center + sectionPos((float(tm.tm_sec) / 5.0F) - 3) * size / 2.5, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarRed), 2_scaled);
}
ImGui::EndChild();

View File

@ -439,7 +439,7 @@ namespace hex::plugin::builtin {
this->m_friendlyName = friendlyName;
}
ImGui::InfoTooltip(path.c_str());
ImGuiExt::InfoTooltip(path.c_str());
}
ImGui::PopID();
@ -455,7 +455,7 @@ namespace hex::plugin::builtin {
#else
if (ImGui::InputText("hex.builtin.provider.disk.selected_disk"_lang, this->m_pathBuffer.data(), this->m_pathBuffer.size(), ImGuiInputTextFlags_CallbackResize, ImGui::UpdateStringSizeCallback, &this->m_pathBuffer)) {
if (ImGui::InputText("hex.builtin.provider.disk.selected_disk"_lang, this->m_pathBuffer.data(), this->m_pathBuffer.size(), ImGuiInputTextFlags_CallbackResize, ImGuiExt::UpdateStringSizeCallback, &this->m_pathBuffer)) {
this->m_path = this->m_pathBuffer;
this->m_friendlyName = this->m_pathBuffer;
}

View File

@ -312,7 +312,7 @@ namespace hex::plugin::builtin {
ImGui::Separator();
ImGui::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size, ImGuiInputTextFlags_CharsHexadecimal);
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size, ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_port < 0)
this->m_port = 0;

View File

@ -170,7 +170,7 @@ namespace hex::plugin::builtin::recent {
void draw() {
ImGui::BeginSubWindow("hex.builtin.welcome.start.recent"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.recent"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
{
if (!s_recentEntriesUpdating) {
@ -189,7 +189,8 @@ namespace hex::plugin::builtin::recent {
} else {
icon = ICON_VS_FILE_BINARY;
}
if (ImGui::Hyperlink(hex::format("{} {}", icon, hex::limitStringLength(recentEntry.displayName, 32)).c_str())) {
if (ImGuiExt::Hyperlink(hex::format("{} {}", icon, hex::limitStringLength(recentEntry.displayName, 32)).c_str())) {
loadRecentEntry(recentEntry);
break;
}
@ -219,7 +220,7 @@ namespace hex::plugin::builtin::recent {
}
}
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
}
void drawFileMenuItem() {

View File

@ -105,7 +105,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::IconButton(ICON_VS_NEW_FOLDER, ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec2(30, 30))) {
if (ImGuiExt::IconButton(ICON_VS_NEW_FOLDER, ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec2(30, 30))) {
fs::openFileBrowser(fs::DialogMode::Folder, {}, [&](const std::fs::path &path) {
if (std::find(this->m_paths.begin(), this->m_paths.end(), path) == this->m_paths.end()) {
this->m_paths.emplace_back(path);
@ -115,9 +115,9 @@ namespace hex::plugin::builtin {
}
});
}
ImGui::InfoTooltip("hex.builtin.setting.folders.add_folder"_lang);
ImGuiExt::InfoTooltip("hex.builtin.setting.folders.add_folder"_lang);
if (ImGui::IconButton(ICON_VS_REMOVE_CLOSE, ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec2(30, 30))) {
if (ImGuiExt::IconButton(ICON_VS_REMOVE_CLOSE, ImGui::GetStyleColorVec4(ImGuiCol_Text), ImVec2(30, 30))) {
if (!this->m_paths.empty()) {
this->m_paths.erase(std::next(this->m_paths.begin(), this->m_itemIndex));
ImHexApi::System::setAdditionalFolderPaths(this->m_paths);
@ -125,7 +125,7 @@ namespace hex::plugin::builtin {
result = true;
}
}
ImGui::InfoTooltip("hex.builtin.setting.folders.remove_folder"_lang);
ImGuiExt::InfoTooltip("hex.builtin.setting.folders.remove_folder"_lang);
ImGui::EndGroup();

View File

@ -203,11 +203,11 @@ namespace hex::plugin::builtin {
ThemeManager::addThemeHandler("imhex", ImHexColorMap,
[](u32 colorId) -> ImColor {
return static_cast<ImGui::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId];
return static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId];
},
[](u32 colorId, ImColor color) {
static_cast<ImGui::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId] = color;
static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId] = color;
}
);
}
@ -344,7 +344,7 @@ namespace hex::plugin::builtin {
}
{
auto &style = ImGui::GetCustomStyle();
auto &style = ImGuiExt::GetCustomStyle();
const static ThemeManager::StyleMap ImHexStyleMap = {
{ "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } },
};

View File

@ -34,18 +34,18 @@ namespace hex::plugin::builtin {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextFormatted("{0:03d}", i + 32 * tablePart);
ImGuiExt::TextFormatted("{0:03d}", i + 32 * tablePart);
if (asciiTableShowOctal) {
ImGui::TableNextColumn();
ImGui::TextFormatted("0o{0:03o}", i + 32 * tablePart);
ImGuiExt::TextFormatted("0o{0:03o}", i + 32 * tablePart);
}
ImGui::TableNextColumn();
ImGui::TextFormatted("0x{0:02X}", i + 32 * tablePart);
ImGuiExt::TextFormatted("0x{0:02X}", i + 32 * tablePart);
ImGui::TableNextColumn();
ImGui::TextFormatted("{0}", hex::makePrintable(i + 32 * tablePart));
ImGuiExt::TextFormatted("{0}", hex::makePrintable(i + 32 * tablePart));
}
ImGui::EndTable();

View File

@ -39,16 +39,16 @@ namespace hex::plugin::builtin {
buffers[3] = hex::toBinaryString(number);
};
if (ImGui::InputTextIcon("hex.builtin.tools.base_converter.dec"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[0]))
if (ImGuiExt::InputTextIcon("hex.builtin.tools.base_converter.dec"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[0]))
ConvertBases(10);
if (ImGui::InputTextIcon("hex.builtin.tools.base_converter.hex"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[1]))
if (ImGuiExt::InputTextIcon("hex.builtin.tools.base_converter.hex"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[1]))
ConvertBases(16);
if (ImGui::InputTextIcon("hex.builtin.tools.base_converter.oct"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[2]))
if (ImGuiExt::InputTextIcon("hex.builtin.tools.base_converter.oct"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[2]))
ConvertBases(8);
if (ImGui::InputTextIcon("hex.builtin.tools.base_converter.bin"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[3]))
if (ImGuiExt::InputTextIcon("hex.builtin.tools.base_converter.bin"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[3]))
ConvertBases(2);
}
}

View File

@ -15,7 +15,7 @@ namespace hex::plugin::builtin {
void drawByteSwapper() {
static std::string input, buffer, output;
if (ImGui::InputTextIcon("hex.builtin.tools.input"_lang, ICON_VS_SYMBOL_NUMERIC, input, ImGuiInputTextFlags_CharsHexadecimal)) {
if (ImGuiExt::InputTextIcon("hex.builtin.tools.input"_lang, ICON_VS_SYMBOL_NUMERIC, input, ImGuiInputTextFlags_CharsHexadecimal)) {
auto nextAlignedSize = std::max<size_t>(2, std::bit_ceil(input.size()));
buffer.clear();
@ -30,7 +30,7 @@ namespace hex::plugin::builtin {
}
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().DisabledAlpha);
ImGui::InputTextIcon("hex.builtin.tools.output"_lang, ICON_VS_SYMBOL_NUMERIC, output, ImGuiInputTextFlags_ReadOnly);
ImGuiExt::InputTextIcon("hex.builtin.tools.output"_lang, ICON_VS_SYMBOL_NUMERIC, output, ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleVar();
}
}

View File

@ -128,7 +128,7 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
// Draw color name below sliders
ImGui::TextFormatted("{}", colorFormatName);
ImGuiExt::TextFormatted("{}", colorFormatName);
ImGui::PopStyleVar();
@ -165,7 +165,7 @@ namespace hex::plugin::builtin {
// Draw value
ImGui::PushID(name);
ImGui::TextFormattedSelectable("{}", formatter());
ImGuiExt::TextFormattedSelectable("{}", formatter());
ImGui::PopID();
};

View File

@ -20,9 +20,9 @@ namespace hex::plugin::builtin {
}
}
ImGui::Header("hex.builtin.tools.demangler.demangled"_lang);
ImGuiExt::Header("hex.builtin.tools.demangler.demangled"_lang);
if (ImGui::BeginChild("demangled", ImVec2(0, 200_scaled), true)) {
ImGui::TextFormattedWrappedSelectable("{}", demangledName);
ImGuiExt::TextFormattedWrappedSelectable("{}", demangledName);
}
ImGui::EndChild();
}

View File

@ -40,11 +40,11 @@ namespace hex::plugin::builtin {
return { x, y };
};
ImGui::TextFormattedWrapped("{}", "hex.builtin.tools.euclidean_algorithm.description"_lang);
ImGuiExt::TextFormattedWrapped("{}", "hex.builtin.tools.euclidean_algorithm.description"_lang);
ImGui::NewLine();
if (ImGui::BeginBox()) {
if (ImGuiExt::BeginBox()) {
bool hasChanged = false;
hasChanged = ImGui::InputScalar("A", ImGuiDataType_U64, &a) || hasChanged;
hasChanged = ImGui::InputScalar("B", ImGuiDataType_U64, &b) || hasChanged;
@ -76,17 +76,17 @@ namespace hex::plugin::builtin {
ImGui::InputScalar("gcd(A, B)", ImGuiDataType_S64, &gcdResult, nullptr, nullptr, "%llu", ImGuiInputTextFlags_ReadOnly);
ImGui::Indent();
ImGui::TextFormatted(ICON_VS_ARROW_RIGHT " a \u00D7 p + b \u00D7 q = ({0}) \u00D7 ({1}) + ({2}) \u00D7 ({3})", a, p, b, q);
ImGuiExt::TextFormatted(ICON_VS_ARROW_RIGHT " a \u00D7 p + b \u00D7 q = ({0}) \u00D7 ({1}) + ({2}) \u00D7 ({3})", a, p, b, q);
ImGui::Unindent();
ImGui::InputScalar("lcm(A, B)", ImGuiDataType_S64, &lcmResult, nullptr, nullptr, "%llu", ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleVar();
ImGui::EndBox();
ImGuiExt::EndBox();
}
if (overflow)
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "{}", "hex.builtin.tools.euclidean_algorithm.overflow"_lang);
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "{}", "hex.builtin.tools.euclidean_algorithm.overflow"_lang);
else
ImGui::NewLine();

View File

@ -106,7 +106,7 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(files.empty() || outputPath.empty());
{
if (combinerTask.isRunning())
ImGui::TextSpinner("hex.builtin.tools.file_tools.combiner.combining"_lang);
ImGuiExt::TextSpinner("hex.builtin.tools.file_tools.combiner.combining"_lang);
else {
if (ImGui::Button("hex.builtin.tools.file_tools.combiner.combine"_lang)) {
combinerTask = TaskManager::createTask("hex.builtin.tools.file_tools.combiner.combining", 0, [](auto &task) {

View File

@ -42,7 +42,7 @@ namespace hex::plugin::builtin {
ImGui::EndChild();
if (shredderTask.isRunning())
ImGui::TextSpinner("hex.builtin.tools.file_tools.shredder.shredding"_lang);
ImGuiExt::TextSpinner("hex.builtin.tools.file_tools.shredder.shredding"_lang);
else {
ImGui::BeginDisabled(selectedFile.empty());
{

View File

@ -99,7 +99,7 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(selectedFile.empty() || baseOutputPath.empty() || splitSize == 0);
{
if (splitterTask.isRunning())
ImGui::TextSpinner("hex.builtin.tools.file_tools.splitter.picker.splitting"_lang);
ImGuiExt::TextSpinner("hex.builtin.tools.file_tools.splitter.picker.splitting"_lang);
else {
if (ImGui::Button("hex.builtin.tools.file_tools.splitter.picker.split"_lang)) {
splitterTask = TaskManager::createTask("hex.builtin.tools.file_tools.splitter.picker.splitting", 0, [](auto &task) {

View File

@ -13,7 +13,7 @@ namespace hex::plugin::builtin {
bool uploading = uploadProcess.valid() && uploadProcess.wait_for(0s) != std::future_status::ready;
ImGui::Header("hex.builtin.tools.file_uploader.control"_lang, true);
ImGuiExt::Header("hex.builtin.tools.file_uploader.control"_lang, true);
if (!uploading) {
if (ImGui::Button("hex.builtin.tools.file_uploader.upload"_lang)) {
fs::openFileBrowser(fs::DialogMode::Open, {}, [&](auto path) {
@ -31,7 +31,7 @@ namespace hex::plugin::builtin {
ImGui::ProgressBar(request.getProgress(), ImVec2(0, 0), uploading ? nullptr : "Done!");
ImGui::Header("hex.builtin.tools.file_uploader.recent"_lang);
ImGuiExt::Header("hex.builtin.tools.file_uploader.recent"_lang);
if (ImGui::BeginTable("##links", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg, ImVec2(0, 200))) {
ImGui::TableSetupColumn("hex.builtin.common.file"_lang);
@ -52,14 +52,14 @@ namespace hex::plugin::builtin {
ImGui::TextUnformatted(fileName.c_str());
ImGui::TableNextColumn();
if (ImGui::Hyperlink(link.c_str())) {
if (ImGuiExt::Hyperlink(link.c_str())) {
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl))
hex::openWebpage(link);
else
ImGui::SetClipboardText(link.c_str());
}
ImGui::InfoTooltip("hex.builtin.tools.file_uploader.tooltip"_lang);
ImGuiExt::InfoTooltip("hex.builtin.tools.file_uploader.tooltip"_lang);
ImGui::TableNextColumn();
ImGui::TextUnformatted(size.c_str());

View File

@ -34,7 +34,7 @@ namespace hex::plugin::builtin {
}
ImGui::PushItemWidth(-1);
ImGui::InputTextIcon("##graphing_math_input", ICON_VS_SYMBOL_OPERATOR, mathInput, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll);
ImGuiExt::InputTextIcon("##graphing_math_input", ICON_VS_SYMBOL_OPERATOR, mathInput, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll);
ImGui::PopItemWidth();
if ((prevPos != limits.X.Min && (ImGui::IsMouseReleased(ImGuiMouseButton_Left) || ImGui::GetIO().MouseWheel != 0)) || (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter))) {

View File

@ -100,7 +100,7 @@ namespace hex::plugin::builtin {
static i64 inputFieldWidth = 0;
ImGui::TextFormattedWrapped("{}", "hex.builtin.tools.ieee754.description"_lang);
ImGuiExt::TextFormattedWrapped("{}", "hex.builtin.tools.ieee754.description"_lang);
ImGui::NewLine();
static i64 displayMode = ContentRegistry::Settings::read("hex.builtin.tools.ieee754.settings", "display_mode", 0);
@ -151,7 +151,7 @@ namespace hex::plugin::builtin {
while (labelIndex + count > startBit) {
auto indentSize = IndentBoxOrLabel(startBit, labelIndex, count, true);
ImGui::Indent(indentSize );
ImGui::TextFormatted("{}", labelIndex);
ImGuiExt::TextFormatted("{}", labelIndex);
lastLabelAdded = labelIndex;
ImGui::Unindent(indentSize );
labelIndex -= 4;
@ -191,7 +191,7 @@ namespace hex::plugin::builtin {
bool checkbox = false;
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
checkbox = (ieee754statics.value & (u128(1) << bit)) != 0;
ImGui::BitCheckbox("##checkbox", &checkbox);
ImGuiExt::BitCheckbox("##checkbox", &checkbox);
ieee754statics.value = (ieee754statics.value & ~(u128(1) << bit)) | (u128(checkbox) << bit);
ImGui::PopStyleVar();
};
@ -211,9 +211,9 @@ namespace hex::plugin::builtin {
// Sign.
ImGui::TableNextColumn();
ImVec4 signColor = ImGui::GetCustomColorVec4(ImGuiCustomCol_IEEEToolSign);
ImVec4 expColor = ImGui::GetCustomColorVec4(ImGuiCustomCol_IEEEToolExp);
ImVec4 mantColor = ImGui::GetCustomColorVec4(ImGuiCustomCol_IEEEToolMantissa);
ImVec4 signColor = ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_IEEEToolSign);
ImVec4 expColor = ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_IEEEToolExp);
ImVec4 mantColor = ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_IEEEToolMantissa);
ImVec4 black = ImVec4(0.0, 0.0, 0.0, 1.0);
float indent = IndentBoxOrLabel(signBitPosition,signBitPosition, 1, false);
@ -475,9 +475,9 @@ namespace hex::plugin::builtin {
const static auto DisplayDecimal = [](IEEE754 &ieee754) {
unsigned signColorU32 = ImGui::GetCustomColorU32(ImGuiCustomCol_IEEEToolSign);
unsigned expColorU32 = ImGui::GetCustomColorU32(ImGuiCustomCol_IEEEToolExp);
unsigned mantColorU32 = ImGui::GetCustomColorU32(ImGuiCustomCol_IEEEToolMantissa);
unsigned signColorU32 = ImGuiExt::GetCustomColorU32(ImGuiCustomCol_IEEEToolSign);
unsigned expColorU32 = ImGuiExt::GetCustomColorU32(ImGuiCustomCol_IEEEToolExp);
unsigned mantColorU32 = ImGuiExt::GetCustomColorU32(ImGuiCustomCol_IEEEToolMantissa);
ImGui::TableNextColumn();
@ -520,9 +520,9 @@ namespace hex::plugin::builtin {
else if (ieee754.numberType == NumberType::Zero)
ImGui::Text("0");
else if (ieee754.numberType == NumberType::Denormal)
ImGui::TextFormatted("2^{0}", 1 - ieee754.exponentBias);
ImGuiExt::TextFormatted("2^{0}", 1 - ieee754.exponentBias);
else
ImGui::TextFormatted("2^{0}", ieee754.exponentBits - ieee754.exponentBias);
ImGuiExt::TextFormatted("2^{0}", ieee754.exponentBits - ieee754.exponentBias);
ImGui::Unindent(20_scaled);
@ -534,7 +534,7 @@ namespace hex::plugin::builtin {
// Mantissa.
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, mantColorU32);
ImGui::Indent(20_scaled);
ImGui::TextFormatted("{:.{}}", ieee754.mantissaValue,ieee754.precision);
ImGuiExt::TextFormatted("{:.{}}", ieee754.mantissaValue,ieee754.precision);
ImGui::Unindent(20_scaled);
ImGui::PopStyleColor();
@ -645,7 +645,7 @@ namespace hex::plugin::builtin {
ImGui::PushItemWidth(inputFieldWidth);
u64 newValue = ieee754statics.value & mask;
if (ImGui::InputHexadecimal("##hex", &newValue, flags))
if (ImGuiExt::InputHexadecimal("##hex", &newValue, flags))
ieee754statics.value = newValue;
ImGui::PopItemWidth();

View File

@ -209,9 +209,9 @@ namespace hex::plugin::builtin {
if (ImGui::Button(".", buttonSize)) mathInput += ".";
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetCustomColorVec4(ImGuiCustomCol_DescButtonHovered));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetCustomColorVec4(ImGuiCustomCol_DescButton));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetCustomColorVec4(ImGuiCustomCol_DescButtonActive));
ImGui::PushStyleColor(ImGuiCol_Button, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DescButtonHovered));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DescButton));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_DescButtonActive));
if (ImGui::Button("=", buttonSize)) evaluate = true;
ImGui::SameLine();
ImGui::PopStyleColor(3);
@ -238,16 +238,16 @@ namespace hex::plugin::builtin {
switch (mathDisplayType) {
case MathDisplayType::Standard:
ImGui::TextFormatted("{0:.3Lf}", mathHistory[(mathHistory.size() - 1) - i]);
ImGuiExt::TextFormatted("{0:.3Lf}", mathHistory[(mathHistory.size() - 1) - i]);
break;
case MathDisplayType::Scientific:
ImGui::TextFormatted("{0:.6Lg}", mathHistory[(mathHistory.size() - 1) - i]);
ImGuiExt::TextFormatted("{0:.6Lg}", mathHistory[(mathHistory.size() - 1) - i]);
break;
case MathDisplayType::Engineering:
ImGui::TextFormatted("{0}", hex::toEngineeringString(mathHistory[(mathHistory.size() - 1) - i]).c_str());
ImGuiExt::TextFormatted("{0}", hex::toEngineeringString(mathHistory[(mathHistory.size() - 1) - i]).c_str());
break;
case MathDisplayType::Programmer:
ImGui::TextFormatted("0x{0:X} ({1})",
ImGuiExt::TextFormatted("0x{0:X} ({1})",
u64(mathHistory[(mathHistory.size() - 1) - i]),
u64(mathHistory[(mathHistory.size() - 1) - i]));
break;
@ -283,16 +283,16 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
switch (mathDisplayType) {
case MathDisplayType::Standard:
ImGui::TextFormatted("{0:.3Lf}", value);
ImGuiExt::TextFormatted("{0:.3Lf}", value);
break;
case MathDisplayType::Scientific:
ImGui::TextFormatted("{0:.6Lg}", value);
ImGuiExt::TextFormatted("{0:.6Lg}", value);
break;
case MathDisplayType::Engineering:
ImGui::TextFormatted("{}", hex::toEngineeringString(value));
ImGuiExt::TextFormatted("{}", hex::toEngineeringString(value));
break;
case MathDisplayType::Programmer:
ImGui::TextFormatted("0x{0:X} ({1})", u64(value), u64(value));
ImGuiExt::TextFormatted("0x{0:X} ({1})", u64(value), u64(value));
break;
}
}
@ -304,14 +304,14 @@ namespace hex::plugin::builtin {
}
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_OPERATOR, mathInput, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
if (ImGuiExt::InputTextIcon("##input", ICON_VS_SYMBOL_OPERATOR, mathInput, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
ImGui::SetKeyboardFocusHere();
evaluate = true;
}
ImGui::PopItemWidth();
if (!lastMathError.empty())
ImGui::TextFormattedColored(ImColor(0xA00040FF), "hex.builtin.tools.error"_lang, lastMathError);
ImGuiExt::TextFormattedColored(ImColor(0xA00040FF), "hex.builtin.tools.error"_lang, lastMathError);
else
ImGui::NewLine();

View File

@ -14,7 +14,7 @@ namespace hex::plugin::builtin {
static u64 multiplier = 1;
static u64 numBits = 32;
ImGui::TextFormattedWrapped("{}", "hex.builtin.tools.invariant_multiplication.description"_lang);
ImGuiExt::TextFormattedWrapped("{}", "hex.builtin.tools.invariant_multiplication.description"_lang);
ImGui::NewLine();
@ -44,14 +44,14 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
ImGui::TextUnformatted("( X *");
ImGui::SameLine();
if (ImGui::InputHexadecimal("##multiplier", &multiplier)) {
if (ImGuiExt::InputHexadecimal("##multiplier", &multiplier)) {
if (multiplier == 0)
multiplier = 1;
divisor = ((1LLU << (numBits + 1)) / multiplier) + 1;
}
ImGui::SameLine();
ImGui::TextFormatted(") >> {}", numBits + 1);
ImGuiExt::TextFormatted(") >> {}", numBits + 1);
ImGui::PopItemWidth();
}

View File

@ -11,7 +11,7 @@ namespace hex::plugin::builtin {
static bool setuid, setgid, sticky;
static bool r[3], w[3], x[3];
ImGui::Header("hex.builtin.tools.permissions.perm_bits"_lang, true);
ImGuiExt::Header("hex.builtin.tools.permissions.perm_bits"_lang, true);
if (ImGui::BeginTable("Permissions", 4, ImGuiTableFlags_Borders)) {
ImGui::TableSetupColumn("Special", ImGuiTableColumnFlags_NoSort);
@ -42,7 +42,7 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGui::Header("hex.builtin.tools.permissions.absolute"_lang);
ImGuiExt::Header("hex.builtin.tools.permissions.absolute"_lang);
auto result = hex::format("{}{}{}{}",
(setuid << 2) | (setgid << 1) | (sticky << 0),
@ -55,11 +55,11 @@ namespace hex::plugin::builtin {
constexpr static auto WarningColor = ImColor(0.92F, 0.25F, 0.2F, 1.0F);
if (setuid && !x[0])
ImGui::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.setuid_error"_lang);
ImGuiExt::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.setuid_error"_lang);
if (setgid && !x[1])
ImGui::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.setgid_error"_lang);
ImGuiExt::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.setgid_error"_lang);
if (sticky && !x[2])
ImGui::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.sticky_error"_lang);
ImGuiExt::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.sticky_error"_lang);
}
}
}

View File

@ -21,8 +21,8 @@ namespace hex::plugin::builtin {
static auto regexOutput = [] { std::string s; s.reserve(0xFFF); return s; }();
ImGui::PushItemWidth(-150_scaled);
bool changed1 = ImGui::InputTextIcon("hex.builtin.tools.regex_replacer.pattern"_lang, ICON_VS_REGEX, regexPattern);
bool changed2 = ImGui::InputTextIcon("hex.builtin.tools.regex_replacer.replace"_lang, ICON_VS_REGEX, replacePattern);
bool changed1 = ImGuiExt::InputTextIcon("hex.builtin.tools.regex_replacer.pattern"_lang, ICON_VS_REGEX, regexPattern);
bool changed2 = ImGuiExt::InputTextIcon("hex.builtin.tools.regex_replacer.replace"_lang, ICON_VS_REGEX, replacePattern);
bool changed3 = ImGui::InputTextMultiline("hex.builtin.tools.regex_replacer.input"_lang, regexInput, ImVec2(0, 0));
if (changed1 || changed2 || changed3) {

View File

@ -28,7 +28,7 @@ namespace hex::plugin::builtin {
static std::jthread receiverThread;
static std::mutex receiverMutex;
ImGui::Header("hex.builtin.tools.tcp_client_server.settings"_lang, true);
ImGuiExt::Header("hex.builtin.tools.tcp_client_server.settings"_lang, true);
ImGui::BeginDisabled(client.isConnected());
{
@ -48,14 +48,14 @@ namespace hex::plugin::builtin {
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x * 0.2F);
if (client.isConnected()) {
if (ImGui::IconButton(ICON_VS_DEBUG_DISCONNECT, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
if (ImGuiExt::IconButton(ICON_VS_DEBUG_DISCONNECT, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
client.disconnect();
receiverThread.request_stop();
receiverThread.join();
}
} else {
if (ImGui::IconButton(ICON_VS_PLAY, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
if (ImGuiExt::IconButton(ICON_VS_PLAY, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
client.connect(ipAddress, port);
receiverThread = std::jthread([](const std::stop_token& stopToken) {
@ -76,14 +76,14 @@ namespace hex::plugin::builtin {
else if (port > 65535)
port = 65535;
ImGui::Header("hex.builtin.tools.tcp_client_server.messages"_lang);
ImGuiExt::Header("hex.builtin.tools.tcp_client_server.messages"_lang);
if (ImGui::BeginTable("##response", 1, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders, ImVec2(0, 200_scaled))) {
{
std::scoped_lock lock(receiverMutex);
for (const auto &message : messages) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextFormattedSelectable("{}", message.c_str());
ImGuiExt::TextFormattedSelectable("{}", message.c_str());
}
}
@ -100,7 +100,7 @@ namespace hex::plugin::builtin {
if (pressedEnter)
ImGui::SetKeyboardFocusHere(-1);
if (ImGui::IconButton(ICON_VS_DEBUG_STACKFRAME, ImGui::GetStyleColorVec4(ImGuiCol_Text)) || pressedEnter) {
if (ImGuiExt::IconButton(ICON_VS_DEBUG_STACKFRAME, ImGui::GetStyleColorVec4(ImGuiCol_Text)) || pressedEnter) {
client.writeString(input);
input.clear();
}
@ -118,7 +118,7 @@ namespace hex::plugin::builtin {
static std::mutex receiverMutex;
static std::jthread receiverThread;
ImGui::Header("hex.builtin.tools.tcp_client_server.settings"_lang, true);
ImGuiExt::Header("hex.builtin.tools.tcp_client_server.settings"_lang, true);
ImGui::BeginDisabled(server.isActive());
{
@ -137,14 +137,14 @@ namespace hex::plugin::builtin {
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x * 0.2F);
if (server.isActive()) {
if (ImGui::IconButton(ICON_VS_DEBUG_DISCONNECT, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
if (ImGuiExt::IconButton(ICON_VS_DEBUG_DISCONNECT, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
server.shutdown();
receiverThread.request_stop();
receiverThread.join();
}
} else {
if (ImGui::IconButton(ICON_VS_PLAY, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
if (ImGuiExt::IconButton(ICON_VS_PLAY, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
receiverThread = std::jthread([](const std::stop_token& stopToken){
server = wolv::net::SocketServer(port);
@ -164,7 +164,7 @@ namespace hex::plugin::builtin {
}
ImGui::PopItemWidth();
ImGui::Header("hex.builtin.tools.tcp_client_server.messages"_lang);
ImGuiExt::Header("hex.builtin.tools.tcp_client_server.messages"_lang);
if (ImGui::BeginTable("##response", 1, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders, ImVec2(0, 200_scaled))) {
{
@ -174,7 +174,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushID(index);
ImGui::TextFormattedSelectable("{}", message.c_str());
ImGuiExt::TextFormattedSelectable("{}", message.c_str());
ImGui::PopID();
index += 1;

View File

@ -28,9 +28,9 @@ namespace hex::plugin::builtin {
static bool extendedSearch = false;
static std::string searchString;
ImGui::Header("hex.builtin.tools.wiki_explain.control"_lang, true);
ImGuiExt::Header("hex.builtin.tools.wiki_explain.control"_lang, true);
bool startSearch = ImGui::InputTextIcon("##search", ICON_VS_SYMBOL_KEY, searchString, ImGuiInputTextFlags_EnterReturnsTrue);
bool startSearch = ImGuiExt::InputTextIcon("##search", ICON_VS_SYMBOL_KEY, searchString, ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::SameLine();
@ -43,12 +43,12 @@ namespace hex::plugin::builtin {
searchProcess = request.execute();
}
ImGui::Header("hex.builtin.tools.wiki_explain.results"_lang);
ImGuiExt::Header("hex.builtin.tools.wiki_explain.results"_lang);
if (ImGui::BeginChild("##summary", ImVec2(0, 300), true)) {
if (!resultTitle.empty() && !resultExtract.empty()) {
ImGui::HeaderColored(resultTitle.c_str(), ImGui::GetCustomColorVec4(ImGuiCustomCol_Highlight), true);
ImGui::TextFormattedWrapped("{}", resultExtract.c_str());
ImGuiExt::HeaderColored(resultTitle.c_str(), ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight), true);
ImGuiExt::TextFormattedWrapped("{}", resultExtract.c_str());
}
}
ImGui::EndChild();

View File

@ -66,11 +66,11 @@ namespace hex::plugin::builtin {
#if defined(DEBUG)
ContentRegistry::Interface::addFooterItem([] {
static float framerate = 0;
if (ImGui::HasSecondPassed()) {
if (ImGuiExt::HasSecondPassed()) {
framerate = 1.0F / ImGui::GetIO().DeltaTime;
}
ImGui::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100);
ImGuiExt::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100);
});
#endif
@ -88,9 +88,9 @@ namespace hex::plugin::builtin {
auto widgetStart = ImGui::GetCursorPos();
ImGui::TextSpinner(hex::format("({})", taskCount).c_str());
ImGuiExt::TextSpinner(hex::format("({})", taskCount).c_str());
ImGui::SameLine();
ImGui::SmallProgressBar(progress, (ImGui::GetCurrentWindow()->MenuBarHeight() - 10_scaled) / 2.0);
ImGuiExt::SmallProgressBar(progress, (ImGui::GetCurrentWindow()->MenuBarHeight() - 10_scaled) / 2.0);
ImGui::SameLine();
auto widgetEnd = ImGui::GetCursorPos();
@ -98,7 +98,7 @@ namespace hex::plugin::builtin {
ImGui::InvisibleButton("FrontTask", ImVec2(widgetEnd.x - widgetStart.x, ImGui::GetCurrentWindow()->MenuBarHeight()));
ImGui::SetCursorPos(widgetEnd);
ImGui::InfoTooltip(LangEntry(frontTask->getUnlocalizedName()).get().c_str());
ImGuiExt::InfoTooltip(LangEntry(frontTask->getUnlocalizedName()).get().c_str());
if (ImGui::BeginPopupContextItem("FrontTask", ImGuiPopupFlags_MouseButtonLeft)) {
for (const auto &task : tasks) {
@ -106,15 +106,15 @@ namespace hex::plugin::builtin {
continue;
ImGui::PushID(&task);
ImGui::TextFormatted("{}", LangEntry(task->getUnlocalizedName()));
ImGuiExt::TextFormatted("{}", LangEntry(task->getUnlocalizedName()));
ImGui::SameLine();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine();
ImGui::SmallProgressBar(frontTask->getMaxValue() == 0 ? 1 : (float(frontTask->getValue()) / frontTask->getMaxValue()), (ImGui::GetTextLineHeightWithSpacing() - 5_scaled) / 2);
ImGuiExt::SmallProgressBar(frontTask->getMaxValue() == 0 ? 1 : (float(frontTask->getValue()) / frontTask->getMaxValue()), (ImGui::GetTextLineHeightWithSpacing() - 5_scaled) / 2);
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
if (ImGui::ToolBarButton(ICON_VS_DEBUG_STOP, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
if (ImGuiExt::ToolBarButton(ICON_VS_DEBUG_STOP, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
task->interrupt();
ImGui::PopStyleVar();
@ -126,7 +126,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, scaled(ImVec2(1, 2)));
if (ImGui::ToolBarButton(ICON_VS_DEBUG_STOP, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
if (ImGuiExt::ToolBarButton(ICON_VS_DEBUG_STOP, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
frontTask->interrupt();
ImGui::PopStyleVar();
@ -167,7 +167,7 @@ namespace hex::plugin::builtin {
// Undo
ImGui::BeginDisabled(!providerValid || !provider->canUndo());
{
if (ImGui::ToolBarButton(ICON_VS_DISCARD, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
if (ImGuiExt::ToolBarButton(ICON_VS_DISCARD, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
provider->undo();
}
ImGui::EndDisabled();
@ -175,7 +175,7 @@ namespace hex::plugin::builtin {
// Redo
ImGui::BeginDisabled(!providerValid || !provider->canRedo());
{
if (ImGui::ToolBarButton(ICON_VS_REDO, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
if (ImGuiExt::ToolBarButton(ICON_VS_REDO, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
provider->redo();
}
ImGui::EndDisabled();
@ -185,7 +185,7 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(tasksRunning);
{
// Create new file
if (ImGui::ToolBarButton(ICON_VS_FILE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGray))) {
if (ImGuiExt::ToolBarButton(ICON_VS_FILE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGray))) {
auto newProvider = hex::ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
if (newProvider != nullptr && !newProvider->open())
hex::ImHexApi::Provider::remove(newProvider);
@ -194,7 +194,7 @@ namespace hex::plugin::builtin {
}
// Open file
if (ImGui::ToolBarButton(ICON_VS_FOLDER_OPENED, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBrown)))
if (ImGuiExt::ToolBarButton(ICON_VS_FOLDER_OPENED, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarBrown)))
EventManager::post<RequestOpenWindow>("Open File");
}
ImGui::EndDisabled();
@ -204,7 +204,7 @@ namespace hex::plugin::builtin {
// Save file
ImGui::BeginDisabled(!providerValid || !provider->isWritable() || !provider->isSavable());
{
if (ImGui::ToolBarButton(ICON_VS_SAVE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
if (ImGuiExt::ToolBarButton(ICON_VS_SAVE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
provider->save();
}
ImGui::EndDisabled();
@ -212,7 +212,7 @@ namespace hex::plugin::builtin {
// Save file as
ImGui::BeginDisabled(!providerValid || !provider->isSavable());
{
if (ImGui::ToolBarButton(ICON_VS_SAVE_AS, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
if (ImGuiExt::ToolBarButton(ICON_VS_SAVE_AS, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue)))
fs::openFileBrowser(fs::DialogMode::Save, {}, [&provider](auto path) {
provider->saveAs(path);
});
@ -226,7 +226,7 @@ namespace hex::plugin::builtin {
// Create bookmark
ImGui::BeginDisabled(!providerValid || !provider->isReadable() || !ImHexApi::HexEditor::isSelectionValid());
{
if (ImGui::ToolBarButton(ICON_VS_BOOKMARK, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
if (ImGuiExt::ToolBarButton(ICON_VS_BOOKMARK, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen))) {
auto region = ImHexApi::HexEditor::getSelection();
if (region.has_value())
@ -279,10 +279,10 @@ namespace hex::plugin::builtin {
lastSelectedProvider = i;
}
if (ImGui::InfoTooltip()) {
if (ImGuiExt::InfoTooltip()) {
ImGui::BeginTooltip();
ImGui::TextFormatted("{}", tabProvider->getName().c_str());
ImGuiExt::TextFormatted("{}", tabProvider->getName().c_str());
const auto &description = tabProvider->getDataDescription();
if (!description.empty()) {
@ -297,15 +297,15 @@ namespace hex::plugin::builtin {
for (auto &[name, value] : description) {
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", name);
ImGuiExt::TextFormatted("{}", name);
ImGui::TableNextColumn();
ImGui::TextFormattedWrapped("{}", value);
ImGuiExt::TextFormattedWrapped("{}", value);
}
ImGui::EndTable();
}
} else {
ImGui::TextFormattedDisabled("hex.builtin.provider.tooltip.show_more"_lang);
ImGuiExt::TextFormattedDisabled("hex.builtin.provider.tooltip.show_more"_lang);
}
}

View File

@ -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() {

View File

@ -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)) {

View File

@ -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));
}

View File

@ -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

View File

@ -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();

View File

@ -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;
}

View File

@ -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());
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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] {

View File

@ -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();

View File

@ -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);
}

View File

@ -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++;

View File

@ -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());
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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))) {

View File

@ -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("");
}

View File

@ -33,7 +33,7 @@
namespace hex::plugin::builtin {
static ImGui::Texture s_bannerTexture, s_backdropTexture;
static ImGuiExt::Texture s_bannerTexture, s_backdropTexture;
static std::string s_tipOfTheDay;
@ -59,7 +59,7 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
ImGui::TextUnformatted("hex.builtin.popup.safety_backup.log_file"_lang);
ImGui::SameLine(0, 2_scaled);
if (ImGui::Hyperlink(this->m_logFilePath.filename().string().c_str())) {
if (ImGuiExt::Hyperlink(this->m_logFilePath.filename().string().c_str())) {
fs::openFolderWithSelectionExternal(this->m_logFilePath);
}
@ -115,9 +115,9 @@ namespace hex::plugin::builtin {
PopupTipOfTheDay() : Popup("hex.builtin.popup.tip_of_the_day.title", true, false) { }
void drawContent() override {
ImGui::Header("hex.builtin.welcome.tip_of_the_day"_lang, true);
ImGuiExt::Header("hex.builtin.welcome.tip_of_the_day"_lang, true);
ImGui::TextFormattedWrapped("{}", s_tipOfTheDay.c_str());
ImGuiExt::TextFormattedWrapped("{}", s_tipOfTheDay.c_str());
ImGui::NewLine();
static bool dontShowAgain = false;
@ -158,7 +158,7 @@ namespace hex::plugin::builtin {
ImGui::TableNextColumn();
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + std::min<float>(450_scaled, availableSpace.x / 2 - 50_scaled));
ImGui::TextFormattedWrapped("A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.");
ImGuiExt::TextFormattedWrapped("A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.");
ImGui::PopTextWrapPos();
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 6);
@ -169,23 +169,23 @@ namespace hex::plugin::builtin {
{
auto startPos = ImGui::GetCursorPos();
ImGui::BeginSubWindow("hex.builtin.welcome.header.start"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.start"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
{
if (ImGui::IconHyperlink(ICON_VS_NEW_FILE, "hex.builtin.welcome.start.create_file"_lang)) {
if (ImGuiExt::IconHyperlink(ICON_VS_NEW_FILE, "hex.builtin.welcome.start.create_file"_lang)) {
auto newProvider = hex::ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
if (newProvider != nullptr && !newProvider->open())
hex::ImHexApi::Provider::remove(newProvider);
else
EventManager::post<EventProviderOpened>(newProvider);
}
if (ImGui::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.builtin.welcome.start.open_file"_lang))
if (ImGuiExt::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.builtin.welcome.start.open_file"_lang))
EventManager::post<RequestOpenWindow>("Open File");
if (ImGui::IconHyperlink(ICON_VS_NOTEBOOK, "hex.builtin.welcome.start.open_project"_lang))
if (ImGuiExt::IconHyperlink(ICON_VS_NOTEBOOK, "hex.builtin.welcome.start.open_project"_lang))
EventManager::post<RequestOpenWindow>("Open Project");
if (ImGui::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
if (ImGuiExt::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
otherProvidersVisible = !otherProvidersVisible;
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
auto endPos = ImGui::GetCursorPos();
if (otherProvidersVisible) {
@ -194,14 +194,14 @@ namespace hex::plugin::builtin {
ImGui::TextUnformatted(ICON_VS_ARROW_RIGHT);
ImGui::SameLine(0, 2_scaled);
ImGui::BeginSubWindow("hex.builtin.welcome.start.open_other"_lang, ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.open_other"_lang, ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), ImGuiChildFlags_AutoResizeX);
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) {
if (ImGuiExt::Hyperlink(LangEntry(unlocalizedProviderName))) {
ImHexApi::Provider::createProvider(unlocalizedProviderName);
otherProvidersVisible = false;
}
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
}
}
@ -212,28 +212,30 @@ namespace hex::plugin::builtin {
if (ImHexApi::System::getInitArguments().contains("update-available")) {
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
ImGui::UnderlinedText("hex.builtin.welcome.header.update"_lang);
ImGuiExt::UnderlinedText("hex.builtin.welcome.header.update"_lang);
{
if (ImGui::DescriptionButton("hex.builtin.welcome.update.title"_lang, hex::format("hex.builtin.welcome.update.desc"_lang, ImHexApi::System::getInitArguments()["update-available"]).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0)))
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.update.title"_lang, hex::format("hex.builtin.welcome.update.desc"_lang, ImHexApi::System::getInitArguments()["update-available"]).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0)))
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
}
}
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 6);
ImGui::TableNextColumn();
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled);
ImGui::BeginSubWindow("hex.builtin.welcome.header.help"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.help"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
{
if (ImGui::IconHyperlink(ICON_VS_GITHUB, "hex.builtin.welcome.help.repo"_lang)) hex::openWebpage("hex.builtin.welcome.help.repo.link"_lang);
if (ImGui::IconHyperlink(ICON_VS_ORGANIZATION, "hex.builtin.welcome.help.gethelp"_lang)) hex::openWebpage("hex.builtin.welcome.help.gethelp.link"_lang);
if (ImGui::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.builtin.welcome.help.discord"_lang)) hex::openWebpage("hex.builtin.welcome.help.discord.link"_lang);
if (ImGuiExt::IconHyperlink(ICON_VS_GITHUB, "hex.builtin.welcome.help.repo"_lang)) hex::openWebpage("hex.builtin.welcome.help.repo.link"_lang);
if (ImGuiExt::IconHyperlink(ICON_VS_ORGANIZATION, "hex.builtin.welcome.help.gethelp"_lang)) hex::openWebpage("hex.builtin.welcome.help.gethelp.link"_lang);
if (ImGuiExt::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.builtin.welcome.help.discord"_lang)) hex::openWebpage("hex.builtin.welcome.help.discord.link"_lang);
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::BeginSubWindow("hex.builtin.welcome.header.plugins"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.plugins"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
{
const auto &plugins = PluginManager::getPlugins();
@ -272,7 +274,7 @@ namespace hex::plugin::builtin {
}
}
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
ImGui::PopStyleVar();
ImGui::EndTable();
@ -284,46 +286,48 @@ namespace hex::plugin::builtin {
auto windowPadding = ImGui::GetStyle().WindowPadding.x * 3;
ImGui::BeginSubWindow("hex.builtin.welcome.header.customize"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.customize"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
{
if (ImGui::DescriptionButton("hex.builtin.welcome.customize.settings.title"_lang, "hex.builtin.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.customize.settings.title"_lang, "hex.builtin.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
EventManager::post<RequestOpenWindow>("Settings");
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
ImGui::BeginSubWindow("hex.builtin.welcome.header.learn"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.learn"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
{
const auto size = ImVec2(ImGui::GetContentRegionAvail().x, 0);
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.latest.title"_lang, "hex.builtin.welcome.learn.latest.desc"_lang, size))
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.latest.title"_lang, "hex.builtin.welcome.learn.latest.desc"_lang, size))
hex::openWebpage("hex.builtin.welcome.learn.latest.link"_lang);
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.imhex.title"_lang, "hex.builtin.welcome.learn.imhex.desc"_lang, size)) {
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.imhex.title"_lang, "hex.builtin.welcome.learn.imhex.desc"_lang, size)) {
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.docs.name");
hex::openWebpage("hex.builtin.welcome.learn.imhex.link"_lang);
}
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.pattern.title"_lang, "hex.builtin.welcome.learn.pattern.desc"_lang, size))
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.pattern.title"_lang, "hex.builtin.welcome.learn.pattern.desc"_lang, size))
hex::openWebpage("hex.builtin.welcome.learn.pattern.link"_lang);
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, size))
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, size))
hex::openWebpage("hex.builtin.welcome.learn.plugins.link"_lang);
if (auto [unlocked, total] = AchievementManager::getProgress(); unlocked != total) {
if (ImGui::DescriptionButtonProgress("hex.builtin.welcome.learn.achievements.title"_lang, "hex.builtin.welcome.learn.achievements.desc"_lang, float(unlocked) / float(total), size)) {
if (ImGuiExt::DescriptionButtonProgress("hex.builtin.welcome.learn.achievements.title"_lang, "hex.builtin.welcome.learn.achievements.desc"_lang, float(unlocked) / float(total), size)) {
EventManager::post<RequestOpenWindow>("Achievements");
}
}
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
if (!extraWelcomeScreenEntries.empty()) {
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
ImGui::BeginSubWindow("hex.builtin.welcome.header.various"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0));
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.various"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0));
{
for (const auto &callback : extraWelcomeScreenEntries)
callback();
}
ImGui::EndSubWindow();
ImGuiExt::EndSubWindow();
}
@ -331,7 +335,7 @@ namespace hex::plugin::builtin {
}
ImGui::SetCursorPos(ImVec2(ImGui::GetContentRegionAvail().x + ImGui::GetStyle().FramePadding.x, ImGui::GetStyle().FramePadding.y * 2 - 1));
if (ImGui::DimmedIconButton(ICON_VS_CLOSE, ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
if (ImGuiExt::DimmedIconButton(ICON_VS_CLOSE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.null");
if (provider != nullptr)
if (provider->open())
@ -392,7 +396,7 @@ namespace hex::plugin::builtin {
);
ImGui::SetCursorPos(textPos);
if (ImGui::DimmedButton(loadDefaultText)){
if (ImGuiExt::DimmedButton(loadDefaultText)){
loadDefaultLayout();
}
}
@ -451,7 +455,7 @@ namespace hex::plugin::builtin {
(void)EventManager::subscribe<RequestChangeTheme>([](const std::string &theme) {
auto changeTexture = [&](const std::string &path) {
return ImGui::Texture(romfs::get(path).span());
return ImGuiExt::Texture(romfs::get(path).span());
};
ThemeManager::changeTheme(theme);

View File

@ -131,15 +131,15 @@ namespace hex::plugin::builtin::ui {
const auto [decoded, advance] = encodingFile.getEncodingFor(buffer);
const ImColor color = [&]{
if (decoded.length() == 1 && std::isalnum(decoded[0]))
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingASCII);
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingASCII);
else if (decoded.length() == 1 && advance == 1)
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingSingleChar);
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingSingleChar);
else if (decoded.length() > 1 && advance == 1)
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingMultiChar);
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingMultiChar);
else if (advance > 1)
return ImGui::GetColorU32(ImGuiCol_Text);
else
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarBlue);
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_ToolbarBlue);
}();
return { std::string(decoded), advance, color };
@ -357,7 +357,7 @@ namespace hex::plugin::builtin::ui {
// Draw address column
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextFormatted(this->m_upperCaseHex ? "{:08X}: " : "{:08x}: ", y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress());
ImGuiExt::TextFormatted(this->m_upperCaseHex ? "{:08X}: " : "{:08x}: ", y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress());
ImGui::TableNextColumn();
const u8 validBytes = std::min<u64>(this->m_bytesPerRow, this->m_provider->getSize() - y * this->m_bytesPerRow);
@ -457,7 +457,7 @@ namespace hex::plugin::builtin::ui {
if (isCurrRegionValid(byteAddress))
this->drawCell(byteAddress, &bytes[x * bytesPerCell], bytesPerCell, cellHovered, CellType::Hex);
else
ImGui::TextFormatted("{}", std::string(maxCharsPerCell, '?'));
ImGuiExt::TextFormatted("{}", std::string(maxCharsPerCell, '?'));
ImGui::PopItemWidth();
ImGui::PopStyleVar();
@ -510,7 +510,7 @@ namespace hex::plugin::builtin::ui {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::PushItemWidth(CharacterSize.x);
if (!isCurrRegionValid(byteAddress))
ImGui::TextFormattedDisabled("{}", this->m_unknownDataCharacter);
ImGuiExt::TextFormattedDisabled("{}", this->m_unknownDataCharacter);
else
this->drawCell(byteAddress, &bytes[x], 1, cellHovered, CellType::ASCII);
ImGui::PopItemWidth();
@ -536,7 +536,7 @@ namespace hex::plugin::builtin::ui {
std::vector<std::pair<u64, CustomEncodingData>> encodingData;
if (this->m_encodingLineStartAddresses[y] >= this->m_bytesPerRow) {
encodingData.emplace_back(y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress(), CustomEncodingData(".", 1, ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingUnknown)));
encodingData.emplace_back(y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress(), CustomEncodingData(".", 1, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingUnknown)));
this->m_encodingLineStartAddresses.push_back(0);
} else {
u32 offset = this->m_encodingLineStartAddresses[y];
@ -581,7 +581,7 @@ namespace hex::plugin::builtin::ui {
}
auto startPos = ImGui::GetCursorPos();
ImGui::TextFormattedColored(data.color, "{}", data.displayValue);
ImGuiExt::TextFormattedColored(data.color, "{}", data.displayValue);
ImGui::SetCursorPosX(startPos.x + cellSize.x);
ImGui::SameLine(0, 0);
ImGui::Dummy({ 0, 0 });
@ -689,7 +689,7 @@ namespace hex::plugin::builtin::ui {
{
u32 page = this->m_provider->getCurrentPage() + 1;
ImGui::TextFormatted("{}: ", "hex.builtin.hex_editor.page"_lang);
ImGuiExt::TextFormatted("{}: ", "hex.builtin.hex_editor.page"_lang);
ImGui::SameLine();
ImGui::BeginDisabled(pageCount <= 1);
@ -705,9 +705,9 @@ namespace hex::plugin::builtin::ui {
{
const auto pageAddress = this->m_provider->getCurrentPageAddress();
const auto pageSize = this->m_provider->getSize();
ImGui::TextFormatted("{}:", "hex.builtin.hex_editor.region"_lang);
ImGuiExt::TextFormatted("{}:", "hex.builtin.hex_editor.region"_lang);
ImGui::SameLine();
ImGui::TextFormattedSelectable("0x{0:08X} - 0x{1:08X} ({0} - {1})",
ImGuiExt::TextFormattedSelectable("0x{0:08X} - 0x{1:08X} ({0} - {1})",
pageAddress,
pageSize == 0 ? 0 : (pageAddress + pageSize - 1)
);
@ -733,17 +733,17 @@ namespace hex::plugin::builtin::ui {
else
value = std::string("hex.builtin.hex_editor.selection.none"_lang);
ImGui::TextFormatted("{}:", "hex.builtin.hex_editor.selection"_lang);
ImGuiExt::TextFormatted("{}:", "hex.builtin.hex_editor.selection"_lang);
ImGui::SameLine();
ImGui::TextFormattedSelectable(value);
ImGuiExt::TextFormattedSelectable(value);
}
// Loaded data size
ImGui::TableNextColumn();
{
ImGui::TextFormatted("{}:", "hex.builtin.hex_editor.data_size"_lang);
ImGuiExt::TextFormatted("{}:", "hex.builtin.hex_editor.data_size"_lang);
ImGui::SameLine();
ImGui::TextFormattedSelectable("0x{0:08X} (0x{1:X} | {2})",
ImGuiExt::TextFormattedSelectable("0x{0:08X} (0x{1:X} | {2})",
this->m_provider->getActualSize(),
this->m_provider->getActualSize(),
this->m_showHumanReadableUnits
@ -757,35 +757,35 @@ namespace hex::plugin::builtin::ui {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 2_scaled);
// Upper/lower case hex
ImGui::DimmedIconToggle(ICON_VS_CASE_SENSITIVE, &this->m_upperCaseHex);
ImGui::InfoTooltip("hex.builtin.hex_editor.uppercase_hex"_lang);
ImGuiExt::DimmedIconToggle(ICON_VS_CASE_SENSITIVE, &this->m_upperCaseHex);
ImGuiExt::InfoTooltip("hex.builtin.hex_editor.uppercase_hex"_lang);
ImGui::SameLine();
// Grayed out zeros
ImGui::DimmedIconToggle(ICON_VS_LIGHTBULB, &this->m_grayOutZero);
ImGui::InfoTooltip("hex.builtin.hex_editor.gray_out_zero"_lang);
ImGuiExt::DimmedIconToggle(ICON_VS_LIGHTBULB, &this->m_grayOutZero);
ImGuiExt::InfoTooltip("hex.builtin.hex_editor.gray_out_zero"_lang);
ImGui::SameLine();
// ASCII view
ImGui::DimmedIconToggle(ICON_VS_SYMBOL_KEY, &this->m_showAscii);
ImGui::InfoTooltip("hex.builtin.hex_editor.ascii_view"_lang);
ImGuiExt::DimmedIconToggle(ICON_VS_SYMBOL_KEY, &this->m_showAscii);
ImGuiExt::InfoTooltip("hex.builtin.hex_editor.ascii_view"_lang);
ImGui::SameLine(0, 1_scaled);
// Custom encoding view
ImGui::BeginDisabled(!this->m_currCustomEncoding.has_value());
ImGui::DimmedIconToggle(ICON_VS_WHITESPACE, &this->m_showCustomEncoding);
ImGuiExt::DimmedIconToggle(ICON_VS_WHITESPACE, &this->m_showCustomEncoding);
ImGui::EndDisabled();
ImGui::InfoTooltip("hex.builtin.hex_editor.custom_encoding_view"_lang);
ImGuiExt::InfoTooltip("hex.builtin.hex_editor.custom_encoding_view"_lang);
ImGui::SameLine();
// Human-readable units
ImGui::DimmedIconToggle(ICON_VS_SYMBOL_NUMERIC, &this->m_showHumanReadableUnits);
ImGui::InfoTooltip("hex.builtin.hex_editor.human_readable_units_footer"_lang);
ImGuiExt::DimmedIconToggle(ICON_VS_SYMBOL_NUMERIC, &this->m_showHumanReadableUnits);
ImGuiExt::InfoTooltip("hex.builtin.hex_editor.human_readable_units_footer"_lang);
ImGui::TableNextColumn();
@ -793,7 +793,7 @@ namespace hex::plugin::builtin::ui {
{
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
ImGui::TextFormatted("{}: ", "hex.builtin.hex_editor.visualizer"_lang);
ImGuiExt::TextFormatted("{}: ", "hex.builtin.hex_editor.visualizer"_lang);
ImGui::SameLine(0, 0);

View File

@ -56,7 +56,7 @@ namespace hex::plugin::builtin::ui {
auto selected = isPatternSelected(address, size);
if (selected)
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetCustomColorVec4(ImGuiCustomCol_PatternSelected));
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_PatternSelected));
if constexpr (HasReturn) {
auto result = callback();
@ -79,7 +79,7 @@ namespace hex::plugin::builtin::ui {
}
void drawTypenameColumn(const pl::ptrn::Pattern& pattern, const std::string& pattern_name) {
ImGui::TextFormattedColored(ImColor(0xFFD69C56), pattern_name);
ImGuiExt::TextFormattedColored(ImColor(0xFFD69C56), pattern_name);
ImGui::SameLine();
ImGui::TextUnformatted(pattern.getTypeName().c_str());
ImGui::TableNextColumn();
@ -94,14 +94,14 @@ namespace hex::plugin::builtin::ui {
void drawOffsetColumnForBitfieldMember(const pl::ptrn::PatternBitfieldMember &pattern) {
if (pattern.isPatternLocal()) {
ImGui::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGuiExt::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGui::TableNextColumn();
ImGui::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGuiExt::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGui::TableNextColumn();
} else {
ImGui::TextFormatted("0x{0:08X}, bit {1}", pattern.getOffset(), pattern.getBitOffsetForDisplay());
ImGuiExt::TextFormatted("0x{0:08X}, bit {1}", pattern.getOffset(), pattern.getBitOffsetForDisplay());
ImGui::TableNextColumn();
ImGui::TextFormatted("0x{0:08X}, bit {1}", pattern.getOffset() + pattern.getSize(), pattern.getBitOffsetForDisplay() + pattern.getBitSize() - (pattern.getSize() == 0 ? 0 : 1));
ImGuiExt::TextFormatted("0x{0:08X}, bit {1}", pattern.getOffset() + pattern.getSize(), pattern.getBitOffsetForDisplay() + pattern.getBitSize() - (pattern.getSize() == 0 ? 0 : 1));
ImGui::TableNextColumn();
}
}
@ -114,17 +114,17 @@ namespace hex::plugin::builtin::ui {
}
if (pattern.isPatternLocal()) {
ImGui::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGuiExt::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
} else {
ImGui::TextFormatted("0x{0:08X}", pattern.getOffset());
ImGuiExt::TextFormatted("0x{0:08X}", pattern.getOffset());
}
ImGui::TableNextColumn();
if (pattern.isPatternLocal()) {
ImGui::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
ImGuiExt::TextFormatted("[{}]", "hex.builtin.pattern_drawer.local"_lang);
} else {
ImGui::TextFormatted("0x{0:08X}", pattern.getOffset() + pattern.getSize() - (pattern.getSize() == 0 ? 0 : 1));
ImGuiExt::TextFormatted("0x{0:08X}", pattern.getOffset() + pattern.getSize() - (pattern.getSize() == 0 ? 0 : 1));
}
ImGui::TableNextColumn();
@ -132,23 +132,23 @@ namespace hex::plugin::builtin::ui {
void drawSizeColumnForBitfieldMember(const pl::ptrn::PatternBitfieldMember &pattern) {
if (pattern.getBitSize() == 1)
ImGui::TextFormatted("1 bit");
ImGuiExt::TextFormatted("1 bit");
else
ImGui::TextFormatted("{0} bits", pattern.getBitSize());
ImGuiExt::TextFormatted("{0} bits", pattern.getBitSize());
}
void drawSizeColumn(const pl::ptrn::Pattern& pattern) {
if (auto *bitfieldMember = dynamic_cast<pl::ptrn::PatternBitfieldMember const*>(&pattern); bitfieldMember != nullptr && bitfieldMember->getParentBitfield() != nullptr)
drawSizeColumnForBitfieldMember(*bitfieldMember);
else
ImGui::TextFormatted("0x{0:04X}", pattern.getSize());
ImGuiExt::TextFormatted("0x{0:04X}", pattern.getSize());
ImGui::TableNextColumn();
}
void drawCommentTooltip(const pl::ptrn::Pattern &pattern) {
if (auto comment = pattern.getComment(); !comment.empty()) {
ImGui::InfoTooltip(comment.c_str());
ImGuiExt::InfoTooltip(comment.c_str());
}
}
@ -237,12 +237,12 @@ namespace hex::plugin::builtin::ui {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
if (this->m_favorites.contains(this->m_currPatternPath)) {
if (ImGui::DimmedIconButton(ICON_VS_STAR_DELETE, ImGui::GetStyleColorVec4(ImGuiCol_PlotHistogram))) {
if (ImGuiExt::DimmedIconButton(ICON_VS_STAR_DELETE, ImGui::GetStyleColorVec4(ImGuiCol_PlotHistogram))) {
this->m_favorites.erase(this->m_currPatternPath);
}
}
else {
if (ImGui::DimmedIconButton(ICON_VS_STAR_ADD, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled))) {
if (ImGuiExt::DimmedIconButton(ICON_VS_STAR_ADD, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled))) {
this->m_favorites.insert({ this->m_currPatternPath, pattern.clone() });
}
}
@ -319,11 +319,11 @@ namespace hex::plugin::builtin::ui {
} else if (const auto &inlineVisualizeArgs = pattern.getAttributeArguments("hex::inline_visualize"); !inlineVisualizeArgs.empty()) {
drawVisualizer(ContentRegistry::PatternLanguage::impl::getInlineVisualizers(), inlineVisualizeArgs, pattern, dynamic_cast<pl::ptrn::IIterable&>(pattern), true);
} else {
ImGui::TextFormatted("{}", value);
ImGuiExt::TextFormatted("{}", value);
}
if (ImGui::CalcTextSize(value.c_str()).x > width) {
ImGui::InfoTooltip(value.c_str());
ImGuiExt::InfoTooltip(value.c_str());
}
}
@ -393,7 +393,7 @@ namespace hex::plugin::builtin::ui {
drawColorColumn(pattern);
drawOffsetColumn(pattern);
drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName().empty() ? pattern.getTypeName() : pattern.getFormattedName());
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName().empty() ? pattern.getTypeName() : pattern.getFormattedName());
ImGui::TableNextColumn();
}
@ -423,7 +423,7 @@ namespace hex::plugin::builtin::ui {
drawOffsetColumnForBitfieldMember(pattern);
drawSizeColumnForBitfieldMember(pattern);
ImGui::TableNextColumn();
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "bits");
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "bits");
ImGui::TableNextColumn();
if (!this->isEditingPattern(pattern)) {
@ -639,7 +639,7 @@ namespace hex::plugin::builtin::ui {
drawColorColumn(pattern);
drawOffsetColumn(pattern);
drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName());
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "{}", pattern.getFormattedName());
ImGui::TableNextColumn();
drawValueColumn(pattern);
}
@ -878,12 +878,12 @@ namespace hex::plugin::builtin::ui {
ImGui::TableNextColumn();
drawOffsetColumn(pattern);
drawSizeColumn(pattern);
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName());
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName());
ImGui::SameLine(0, 0);
ImGui::TextUnformatted("[");
ImGui::SameLine(0, 0);
ImGui::TextFormattedColored(ImColor(0xFF00FF00), "{0}", iterable.getEntryCount());
ImGuiExt::TextFormattedColored(ImColor(0xFF00FF00), "{0}", iterable.getEntryCount());
ImGui::SameLine(0, 0);
ImGui::TextUnformatted("]");
@ -933,19 +933,19 @@ namespace hex::plugin::builtin::ui {
ImGui::TableNextColumn();
ImGui::TableNextColumn();
drawOffsetColumn(pattern);
ImGui::TextFormatted("0x{0:04X}", chunkSize);
ImGuiExt::TextFormatted("0x{0:04X}", chunkSize);
ImGui::TableNextColumn();
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName());
ImGuiExt::TextFormattedColored(ImColor(0xFF9BC64D), "{0}", pattern.getTypeName());
ImGui::SameLine(0, 0);
ImGui::TextUnformatted("[");
ImGui::SameLine(0, 0);
ImGui::TextFormattedColored(ImColor(0xFF00FF00), "{0}", endIndex - i);
ImGuiExt::TextFormattedColored(ImColor(0xFF00FF00), "{0}", endIndex - i);
ImGui::SameLine(0, 0);
ImGui::TextUnformatted("]");
ImGui::TableNextColumn();
ImGui::TextFormatted("[ ... ]");
ImGuiExt::TextFormatted("[ ... ]");
}
@ -1088,13 +1088,13 @@ namespace hex::plugin::builtin::ui {
pushed = true;
}
if (ImGui::DimmedIconButton(icon, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
if (ImGuiExt::DimmedIconButton(icon, ImGui::GetStyleColorVec4(ImGuiCol_Text)))
this->m_treeStyle = style;
if (pushed)
ImGui::PopStyleColor();
ImGui::InfoTooltip(tooltip);
ImGuiExt::InfoTooltip(tooltip);
};
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !ImGui::IsAnyItemHovered()) {
@ -1102,15 +1102,15 @@ namespace hex::plugin::builtin::ui {
}
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGui::GetTextLineHeightWithSpacing() * 9.5);
if (ImGui::InputTextIcon("##Search", ICON_VS_FILTER, this->m_filterText)) {
if (ImGuiExt::InputTextIcon("##Search", ICON_VS_FILTER, this->m_filterText)) {
this->m_filter = parseRValueFilter(this->m_filterText).value_or(Filter{ });
}
ImGui::PopItemWidth();
ImGui::SameLine();
ImGui::DimmedIconToggle(ICON_VS_BOOK, &this->m_showSpecName);
ImGui::InfoTooltip("hex.builtin.pattern_drawer.spec_name"_lang);
ImGuiExt::DimmedIconToggle(ICON_VS_BOOK, &this->m_showSpecName);
ImGuiExt::InfoTooltip("hex.builtin.pattern_drawer.spec_name"_lang);
ImGui::SameLine();
@ -1125,12 +1125,12 @@ namespace hex::plugin::builtin::ui {
const auto startPos = ImGui::GetCursorPos();
ImGui::BeginDisabled(runtime == nullptr);
if (ImGui::DimmedIconButton(ICON_VS_EXPORT, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
if (ImGuiExt::DimmedIconButton(ICON_VS_EXPORT, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
ImGui::OpenPopup("ExportPatterns");
}
ImGui::EndDisabled();
ImGui::InfoTooltip("hex.builtin.pattern_drawer.export"_lang);
ImGuiExt::InfoTooltip("hex.builtin.pattern_drawer.export"_lang);
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImVec2(startPos.x, ImGui::GetCursorPosY()));
if (ImGui::BeginPopup("ExportPatterns")) {
@ -1285,7 +1285,7 @@ namespace hex::plugin::builtin::ui {
}
if (this->m_favoritesUpdateTask.isRunning()) {
ImGui::TextOverlay("hex.builtin.pattern_drawer.updating"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2);
ImGuiExt::TextOverlay("hex.builtin.pattern_drawer.updating"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2);
}
}

View File

@ -85,7 +85,7 @@ namespace {
}
if (updaterTask.isRunning()) {
ImGui::TextSpinner("hex.script_loader.menu.loading"_lang);
ImGuiExt::TextSpinner("hex.script_loader.menu.loading"_lang);
} else if (scripts.empty()) {
ImGui::TextUnformatted("hex.script_loader.menu.no_scripts"_lang);
}

View File

@ -20,7 +20,7 @@ public:
m_message(std::move(message)) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
ImGui::Separator();
@ -63,7 +63,7 @@ public:
m_message(std::move(message)), m_maxSize(maxSize) { }
void drawContent() override {
ImGui::TextFormattedWrapped("{}", this->m_message.c_str());
ImGuiExt::TextFormattedWrapped("{}", this->m_message.c_str());
ImGui::NewLine();
ImGui::SetItemDefaultFocus();

View File

@ -67,7 +67,7 @@ namespace hex::plugin::windows {
struct Process {
u32 id;
std::string name;
ImGui::Texture icon;
ImGuiExt::Texture icon;
};
struct MemoryRegion {

View File

@ -84,7 +84,7 @@ namespace hex::plugin::windows {
if (GetModuleBaseNameA(processHandle, nullptr, processName, MAX_PATH) == 0)
continue;
ImGui::Texture texture;
ImGuiExt::Texture texture;
{
HMODULE moduleHandle = nullptr;
DWORD numModules = 0;
@ -114,7 +114,7 @@ namespace hex::plugin::windows {
for (auto &pixel : pixels)
pixel = (pixel & 0xFF00FF00) | ((pixel & 0xFF) << 16) | ((pixel & 0xFF0000) >> 16);
texture = ImGui::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size(), bitmap.bmWidth, bitmap.bmHeight);
texture = ImGuiExt::Texture(reinterpret_cast<u8*>(pixels.data()), pixels.size(), bitmap.bmWidth, bitmap.bmHeight);
}
}
}
@ -167,7 +167,7 @@ namespace hex::plugin::windows {
}
void ProcessMemoryProvider::drawInterface() {
ImGui::Header("hex.windows.provider.process_memory.memory_regions"_lang, true);
ImGuiExt::Header("hex.windows.provider.process_memory.memory_regions"_lang, true);
auto availableX = ImGui::GetContentRegionAvail().x;
ImGui::PushItemWidth(availableX);
@ -202,7 +202,7 @@ namespace hex::plugin::windows {
ImGui::EndTable();
}
ImGui::Header("hex.windows.provider.process_memory.utils"_lang);
ImGuiExt::Header("hex.windows.provider.process_memory.utils"_lang);
if (ImGui::Button("hex.windows.provider.process_memory.utils.inject_dll"_lang)) {
hex::fs::openFileBrowser(fs::DialogMode::Open, { { "DLL File", "dll" } }, [this](const std::fs::path &path) {

View File

@ -17,7 +17,7 @@ namespace hex::plugin::windows {
ContentRegistry::Interface::addFooterItem([] {
static float cpuUsage = 0.0F;
if (ImGui::HasSecondPassed()) {
if (ImGuiExt::HasSecondPassed()) {
static ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
static u32 numProcessors;
static HANDLE self = GetCurrentProcess();
@ -61,14 +61,14 @@ namespace hex::plugin::windows {
cpuUsage *= 100;
}
ImGui::TextFormatted(ICON_FA_TACHOMETER_ALT " {0:2}.{1:02}", u32(cpuUsage), u32(cpuUsage * 100) % 100);
ImGuiExt::TextFormatted(ICON_FA_TACHOMETER_ALT " {0:2}.{1:02}", u32(cpuUsage), u32(cpuUsage * 100) % 100);
});
ContentRegistry::Interface::addFooterItem([] {
static MEMORYSTATUSEX memInfo;
static PROCESS_MEMORY_COUNTERS_EX pmc;
if (ImGui::HasSecondPassed()) {
if (ImGuiExt::HasSecondPassed()) {
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PROCESS_MEMORY_COUNTERS *>(&pmc), sizeof(pmc));
@ -77,7 +77,7 @@ namespace hex::plugin::windows {
auto totalMem = memInfo.ullTotalPhys;
auto usedMem = pmc.WorkingSetSize;
ImGui::TextFormatted(ICON_FA_MICROCHIP " {0} / {1}", hex::toByteString(usedMem), hex::toByteString(totalMem));
ImGuiExt::TextFormatted(ICON_FA_MICROCHIP " {0} / {1}", hex::toByteString(usedMem), hex::toByteString(totalMem));
});
}

View File

@ -19,7 +19,7 @@ namespace hex::plugin::windows {
void ViewTTYConsole::drawContent() {
if (ImGui::Begin(View::toWindowName("hex.windows.view.tty_console.name").c_str(), &this->getWindowOpenState())) {
ImGui::Header("hex.windows.view.tty_console.config"_lang, true);
ImGuiExt::Header("hex.windows.view.tty_console.config"_lang, true);
bool connected = this->m_portHandle != INVALID_HANDLE_VALUE;
@ -104,7 +104,7 @@ namespace hex::plugin::windows {
ImGui::Checkbox("hex.windows.view.tty_console.auto_scroll"_lang, &this->m_shouldAutoScroll);
ImGui::Header("hex.windows.view.tty_console.console"_lang);
ImGuiExt::Header("hex.windows.view.tty_console.console"_lang);
auto consoleSize = ImGui::GetContentRegionAvail();
consoleSize.y -= ImGui::GetTextLineHeight() + ImGui::GetStyle().FramePadding.y * 4;