FontEditor: Don't allow cutting and copying absent glyphs

And update status bar on cut. Fixes placing these effectless actions
on the undo stack.
This commit is contained in:
thankyouverycool 2021-11-29 09:52:56 -05:00 committed by Andreas Kling
parent d2b211f14a
commit 281805696b
Notes: sideshowbarker 2024-07-17 23:20:58 +09:00

View file

@ -177,9 +177,18 @@ FontEditorWidget::FontEditorWidget()
save_as(save_path.value());
});
m_cut_action = GUI::CommonActions::make_cut_action([&](auto&) {
if (!m_edited_font->contains_raw_glyph(m_glyph_map_widget->selected_glyph()))
return;
m_glyph_editor_widget->cut_glyph();
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&) {
if (!m_edited_font->contains_raw_glyph(m_glyph_map_widget->selected_glyph()))
return;
m_glyph_editor_widget->copy_glyph();
});
m_paste_action = GUI::CommonActions::make_paste_action([&](auto&) {