mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
refactor: Move custom ImGui functions to ImGuiExt namespace (#1427)
Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user