mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:17:46 +00:00
LibGUI: Allow GlyphMapWidget to highlight modified glyphs
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. I didn't feel like this one use was enough to add 3 new color roles to themes, so to make this look decent on dark themes, it detects if the theme is marked as dark, and uses darker colors for the highlights which look nice with a light text color.
This commit is contained in:
parent
bddbb49923
commit
014d825472
2 changed files with 67 additions and 3 deletions
|
@ -21,6 +21,8 @@ class GlyphMapWidget final : public AbstractScrollableWidget {
|
|||
public:
|
||||
virtual ~GlyphMapWidget() override = default;
|
||||
|
||||
void set_font(Gfx::Font const&);
|
||||
|
||||
class Selection {
|
||||
public:
|
||||
Selection() = default;
|
||||
|
@ -60,6 +62,10 @@ public:
|
|||
void scroll_to_glyph(int);
|
||||
void update_glyph(int);
|
||||
|
||||
void set_highlight_modifications(bool);
|
||||
void set_glyph_modified(u32 glyph, bool modified);
|
||||
bool glyph_is_modified(u32 glyph);
|
||||
|
||||
void select_previous_existing_glyph();
|
||||
void select_next_existing_glyph();
|
||||
|
||||
|
@ -88,6 +94,7 @@ private:
|
|||
|
||||
void recalculate_content_size();
|
||||
|
||||
RefPtr<Gfx::Font> m_original_font;
|
||||
int m_glyph_count { 0x110000 };
|
||||
int m_columns { 0 };
|
||||
int m_rows { 0 };
|
||||
|
@ -97,6 +104,8 @@ private:
|
|||
int m_active_glyph { 0 };
|
||||
int m_visible_glyphs { 0 };
|
||||
bool m_in_drag_select { false };
|
||||
bool m_highlight_modifications { false };
|
||||
HashTable<u32> m_modified_glyphs;
|
||||
Unicode::CodePointRange m_active_range { 0x0000, 0x10FFFF };
|
||||
RefPtr<Core::Timer> m_automatic_selection_scroll_timer;
|
||||
Gfx::IntPoint m_last_mousemove_position;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue