serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibGUI: Allow GlyphMapWidget to highlight modified glyphs

Open AtkinsSJ opened this issue 2 years ago • 1 comments

image

This makes modifications in FontEditor more visible, both so you know what you've changed, and for taking a handy "here's what's changed" screenshot for a font PR. :^)

The background color for new glyphs is green, modified glyphs is blue, and deleted glyphs is red. The changes persist until you load a new font file, so you can continue saving your work as you go and still be able to take a convenient screenshot at the end.

FontEditor does not currently mark glyphs as unmodified if you undo a change you made though.

AtkinsSJ avatar Jul 27 '22 15:07 AtkinsSJ

More love to FontEditor. ❤️

djwisdom avatar Jul 27 '22 18:07 djwisdom

Thanks everyone! I wasn't initially sure if this was a desired feature. I've improved it a bit:

  • Tweaked the colours because I wasn't happy with them.
  • Added darker versions of the colours when the theme is dark. (A proper solution might be to add color-roles for them, but it felt excessive for one application. If we end up with other apps wanting "created/modified/deleted" colours then we can move it into the theme then.)
  • Added undo support.
  • Add a menu option to show or hide the highlights.

New screenshots are in the first post. :^)

EDIT: The option to turn the highlights on/off has the explanation of the colours. I did try adding a (*) to the statusbar when a modified glyph is selected, but the statusbar is pretty noisy already.

AtkinsSJ avatar Aug 02 '22 13:08 AtkinsSJ

This is a really nice feature! MainWidget::paste_glyphs() doesn't trigger an update for individual glyphs, but set them modified and it should be able to color-code pasted selections too. Something like m_glyph_map_widget->set_glyph_modified(selection.start() + i, true); at the end of the range bound glyph count loop.

thankyouverycool avatar Aug 02 '22 15:08 thankyouverycool

This is a really nice feature! MainWidget::paste_glyphs() doesn't trigger an update for individual glyphs, but set them modified and it should be able to color-code pasted selections too. Something like m_glyph_map_widget->set_glyph_modified(selection.start() + i, true); at the end of the range bound glyph count loop.

Thank you, @thankyouverycool, very cool. I didn't know which email to use to co-author you so I just used the one GitHub displays. Let me know if you'd prefer something else. :^)

AtkinsSJ avatar Aug 03 '22 11:08 AtkinsSJ

Fixed a merge conflict.

AtkinsSJ avatar Aug 05 '22 15:08 AtkinsSJ