Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline visualizers in custom data inspectors #1966

Merged
merged 8 commits into from
Nov 29, 2024

Conversation

paxcut
Copy link
Contributor

@paxcut paxcut commented Nov 23, 2024

Problem description

This PR aims at making inline visualizers work on the data inspector so that more rgb encodings can be added as custom pattern language inspector rows. This was never setup to work because the inline visualizer rendering function was a private member function.

Implementation description

In order to be accessible from the inspector class the rendering function was made public.

Additional things

Missing still is the tooltip to make it behave like other color entries.

This PR aims at making inline visualizers work on the data inspector so that more rgb encodings can be added as custom pattern language inspector rows. This was never setup to work because the inline visualizer rendering function was a private member function.

In order to be accessible from the inspector class the rendering function was made public.

Missing still is the tooltip to make it behave like other color entries.
paxcut and others added 4 commits November 24, 2024 08:56
…tor.

The previous version was trying to use the drawVisualizer function in PatternDrawer from DataInspector which was inefficient. The former drawVisualizer code was put in its own class in ui from imhex plugin library. Both DataInspector and PatternDrawer get a member field that is used to draw inline and regular visualizers. Code has been tested to make sure it works for both the inspector and the pattern drawer.
@@ -384,11 +358,12 @@ namespace hex::ui {
if (ImGui::Button(hex::format(" {} {}", ICON_VS_EYE_WATCH, value).c_str(), ImVec2(width, ImGui::GetTextLineHeight()))) {
auto previousPattern = m_currVisualizedPattern;
m_currVisualizedPattern = &pattern;

m_lastVisualizerError = m_visualizerDrawer.getLastVisualizerError();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like m_lastVisualizerError is really needed anymore. Keeping the error message only stored in the visualizer drawer would be better

Copy link
Contributor Author

@paxcut paxcut Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the variable as requested and added function to clear the error on VisualizerDrawer to make it easier. I simulated a code error in my Inspector rgba5551 visualizer and I got a nice popup error of the reason why it wasn't working. Fixing the error made the visualizer work again so it looks like at a basic level it is working.
The question now is how to get the color information popup working for this entries like it does for the other color entries. I looked for the popup code and couldn't find it cause it is probably a callback or something like that.

paxcut and others added 3 commits November 28, 2024 12:30
…made it easier by creating a function that clears it. I tested the implementation by simulating a code error and I got a nice descriptive error message about why the color visualizer wasn't working. I fixed it and went back to working as before.
@WerWolv WerWolv merged commit 9de3dd8 into WerWolv:master Nov 29, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants