1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:17:36 +00:00

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.
This commit is contained in:
thankyouverycool 2022-03-19 13:29:55 -04:00 committed by Andreas Kling
parent 42284a1550
commit b8cc18896f
4 changed files with 59 additions and 9 deletions

View file

@ -182,8 +182,17 @@ int GlyphMapWidget::glyph_at_position_clamped(Gfx::IntPoint position) const
return glyph;
}
void GlyphMapWidget::context_menu_event(GUI::ContextMenuEvent& event)
{
if (on_context_menu_request)
on_context_menu_request(event);
}
void GlyphMapWidget::mousedown_event(MouseEvent& event)
{
if (event.button() == MouseButton::Secondary)
return;
if (auto maybe_glyph = glyph_at_position(event.position()); maybe_glyph.has_value()) {
auto glyph = maybe_glyph.value();
if (event.shift())
@ -196,6 +205,9 @@ void GlyphMapWidget::mousedown_event(MouseEvent& event)
void GlyphMapWidget::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() == MouseButton::Secondary)
return;
if (!m_in_drag_select)
return;
auto constrained = event.position().constrained(widget_inner_rect());