refactor: Streamline entire view system
This commit is contained in:
parent
fc23efdb25
commit
c89a870fe9
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
using ImGuiID = unsigned int;
|
using ImGuiID = unsigned int;
|
||||||
struct ImVec2;
|
struct ImVec2;
|
||||||
|
struct ImFontAtlas;
|
||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
@ -340,12 +341,14 @@ namespace hex {
|
|||||||
|
|
||||||
void setCustomFontPath(const std::fs::path &path);
|
void setCustomFontPath(const std::fs::path &path);
|
||||||
void setFontSize(float size);
|
void setFontSize(float size);
|
||||||
|
void setFontAtlas(ImFontAtlas *fontAtlas);
|
||||||
|
|
||||||
void setGPUVendor(const std::string &vendor);
|
void setGPUVendor(const std::string &vendor);
|
||||||
|
|
||||||
void setPortableVersion(bool enabled);
|
void setPortableVersion(bool enabled);
|
||||||
|
|
||||||
void addInitArgument(const std::string &key, const std::string &value = { });
|
void addInitArgument(const std::string &key, const std::string &value = { });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProgramArguments {
|
struct ProgramArguments {
|
||||||
@ -457,6 +460,12 @@ namespace hex {
|
|||||||
*/
|
*/
|
||||||
float getFontSize();
|
float getFontSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the current font atlas
|
||||||
|
* @return Current font atlas
|
||||||
|
*/
|
||||||
|
ImFontAtlas* getFontAtlas();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets if ImHex should follow the system theme
|
* @brief Sets if ImHex should follow the system theme
|
||||||
|
@ -274,6 +274,8 @@ namespace ImGuiExt {
|
|||||||
void BeginSubWindow(const char *label, ImVec2 size = ImVec2(0, 0), ImGuiChildFlags flags = ImGuiChildFlags_None);
|
void BeginSubWindow(const char *label, ImVec2 size = ImVec2(0, 0), ImGuiChildFlags flags = ImGuiChildFlags_None);
|
||||||
void EndSubWindow();
|
void EndSubWindow();
|
||||||
|
|
||||||
|
void ConfirmButtons(const char *textLeft, const char *textRight, const std::function<void()> &leftButtonCallback, const std::function<void()> &rightButtonCallback);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr ImGuiDataType getImGuiDataType() {
|
constexpr ImGuiDataType getImGuiDataType() {
|
||||||
if constexpr (std::same_as<T, u8>) return ImGuiDataType_U8;
|
if constexpr (std::same_as<T, u8>) return ImGuiDataType_U8;
|
||||||
|
@ -18,25 +18,72 @@
|
|||||||
|
|
||||||
#include <hex/api/localization.hpp>
|
#include <hex/api/localization.hpp>
|
||||||
|
|
||||||
#include <functional>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
class View {
|
class View {
|
||||||
public:
|
|
||||||
explicit View(std::string unlocalizedName);
|
explicit View(std::string unlocalizedName);
|
||||||
|
public:
|
||||||
virtual ~View() = default;
|
virtual ~View() = default;
|
||||||
|
|
||||||
virtual void drawContent() = 0;
|
/**
|
||||||
virtual void drawAlwaysVisible() { }
|
* @brief Draws the view
|
||||||
[[nodiscard]] virtual bool isAvailable() const;
|
* @note Do not override this method. Override drawContent() instead
|
||||||
[[nodiscard]] virtual bool shouldProcess() const { return this->isAvailable() && this->getWindowOpenState(); }
|
*/
|
||||||
|
virtual void draw() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Draws the content of the view
|
||||||
|
*/
|
||||||
|
virtual void drawContent() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Draws content that should always be visible, even if the view is not open
|
||||||
|
*/
|
||||||
|
virtual void drawAlwaysVisibleContent() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Whether or not the view window should be drawn
|
||||||
|
* @return True if the view window should be drawn, false otherwise
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool shouldDraw() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Whether or not the entire view should be processed
|
||||||
|
* If this returns false, the view will not be drawn and no shortcuts will be handled. This includes things
|
||||||
|
* drawn in the drawAlwaysVisibleContent() function.
|
||||||
|
* @return True if the view should be processed, false otherwise
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool shouldProcess() const { return true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Whether or not the view should have an entry in the view menu
|
||||||
|
* @return True if the view should have an entry in the view menu, false otherwise
|
||||||
|
*/
|
||||||
[[nodiscard]] virtual bool hasViewMenuItemEntry() const;
|
[[nodiscard]] virtual bool hasViewMenuItemEntry() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the minimum size of the view window
|
||||||
|
* @return The minimum size of the view window
|
||||||
|
*/
|
||||||
[[nodiscard]] virtual ImVec2 getMinSize() const;
|
[[nodiscard]] virtual ImVec2 getMinSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the maximum size of the view window
|
||||||
|
* @return The maximum size of the view window
|
||||||
|
*/
|
||||||
[[nodiscard]] virtual ImVec2 getMaxSize() const;
|
[[nodiscard]] virtual ImVec2 getMaxSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets additional window flags for the view window
|
||||||
|
* @return Additional window flags for the view window
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual ImGuiWindowFlags getWindowFlags() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[nodiscard]] bool &getWindowOpenState();
|
[[nodiscard]] bool &getWindowOpenState();
|
||||||
[[nodiscard]] const bool &getWindowOpenState() const;
|
[[nodiscard]] const bool &getWindowOpenState() const;
|
||||||
|
|
||||||
@ -46,18 +93,15 @@ namespace hex {
|
|||||||
[[nodiscard]] bool didWindowJustOpen();
|
[[nodiscard]] bool didWindowJustOpen();
|
||||||
void setWindowJustOpened(bool state);
|
void setWindowJustOpened(bool state);
|
||||||
|
|
||||||
static void confirmButtons(const std::string &textLeft, const std::string &textRight, const std::function<void()> &leftButtonFn, const std::function<void()> &rightButtonFn);
|
|
||||||
static void discardNavigationRequests();
|
static void discardNavigationRequests();
|
||||||
|
|
||||||
static std::string toWindowName(const std::string &unlocalizedName) {
|
[[nodiscard]] static std::string toWindowName(const std::string &unlocalizedName);
|
||||||
return LangEntry(unlocalizedName) + "###" + unlocalizedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ImFontAtlas *getFontAtlas();
|
public:
|
||||||
static void setFontAtlas(ImFontAtlas *atlas);
|
class Window;
|
||||||
|
class Special;
|
||||||
static ImFontConfig getFontConfig();
|
class Floating;
|
||||||
static void setFontConfig(ImFontConfig config);
|
class Modal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_unlocalizedViewName;
|
std::string m_unlocalizedViewName;
|
||||||
@ -68,4 +112,68 @@ namespace hex {
|
|||||||
friend class ShortcutManager;
|
friend class ShortcutManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A view that draws a regular window. This should be the default for most views
|
||||||
|
*/
|
||||||
|
class View::Window : public View {
|
||||||
|
public:
|
||||||
|
explicit Window(std::string unlocalizedName) : View(std::move(unlocalizedName)) {}
|
||||||
|
|
||||||
|
void draw() final {
|
||||||
|
if (this->shouldDraw()) {
|
||||||
|
ImGui::SetNextWindowSizeConstraints(this->getMinSize(), this->getMaxSize());
|
||||||
|
|
||||||
|
if (ImGui::Begin(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | this->getWindowFlags())) {
|
||||||
|
this->drawContent();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A view that doesn't handle any window creation and just draws its content.
|
||||||
|
* This should be used if you intend to draw your own special window
|
||||||
|
*/
|
||||||
|
class View::Special : public View {
|
||||||
|
public:
|
||||||
|
explicit Special(std::string unlocalizedName) : View(std::move(unlocalizedName)) {}
|
||||||
|
|
||||||
|
void draw() final {
|
||||||
|
if (this->shouldDraw()) {
|
||||||
|
this->drawContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A view that draws a floating window. These are the same as regular windows but cannot be docked
|
||||||
|
*/
|
||||||
|
class View::Floating : public View::Window {
|
||||||
|
public:
|
||||||
|
explicit Floating(std::string unlocalizedName) : Window(std::move(unlocalizedName)) {}
|
||||||
|
|
||||||
|
[[nodiscard]] ImGuiWindowFlags getWindowFlags() const final { return ImGuiWindowFlags_NoDocking; }
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A view that draws a modal window. The window will always be drawn on top and will block input to other windows
|
||||||
|
*/
|
||||||
|
class View::Modal : public View {
|
||||||
|
public:
|
||||||
|
explicit Modal(std::string unlocalizedName) : View(std::move(unlocalizedName)) {}
|
||||||
|
|
||||||
|
void draw() final {
|
||||||
|
if (this->shouldDraw()) {
|
||||||
|
ImGui::SetNextWindowSizeConstraints(this->getMinSize(), this->getMaxSize());
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | this->getWindowFlags())) {
|
||||||
|
this->drawContent();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -421,6 +421,12 @@ namespace hex {
|
|||||||
s_fontSize = size;
|
s_fontSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ImFontAtlas *s_fontAtlas;
|
||||||
|
void setFontAtlas(ImFontAtlas* fontAtlas) {
|
||||||
|
s_fontAtlas = fontAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static std::string s_gpuVendor;
|
static std::string s_gpuVendor;
|
||||||
void setGPUVendor(const std::string &vendor) {
|
void setGPUVendor(const std::string &vendor) {
|
||||||
s_gpuVendor = vendor;
|
s_gpuVendor = vendor;
|
||||||
@ -508,6 +514,11 @@ namespace hex {
|
|||||||
return impl::s_fontSize;
|
return impl::s_fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImFontAtlas* getFontAtlas() {
|
||||||
|
return impl::s_fontAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool s_systemThemeDetection;
|
static bool s_systemThemeDetection;
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ namespace hex {
|
|||||||
return vector * ImHexApi::System::getGlobalScale();
|
return vector * ImHexApi::System::getGlobalScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImVec2 scaled(float x, float y) {
|
||||||
|
return ImVec2(x, y) * ImHexApi::System::getGlobalScale();
|
||||||
|
}
|
||||||
|
|
||||||
std::string to_string(u128 value) {
|
std::string to_string(u128 value) {
|
||||||
char data[45] = { 0 };
|
char data[45] = { 0 };
|
||||||
|
|
||||||
|
@ -917,6 +917,17 @@ namespace ImGuiExt {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfirmButtons(const char *textLeft, const char *textRight, const std::function<void()> &leftButtonCallback, const std::function<void()> &rightButtonCallback) {
|
||||||
|
auto width = ImGui::GetWindowWidth();
|
||||||
|
ImGui::SetCursorPosX(width / 9);
|
||||||
|
if (ImGui::Button(textLeft, ImVec2(width / 3, 0)))
|
||||||
|
leftButtonCallback();
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetCursorPosX(width / 9 * 5);
|
||||||
|
if (ImGui::Button(textRight, ImVec2(width / 3, 0)))
|
||||||
|
rightButtonCallback();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ImGui {
|
namespace ImGui {
|
||||||
|
@ -7,16 +7,9 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
ImFontAtlas *s_fontAtlas;
|
|
||||||
ImFontConfig s_fontConfig;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
View::View(std::string unlocalizedName) : m_unlocalizedViewName(std::move(unlocalizedName)) { }
|
View::View(std::string unlocalizedName) : m_unlocalizedViewName(std::move(unlocalizedName)) { }
|
||||||
|
|
||||||
bool View::isAvailable() const {
|
bool View::shouldDraw() const {
|
||||||
return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->isAvailable();
|
return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->isAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +18,18 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 View::getMinSize() const {
|
ImVec2 View::getMinSize() const {
|
||||||
return scaled(ImVec2(300, 400));
|
return scaled({ 300, 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 View::getMaxSize() const {
|
ImVec2 View::getMaxSize() const {
|
||||||
return { FLT_MAX, FLT_MAX };
|
return { FLT_MAX, FLT_MAX };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiWindowFlags View::getWindowFlags() const {
|
||||||
|
return ImGuiWindowFlags_None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool &View::getWindowOpenState() {
|
bool &View::getWindowOpenState() {
|
||||||
return this->m_windowOpen;
|
return this->m_windowOpen;
|
||||||
@ -50,11 +48,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool View::didWindowJustOpen() {
|
bool View::didWindowJustOpen() {
|
||||||
bool result = this->m_windowJustOpened;
|
return std::exchange(this->m_windowJustOpened, false);
|
||||||
|
|
||||||
this->m_windowJustOpened = false;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::setWindowJustOpened(bool state) {
|
void View::setWindowJustOpened(bool state) {
|
||||||
@ -66,21 +60,8 @@ namespace hex {
|
|||||||
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NavEnableKeyboard;
|
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::confirmButtons(const std::string &textLeft, const std::string &textRight, const std::function<void()> &leftButtonFn, const std::function<void()> &rightButtonFn) {
|
std::string View::toWindowName(const std::string &unlocalizedName) {
|
||||||
auto width = ImGui::GetWindowWidth();
|
return LangEntry(unlocalizedName) + "###" + unlocalizedName;
|
||||||
ImGui::SetCursorPosX(width / 9);
|
|
||||||
if (ImGui::Button(textLeft.c_str(), ImVec2(width / 3, 0)))
|
|
||||||
leftButtonFn();
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::SetCursorPosX(width / 9 * 5);
|
|
||||||
if (ImGui::Button(textRight.c_str(), ImVec2(width / 3, 0)))
|
|
||||||
rightButtonFn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFontAtlas *View::getFontAtlas() { return s_fontAtlas; }
|
|
||||||
void View::setFontAtlas(ImFontAtlas *atlas) { s_fontAtlas = atlas; }
|
|
||||||
|
|
||||||
ImFontConfig View::getFontConfig() { return s_fontConfig; }
|
|
||||||
void View::setFontConfig(ImFontConfig config) { s_fontConfig = std::move(config); }
|
|
||||||
|
|
||||||
}
|
}
|
@ -325,8 +325,7 @@ namespace hex::init {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure ImGui to use the font atlas
|
// Configure ImGui to use the font atlas
|
||||||
View::setFontAtlas(fonts);
|
ImHexApi::System::impl::setFontAtlas(fonts);
|
||||||
View::setFontConfig(cfg);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -810,17 +810,14 @@ namespace hex {
|
|||||||
ImGui::GetCurrentContext()->NextWindowData.ClearFlags();
|
ImGui::GetCurrentContext()->NextWindowData.ClearFlags();
|
||||||
|
|
||||||
// Draw always visible views
|
// Draw always visible views
|
||||||
view->drawAlwaysVisible();
|
view->drawAlwaysVisibleContent();
|
||||||
|
|
||||||
// Skip views that shouldn't be processed currently
|
// Skip views that shouldn't be processed currently
|
||||||
if (!view->shouldProcess())
|
if (!view->shouldProcess())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw view
|
// Draw view
|
||||||
if (view->isAvailable()) {
|
view->draw();
|
||||||
ImGui::SetNextWindowSizeConstraints(view->getMinSize(), view->getMaxSize());
|
|
||||||
view->drawContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (view->getWindowOpenState()) {
|
if (view->getWindowOpenState()) {
|
||||||
auto window = ImGui::FindWindowByName(view->getName().c_str());
|
auto window = ImGui::FindWindowByName(view->getName().c_str());
|
||||||
@ -1137,7 +1134,7 @@ namespace hex {
|
|||||||
void Window::initImGui() {
|
void Window::initImGui() {
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
|
|
||||||
auto fonts = View::getFontAtlas();
|
auto fonts = ImHexApi::System::getFontAtlas();
|
||||||
|
|
||||||
// Initialize ImGui and all other ImGui extensions
|
// Initialize ImGui and all other ImGui extensions
|
||||||
GImGui = ImGui::CreateContext(fonts);
|
GImGui = ImGui::CreateContext(fonts);
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewAbout : public View {
|
class ViewAbout : public View::Modal {
|
||||||
public:
|
public:
|
||||||
ViewAbout();
|
ViewAbout();
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return true; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMinSize() const override {
|
[[nodiscard]] ImVec2 getMinSize() const override {
|
||||||
@ -22,8 +22,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_aboutWindowOpen = false;
|
|
||||||
|
|
||||||
void drawAboutPopup();
|
void drawAboutPopup();
|
||||||
|
|
||||||
void drawAboutMainPage();
|
void drawAboutMainPage();
|
||||||
|
@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewAchievements : public View {
|
class ViewAchievements : public View::Floating {
|
||||||
public:
|
public:
|
||||||
ViewAchievements();
|
ViewAchievements();
|
||||||
~ViewAchievements() override;
|
~ViewAchievements() override;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
void drawAlwaysVisible() override;
|
void drawAlwaysVisibleContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return true; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMinSize() const override {
|
[[nodiscard]] ImVec2 getMinSize() const override {
|
||||||
@ -28,8 +28,6 @@ namespace hex::plugin::builtin {
|
|||||||
ImVec2 drawAchievementTree(ImDrawList *drawList, const AchievementManager::AchievementNode * prevNode, const std::vector<AchievementManager::AchievementNode*> &nodes, ImVec2 position);
|
ImVec2 drawAchievementTree(ImDrawList *drawList, const AchievementManager::AchievementNode * prevNode, const std::vector<AchievementManager::AchievementNode*> &nodes, ImVec2 position);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_viewOpen = false;
|
|
||||||
|
|
||||||
std::list<const Achievement*> m_achievementUnlockQueue;
|
std::list<const Achievement*> m_achievementUnlockQueue;
|
||||||
const Achievement *m_currAchievement = nullptr;
|
const Achievement *m_currAchievement = nullptr;
|
||||||
const Achievement *m_achievementToGoto = nullptr;
|
const Achievement *m_achievementToGoto = nullptr;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewBookmarks : public View {
|
class ViewBookmarks : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewBookmarks();
|
ViewBookmarks();
|
||||||
~ViewBookmarks() override;
|
~ViewBookmarks() override;
|
||||||
|
@ -8,14 +8,15 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewCommandPalette : public View {
|
class ViewCommandPalette : public View::Special {
|
||||||
public:
|
public:
|
||||||
ViewCommandPalette();
|
ViewCommandPalette();
|
||||||
~ViewCommandPalette() override = default;
|
~ViewCommandPalette() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override {}
|
||||||
|
void drawAlwaysVisibleContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return false; }
|
||||||
[[nodiscard]] bool shouldProcess() const override { return true; }
|
[[nodiscard]] bool shouldProcess() const override { return true; }
|
||||||
|
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
@ -20,21 +20,13 @@ namespace hex::plugin::builtin {
|
|||||||
std::string value;
|
std::string value;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ViewConstants : public View {
|
class ViewConstants : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewConstants();
|
explicit ViewConstants();
|
||||||
~ViewConstants() override = default;
|
~ViewConstants() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
|
||||||
ImVec2 getMinSize() const override {
|
|
||||||
return scaled(ImVec2(300, 400));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImVec2 getMaxSize() const override {
|
|
||||||
return { FLT_MAX, 800_scaled };
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reloadConstants();
|
void reloadConstants();
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewDataInspector : public View {
|
class ViewDataInspector : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewDataInspector();
|
explicit ViewDataInspector();
|
||||||
~ViewDataInspector() override;
|
~ViewDataInspector() override;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewDataProcessor : public View {
|
class ViewDataProcessor : public View::Window {
|
||||||
public:
|
public:
|
||||||
struct Workspace {
|
struct Workspace {
|
||||||
Workspace() = default;
|
Workspace() = default;
|
||||||
|
@ -12,12 +12,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewDiff : public View {
|
class ViewDiff : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewDiff();
|
ViewDiff();
|
||||||
~ViewDiff() override;
|
~ViewDiff() override;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Column {
|
struct Column {
|
||||||
|
@ -21,7 +21,7 @@ namespace hex::plugin::builtin {
|
|||||||
std::string operators;
|
std::string operators;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ViewDisassembler : public View {
|
class ViewDisassembler : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewDisassembler();
|
explicit ViewDisassembler();
|
||||||
~ViewDisassembler() override;
|
~ViewDisassembler() override;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewFind : public View {
|
class ViewFind : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewFind();
|
ViewFind();
|
||||||
~ViewFind() override = default;
|
~ViewFind() override = default;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewHashes : public View {
|
class ViewHashes : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewHashes();
|
explicit ViewHashes();
|
||||||
~ViewHashes() override;
|
~ViewHashes() override;
|
||||||
|
@ -9,12 +9,15 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewHexEditor : public View {
|
class ViewHexEditor : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewHexEditor();
|
ViewHexEditor();
|
||||||
~ViewHexEditor() override;
|
~ViewHexEditor() override;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
[[nodiscard]] ImGuiWindowFlags getWindowFlags() const override {
|
||||||
|
return ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
|
||||||
|
}
|
||||||
|
|
||||||
class Popup {
|
class Popup {
|
||||||
public:
|
public:
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewInformation : public View {
|
class ViewInformation : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewInformation();
|
explicit ViewInformation();
|
||||||
~ViewInformation() override;
|
~ViewInformation() override;
|
||||||
|
@ -4,19 +4,18 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewLogs : public View {
|
class ViewLogs : public View::Floating {
|
||||||
public:
|
public:
|
||||||
ViewLogs();
|
ViewLogs();
|
||||||
~ViewLogs() override = default;
|
~ViewLogs() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return true; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_logLevel = 1;
|
int m_logLevel = 1;
|
||||||
bool m_viewOpen = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewPatches : public View {
|
class ViewPatches : public View::Window {
|
||||||
public:
|
public:
|
||||||
explicit ViewPatches();
|
explicit ViewPatches();
|
||||||
~ViewPatches() override = default;
|
~ViewPatches() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
void drawAlwaysVisible() override;
|
void drawAlwaysVisibleContent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u64 m_selectedPatch = 0x00;
|
u64 m_selectedPatch = 0x00;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewPatternData : public View {
|
class ViewPatternData : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewPatternData();
|
ViewPatternData();
|
||||||
~ViewPatternData() override;
|
~ViewPatternData() override;
|
||||||
|
@ -24,13 +24,16 @@ namespace pl::ptrn { class Pattern; }
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewPatternEditor : public View {
|
class ViewPatternEditor : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewPatternEditor();
|
ViewPatternEditor();
|
||||||
~ViewPatternEditor() override;
|
~ViewPatternEditor() override;
|
||||||
|
|
||||||
void drawAlwaysVisible() override;
|
void drawAlwaysVisibleContent() override;
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
[[nodiscard]] ImGuiWindowFlags getWindowFlags() const override {
|
||||||
|
return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class DangerousFunctionPerms : u8 {
|
enum class DangerousFunctionPerms : u8 {
|
||||||
@ -79,7 +82,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang);
|
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang);
|
||||||
|
|
||||||
confirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang,
|
||||||
[this, provider] {
|
[this, provider] {
|
||||||
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles.get(provider)[this->m_selectedPatternFile], provider);
|
this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles.get(provider)[this->m_selectedPatternFile], provider);
|
||||||
this->close();
|
this->close();
|
||||||
|
@ -4,17 +4,16 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewProviderSettings : public hex::View {
|
class ViewProviderSettings : public View::Modal {
|
||||||
public:
|
public:
|
||||||
ViewProviderSettings();
|
ViewProviderSettings();
|
||||||
~ViewProviderSettings() override;
|
~ViewProviderSettings() override;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
void drawAlwaysVisible() override;
|
|
||||||
|
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override;
|
[[nodiscard]] bool hasViewMenuItemEntry() const override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override;
|
[[nodiscard]] bool shouldDraw() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -4,14 +4,15 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewSettings : public View {
|
class ViewSettings : public View::Floating {
|
||||||
public:
|
public:
|
||||||
explicit ViewSettings();
|
explicit ViewSettings();
|
||||||
~ViewSettings() override;
|
~ViewSettings() override;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override {}
|
||||||
|
void drawAlwaysVisibleContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return false; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 700, 400 }); }
|
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 700, 400 }); }
|
||||||
|
@ -44,14 +44,14 @@ namespace hex::plugin::builtin {
|
|||||||
std::function<void()> downloadCallback;
|
std::function<void()> downloadCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ViewStore : public View {
|
class ViewStore : public View::Floating {
|
||||||
public:
|
public:
|
||||||
ViewStore();
|
ViewStore();
|
||||||
~ViewStore() override = default;
|
~ViewStore() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return false; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 600, 400 }); }
|
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 600, 400 }); }
|
||||||
|
@ -6,19 +6,18 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewThemeManager : public View {
|
class ViewThemeManager : public View::Floating {
|
||||||
public:
|
public:
|
||||||
ViewThemeManager();
|
ViewThemeManager();
|
||||||
~ViewThemeManager() override = default;
|
~ViewThemeManager() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
|
|
||||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
[[nodiscard]] bool shouldDraw() const override { return true; }
|
||||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_themeName;
|
std::string m_themeName;
|
||||||
bool m_viewOpen = false;
|
|
||||||
|
|
||||||
std::optional<ImColor> m_startingColor;
|
std::optional<ImColor> m_startingColor;
|
||||||
std::optional<u32> m_hoveredColorId;
|
std::optional<u32> m_hoveredColorId;
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewTools : public View {
|
class ViewTools : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewTools();
|
ViewTools();
|
||||||
~ViewTools() override = default;
|
~ViewTools() override = default;
|
||||||
|
|
||||||
void drawContent() override;
|
void drawContent() override;
|
||||||
void drawAlwaysVisible() override;
|
void drawAlwaysVisibleContent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ContentRegistry::Tools::impl::Entry>::iterator m_dragStartIterator;
|
std::vector<ContentRegistry::Tools::impl::Entry>::iterator m_dragStartIterator;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
class ViewYara : public View {
|
class ViewYara : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewYara();
|
ViewYara();
|
||||||
~ViewYara() override;
|
~ViewYara() override;
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewAbout::ViewAbout() : View("hex.builtin.view.help.about.name") {
|
ViewAbout::ViewAbout() : View::Modal("hex.builtin.view.help.about.name") {
|
||||||
|
|
||||||
// Add "About" menu item to the help menu
|
// Add "About" menu item to the help menu
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.about.name" }, 1000, Shortcut::None, [this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.about.name" }, 1000, Shortcut::None, [this] {
|
||||||
TaskManager::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.help.about.name").c_str()); });
|
TaskManager::doLater([this] { ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str()); });
|
||||||
this->m_aboutWindowOpen = true;
|
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -481,8 +480,6 @@ namespace hex::plugin::builtin {
|
|||||||
Tab { "hex.builtin.view.help.about.license", &ViewAbout::drawLicensePage },
|
Tab { "hex.builtin.view.help.about.license", &ViewAbout::drawLicensePage },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.help.about.name").c_str(), &this->m_aboutWindowOpen)) {
|
|
||||||
|
|
||||||
// Allow the window to be closed by pressing ESC
|
// Allow the window to be closed by pressing ESC
|
||||||
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
@ -504,15 +501,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewAbout::drawContent() {
|
void ViewAbout::drawContent() {
|
||||||
if (!this->m_aboutWindowOpen)
|
|
||||||
this->getWindowOpenState() = false;
|
|
||||||
|
|
||||||
this->drawAboutPopup();
|
this->drawAboutPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewAchievements::ViewAchievements() : View("hex.builtin.view.achievements.name") {
|
ViewAchievements::ViewAchievements() : View::Floating("hex.builtin.view.achievements.name") {
|
||||||
// Add achievements menu item to Extas menu
|
// Add achievements menu item to Extas menu
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.achievements.name" }, 2600, Shortcut::None, [&, this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.achievements.name" }, 2600, Shortcut::None, [&, this] {
|
||||||
this->m_viewOpen = true;
|
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ namespace hex::plugin::builtin {
|
|||||||
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
|
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
|
||||||
if (name == "Achievements") {
|
if (name == "Achievements") {
|
||||||
TaskManager::doLater([this] {
|
TaskManager::doLater([this] {
|
||||||
this->m_viewOpen = true;
|
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -302,7 +300,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewAchievements::drawContent() {
|
void ViewAchievements::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.achievements.name").c_str(), &this->m_viewOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking)) {
|
|
||||||
if (ImGui::BeginTabBar("##achievement_categories")) {
|
if (ImGui::BeginTabBar("##achievement_categories")) {
|
||||||
auto &startNodes = AchievementManager::getAchievementStartNodes();
|
auto &startNodes = AchievementManager::getAchievementStartNodes();
|
||||||
|
|
||||||
@ -400,15 +397,11 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
this->getWindowOpenState() = this->m_viewOpen;
|
|
||||||
|
|
||||||
this->m_achievementToGoto = nullptr;
|
this->m_achievementToGoto = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewAchievements::drawAlwaysVisible() {
|
void ViewAchievements::drawAlwaysVisibleContent() {
|
||||||
|
|
||||||
// Handle showing the achievement unlock popup
|
// Handle showing the achievement unlock popup
|
||||||
if (this->m_achievementUnlockQueueTimer >= 0 && this->m_showPopup) {
|
if (this->m_achievementUnlockQueueTimer >= 0 && this->m_showPopup) {
|
||||||
@ -439,8 +432,7 @@ namespace hex::plugin::builtin {
|
|||||||
// Handle clicking on the popup
|
// Handle clicking on the popup
|
||||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
|
if (ImGui::IsWindowHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
|
||||||
// Open the achievement window and jump to the achievement
|
// Open the achievement window and jump to the achievement
|
||||||
this->m_viewOpen = true;
|
this->getWindowOpenState() = true;
|
||||||
this->getWindowOpenState() = this->m_viewOpen;
|
|
||||||
this->m_achievementToGoto = this->m_currAchievement;
|
this->m_achievementToGoto = this->m_currAchievement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewBookmarks::ViewBookmarks() : View("hex.builtin.view.bookmarks.name") {
|
ViewBookmarks::ViewBookmarks() : View::Window("hex.builtin.view.bookmarks.name") {
|
||||||
|
|
||||||
// Handle bookmark add requests sent by the API
|
// Handle bookmark add requests sent by the API
|
||||||
EventManager::subscribe<RequestAddBookmark>(this, [this](Region region, std::string name, std::string comment, color_t color) {
|
EventManager::subscribe<RequestAddBookmark>(this, [this](Region region, std::string name, std::string comment, color_t color) {
|
||||||
@ -201,7 +201,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewBookmarks::drawContent() {
|
void ViewBookmarks::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.bookmarks.name").c_str(), &this->getWindowOpenState())) {
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
// Draw filter input
|
// Draw filter input
|
||||||
@ -387,8 +386,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ViewBookmarks::importBookmarks(prv::Provider *provider, const nlohmann::json &json) {
|
bool ViewBookmarks::importBookmarks(prv::Provider *provider, const nlohmann::json &json) {
|
||||||
if (!json.contains("bookmarks"))
|
if (!json.contains("bookmarks"))
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewCommandPalette::ViewCommandPalette() : View("hex.builtin.view.command_palette.name") {
|
ViewCommandPalette::ViewCommandPalette() : View::Special("hex.builtin.view.command_palette.name") {
|
||||||
// Add global shortcut to open the command palette
|
// Add global shortcut to open the command palette
|
||||||
ShortcutManager::addGlobalShortcut(CTRLCMD + SHIFT + Keys::P, "hex.builtin.view.command_palette.name", [this] {
|
ShortcutManager::addGlobalShortcut(CTRLCMD + SHIFT + Keys::P, "hex.builtin.view.command_palette.name", [this] {
|
||||||
EventManager::post<RequestOpenPopup>("hex.builtin.view.command_palette.name"_lang);
|
EventManager::post<RequestOpenPopup>("hex.builtin.view.command_palette.name"_lang);
|
||||||
@ -20,7 +20,7 @@ namespace hex::plugin::builtin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewCommandPalette::drawContent() {
|
void ViewCommandPalette::drawAlwaysVisibleContent() {
|
||||||
// If the command palette is hidden, don't draw it
|
// If the command palette is hidden, don't draw it
|
||||||
if (!this->m_commandPaletteOpen) return;
|
if (!this->m_commandPaletteOpen) return;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewConstants::ViewConstants() : View("hex.builtin.view.constants.name") {
|
ViewConstants::ViewConstants() : View::Window("hex.builtin.view.constants.name") {
|
||||||
this->reloadConstants();
|
this->reloadConstants();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +63,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewConstants::drawContent() {
|
void ViewConstants::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.constants.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
|
|
||||||
ImGui::PushItemWidth(-1);
|
ImGui::PushItemWidth(-1);
|
||||||
|
|
||||||
if (ImGuiExt::InputTextIcon("##search", ICON_VS_FILTER, this->m_filter)) {
|
if (ImGuiExt::InputTextIcon("##search", ICON_VS_FILTER, this->m_filter)) {
|
||||||
@ -148,7 +146,5 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle;
|
using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle;
|
||||||
|
|
||||||
ViewDataInspector::ViewDataInspector() : View("hex.builtin.view.data_inspector.name") {
|
ViewDataInspector::ViewDataInspector() : View::Window("hex.builtin.view.data_inspector.name") {
|
||||||
// Handle region selection
|
// Handle region selection
|
||||||
EventManager::subscribe<EventRegionSelected>(this, [this](const auto ®ion) {
|
EventManager::subscribe<EventRegionSelected>(this, [this](const auto ®ion) {
|
||||||
|
|
||||||
@ -208,7 +208,6 @@ namespace hex::plugin::builtin {
|
|||||||
this->updateInspectorRows();
|
this->updateInspectorRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.data_inspector.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
if (this->m_selectedProvider != nullptr && this->m_selectedProvider->isReadable() && this->m_validBytes > 0) {
|
if (this->m_selectedProvider != nullptr && this->m_selectedProvider->isReadable() && this->m_validBytes > 0) {
|
||||||
u32 validLineCount = this->m_cachedData.size();
|
u32 validLineCount = this->m_cachedData.size();
|
||||||
if (!this->m_tableEditingModeEnabled) {
|
if (!this->m_tableEditingModeEnabled) {
|
||||||
@ -406,7 +405,5 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::TextUnformatted(text.c_str());
|
ImGui::TextUnformatted(text.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -347,7 +347,7 @@ namespace hex::plugin::builtin {
|
|||||||
ViewDataProcessor::Workspace m_workspace;
|
ViewDataProcessor::Workspace m_workspace;
|
||||||
};
|
};
|
||||||
|
|
||||||
ViewDataProcessor::ViewDataProcessor() : View("hex.builtin.view.data_processor.name") {
|
ViewDataProcessor::ViewDataProcessor() : View::Window("hex.builtin.view.data_processor.name") {
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCustom>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.custom", this);
|
ContentRegistry::DataProcessorNode::add<NodeCustom>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.custom", this);
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCustomInput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.input");
|
ContentRegistry::DataProcessorNode::add<NodeCustomInput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.input");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCustomOutput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.output");
|
ContentRegistry::DataProcessorNode::add<NodeCustomOutput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.output");
|
||||||
@ -842,7 +842,6 @@ namespace hex::plugin::builtin {
|
|||||||
auto &workspace = *this->m_workspaceStack->back();
|
auto &workspace = *this->m_workspaceStack->back();
|
||||||
|
|
||||||
bool popWorkspace = false;
|
bool popWorkspace = false;
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.data_processor.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
// Set the ImNodes context to the current workspace context
|
// Set the ImNodes context to the current workspace context
|
||||||
ImNodes::SetCurrentContext(workspace.context.get());
|
ImNodes::SetCurrentContext(workspace.context.get());
|
||||||
|
|
||||||
@ -1014,8 +1013,6 @@ namespace hex::plugin::builtin {
|
|||||||
this->eraseNodes(workspace, selectedNodes);
|
this->eraseNodes(workspace, selectedNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
// Remove the top-most workspace from the stack if requested
|
// Remove the top-most workspace from the stack if requested
|
||||||
if (popWorkspace) {
|
if (popWorkspace) {
|
||||||
|
@ -15,7 +15,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewDiff::ViewDiff() : View("hex.builtin.view.diff.name") {
|
ViewDiff::ViewDiff() : View::Window("hex.builtin.view.diff.name") {
|
||||||
|
|
||||||
// Clear the selected diff providers when a provider is closed
|
// Clear the selected diff providers when a provider is closed
|
||||||
EventManager::subscribe<EventProviderClosed>(this, [this](prv::Provider *) {
|
EventManager::subscribe<EventProviderClosed>(this, [this](prv::Provider *) {
|
||||||
@ -183,8 +183,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewDiff::drawContent() {
|
void ViewDiff::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.diff.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
|
||||||
|
|
||||||
auto &[a, b] = this->m_columns;
|
auto &[a, b] = this->m_columns;
|
||||||
|
|
||||||
a.hexEditor.enableSyncScrolling(false);
|
a.hexEditor.enableSyncScrolling(false);
|
||||||
@ -321,9 +319,6 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ using namespace std::literals::string_literals;
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewDisassembler::ViewDisassembler() : View("hex.builtin.view.disassembler.name") {
|
ViewDisassembler::ViewDisassembler() : View::Window("hex.builtin.view.disassembler.name") {
|
||||||
EventManager::subscribe<EventProviderDeleted>(this, [this](const auto*) {
|
EventManager::subscribe<EventProviderDeleted>(this, [this](const auto*) {
|
||||||
this->m_disassembly.clear();
|
this->m_disassembly.clear();
|
||||||
});
|
});
|
||||||
@ -91,9 +91,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewDisassembler::drawContent() {
|
void ViewDisassembler::drawContent() {
|
||||||
|
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.disassembler.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
||||||
ImGuiExt::Header("hex.builtin.view.disassembler.position"_lang, true);
|
ImGuiExt::Header("hex.builtin.view.disassembler.position"_lang, true);
|
||||||
@ -450,7 +447,5 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewFind::ViewFind() : View("hex.builtin.view.find.name") {
|
ViewFind::ViewFind() : View::Window("hex.builtin.view.find.name") {
|
||||||
const static auto HighlightColor = [] { return (ImGuiExt::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> {
|
ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8* data, size_t size, bool) -> std::optional<color_t> {
|
||||||
@ -599,7 +599,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewFind::drawContent() {
|
void ViewFind::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.find.name").c_str(), &this->getWindowOpenState())) {
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
ImGui::BeginDisabled(this->m_searchTask.isRunning());
|
ImGui::BeginDisabled(this->m_searchTask.isRunning());
|
||||||
@ -937,9 +936,6 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,21 +42,13 @@ namespace hex::plugin::builtin {
|
|||||||
return ImGuiWindowFlags_AlwaysAutoResize;
|
return ImGuiWindowFlags_AlwaysAutoResize;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMinSize() const override {
|
|
||||||
return scaled({ 400, 100 });
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] ImVec2 getMaxSize() const override {
|
|
||||||
return scaled({ 600, 300 });
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_input;
|
std::string m_input;
|
||||||
std::string m_result;
|
std::string m_result;
|
||||||
ContentRegistry::Hashes::Hash::Function m_hash;
|
ContentRegistry::Hashes::Hash::Function m_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
ViewHashes::ViewHashes() : View("hex.builtin.view.hashes.name") {
|
ViewHashes::ViewHashes() : View::Window("hex.builtin.view.hashes.name") {
|
||||||
EventManager::subscribe<EventRegionSelected>(this, [this](const auto &providerRegion) {
|
EventManager::subscribe<EventRegionSelected>(this, [this](const auto &providerRegion) {
|
||||||
for (auto &function : this->m_hashFunctions.get(providerRegion.getProvider()))
|
for (auto &function : this->m_hashFunctions.get(providerRegion.getProvider()))
|
||||||
function.reset();
|
function.reset();
|
||||||
@ -143,7 +135,6 @@ namespace hex::plugin::builtin {
|
|||||||
this->m_selectedHash = hashes.front().get();
|
this->m_selectedHash = hashes.front().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.hashes.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
if (ImGui::BeginCombo("hex.builtin.view.hashes.function"_lang, this->m_selectedHash != nullptr ? LangEntry(this->m_selectedHash->getUnlocalizedName()) : "")) {
|
if (ImGui::BeginCombo("hex.builtin.view.hashes.function"_lang, this->m_selectedHash != nullptr ? LangEntry(this->m_selectedHash->getUnlocalizedName()) : "")) {
|
||||||
|
|
||||||
for (const auto &hash : hashes) {
|
for (const auto &hash : hashes) {
|
||||||
@ -248,8 +239,6 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ViewHashes::importHashes(prv::Provider *provider, const nlohmann::json &json) {
|
bool ViewHashes::importHashes(prv::Provider *provider, const nlohmann::json &json) {
|
||||||
if (!json.contains("hashes"))
|
if (!json.contains("hashes"))
|
||||||
|
@ -347,7 +347,7 @@ namespace hex::plugin::builtin {
|
|||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this]{
|
[&, this]{
|
||||||
setBaseAddress(this->m_baseAddress);
|
setBaseAddress(this->m_baseAddress);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -381,7 +381,7 @@ namespace hex::plugin::builtin {
|
|||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this]{
|
[&, this]{
|
||||||
setPageSize(this->m_pageSize);
|
setPageSize(this->m_pageSize);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -419,7 +419,7 @@ namespace hex::plugin::builtin {
|
|||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this]{
|
[&, this]{
|
||||||
this->resize(this->m_size);
|
this->resize(this->m_size);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -449,7 +449,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||||
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||||
|
|
||||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this]{
|
[&, this]{
|
||||||
insert(this->m_address, this->m_size);
|
insert(this->m_address, this->m_size);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -480,7 +480,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
ImGuiExt::InputHexadecimal("hex.builtin.common.address"_lang, &this->m_address);
|
||||||
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
ImGuiExt::InputHexadecimal("hex.builtin.common.size"_lang, &this->m_size);
|
||||||
|
|
||||||
View::confirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this]{
|
[&, this]{
|
||||||
remove(this->m_address, this->m_size);
|
remove(this->m_address, this->m_size);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -515,7 +515,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGuiExt::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,
|
ImGuiExt::ConfirmButtons("hex.builtin.common.set"_lang, "hex.builtin.common.cancel"_lang,
|
||||||
[&, this] {
|
[&, this] {
|
||||||
fill(this->m_address, this->m_size, this->m_input);
|
fill(this->m_address, this->m_size, this->m_input);
|
||||||
editor->closePopup();
|
editor->closePopup();
|
||||||
@ -552,7 +552,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
/* Hex Editor */
|
/* Hex Editor */
|
||||||
|
|
||||||
ViewHexEditor::ViewHexEditor() : View("hex.builtin.view.hex_editor.name") {
|
ViewHexEditor::ViewHexEditor() : View::Window("hex.builtin.view.hex_editor.name") {
|
||||||
this->m_hexEditor.setForegroundHighlightCallback([this](u64 address, const u8 *data, size_t size) -> std::optional<color_t> {
|
this->m_hexEditor.setForegroundHighlightCallback([this](u64 address, const u8 *data, size_t size) -> std::optional<color_t> {
|
||||||
if (auto highlight = this->m_foregroundHighlights->find(address); highlight != this->m_foregroundHighlights->end())
|
if (auto highlight = this->m_foregroundHighlights->find(address); highlight != this->m_foregroundHighlights->end())
|
||||||
return highlight->second;
|
return highlight->second;
|
||||||
@ -675,15 +675,12 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewHexEditor::drawContent() {
|
void ViewHexEditor::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
|
||||||
this->m_hexEditor.setProvider(ImHexApi::Provider::get());
|
this->m_hexEditor.setProvider(ImHexApi::Provider::get());
|
||||||
|
|
||||||
this->m_hexEditor.draw();
|
this->m_hexEditor.draw();
|
||||||
|
|
||||||
this->drawPopup();
|
this->drawPopup();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void save() {
|
static void save() {
|
||||||
ImHexApi::Provider::get()->save();
|
ImHexApi::Provider::get()->save();
|
||||||
|
@ -20,7 +20,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
using namespace hex::literals;
|
using namespace hex::literals;
|
||||||
|
|
||||||
ViewInformation::ViewInformation() : View("hex.builtin.view.information.name") {
|
ViewInformation::ViewInformation() : View::Window("hex.builtin.view.information.name") {
|
||||||
EventManager::subscribe<EventDataChanged>(this, [this] {
|
EventManager::subscribe<EventDataChanged>(this, [this] {
|
||||||
this->m_dataValid = false;
|
this->m_dataValid = false;
|
||||||
this->m_plainTextCharacterPercentage = -1.0;
|
this->m_plainTextCharacterPercentage = -1.0;
|
||||||
@ -136,7 +136,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewInformation::drawContent() {
|
void ViewInformation::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.information.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) {
|
if (ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav)) {
|
||||||
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
@ -361,7 +360,5 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewLogs::ViewLogs() : View("hex.builtin.view.logs.name") {
|
ViewLogs::ViewLogs() : View::Floating("hex.builtin.view.logs.name") {
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.logs.name" }, 2500, Shortcut::None, [&, this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.logs.name" }, 2500, Shortcut::None, [&, this] {
|
||||||
this->m_viewOpen = true;
|
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -41,8 +40,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewLogs::drawContent() {
|
void ViewLogs::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.logs.name").c_str(), &this->m_viewOpen, ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
|
|
||||||
ImGui::Combo("hex.builtin.view.logs.log_level"_lang, &this->m_logLevel, "DEBUG\0INFO\0WARNING\0ERROR\0FATAL\0");
|
ImGui::Combo("hex.builtin.view.logs.log_level"_lang, &this->m_logLevel, "DEBUG\0INFO\0WARNING\0ERROR\0FATAL\0");
|
||||||
|
|
||||||
if (ImGui::BeginTable("##logs", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollY)) {
|
if (ImGui::BeginTable("##logs", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollY)) {
|
||||||
@ -80,9 +77,5 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
this->getWindowOpenState() = this->m_viewOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ using namespace std::literals::string_literals;
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewPatches::ViewPatches() : View("hex.builtin.view.patches.name") {
|
ViewPatches::ViewPatches() : View::Window("hex.builtin.view.patches.name") {
|
||||||
|
|
||||||
ProjectFile::registerPerProviderHandler({
|
ProjectFile::registerPerProviderHandler({
|
||||||
.basePath = "patches.json",
|
.basePath = "patches.json",
|
||||||
@ -54,7 +54,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatches::drawContent() {
|
void ViewPatches::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.patches.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
|
||||||
@ -118,10 +117,8 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewPatches::drawAlwaysVisible() {
|
void ViewPatches::drawAlwaysVisibleContent() {
|
||||||
if (auto provider = ImHexApi::Provider::get(); provider != nullptr) {
|
if (auto provider = ImHexApi::Provider::get(); provider != nullptr) {
|
||||||
const auto &patches = provider->getPatches();
|
const auto &patches = provider->getPatches();
|
||||||
if (this->m_numPatches.get(provider) != patches.size()) {
|
if (this->m_numPatches.get(provider) != patches.size()) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewPatternData::ViewPatternData() : View("hex.builtin.view.pattern_data.name") {
|
ViewPatternData::ViewPatternData() : View::Window("hex.builtin.view.pattern_data.name") {
|
||||||
this->m_patternDrawer = std::make_unique<ui::PatternDrawer>();
|
this->m_patternDrawer = std::make_unique<ui::PatternDrawer>();
|
||||||
|
|
||||||
// Handle tree style setting changes
|
// Handle tree style setting changes
|
||||||
@ -42,7 +42,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatternData::drawContent() {
|
void ViewPatternData::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.pattern_data.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
// Draw the pattern tree if the provider is valid
|
// Draw the pattern tree if the provider is valid
|
||||||
if (ImHexApi::Provider::isValid()) {
|
if (ImHexApi::Provider::isValid()) {
|
||||||
// Make sure the runtime has finished evaluating and produced valid patterns
|
// Make sure the runtime has finished evaluating and produced valid patterns
|
||||||
@ -57,7 +56,5 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ namespace hex::plugin::builtin {
|
|||||||
return langDef;
|
return langDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewPatternEditor::ViewPatternEditor() : View("hex.builtin.view.pattern_editor.name") {
|
ViewPatternEditor::ViewPatternEditor() : View::Window("hex.builtin.view.pattern_editor.name") {
|
||||||
this->m_parserRuntime = std::make_unique<pl::PatternLanguage>();
|
this->m_parserRuntime = std::make_unique<pl::PatternLanguage>();
|
||||||
ContentRegistry::PatternLanguage::configureRuntime(*this->m_parserRuntime, nullptr);
|
ContentRegistry::PatternLanguage::configureRuntime(*this->m_parserRuntime, nullptr);
|
||||||
|
|
||||||
@ -148,7 +148,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatternEditor::drawContent() {
|
void ViewPatternEditor::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.pattern_editor.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
|
if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
|
||||||
@ -343,8 +342,6 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
View::discardNavigationRequests();
|
View::discardNavigationRequests();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewPatternEditor::drawConsole(ImVec2 size) {
|
void ViewPatternEditor::drawConsole(ImVec2 size) {
|
||||||
if (this->m_consoleNeedsUpdate) {
|
if (this->m_consoleNeedsUpdate) {
|
||||||
@ -689,7 +686,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatternEditor::drawAlwaysVisible() {
|
void ViewPatternEditor::drawAlwaysVisibleContent() {
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
|
|
||||||
auto open = this->m_sectionWindowDrawer.contains(provider);
|
auto open = this->m_sectionWindowDrawer.contains(provider);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewProviderSettings::ViewProviderSettings() : hex::View("hex.builtin.view.provider_settings.name") {
|
ViewProviderSettings::ViewProviderSettings() : View::Modal("hex.builtin.view.provider_settings.name") {
|
||||||
EventManager::subscribe<EventProviderCreated>(this, [](const hex::prv::Provider *provider) {
|
EventManager::subscribe<EventProviderCreated>(this, [](const hex::prv::Provider *provider) {
|
||||||
if (provider->hasLoadInterface() && !provider->shouldSkipLoadInterface())
|
if (provider->hasLoadInterface() && !provider->shouldSkipLoadInterface())
|
||||||
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
|
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
|
||||||
@ -29,13 +29,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderSettings::drawContent() {
|
void ViewProviderSettings::drawContent() {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewProviderSettings::drawAlwaysVisible() {
|
|
||||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F));
|
|
||||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.provider_settings.load_popup").c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
|
||||||
|
|
||||||
auto provider = hex::ImHexApi::Provider::get();
|
auto provider = hex::ImHexApi::Provider::get();
|
||||||
if (provider != nullptr) {
|
if (provider != nullptr) {
|
||||||
bool settingsValid = provider->drawLoadInterface();
|
bool settingsValid = provider->drawLoadInterface();
|
||||||
@ -69,17 +62,10 @@ namespace hex::plugin::builtin {
|
|||||||
TaskManager::doLater([=] { ImHexApi::Provider::remove(provider); });
|
TaskManager::doLater([=] { ImHexApi::Provider::remove(provider); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderSettings::hasViewMenuItemEntry() const {
|
bool ViewProviderSettings::hasViewMenuItemEntry() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderSettings::isAvailable() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewSettings::ViewSettings() : View("hex.builtin.view.settings.name") {
|
ViewSettings::ViewSettings() : View::Floating("hex.builtin.view.settings.name") {
|
||||||
// Handle window open requests
|
// Handle window open requests
|
||||||
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
|
EventManager::subscribe<RequestOpenWindow>(this, [this](const std::string &name) {
|
||||||
if (name == "Settings") {
|
if (name == "Settings") {
|
||||||
TaskManager::doLater([this] {
|
TaskManager::doLater([this] {
|
||||||
ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str());
|
ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str());
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ namespace hex::plugin::builtin {
|
|||||||
// Add the settings menu item to the Extras menu
|
// Add the settings menu item to the Extras menu
|
||||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 3000);
|
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 3000);
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.settings.name"_lang }, 4000, Shortcut::None, [&, this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.settings.name"_lang }, 4000, Shortcut::None, [&, this] {
|
||||||
TaskManager::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.settings.name").c_str()); });
|
TaskManager::doLater([this] { ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str()); });
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -33,9 +33,8 @@ namespace hex::plugin::builtin {
|
|||||||
EventManager::unsubscribe<RequestOpenWindow>(this);
|
EventManager::unsubscribe<RequestOpenWindow>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewSettings::drawContent() {
|
void ViewSettings::drawAlwaysVisibleContent() {
|
||||||
|
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
|
||||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
|
|
||||||
if (ImGui::BeginTabBar("settings")) {
|
if (ImGui::BeginTabBar("settings")) {
|
||||||
auto &categories = ContentRegistry::Settings::impl::getSettings();
|
auto &categories = ContentRegistry::Settings::impl::getSettings();
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ namespace hex::plugin::builtin {
|
|||||||
using namespace std::literals::string_literals;
|
using namespace std::literals::string_literals;
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
|
|
||||||
ViewStore::ViewStore() : View("hex.builtin.view.store.name") {
|
ViewStore::ViewStore() : View::Floating("hex.builtin.view.store.name") {
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.store.name" }, 1000, Shortcut::None, [&, this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.store.name" }, 1000, Shortcut::None, [&, this] {
|
||||||
if (this->m_requestStatus == RequestStatus::NotAttempted)
|
if (this->m_requestStatus == RequestStatus::NotAttempted)
|
||||||
this->refresh();
|
this->refresh();
|
||||||
TaskManager::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.store.name").c_str()); });
|
TaskManager::doLater([this] { ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str()); });
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -278,16 +278,10 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewStore::drawContent() {
|
void ViewStore::drawContent() {
|
||||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.store.name").c_str(), &this->getWindowOpenState())) {
|
|
||||||
if (this->m_requestStatus == RequestStatus::Failed)
|
if (this->m_requestStatus == RequestStatus::Failed)
|
||||||
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.store.netfailed"_lang);
|
ImGuiExt::TextFormattedColored(ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.store.netfailed"_lang);
|
||||||
|
|
||||||
this->drawStore();
|
this->drawStore();
|
||||||
|
|
||||||
ImGui::EndPopup();
|
|
||||||
} else {
|
|
||||||
this->getWindowOpenState() = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewStore::download(fs::ImHexPath pathType, const std::string &fileName, const std::string &url, bool update) {
|
bool ViewStore::download(fs::ImHexPath pathType, const std::string &fileName, const std::string &url, bool update) {
|
||||||
|
@ -7,15 +7,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewThemeManager::ViewThemeManager() : View("hex.builtin.view.theme_manager.name") {
|
ViewThemeManager::ViewThemeManager() : View::Floating("hex.builtin.view.theme_manager.name") {
|
||||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.theme_manager.name" }, 2000, Shortcut::None, [&, this] {
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.theme_manager.name" }, 2000, Shortcut::None, [&, this] {
|
||||||
this->m_viewOpen = true;
|
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewThemeManager::drawContent() {
|
void ViewThemeManager::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.theme_manager.name").c_str(), &this->m_viewOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking)) {
|
|
||||||
ImGuiExt::Header("hex.builtin.view.theme_manager.colors"_lang, true);
|
ImGuiExt::Header("hex.builtin.view.theme_manager.colors"_lang, true);
|
||||||
|
|
||||||
// Draw theme handlers
|
// Draw theme handlers
|
||||||
@ -125,11 +123,6 @@ namespace hex::plugin::builtin {
|
|||||||
outputFile.writeString(json.dump(4));
|
outputFile.writeString(json.dump(4));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
this->getWindowOpenState() = this->m_viewOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,15 +5,13 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
ViewTools::ViewTools() : View("hex.builtin.view.tools.name") {
|
ViewTools::ViewTools() : View::Window("hex.builtin.view.tools.name") {
|
||||||
this->m_dragStartIterator = ContentRegistry::Tools::impl::getEntries().end();
|
this->m_dragStartIterator = ContentRegistry::Tools::impl::getEntries().end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewTools::drawContent() {
|
void ViewTools::drawContent() {
|
||||||
auto &tools = ContentRegistry::Tools::impl::getEntries();
|
auto &tools = ContentRegistry::Tools::impl::getEntries();
|
||||||
|
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
|
|
||||||
// Draw all tools
|
// Draw all tools
|
||||||
for (auto iter = tools.begin(); iter != tools.end(); ++iter) {
|
for (auto iter = tools.begin(); iter != tools.end(); ++iter) {
|
||||||
auto &[name, function, detached] = *iter;
|
auto &[name, function, detached] = *iter;
|
||||||
@ -44,10 +42,8 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewTools::drawAlwaysVisible() {
|
void ViewTools::drawAlwaysVisibleContent() {
|
||||||
// Make sure the tool windows never get drawn over the welcome screen
|
// Make sure the tool windows never get drawn over the welcome screen
|
||||||
if (!ImHexApi::Provider::isValid())
|
if (!ImHexApi::Provider::isValid())
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
using namespace wolv::literals;
|
using namespace wolv::literals;
|
||||||
|
|
||||||
ViewYara::ViewYara() : View("hex.builtin.view.yara.name") {
|
ViewYara::ViewYara() : View::Window("hex.builtin.view.yara.name") {
|
||||||
yr_initialize();
|
yr_initialize();
|
||||||
|
|
||||||
ContentRegistry::FileHandler::add({ ".yar", ".yara" }, [](const auto &path) {
|
ContentRegistry::FileHandler::add({ ".yar", ".yara" }, [](const auto &path) {
|
||||||
@ -99,8 +99,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewYara::drawContent() {
|
void ViewYara::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.yara.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
|
||||||
|
|
||||||
ImGuiExt::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))) {
|
if (ImGui::BeginListBox("##rules", ImVec2(-FLT_MIN, ImGui::GetTextLineHeightWithSpacing() * 5))) {
|
||||||
@ -245,8 +243,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewYara::clearResult() {
|
void ViewYara::clearResult() {
|
||||||
for (const auto &match : *this->m_matches) {
|
for (const auto &match : *this->m_matches) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::windows {
|
namespace hex::plugin::windows {
|
||||||
|
|
||||||
class ViewTTYConsole : public View {
|
class ViewTTYConsole : public View::Window {
|
||||||
public:
|
public:
|
||||||
ViewTTYConsole();
|
ViewTTYConsole();
|
||||||
~ViewTTYConsole() override = default;
|
~ViewTTYConsole() override = default;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace hex::plugin::windows {
|
namespace hex::plugin::windows {
|
||||||
|
|
||||||
ViewTTYConsole::ViewTTYConsole() : View("hex.windows.view.tty_console.name") {
|
ViewTTYConsole::ViewTTYConsole() : View::Window("hex.windows.view.tty_console.name") {
|
||||||
this->m_comPorts = getAvailablePorts();
|
this->m_comPorts = getAvailablePorts();
|
||||||
this->m_transmitDataBuffer.resize(0xFFF, 0x00);
|
this->m_transmitDataBuffer.resize(0xFFF, 0x00);
|
||||||
this->m_receiveDataBuffer.reserve(0xFFF);
|
this->m_receiveDataBuffer.reserve(0xFFF);
|
||||||
@ -17,8 +17,6 @@ namespace hex::plugin::windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewTTYConsole::drawContent() {
|
void ViewTTYConsole::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.windows.view.tty_console.name").c_str(), &this->getWindowOpenState())) {
|
|
||||||
|
|
||||||
ImGuiExt::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;
|
bool connected = this->m_portHandle != INVALID_HANDLE_VALUE;
|
||||||
@ -166,8 +164,6 @@ namespace hex::plugin::windows {
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> ViewTTYConsole::getAvailablePorts() const {
|
std::vector<std::pair<std::string, std::string>> ViewTTYConsole::getAvailablePorts() const {
|
||||||
std::vector<std::pair<std::string, std::string>> result;
|
std::vector<std::pair<std::string, std::string>> result;
|
||||||
|
Loading…
Reference in New Issue
Block a user