summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-01-09 13:02:16 -0500
committerAndreas Kling <kling@serenityos.org>2022-01-16 21:36:39 +0100
commitc2b7bbbb2c249b76ed08226df2e6e3929114e75f (patch)
treef8a979fc7ceeeb11c4612148b153603d8fca6bac /Userland
parent7d7f68371562e9cfa30c7302590ed5c695c2b844 (diff)
downloadserenity-c2b7bbbb2c249b76ed08226df2e6e3929114e75f.zip
FontEditor: Update GlyphEditor and width widgets on paste and delete
Fixes unsynced state between widgets after paste and delete actions.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/FontEditor/FontEditor.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp
index 5e6e86900d..f0845e6382 100644
--- a/Userland/Applications/FontEditor/FontEditor.cpp
+++ b/Userland/Applications/FontEditor/FontEditor.cpp
@@ -180,27 +180,16 @@ FontEditorWidget::FontEditorWidget()
});
m_cut_action = GUI::CommonActions::make_cut_action([&](auto&) {
cut_selected_glyphs();
- if (m_edited_font->is_fixed_width())
- m_glyph_editor_present_checkbox->set_checked(false, GUI::AllowCallback::No);
- else
- m_glyph_editor_width_spinbox->set_value(0, GUI::AllowCallback::No);
- update_statusbar();
});
m_copy_action = GUI::CommonActions::make_copy_action([&](auto&) {
copy_selected_glyphs();
});
m_paste_action = GUI::CommonActions::make_paste_action([&](auto&) {
paste_glyphs();
- update_statusbar();
});
m_paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type() == "glyph/x-fonteditor");
m_delete_action = GUI::CommonActions::make_delete_action([this](auto&) {
delete_selected_glyphs();
- if (m_edited_font->is_fixed_width())
- m_glyph_editor_present_checkbox->set_checked(false, GUI::AllowCallback::No);
- else
- m_glyph_editor_width_spinbox->set_value(0, GUI::AllowCallback::No);
- update_statusbar();
});
m_undo_action = GUI::CommonActions::make_undo_action([&](auto&) {
undo();
@@ -856,7 +845,13 @@ void FontEditorWidget::paste_glyphs()
m_glyph_editor_widget->on_glyph_altered(glyph);
}
+ if (m_edited_font->is_fixed_width())
+ m_glyph_editor_present_checkbox->set_checked(m_edited_font->contains_raw_glyph(m_glyph_map_widget->active_glyph()), GUI::AllowCallback::No);
+ else
+ m_glyph_editor_width_spinbox->set_value(m_edited_font->raw_glyph_width(m_glyph_map_widget->active_glyph()), GUI::AllowCallback::No);
+
m_glyph_editor_widget->update();
+ update_statusbar();
}
void FontEditorWidget::delete_selected_glyphs()
@@ -882,4 +877,12 @@ void FontEditorWidget::delete_selected_glyphs()
for (int i = selection.start(); i < selection.start() + selection.size(); i++)
delete_glyph(i);
+
+ if (m_edited_font->is_fixed_width())
+ m_glyph_editor_present_checkbox->set_checked(false, GUI::AllowCallback::No);
+ else
+ m_glyph_editor_width_spinbox->set_value(0, GUI::AllowCallback::No);
+
+ m_glyph_editor_widget->update();
+ update_statusbar();
}