mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
FontEditor: Update GlyphEditor and width widgets on paste and delete
Fixes unsynced state between widgets after paste and delete actions.
This commit is contained in:
parent
7d7f683715
commit
c2b7bbbb2c
1 changed files with 14 additions and 11 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue