WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
42.78k stars 1.88k forks source link

[Feature] Color on struct when the struct is folded #1402

Open leenzhu opened 10 months ago

leenzhu commented 10 months ago

What feature would you like to see?

When we assign a color to a struct, and when the struct isn't expanded, we want the hex editor ignore the color of each field, and display all the field in the struct's color. And the patter data display the struct's color.

image

When we expand the struct, each filed would displayed with different color while draw an outline with the struct with the color of struct.

image

How will this feature be useful to you and others?

It would help us to have an overview of the file's layout before diving into the detailed fields.

Request Type

Additional context?

No response

WerWolv commented 10 months ago

Hey I generally like the idea! Need to see how easy it is to implement though

Nemoumbra commented 10 months ago

and when the struct isn't expanded

Would you also prefer the field colors to be ignored when the Pattern data view is closed too?

leenzhu commented 10 months ago

Hey I generally like the idea! Need to see how easy it is to implement though

Glade to hear that!

I have some idear about it:

  1. If users haven't assign a color to a struct, the struct has a random color.
  2. If users assign a color to a struct, the current behavior is that all the members inherit the color of the struct, we need to add an option to indicate that we wanna inhibit this behavior, so that each member of the struct could have different color.
  3. When the struct isn't expanded, let the color of struct take priority over the members.
  4. When the struct has been expanded, the color of members are given priority.

And further more, Sometimes we may still need the default color rendering even when the tree is collapsed, It would be better to add a check button to toggle the behavior of expanding.

Hope this would be helpfull, thanks.

leenzhu commented 10 months ago

and when the struct isn't expanded

Would you also prefer the field colors to be ignored when the Pattern data view is closed too?

I think the color render behavior is depended on the state of the pattern data view tree.

So no matter the pattern data view is open or closed, it doesn't change the state of the tree.

C3pa commented 2 months ago

This looks semi-related to #1274.