diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-12-17 15:45:53 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-20 10:22:27 +0100 |
commit | 96d7964913beacee2d9e6de833b9aefc46fd6786 (patch) | |
tree | cd93c1f0ff7fe1617b8aa2cf2a23c2567e4800e9 /Userland | |
parent | 40e94a315a8dee8eebda93ad2c94042258cf533f (diff) | |
download | serenity-96d7964913beacee2d9e6de833b9aefc46fd6786.zip |
FontEditor: Add Unicode block/glyph selection Statusbar Segment
Displays the current active Unicode block range, or, if multiple
glyphs are selected, their count. Clicking toggles the Unicode
block ListView.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/FontEditor/FontEditorWindow.gml | 1 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/MainWidget.cpp | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Userland/Applications/FontEditor/FontEditorWindow.gml b/Userland/Applications/FontEditor/FontEditorWindow.gml index 7bbb607049..cc4ae69179 100644 --- a/Userland/Applications/FontEditor/FontEditorWindow.gml +++ b/Userland/Applications/FontEditor/FontEditorWindow.gml @@ -235,5 +235,6 @@ @GUI::Statusbar { name: "statusbar" + segment_count: 2 } } diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index 048a299171..2e2711d092 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -172,6 +172,7 @@ ErrorOr<void> MainWidget::create_actions() auto selection = m_glyph_map_widget->selection().normalized(); m_undo_selection->set_start(selection.start()); m_undo_selection->set_size(selection.size()); + update_statusbar(); }); m_open_preview_action = GUI::Action::create("&Preview Font", { Mod_Ctrl, Key_P }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)), [&](auto&) { @@ -459,6 +460,10 @@ MainWidget::MainWidget() m_context_menu->popup(event.screen_position()); }; + m_glyph_map_widget->on_escape_pressed = [this]() { + update_statusbar(); + }; + m_name_textbox = find_descendant_of_type_named<GUI::TextBox>("name_textbox"); m_name_textbox->on_change = [&] { m_edited_font->set_name(m_name_textbox->text()); @@ -567,6 +572,12 @@ MainWidget::MainWidget() }; m_statusbar = find_descendant_of_type_named<GUI::Statusbar>("statusbar"); + m_statusbar->segment(1).set_mode(GUI::Statusbar::Segment::Mode::Auto); + m_statusbar->segment(1).set_clickable(true); + m_statusbar->segment(1).on_click = [&](auto) { + m_show_unicode_blocks_action->activate(); + }; + GUI::Application::the()->on_action_enter = [this](GUI::Action& action) { auto text = action.status_tip(); if (text.is_empty()) @@ -753,6 +764,10 @@ void MainWidget::set_show_unicode_blocks(bool show) return; m_unicode_blocks = show; m_unicode_block_container->set_visible(m_unicode_blocks); + if (show) + m_search_textbox->set_focus(true); + else + m_glyph_map_widget->set_focus(true); } void MainWidget::set_highlight_modifications(bool highlight_modifications) @@ -922,6 +937,15 @@ void MainWidget::update_statusbar() else if (Gfx::Emoji::emoji_for_code_point(glyph)) builder.appendff(" [emoji]"); m_statusbar->set_text(builder.to_deprecated_string()); + + builder.clear(); + + auto selection = m_glyph_map_widget->selection().normalized(); + if (selection.size() > 1) + builder.appendff("{} glyphs selected", selection.size()); + else + builder.appendff("U+{:04X}-U+{:04X}", m_range.first, m_range.last); + m_statusbar->set_text(1, builder.to_deprecated_string()); } void MainWidget::update_preview() |