From b646ece14b3a46f1dc9ed398077107caf5155781 Mon Sep 17 00:00:00 2001 From: Wolf <47079795+BioTheWolff@users.noreply.github.com> Date: Sat, 25 Jan 2025 16:32:07 +0100 Subject: [PATCH] impr: Refactor and restructure Event Manager (#2082) ### Problem description This PR addresses issue #2013 that described a cluttered Event Manager. This is a DX issue and should not impact the users whatsoever. ### Implementation description The changes revolve around three main points: 1. the Event Manager (`event_manager.hpp`) was split into four categories: GUI, Interaction, Lifecycle, and Provider, and two types: Events, and Requests. This results in the following files: - `events_gui.hpp` - `events_interaction.hpp` - `events_lifecycle.hpp` - `events_provider.hpp` - `requests_gui.hpp` - `requests_interaction.hpp` - `requests_lifecycle.hpp` - `requests_provider.hpp` 2. Every event and request now has its own piece of documentation, with a `@brief`, accompanied by a longer comment if needed, and gets its `@param`s described. 3. The old `event_manager.hpp` import was removed and replaced by the correct imports wherever needed, as to reduce spread of those files only to where they are truly useful. ### Additional things The commits have been split into (chrono-)logical steps: - `feat`: split the Event Manager, and replace the imports - `refactor`, `chore`: make various small changes to match the required structure - `docs`: add documentation for events and requests Hopefully, this will help to review the PR. *Note: Beware of very long rebuild times in between the commits, use them sparingly! The Actions will ensure this PR builds anyways* Closes #2013 --------- Signed-off-by: BioTheWolff <47079795+BioTheWolff@users.noreply.github.com> Co-authored-by: Nik --- .../include/hex/api/event_manager.hpp | 133 +-------------- .../include/hex/api/events/events_gui.hpp | 120 +++++++++++++ .../hex/api/events/events_interaction.hpp | 158 ++++++++++++++++++ .../hex/api/events/events_lifecycle.hpp | 72 ++++++++ .../hex/api/events/events_provider.hpp | 113 +++++++++++++ .../include/hex/api/events/requests_gui.hpp | 37 ++++ .../hex/api/events/requests_interaction.hpp | 116 +++++++++++++ .../hex/api/events/requests_lifecycle.hpp | 84 ++++++++++ .../hex/api/events/requests_provider.hpp | 22 +++ .../include/hex/helpers/auto_reset.hpp | 1 - .../include/hex/providers/provider_data.hpp | 5 +- .../include/hex/providers/undo_redo/stack.hpp | 2 +- lib/libimhex/include/hex/ui/view.hpp | 1 - .../source/api/achievement_manager.cpp | 2 +- lib/libimhex/source/api/content_registry.cpp | 1 + lib/libimhex/source/api/imhex_api.cpp | 9 +- lib/libimhex/source/api/theme_manager.cpp | 2 +- lib/libimhex/source/api/tutorial_manager.cpp | 1 + lib/libimhex/source/helpers/imgui_hooks.cpp | 2 +- lib/libimhex/source/helpers/logger.cpp | 1 - lib/libimhex/source/providers/provider.cpp | 2 +- .../source/subcommands/subcommands.cpp | 2 +- main/gui/source/init/run/common.cpp | 2 +- main/gui/source/init/run/native.cpp | 2 +- main/gui/source/init/run/web.cpp | 2 +- main/gui/source/init/splash_window.cpp | 2 +- main/gui/source/messaging/common.cpp | 3 +- main/gui/source/window/linux_window.cpp | 3 +- main/gui/source/window/macos_window.cpp | 3 +- main/gui/source/window/web_window.cpp | 4 +- main/gui/source/window/win_window.cpp | 3 + main/gui/source/window/window.cpp | 4 + .../content/providers/null_provider.hpp | 2 +- .../builtin/source/content/achievements.cpp | 4 +- .../source/content/background_services.cpp | 3 +- .../source/content/command_line_interface.cpp | 3 +- .../content/communication_interface.cpp | 2 +- .../data_processor_nodes/other_nodes.cpp | 1 - plugins/builtin/source/content/events.cpp | 7 +- plugins/builtin/source/content/init_tasks.cpp | 2 +- .../source/content/main_menu_items.cpp | 1 + .../source/content/out_of_box_experience.cpp | 3 +- plugins/builtin/source/content/project.cpp | 3 +- .../content/providers/file_provider.cpp | 1 + .../providers/memory_file_provider.cpp | 4 +- .../content/providers/view_provider.cpp | 3 +- plugins/builtin/source/content/recent.cpp | 3 +- .../source/content/settings_entries.cpp | 2 +- plugins/builtin/source/content/themes.cpp | 2 +- .../source/content/tutorials/introduction.cpp | 3 +- plugins/builtin/source/content/ui_items.cpp | 3 + .../content/views/view_achievements.cpp | 1 + .../source/content/views/view_bookmarks.cpp | 1 + .../content/views/view_command_palette.cpp | 1 + .../content/views/view_data_processor.cpp | 3 + .../source/content/views/view_hex_editor.cpp | 4 + .../content/views/view_highlight_rules.cpp | 2 + .../content/views/view_pattern_data.cpp | 1 + .../content/views/view_pattern_editor.cpp | 3 + .../content/views/view_provider_settings.cpp | 1 + .../source/content/views/view_settings.cpp | 1 + .../source/content/views/view_tutorials.cpp | 1 + .../builtin/source/content/welcome_screen.cpp | 5 +- .../source/content/window_decoration.cpp | 3 +- .../source/content/views/view_diff.cpp | 1 + plugins/fonts/include/font_atlas.hpp | 1 - plugins/fonts/source/library_fonts.cpp | 1 + .../support/c/source/script_api/v1/ui.cpp | 1 - plugins/windows/source/content/ui_items.cpp | 1 - plugins/windows/source/plugin_windows.cpp | 2 + tests/common/source/main.cpp | 3 +- 71 files changed, 830 insertions(+), 173 deletions(-) create mode 100644 lib/libimhex/include/hex/api/events/events_gui.hpp create mode 100644 lib/libimhex/include/hex/api/events/events_interaction.hpp create mode 100644 lib/libimhex/include/hex/api/events/events_lifecycle.hpp create mode 100644 lib/libimhex/include/hex/api/events/events_provider.hpp create mode 100644 lib/libimhex/include/hex/api/events/requests_gui.hpp create mode 100644 lib/libimhex/include/hex/api/events/requests_interaction.hpp create mode 100644 lib/libimhex/include/hex/api/events/requests_lifecycle.hpp create mode 100644 lib/libimhex/include/hex/api/events/requests_provider.hpp diff --git a/lib/libimhex/include/hex/api/event_manager.hpp b/lib/libimhex/include/hex/api/event_manager.hpp index 3f5898703..d750eb5c3 100644 --- a/lib/libimhex/include/hex/api/event_manager.hpp +++ b/lib/libimhex/include/hex/api/event_manager.hpp @@ -11,7 +11,6 @@ #include #include -#include #include @@ -32,15 +31,6 @@ #define EVENT_DEF_NO_LOG(event_name, ...) EVENT_DEF_IMPL(event_name, #event_name, false, __VA_ARGS__) -/* Forward declarations */ -struct GLFWwindow; -namespace hex { - class Achievement; - class View; -} - -namespace pl::ptrn { class Pattern; } - namespace hex { namespace impl { @@ -100,7 +90,8 @@ namespace hex { /** * @brief The EventManager allows subscribing to and posting events to different parts of the program. - * To create a new event, use the EVENT_DEF macro. This will create a new event type with the given name and parameters + * To create a new event, use the EVENT_DEF macro. This will create a new event type with the given name and parameters. + * Events should be created in an `events_*.hpp` category file under the `events` folder, and never directly here. */ class EventManager { public: @@ -200,124 +191,4 @@ namespace hex { static void unsubscribe(void *token, impl::EventId id); }; - /* Default Events */ - - /** - * @brief Called when Imhex finished startup, and will enter the main window rendering loop - */ - EVENT_DEF(EventImHexStartupFinished); - - EVENT_DEF(EventFileLoaded, std::fs::path); - EVENT_DEF(EventDataChanged, prv::Provider *); - EVENT_DEF(EventHighlightingChanged); - EVENT_DEF(EventWindowClosing, GLFWwindow *); - EVENT_DEF(EventRegionSelected, ImHexApi::HexEditor::ProviderRegion); - EVENT_DEF(EventAbnormalTermination, int); - EVENT_DEF(EventThemeChanged); - EVENT_DEF(EventOSThemeChanged); - EVENT_DEF(EventDPIChanged, float, float); - EVENT_DEF(EventWindowFocused, bool); - EVENT_DEF(EventImHexUpdated, SemanticVersion, SemanticVersion); - - /** - * @brief Called when the provider is created. - * This event is responsible for (optionally) initializing the provider and calling EventProviderOpened - * (although the event can also be called manually without problem) - */ - EVENT_DEF(EventProviderCreated, prv::Provider *); - EVENT_DEF(EventProviderChanged, prv::Provider *, prv::Provider *); - - /** - * @brief Called as a continuation of EventProviderCreated - * this event is normally called immediately after EventProviderCreated successfully initialized the provider. - * If no initialization (Provider::skipLoadInterface() has been set), this event should be called manually - * If skipLoadInterface failed, this event is not called - * - * @note this is not related to Provider::open() - */ - EVENT_DEF(EventProviderOpened, prv::Provider *); - EVENT_DEF(EventProviderClosing, prv::Provider *, bool *); - EVENT_DEF(EventProviderClosed, prv::Provider *); - EVENT_DEF(EventProviderDeleted, prv::Provider *); - EVENT_DEF(EventProviderSaved, prv::Provider *); - EVENT_DEF(EventWindowInitialized); - EVENT_DEF(EventWindowDeinitializing, GLFWwindow *); - EVENT_DEF(EventBookmarkCreated, ImHexApi::Bookmarks::Entry&); - - /** - * @brief Called upon creation of an IPS patch. - * As for now, the event only serves a purpose for the achievement unlock. - */ - EVENT_DEF(EventPatchCreated, const u8*, u64, const PatchKind); - EVENT_DEF(EventPatternEvaluating); - EVENT_DEF(EventPatternExecuted, const std::string&); - EVENT_DEF(EventPatternEditorChanged, const std::string&); - EVENT_DEF(EventStoreContentDownloaded, const std::fs::path&); - EVENT_DEF(EventStoreContentRemoved, const std::fs::path&); - EVENT_DEF(EventImHexClosing); - EVENT_DEF(EventAchievementUnlocked, const Achievement&); - EVENT_DEF(EventSearchBoxClicked, u32); - EVENT_DEF(EventViewOpened, View*); - EVENT_DEF(EventFirstLaunch); - - EVENT_DEF(EventFileDragged, bool); - EVENT_DEF(EventFileDropped, std::fs::path); - - EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*); - EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64); - EVENT_DEF(EventProviderDataRemoved, prv::Provider *, u64, u64); - EVENT_DEF(EventProviderDirtied, prv::Provider *); - - /** - * @brief Called when a project has been loaded - */ - EVENT_DEF(EventProjectOpened); - - EVENT_DEF_NO_LOG(EventFrameBegin); - EVENT_DEF_NO_LOG(EventFrameEnd); - EVENT_DEF_NO_LOG(EventSetTaskBarIconState, u32, u32, u32); - EVENT_DEF_NO_LOG(EventImGuiElementRendered, ImGuiID, const std::array&); - - EVENT_DEF(RequestAddInitTask, std::string, bool, std::function); - EVENT_DEF(RequestAddExitTask, std::string, std::function); - EVENT_DEF(RequestOpenWindow, std::string); - EVENT_DEF(RequestHexEditorSelectionChange, Region); - EVENT_DEF(RequestPatternEditorSelectionChange, u32, u32); - EVENT_DEF(RequestJumpToPattern, const pl::ptrn::Pattern*); - EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*); - EVENT_DEF(RequestRemoveBookmark, u64); - EVENT_DEF(RequestSetPatternLanguageCode, std::string); - EVENT_DEF(RequestRunPatternCode); - EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path); - EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path); - EVENT_DEF(RequestUpdateWindowTitle); - EVENT_DEF(RequestCloseImHex, bool); - EVENT_DEF(RequestRestartImHex); - EVENT_DEF(RequestOpenFile, std::fs::path); - EVENT_DEF(RequestChangeTheme, std::string); - EVENT_DEF(RequestOpenPopup, std::string); - EVENT_DEF(RequestAddVirtualFile, std::fs::path, std::vector, Region); - EVENT_DEF(RequestStartMigration); - - /** - * @brief Creates a provider from it's unlocalized name, and add it to the provider list - */ - EVENT_DEF(RequestCreateProvider, std::string, bool, bool, hex::prv::Provider **); - EVENT_DEF(RequestInitThemeHandlers); - - /** - * @brief Send an event to the main Imhex instance - */ - EVENT_DEF(SendMessageToMainInstance, const std::string, const std::vector&); - - /** - * Move the data from all PerProvider instances from one provider to another. - * The 'from' provider should not have any per provider data after this, and should be immediately deleted - */ - EVENT_DEF(MovePerProviderData, prv::Provider *, prv::Provider *); - - /** - * Called when ImHex managed to catch an error in a general try/catch to prevent/recover from a crash - */ - EVENT_DEF(EventCrashRecovered, const std::exception &); } \ No newline at end of file diff --git a/lib/libimhex/include/hex/api/events/events_gui.hpp b/lib/libimhex/include/hex/api/events/events_gui.hpp new file mode 100644 index 000000000..e14e6e4b6 --- /dev/null +++ b/lib/libimhex/include/hex/api/events/events_gui.hpp @@ -0,0 +1,120 @@ +#pragma once + +#include + +/* Forward declarations */ +struct GLFWwindow; +namespace hex { class View; } + +/* GUI events definitions */ +namespace hex { + + /** + * @brief Signals a newly opened window + * + * This event is sent when the window has just been opened and docked by the Window manager. + * + * FIXME: In the event that a newly created window is already docked, this will not be sent. + * + * FIXME: This is currently only used for the introduction tutorial. + * If the event's only purpose is this, maybe rename it? + * + * @param view the new view reference + */ + EVENT_DEF(EventViewOpened, View*); + + /** + * @brief Signals a change in the DPI scale. + * + * This event is called once at startup to signal native scale definition (by passing the same value twice). + * On Windows OS, this event can also be posted if the window DPI has been changed. + * + * @param oldScale the old scale + * @param newScale the current scale that's now in use + */ + EVENT_DEF(EventDPIChanged, float, float); + + /** + * @brief Signals the focus of the ImHex main window. + * + * This is directly tied as a GLFW window focus callback, and will be called accordingly when GLFW detects + * a change in focus. + * + * @param isFocused true if the window is focused + */ + EVENT_DEF(EventWindowFocused, bool); + + /** + * @brief Signals a window being closed. + * + * Allows reactive clean up of running tasks, and prevents ImHex from closing + * by displaying an exit confirmation popup. + * + * @param window The window reference + */ + EVENT_DEF(EventWindowClosing, GLFWwindow*); + + /** + * @brief Informs that the main window is initialized + * + * On Windows OS, it is used to initialize system theme, if ImHex's theme is following it. + * + * FIXME: Change event name to reflect Theme detection, if it's only used for that purpose? + */ + EVENT_DEF(EventWindowInitialized); + + /** + * @brief Informs that the main window is deinitializing + * + * Allows for lifecycle cleanup before ImHex shutdown. + * + * @param window The window reference + */ + EVENT_DEF(EventWindowDeinitializing, GLFWwindow*); + + /** + * @brief Signals a theme change in the host OS + * + * Allows ImHex to react to OS theme changes dynamically during execution. + */ + EVENT_DEF(EventOSThemeChanged); + +} + +/* silent (no-logging) GUI events definitions */ +namespace hex { + + /** + * @brief Signals the start of a new ImGui frame + */ + EVENT_DEF_NO_LOG(EventFrameBegin); + + /** + * @brief Signals the end of an ImGui frame + */ + EVENT_DEF_NO_LOG(EventFrameEnd); + + /** + * @brief Windows OS: Sets the taskbar icon state + * + * This event is used on Windows OS to display progress through the taskbar icon (the famous "green loading bar" + * in the taskbar). + * + * @param progressState the progress state (converted from the TaskProgressState enum) + * @param progressType the type of progress (converted from the TaskProgressType enum) + * @param percentage actual progress percentage (expected from 0 to 100) + * + * @see hex::ImHexApi::System::TaskProgressState + * @see hex::ImHexApi::System::TaskProgressType + */ + EVENT_DEF_NO_LOG(EventSetTaskBarIconState, u32, u32, u32); + + /** + * @brief Informs of an ImGui element being rendered + * + * @param elementId the element's ID + * @param boundingBox the bounding box (composed of 4 floats) + */ + EVENT_DEF_NO_LOG(EventImGuiElementRendered, ImGuiID, const std::array&); + +} diff --git a/lib/libimhex/include/hex/api/events/events_interaction.hpp b/lib/libimhex/include/hex/api/events/events_interaction.hpp new file mode 100644 index 000000000..59941dbad --- /dev/null +++ b/lib/libimhex/include/hex/api/events/events_interaction.hpp @@ -0,0 +1,158 @@ +#pragma once + +#include +#include + +/* Forward declarations */ +namespace hex { class Achievement; } + +/* Interaction events definitions */ +namespace hex { + + /** + * @brief Signals a file was loaded + * + * FIXME: this event is unused and should be scrapped. + * + * @param path the loaded file's path + */ + EVENT_DEF(EventFileLoaded, std::fs::path); + + /** + * @brief Signals a change in the current data + * + * Enables provider reaction to data change, especially the data inspector. + * + * This is caused by the following: + * - an explicit provider reload, requested by the user (Ctrl+R) + * - any user action that results in the creation of an "undo" stack action (generally a data modification) + * + * @param provider the Provider subject to the data change + */ + EVENT_DEF(EventDataChanged, prv::Provider *); + + /** + * @brief Signals a change in highlighting + * + * The event's only purpose is for the Hex editor to clear highlights when receiving this event. + */ + EVENT_DEF(EventHighlightingChanged); + + /** + * @brief Informs of a provider region being selected + * + * This is very generally used to signal user actions that select a specific region within the provider. + * It is also used to pass on regions when the provider changes. + * + * @param providerRegion the provider-aware region being selected + */ + EVENT_DEF(EventRegionSelected, ImHexApi::HexEditor::ProviderRegion); + + /** + * @brief Signals a theme change + * + * On Windows OS, this is used to reflect the theme color onto the window frame. + */ + EVENT_DEF(EventThemeChanged); + + /** + * @brief Signals that a bookmark was created + * + * For now, this event's only purpose is to unlock an achievement. + * + * @param entry the new bookmark + */ + EVENT_DEF(EventBookmarkCreated, ImHexApi::Bookmarks::Entry&); + + /** + * @brief Called upon creation of an IPS patch. + * As for now, the event only serves a purpose for the achievement unlock. + * + * @param data the pointer to the patch content's start + * @param size the patch data size + * @param kind the patch's kind + */ + EVENT_DEF(EventPatchCreated, const u8*, u64, const PatchKind); + + /** + * @brief Signals the beginning of evaluation of the current pattern + * + * This allows resetting the drawer view for the pattern data while we wait for the execution completion. + */ + EVENT_DEF(EventPatternEvaluating); + + /** + * @brief Signals the completion of the pattern evaluation + * + * This causes another reset in the drawer view, to refresh the table displayed to the user. + * + * @param code the execution's status code + */ + EVENT_DEF(EventPatternExecuted, const std::string&); + + /** + * @brief Denotes when pattern editor has changed + * + * FIXME: this event is unused and should be scrapped. + */ + EVENT_DEF(EventPatternEditorChanged, const std::string&); + + /** + * @brief Signals that a Content Store item was downloaded + * + * FIXME: this event is unused and should be scrapped. + * + * @param path the item's path on the filesystem + */ + EVENT_DEF(EventStoreContentDownloaded, const std::fs::path&); + + /** + * @brief Signals the removal of a Content Store item + * + * Note: at the time of the event firing, the item has already been removed from the filesystem. + * + * FIXME: this event is unused and should be scrapped. + * + * @param path the item's old file path where it used to be in the filesystem + */ + EVENT_DEF(EventStoreContentRemoved, const std::fs::path&); + + /** + * @brief Signals the unlocking of an achievement + * + * This is used by the achievement manager to refresh the achievement display, as well as store progress to + * the appropriate storage file. + * + * @param achievement the achievement that was unlocked + */ + EVENT_DEF(EventAchievementUnlocked, const Achievement&); + + /** + * @brief Signals a click on the search box + * + * As there are different behaviours depending on the click (left or right) done by the user, + * this allows the consequences of said click to be registered in their own components. + * + * @param button the ImGuiMouseButton's value + */ + EVENT_DEF(EventSearchBoxClicked, u32); + + /** + * @brief Updates on whether a file is being dragged into ImHex + * + * Allows ImGUi to display a file dragging information on screen when a file is being dragged. + * + * @param isFileDragged true if a file is being dragged + */ + EVENT_DEF(EventFileDragged, bool); + + /** + * @brief Triggers loading when a file is dropped + * + * The event fires when a file is dropped into ImHex, which passes it to file handlers to load it. + * + * @param path the dropped file's path + */ + EVENT_DEF(EventFileDropped, std::fs::path); + +} \ No newline at end of file diff --git a/lib/libimhex/include/hex/api/events/events_lifecycle.hpp b/lib/libimhex/include/hex/api/events/events_lifecycle.hpp new file mode 100644 index 000000000..fd65c026f --- /dev/null +++ b/lib/libimhex/include/hex/api/events/events_lifecycle.hpp @@ -0,0 +1,72 @@ +#pragma once + +#include + +/* Lifecycle events definitions */ +namespace hex { + + /** + * @brief Called when Imhex finished startup, and will enter the main window rendering loop + */ + EVENT_DEF(EventImHexStartupFinished); + + /** + * @brief Called when ImHex is closing, to trigger the last shutdown hooks + * + * This is the last event to fire before complete graceful shutdown. + */ + EVENT_DEF(EventImHexClosing); + + /** + * @brief Signals that it's ImHex first launch ever + * + * This event allows for the launch of the ImHex tutorial (also called Out of Box experience). + */ + EVENT_DEF(EventFirstLaunch); + + /** + * FIXME: this event is unused and should be scrapped. + */ + EVENT_DEF(EventAnySettingChanged); + + /** + * @brief Ensures correct plugin cleanup on crash + * + * This event is fired when catching an unexpected error that cannot be recovered and + * which forces Imhex to close immediately. + * + * Subscribing to this event ensures that the plugin can correctly clean up any mission-critical tasks + * before forceful shutdown. + * + * @param signal the POSIX signal code + */ + EVENT_DEF(EventAbnormalTermination, int); + + /** + * @brief Informs of the ImHex versions (and difference, if any) + * + * Called on every startup to inform subscribers of the two versions picked up: + * - the version of the previous launch, gathered from the settings file + * - the current version, gathered directly from C++ code + * + * In most cases, and unless ImHex was updated, the two parameters will be the same. + * + * FIXME: Maybe rename the event to signal a startup information, instead of the misleading + * title that the event could be fired when ImHex detects that it was updated since last launch? + * + * @param previousLaunchVersion ImHex's version during the previous launch + * @param currentVersion ImHex's current version for this startup + */ + EVENT_DEF(EventImHexUpdated, SemanticVersion, SemanticVersion); + + /** + * @brief Called when ImHex managed to catch an error in a general try/catch to prevent/recover from a crash + */ + EVENT_DEF(EventCrashRecovered, const std::exception &); + + /** + * @brief Called when a project has been loaded + */ + EVENT_DEF(EventProjectOpened); + +} \ No newline at end of file diff --git a/lib/libimhex/include/hex/api/events/events_provider.hpp b/lib/libimhex/include/hex/api/events/events_provider.hpp new file mode 100644 index 000000000..eb94468cf --- /dev/null +++ b/lib/libimhex/include/hex/api/events/events_provider.hpp @@ -0,0 +1,113 @@ +#pragma once + +#include +#include + +/* Provider events definitions */ +namespace hex { + /** + * @brief Called when the provider is created. + * This event is responsible for (optionally) initializing the provider and calling EventProviderOpened + * (although the event can also be called manually without problem) + */ + EVENT_DEF(EventProviderCreated, prv::Provider *); + + /** + * @brief Called as a continuation of EventProviderCreated + * this event is normally called immediately after EventProviderCreated successfully initialized the provider. + * If no initialization (Provider::skipLoadInterface() has been set), this event should be called manually + * If skipLoadInterface failed, this event is not called + * + * @note this is not related to Provider::open() + */ + EVENT_DEF(EventProviderOpened, prv::Provider *); + + /** + * @brief Signals a change in provider (in-place) + * + * Note: if the provider was deleted, the new ("current") provider will be `nullptr` + * + * @param oldProvider the old provider + * @param currentProvider the current provider + */ + EVENT_DEF(EventProviderChanged, prv::Provider *, prv::Provider *); + + /** + * @brief Signals that a provider was saved + * + * @param provider the saved provider + */ + EVENT_DEF(EventProviderSaved, prv::Provider *); + + /** + * @brief Signals a provider is closing + * + * FIXME: as for now, this behaves as a request more than an event. Also, the boolean is always set to true, + * and serves no purpose. This should be moved into the Provider requests section and declared accordingly. + * + * @param provider the closing provider + * @param shouldClose whether the provider should close + */ + EVENT_DEF(EventProviderClosing, prv::Provider *, bool *); + + /** + * @brief Signals that a provider was closed + * + * As this is a closure information broadcast, the provider should generally not be accessed, as it could + * result in problems. + * + * @param provider the now-closed provider + */ + EVENT_DEF(EventProviderClosed, prv::Provider *); + + /** + * @brief Signals that a provider is being deleted + * + * Provider's data should not be accessed. + * + * @param provider the provider + */ + EVENT_DEF(EventProviderDeleted, prv::Provider *); + +} + +/* Provider data events definitions */ +namespace hex { + + /** + * @brief Signals the dirtying of a provider + * + * Any data modification that occurs in a provider dirties it, until its state is either saved or restored. + * This event signals that fact to subscribers so additional code can be executed for certain cases. + */ + EVENT_DEF(EventProviderDirtied, prv::Provider *); + + /** + * @brief Signals an insertion of new data into a provider + * + * @param provider the provider + * @param offset the start of the insertion + * @param size the new data's size + */ + EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64); + + /** + * @brief Signals a modification in the provider's data + * + * @param provider the provider + * @param offset the data modification's offset (start address) + * @param size the buffer's size + * @param buffer the modified data written at this address + */ + EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*); + + /** + * @brief Signals a removal of some of the provider's data + * + * @param provider the provider + * @param offset the deletion offset (start address) + * @param size the deleted data's size + */ + EVENT_DEF(EventProviderDataRemoved, prv::Provider *, u64, u64); + +} diff --git a/lib/libimhex/include/hex/api/events/requests_gui.hpp b/lib/libimhex/include/hex/api/events/requests_gui.hpp new file mode 100644 index 000000000..5fdee10ee --- /dev/null +++ b/lib/libimhex/include/hex/api/events/requests_gui.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include + +/* GUI requests definitions */ +namespace hex { + + /** + * @brief Requests the opening of a new window. + * + * @param name the window's name + */ + EVENT_DEF(RequestOpenWindow, std::string); + + /** + * @brief Centralized request to update ImHex's main window title + * + * This request can be called to make ImHex refresh its main window title, taking into account a new project + * or file opened/closed. + */ + EVENT_DEF(RequestUpdateWindowTitle); + + /** + * @brief Requests a theme type (light or dark) change + * + * @param themeType either `Light` or `Dark` + */ + EVENT_DEF(RequestChangeTheme, std::string); + + /** + * @brief Requests the opening of a popup + * + * @param name the popup's name + */ + EVENT_DEF(RequestOpenPopup, std::string); + +} diff --git a/lib/libimhex/include/hex/api/events/requests_interaction.hpp b/lib/libimhex/include/hex/api/events/requests_interaction.hpp new file mode 100644 index 000000000..53fa504b9 --- /dev/null +++ b/lib/libimhex/include/hex/api/events/requests_interaction.hpp @@ -0,0 +1,116 @@ +#pragma once + +#include +#include + +/* Forward declarations */ +namespace pl::ptrn { class Pattern; } + +/* Interaction requests definitions */ +namespace hex { + + /** + * @brief Requests a selection change in the Hex editor + * + * This request is handled by the Hex editor, which proceeds to check if the selection is valid. + * If it is invalid, the Hex editor fires the `EventRegionSelected` event with nullptr region info. + * + * @param region the region that should be selected + */ + EVENT_DEF(RequestHexEditorSelectionChange, Region); + + /** + * @brief Requests the Pattern editor to move selection + * + * Requests the Pattern editor to move the cursor's position to reflect the user's click or movement. + * + * @param line the target line + * @param column the target column + */ + EVENT_DEF(RequestPatternEditorSelectionChange, u32, u32); + + /** + * @brief Requests a jump to a given pattern + * + * This request is fired by the Hex editor when the user asks to jump to the pattern. + * It is then caught and reflected by the Pattern data component. + * + * @param pattern the pattern to jump to + */ + EVENT_DEF(RequestJumpToPattern, const pl::ptrn::Pattern*); + + /** + * @brief Requests to add a bookmark + * + * @param region the region to be bookmarked + * @param name the bookmark's name + * @param comment a comment + * @param color the color + * @param id the bookmark's unique ID + */ + EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*); + + /** + * @brief Requests a bookmark removal + * + * @param id the bookmark's unique ID + */ + EVENT_DEF(RequestRemoveBookmark, u64); + + /** + * @brief Request the Pattern editor to set its code + * + * This request allows the rest of ImHex to interface with the Pattern editor component, by setting its code. + * This allows for `.hexpat` file loading, and more. + * + * @param code the code's string + */ + EVENT_DEF(RequestSetPatternLanguageCode, std::string); + + /** + * @brief Requests the Pattern editor to run the current code + * + * This is only ever used in the introduction tutorial. + * + * FIXME: the name is misleading, as for now this activates the pattern's auto-evaluation rather than a + * one-off execution + */ + EVENT_DEF(RequestRunPatternCode); + + /** + * @brief Request to load a pattern language file + * + * FIXME: this request is unused, as now another component is responsible for pattern file loading. + * This request should be scrapped. + * + * @param path the pattern file's path + */ + EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path); + + /** + * @brief Request to save a pattern language file + * + * FIXME: this request is unused, as now another component is responsible for pattern file saving. + * This request should be scrapped. + * + * @param path the pattern file's path + */ + EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path); + + /** + * @brief Requests ImHex to open and process a file + * + * @param path the file's path + */ + EVENT_DEF(RequestOpenFile, std::fs::path); + + /** + * @brief Adds a virtual file in the Pattern editor + * + * @param path the file's path + * @param data the file's data + * @param region the impacted region + */ + EVENT_DEF(RequestAddVirtualFile, std::fs::path, std::vector, Region); + +} diff --git a/lib/libimhex/include/hex/api/events/requests_lifecycle.hpp b/lib/libimhex/include/hex/api/events/requests_lifecycle.hpp new file mode 100644 index 000000000..486e373ed --- /dev/null +++ b/lib/libimhex/include/hex/api/events/requests_lifecycle.hpp @@ -0,0 +1,84 @@ +#pragma once + +#include +#include + +/* Lifecycle requests definitions */ +namespace hex { + + /** + * @brief Emit a request to add an initialization task to the list + * + * These tasks will be executed at startup. + * + * @param name Name of the init task + * @param isAsync Whether the task is asynchronous (true if yes) + * @param callbackFunction The function to call to execute the task + */ + EVENT_DEF(RequestAddInitTask, std::string, bool, std::function); + + /** + * @brief Emit a request to add an exit task to the list + * + * These tasks will be executed during the exit phase. + * + * FIXME: request is unused and should be scrapped. + * + * @param name Name of the exit task + * @param callbackFunction The function to call to execute the task + */ + EVENT_DEF(RequestAddExitTask, std::string, std::function); + + /** + * @brief Requests ImHex's graceful shutdown + * + * If there are no questions (bool set to true), ImHex closes immediately. + * If set to false, there is a procedure run to prompt a confirmation to the user. + * + * @param noQuestions true if no questions + */ + EVENT_DEF(RequestCloseImHex, bool); + + /** + * @brief Requests ImHex's restart + * + * This event is necessary for ImHex to restart in the main loop for native and web platforms, + * as ImHex cannot simply close and re-open. + * + * This event serves no purpose on Linux, Windows and macOS platforms. + */ + EVENT_DEF(RequestRestartImHex); + + /** + * @brief Requests the initialization of theme handlers + * + * This is called during ImGui bootstrapping, and should not be called at any other time. + */ + EVENT_DEF(RequestInitThemeHandlers); + + /** + * @brief Requests version and first-startup checks + * + * This request is called during ImHex's startup, and allows ImHex to check if it was updated since last launch. + * It also ensures newcomers (that open ImHex for the first time) are greeted with the tutorial. + * + * FIXME: the name is misleading, as this request does not effectively start any migration. It only executes + * checks about ImHex's version. The name should be changed to reflect this behaviour. + */ + EVENT_DEF(RequestStartMigration); + + /** + * @brief Send a subcommand to the main Imhex instance + * + * This request is called to send a subcommand to the main ImHex instance. + * This subcommand will then be executed by a handler when ImHex finishing initializing + * (`EventImHexStartupFinished`). + * + * FIXME: change the name so that it is prefixed with "Request" like every other request. + * + * @param name the subcommand's name + * @param data the subcommand's data + */ + EVENT_DEF(SendMessageToMainInstance, const std::string, const std::vector&); + +} diff --git a/lib/libimhex/include/hex/api/events/requests_provider.hpp b/lib/libimhex/include/hex/api/events/requests_provider.hpp new file mode 100644 index 000000000..db28d42ec --- /dev/null +++ b/lib/libimhex/include/hex/api/events/requests_provider.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include + +/* Provider requests definitions */ +namespace hex { + + /** + * @brief Creates a provider from its unlocalized name, and add it to the provider list + */ + EVENT_DEF(RequestCreateProvider, std::string, bool, bool, hex::prv::Provider **); + + /** + * @brief Move the data from all PerProvider instances from one provider to another + * + * The 'from' provider should not have any per provider data after this, and should be immediately deleted + * + * FIXME: rename with the "Request" prefix to apply standard naming convention. + */ + EVENT_DEF(MovePerProviderData, prv::Provider *, prv::Provider *); + +} diff --git a/lib/libimhex/include/hex/helpers/auto_reset.hpp b/lib/libimhex/include/hex/helpers/auto_reset.hpp index ef3165821..a79752e3f 100644 --- a/lib/libimhex/include/hex/helpers/auto_reset.hpp +++ b/lib/libimhex/include/hex/helpers/auto_reset.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include namespace hex { diff --git a/lib/libimhex/include/hex/providers/provider_data.hpp b/lib/libimhex/include/hex/providers/provider_data.hpp index aee4dd2dd..821e51152 100644 --- a/lib/libimhex/include/hex/providers/provider_data.hpp +++ b/lib/libimhex/include/hex/providers/provider_data.hpp @@ -1,7 +1,10 @@ #pragma once #include -#include +#include +#include +#include + #include #include diff --git a/lib/libimhex/include/hex/providers/undo_redo/stack.hpp b/lib/libimhex/include/hex/providers/undo_redo/stack.hpp index aa5b8eaba..3ae51799a 100644 --- a/lib/libimhex/include/hex/providers/undo_redo/stack.hpp +++ b/lib/libimhex/include/hex/providers/undo_redo/stack.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include diff --git a/lib/libimhex/include/hex/ui/view.hpp b/lib/libimhex/include/hex/ui/view.hpp index f65bf34a0..7f5de4df9 100644 --- a/lib/libimhex/include/hex/ui/view.hpp +++ b/lib/libimhex/include/hex/ui/view.hpp @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/lib/libimhex/source/api/achievement_manager.cpp b/lib/libimhex/source/api/achievement_manager.cpp index 4dec3cd35..a346532e0 100644 --- a/lib/libimhex/source/api/achievement_manager.cpp +++ b/lib/libimhex/source/api/achievement_manager.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index f4de78a12..e772b4aa9 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 71c41e21f..aa2e33ec3 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -1,6 +1,13 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include diff --git a/lib/libimhex/source/api/theme_manager.cpp b/lib/libimhex/source/api/theme_manager.cpp index 1b030e827..7851cb855 100644 --- a/lib/libimhex/source/api/theme_manager.cpp +++ b/lib/libimhex/source/api/theme_manager.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/lib/libimhex/source/api/tutorial_manager.cpp b/lib/libimhex/source/api/tutorial_manager.cpp index 0ce3d17af..59e722650 100644 --- a/lib/libimhex/source/api/tutorial_manager.cpp +++ b/lib/libimhex/source/api/tutorial_manager.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include diff --git a/lib/libimhex/source/helpers/imgui_hooks.cpp b/lib/libimhex/source/helpers/imgui_hooks.cpp index fa3688f09..b40cf490e 100644 --- a/lib/libimhex/source/helpers/imgui_hooks.cpp +++ b/lib/libimhex/source/helpers/imgui_hooks.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/lib/libimhex/source/helpers/logger.cpp b/lib/libimhex/source/helpers/logger.cpp index bb5dd21b3..46caa5b68 100644 --- a/lib/libimhex/source/helpers/logger.cpp +++ b/lib/libimhex/source/helpers/logger.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include diff --git a/lib/libimhex/source/providers/provider.cpp b/lib/libimhex/source/providers/provider.cpp index ba00a66af..3b68cf5db 100644 --- a/lib/libimhex/source/providers/provider.cpp +++ b/lib/libimhex/source/providers/provider.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/lib/libimhex/source/subcommands/subcommands.cpp b/lib/libimhex/source/subcommands/subcommands.cpp index e80bae2cf..6c9e88db7 100644 --- a/lib/libimhex/source/subcommands/subcommands.cpp +++ b/lib/libimhex/source/subcommands/subcommands.cpp @@ -4,7 +4,7 @@ #include "hex/subcommands/subcommands.hpp" -#include +#include #include #include #include diff --git a/main/gui/source/init/run/common.cpp b/main/gui/source/init/run/common.cpp index f8eb81233..06fddef03 100644 --- a/main/gui/source/init/run/common.cpp +++ b/main/gui/source/init/run/common.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/main/gui/source/init/run/native.cpp b/main/gui/source/init/run/native.cpp index f11cffc53..740ff1c5d 100644 --- a/main/gui/source/init/run/native.cpp +++ b/main/gui/source/init/run/native.cpp @@ -1,6 +1,6 @@ #if !defined(OS_WEB) - #include + #include #include #include diff --git a/main/gui/source/init/run/web.cpp b/main/gui/source/init/run/web.cpp index ac9ef0abf..577ccb7ae 100644 --- a/main/gui/source/init/run/web.cpp +++ b/main/gui/source/init/run/web.cpp @@ -4,7 +4,7 @@ #include #include - #include + #include #include #include diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index 3bffbf175..fde743c55 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -2,7 +2,7 @@ #include "init/splash_window.hpp" #include -#include +#include #include #include diff --git a/main/gui/source/messaging/common.cpp b/main/gui/source/messaging/common.cpp index 4af6b0004..1d51c16ee 100644 --- a/main/gui/source/messaging/common.cpp +++ b/main/gui/source/messaging/common.cpp @@ -1,7 +1,8 @@ #include #include -#include +#include +#include #include #include "messaging.hpp" diff --git a/main/gui/source/window/linux_window.cpp b/main/gui/source/window/linux_window.cpp index efd40d1d9..3035169e7 100644 --- a/main/gui/source/window/linux_window.cpp +++ b/main/gui/source/window/linux_window.cpp @@ -4,7 +4,8 @@ #include #include - #include + #include + #include #include #include diff --git a/main/gui/source/window/macos_window.cpp b/main/gui/source/window/macos_window.cpp index 704ecf741..8335cbb7b 100644 --- a/main/gui/source/window/macos_window.cpp +++ b/main/gui/source/window/macos_window.cpp @@ -4,7 +4,8 @@ #include #include - #include + #include + #include #include #include diff --git a/main/gui/source/window/web_window.cpp b/main/gui/source/window/web_window.cpp index 32b7ae22a..0babc5f94 100644 --- a/main/gui/source/window/web_window.cpp +++ b/main/gui/source/window/web_window.cpp @@ -5,7 +5,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/main/gui/source/window/win_window.cpp b/main/gui/source/window/win_window.cpp index e9e8798aa..34e1c6312 100644 --- a/main/gui/source/window/win_window.cpp +++ b/main/gui/source/window/win_window.cpp @@ -12,6 +12,9 @@ #include #include + #include + #include + #include #include diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 09bf68eaf..7623a157c 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include +#include #include #include diff --git a/plugins/builtin/include/content/providers/null_provider.hpp b/plugins/builtin/include/content/providers/null_provider.hpp index 39c59593d..450f6f637 100644 --- a/plugins/builtin/include/content/providers/null_provider.hpp +++ b/plugins/builtin/include/content/providers/null_provider.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include namespace hex::plugin::builtin { diff --git a/plugins/builtin/source/content/achievements.cpp b/plugins/builtin/source/content/achievements.cpp index 4806863d0..68401f533 100644 --- a/plugins/builtin/source/content/achievements.cpp +++ b/plugins/builtin/source/content/achievements.cpp @@ -1,7 +1,9 @@ #include #include #include -#include + +#include +#include #include #include diff --git a/plugins/builtin/source/content/background_services.cpp b/plugins/builtin/source/content/background_services.cpp index 3501c726a..3d01f8532 100644 --- a/plugins/builtin/source/content/background_services.cpp +++ b/plugins/builtin/source/content/background_services.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/command_line_interface.cpp b/plugins/builtin/source/content/command_line_interface.cpp index 2688d035a..b815c008b 100644 --- a/plugins/builtin/source/content/command_line_interface.cpp +++ b/plugins/builtin/source/content/command_line_interface.cpp @@ -4,7 +4,8 @@ #include #include -#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/communication_interface.cpp b/plugins/builtin/source/content/communication_interface.cpp index 653801bcf..f4849741f 100644 --- a/plugins/builtin/source/content/communication_interface.cpp +++ b/plugins/builtin/source/content/communication_interface.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include diff --git a/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp index 2467e8165..5051ec301 100644 --- a/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp +++ b/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 6b9e627e1..b0bc4d4db 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -1,4 +1,9 @@ -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/init_tasks.cpp b/plugins/builtin/source/content/init_tasks.cpp index 3e8e92def..476c1d3a7 100644 --- a/plugins/builtin/source/content/init_tasks.cpp +++ b/plugins/builtin/source/content/init_tasks.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/plugins/builtin/source/content/main_menu_items.cpp b/plugins/builtin/source/content/main_menu_items.cpp index e27a53d91..3669e3731 100644 --- a/plugins/builtin/source/content/main_menu_items.cpp +++ b/plugins/builtin/source/content/main_menu_items.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/plugins/builtin/source/content/out_of_box_experience.cpp b/plugins/builtin/source/content/out_of_box_experience.cpp index 8ae2aa331..88986318a 100644 --- a/plugins/builtin/source/content/out_of_box_experience.cpp +++ b/plugins/builtin/source/content/out_of_box_experience.cpp @@ -4,7 +4,8 @@ #include #include -#include +#include +#include #include #include #include diff --git a/plugins/builtin/source/content/project.cpp b/plugins/builtin/source/content/project.cpp index de67ec005..c20e5a1ac 100644 --- a/plugins/builtin/source/content/project.cpp +++ b/plugins/builtin/source/content/project.cpp @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index 9de0f2967..bda59de38 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/plugins/builtin/source/content/providers/memory_file_provider.cpp b/plugins/builtin/source/content/providers/memory_file_provider.cpp index f76a0bd99..063ef8a58 100644 --- a/plugins/builtin/source/content/providers/memory_file_provider.cpp +++ b/plugins/builtin/source/content/providers/memory_file_provider.cpp @@ -6,7 +6,9 @@ #include #include -#include +#include +#include +#include #include diff --git a/plugins/builtin/source/content/providers/view_provider.cpp b/plugins/builtin/source/content/providers/view_provider.cpp index 4ae912ad5..e06c4e3d7 100644 --- a/plugins/builtin/source/content/providers/view_provider.cpp +++ b/plugins/builtin/source/content/providers/view_provider.cpp @@ -2,7 +2,8 @@ #include -#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/recent.cpp b/plugins/builtin/source/content/recent.cpp index 34a55c8cc..50aee8488 100644 --- a/plugins/builtin/source/content/recent.cpp +++ b/plugins/builtin/source/content/recent.cpp @@ -1,7 +1,8 @@ #include #include -#include +#include +#include #include #include #include diff --git a/plugins/builtin/source/content/settings_entries.cpp b/plugins/builtin/source/content/settings_entries.cpp index 27851c936..01d4dfba5 100644 --- a/plugins/builtin/source/content/settings_entries.cpp +++ b/plugins/builtin/source/content/settings_entries.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/plugins/builtin/source/content/themes.cpp b/plugins/builtin/source/content/themes.cpp index 469c06304..cc72007fb 100644 --- a/plugins/builtin/source/content/themes.cpp +++ b/plugins/builtin/source/content/themes.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/plugins/builtin/source/content/tutorials/introduction.cpp b/plugins/builtin/source/content/tutorials/introduction.cpp index 1a4f8c935..9e37a510e 100644 --- a/plugins/builtin/source/content/tutorials/introduction.cpp +++ b/plugins/builtin/source/content/tutorials/introduction.cpp @@ -1,8 +1,9 @@ #include -#include #include #include #include +#include +#include namespace hex::plugin::builtin { diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index a6cac0f7e..5bbff88e6 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include #include diff --git a/plugins/builtin/source/content/views/view_achievements.cpp b/plugins/builtin/source/content/views/view_achievements.cpp index eb489d1aa..6bf8a56e4 100644 --- a/plugins/builtin/source/content/views/view_achievements.cpp +++ b/plugins/builtin/source/content/views/view_achievements.cpp @@ -2,6 +2,7 @@ #include #include +#include #include diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp index 2a285165b..0d22ce3ad 100644 --- a/plugins/builtin/source/content/views/view_bookmarks.cpp +++ b/plugins/builtin/source/content/views/view_bookmarks.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/builtin/source/content/views/view_command_palette.cpp b/plugins/builtin/source/content/views/view_command_palette.cpp index 4df5df2cb..10a44a78b 100644 --- a/plugins/builtin/source/content/views/view_command_palette.cpp +++ b/plugins/builtin/source/content/views/view_command_palette.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "imstb_textedit.h" diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp index acc326538..84eae8023 100644 --- a/plugins/builtin/source/content/views/view_data_processor.cpp +++ b/plugins/builtin/source/content/views/view_data_processor.cpp @@ -5,6 +5,9 @@ #include #include +#include +#include + #include #include #include diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 9c3b49fbd..3d836cac6 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -5,6 +5,10 @@ #include #include +#include +#include +#include + #include #include #include diff --git a/plugins/builtin/source/content/views/view_highlight_rules.cpp b/plugins/builtin/source/content/views/view_highlight_rules.cpp index 5e5e51682..d8177582b 100644 --- a/plugins/builtin/source/content/views/view_highlight_rules.cpp +++ b/plugins/builtin/source/content/views/view_highlight_rules.cpp @@ -2,6 +2,8 @@ #include #include +#include + #include #include diff --git a/plugins/builtin/source/content/views/view_pattern_data.cpp b/plugins/builtin/source/content/views/view_pattern_data.cpp index 06a0f5ab0..6ad266145 100644 --- a/plugins/builtin/source/content/views/view_pattern_data.cpp +++ b/plugins/builtin/source/content/views/view_pattern_data.cpp @@ -2,6 +2,7 @@ #include #include +#include #include diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index f7647eaf5..20a0d4c67 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include + #include #include #include diff --git a/plugins/builtin/source/content/views/view_provider_settings.cpp b/plugins/builtin/source/content/views/view_provider_settings.cpp index f95d73c79..ea4665987 100644 --- a/plugins/builtin/source/content/views/view_provider_settings.cpp +++ b/plugins/builtin/source/content/views/view_provider_settings.cpp @@ -2,6 +2,7 @@ #include #include +#include #include diff --git a/plugins/builtin/source/content/views/view_settings.cpp b/plugins/builtin/source/content/views/view_settings.cpp index c89a8a67f..3a692f330 100644 --- a/plugins/builtin/source/content/views/view_settings.cpp +++ b/plugins/builtin/source/content/views/view_settings.cpp @@ -1,6 +1,7 @@ #include "content/views/view_settings.hpp" #include +#include #include #include diff --git a/plugins/builtin/source/content/views/view_tutorials.cpp b/plugins/builtin/source/content/views/view_tutorials.cpp index 28f013be2..dbe721dd7 100644 --- a/plugins/builtin/source/content/views/view_tutorials.cpp +++ b/plugins/builtin/source/content/views/view_tutorials.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 403692de7..b47c798a8 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -9,6 +8,10 @@ #include #include +#include +#include +#include + #include #include diff --git a/plugins/builtin/source/content/window_decoration.cpp b/plugins/builtin/source/content/window_decoration.cpp index bc2be4edc..ae350c521 100644 --- a/plugins/builtin/source/content/window_decoration.cpp +++ b/plugins/builtin/source/content/window_decoration.cpp @@ -1,8 +1,9 @@ #include -#include #include #include #include +#include +#include #include #include diff --git a/plugins/diffing/source/content/views/view_diff.cpp b/plugins/diffing/source/content/views/view_diff.cpp index 1d5afecbb..f814b9424 100644 --- a/plugins/diffing/source/content/views/view_diff.cpp +++ b/plugins/diffing/source/content/views/view_diff.cpp @@ -1,6 +1,7 @@ #include "content/views/view_diff.hpp" #include +#include #include #include diff --git a/plugins/fonts/include/font_atlas.hpp b/plugins/fonts/include/font_atlas.hpp index ec2867dc0..0736cb001 100644 --- a/plugins/fonts/include/font_atlas.hpp +++ b/plugins/fonts/include/font_atlas.hpp @@ -7,7 +7,6 @@ #include #include -#include #include #include diff --git a/plugins/fonts/source/library_fonts.cpp b/plugins/fonts/source/library_fonts.cpp index 7739e2049..bfa1b29dc 100644 --- a/plugins/fonts/source/library_fonts.cpp +++ b/plugins/fonts/source/library_fonts.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include diff --git a/plugins/script_loader/support/c/source/script_api/v1/ui.cpp b/plugins/script_loader/support/c/source/script_api/v1/ui.cpp index 3ab2f24da..56f6a8d59 100644 --- a/plugins/script_loader/support/c/source/script_api/v1/ui.cpp +++ b/plugins/script_loader/support/c/source/script_api/v1/ui.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/plugins/windows/source/content/ui_items.cpp b/plugins/windows/source/content/ui_items.cpp index 3e080c7a1..4a989cba9 100644 --- a/plugins/windows/source/content/ui_items.cpp +++ b/plugins/windows/source/content/ui_items.cpp @@ -9,7 +9,6 @@ #include #include -#include namespace hex::plugin::windows { diff --git a/plugins/windows/source/plugin_windows.cpp b/plugins/windows/source/plugin_windows.cpp index a1ffc3ff2..c8e68fec3 100644 --- a/plugins/windows/source/plugin_windows.cpp +++ b/plugins/windows/source/plugin_windows.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include diff --git a/tests/common/source/main.cpp b/tests/common/source/main.cpp index 217e229ba..84dab21cd 100644 --- a/tests/common/source/main.cpp +++ b/tests/common/source/main.cpp @@ -1,12 +1,11 @@ #include -#include #include #include #include #include #include -#include +#include #include