-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impr: Convert all hex editor popups to floating, movable windows (#1658)
### Problem description In previous versions of ImHex, all tool windows were implemented as static popups fixed in the upper left position of the hex view. This PR refactors all tool popups to use floating windows that can be dragged around by the user, or closed with a dedicated close button on the title bar. These popup also support a stylable transparency when the user is not hovering their mouse over the window. ### Implementation description I rewrote the logic in `ViewHexEditor::drawPopup()` to use a custom `ImGuiExt::BeginHoveringPopup` function for rendering the popup windows. This new function is an almost exact replica of the built-in `ImGui::BeginPopupModal`, except it does also displays the default window title bar with a close button. A second custom function, `ImGuiExt::PopupTitleBarButton` was also added for rendering small icon-based buttons into the title bar of the parent popup window. This new function was used to implement an optional "Pinning" feature that individual popup implementations can specify. If a window is pinned, it won't close automatically when its main action is executed. For example, the "Select" button on the Select dialog will close the popup by default, unless the window is pinned. ### Screenshots Popup dialogs before: ![image](https://github.com/WerWolv/ImHex/assets/45818400/7c253181-8284-4076-a066-089403554f0f) Popup dialogs after: https://github.com/WerWolv/ImHex/assets/45818400/99d1a628-8ac1-40ac-9146-9062091bb0db ### Additional things - When the user stops hovering their mouse over a popup window, it becomes semi-transparent, making it easier to see the content behind it - This PR also introduces the `styles.imhex.popup-alpha` style, making the transparency effect configurable, including the ability to disable the effect completely by setting `popup-alpha` to `1.0`. - Fixed a bug that caused some popup windows to ignore the Enter and the KeypadEnter keys. With this PR, all tool windows will execute their main action when the user presses either one of the two Enter keys, and will also close automatically unless the window is pinned. ### Possible changes and improvements - Should the transparency effect be disabled if a window is pinned? - Should the transparency factor be modifiable on the Settings/Interface page? - A keyboard shortcut could be added for quickly pinning / unpinning the current window. - Can the pin icon stay on the left, or should it be moved next to the close button, with a similar circular background? --------- Co-authored-by: WerWolv <werwolv98@gmail.com>
- Loading branch information
Showing
10 changed files
with
208 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,7 +333,8 @@ | |
] | ||
}, | ||
"imhex": { | ||
"window-blur": 0.0 | ||
"window-blur": 0.0, | ||
"popup-alpha": 0.65 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,7 +333,8 @@ | |
] | ||
}, | ||
"imhex": { | ||
"window-blur": 0.0 | ||
"window-blur": 0.0, | ||
"popup-alpha": 0.65 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,7 +333,8 @@ | |
] | ||
}, | ||
"imhex": { | ||
"window-blur": 0.0 | ||
"window-blur": 0.0, | ||
"popup-alpha": 0.65 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.