Commit graph

25 commits

Author SHA1 Message Date
thankyouverycool
804baa42f9 LibGUI: Standardize automatic scrolling in TextEditor+GlyphMapWidget
Both widgets now make use of their base class's scrolling timer and
now always accept drag selection updates on mousemove_event().

This guarantees much snappier feeling selections when actively moving
the mouse.
2022-12-26 09:27:19 +01:00
thankyouverycool
40e94a315a LibGUI+FontEditor: Restore normalized selections on Undo/Redo
Selections are always normalized when saving undo commands.
The restore_selection() function reverses this process so
negatively sized selections (created right-to-left) continue
to resize correctly with the keyboard when restored.
2022-12-20 10:22:27 +01:00
thankyouverycool
673afffd5a LibGUI: Only reset GlyphMapWidget selection on Escape
and when using unmodified arrows.
2022-12-20 10:22:27 +01:00
thankyouverycool
a98d5c52f8 LibGUI: Improve visible glyph estimate in GlyphMapWidget
Previously the widget used a very rough estimate for visible glyphs
based on viewport and glyph areas. Now it simply figures rows times
columns with a two row overdraw to accommodate fractional glyphs
on either end of visible content. For KaticaRegular10, this ends up
reducing unnecessary glyph iterations during painting by about 30%.
2022-12-20 10:22:27 +01:00
thankyouverycool
e34503800c LibGUI: Adjust GlyphMapWidget content sizing and glyph padding
Fixes a slightly oversized content rect and erroneous glyph outer
rect values. Increases glyph rect padding to guarantee at least 1px
between the focus rect and glyph.
2022-12-20 10:22:27 +01:00
thankyouverycool
0f5ce017c5 LibGUI: Implement calculated_min_size() for GlyphMapWidget 2022-12-20 10:22:27 +01:00
thankyouverycool
360e58a276 LibGUI: Disallow GlyphMapWidget selection sizes equal to zero
This is a bogus size as the map must always have at least 1 glyph
selected, and it was causing occasional desync between selection
contents and the focused glyph when manipulating selections with
the keyboard.
2022-12-20 10:22:27 +01:00
thankyouverycool
9725fd162f LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail
And TRY early during initialization in FontEditor to leave the app
in a valid state on error. Fixes OOM crashes when cloning the original
font for highlight modifications.
2022-11-19 15:41:09 +01:00
thankyouverycool
d9fb838cf6 LibGUI+FontEditor: Allow system emoji to be toggled in GlyphMapWidget
And remove their red backgrounds when visible to not be confused with
deletion highlights.
2022-11-19 15:41:09 +01:00
Sam Atkins
014d825472 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.
2022-08-14 13:59:19 +01:00
Simon Wanner
206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
thankyouverycool
b8cc18896f LibGUI+FontEditor: Add context menu for editor actions
GlyphMapWidget now reports context menu requests when secondary
clicking the map. This also adds a new Select All action and updates
the Copy Character action to work on multi-glyph selections. Glyph
navigation actions have been moved to a separate Go menu, as is
common in other apps.
2022-03-20 20:00:25 +01:00
thankyouverycool
df443863bd LibGUI: Add set_selection() convenience helper to GlyphMapWidget 2022-03-20 20:00:25 +01:00
thankyouverycool
5c6326ae23 LibGUI: Add automatic scrolling to GlyphMapWidget
Similar to TextEditor, GlyphMapWidget now automatically scrolls
when dragging a selection outside its boundaries.
2022-03-20 20:00:25 +01:00
Maciej
a95794a356 LibGUI: Clamp selection when drag-selecting over out of range area 2022-03-17 17:05:56 +01:00
Lenny Maiorani
fe3b846ac8 Libraries: Use default constructors/destructors in LibGUI
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-12 14:44:43 -08:00
thankyouverycool
170afc2f47 LibGUI: Allow GlyphMapWidget to filter by code point ranges 2022-02-15 10:13:19 -05:00
kleines Filmröllchen
145eeb57ab Userland: Remove a bunch of unnecessary Vector imports
How silly :^)
2022-01-28 23:40:25 +01:00
thankyouverycool
66e72ed5e6 LibGUI: Allow selecting glyphs by dragging in GlyphMapWidget 2022-01-16 21:36:39 +01:00
Sam Atkins
e975db23c0 LibGUI+FontEditor: Move seek-prev/next-glyph logic into GlyphMapWidget 2022-01-16 11:17:03 +01:00
Sam Atkins
ff500ffcc4 LibGUI: Add on_glyph_double_clicked() callback to GlyphMapWidget
This will be used by CharacterMap.

In implementing this, extracted the logic for finding which glyph is at
a given position within the widget.
2022-01-16 11:17:03 +01:00
Sam Atkins
70a79ea70c LibGUI: Remove unused method definitions from GlyphMapWidget
These got added recently but were never implemented, so let's remove
them. :^)
2022-01-16 11:17:03 +01:00
Sam Atkins
15a7dfbc30 LibGUI: Recalculate GlyphMapWidget content size when changing font
Previously, if it was displaying N glyphs per line, then you changed
font to one that was a drastically different size, it would continue to
display N glyphs per line until you resized the window. Now, we
immediately recalculate how many to show, so that they fill the
available width. :^)
2022-01-16 11:17:03 +01:00
Sam Atkins
21a24c36a8 LibGUI: Make GlyphMapWidget work with vector fonts
This basically just meant replacing the `m_font` field with the one
inherited from Widget.
2022-01-16 11:17:03 +01:00
Sam Atkins
8175cd0a28 LibGUI+FontEditor: Move GlyphMapWidget to LibGUI
This will allow us to use this in other apps, such as the upcoming
Character Map. :^)
2022-01-16 11:17:03 +01:00
Renamed from Userland/Applications/FontEditor/GlyphMapWidget.h (Browse further)