mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
FontEditor: Add ability to copy the selected code point
This makes it easier to preview the current glyph, if it is not easily typable.
This commit is contained in:
parent
7180813cd4
commit
8d80d1346d
2 changed files with 26 additions and 0 deletions
|
@ -116,6 +116,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
|
||||||
auto& rotate_90_button = *find_descendant_of_type_named<GUI::Button>("rotate_90");
|
auto& rotate_90_button = *find_descendant_of_type_named<GUI::Button>("rotate_90");
|
||||||
auto& flip_vertical_button = *find_descendant_of_type_named<GUI::Button>("flip_vertical");
|
auto& flip_vertical_button = *find_descendant_of_type_named<GUI::Button>("flip_vertical");
|
||||||
auto& flip_horizontal_button = *find_descendant_of_type_named<GUI::Button>("flip_horizontal");
|
auto& flip_horizontal_button = *find_descendant_of_type_named<GUI::Button>("flip_horizontal");
|
||||||
|
auto& copy_code_point_button = *find_descendant_of_type_named<GUI::Button>("copy_code_point");
|
||||||
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||||
m_glyph_editor_container = *find_descendant_of_type_named<GUI::Widget>("glyph_editor_container");
|
m_glyph_editor_container = *find_descendant_of_type_named<GUI::Widget>("glyph_editor_container");
|
||||||
m_left_column_container = *find_descendant_of_type_named<GUI::Widget>("left_column_container");
|
m_left_column_container = *find_descendant_of_type_named<GUI::Widget>("left_column_container");
|
||||||
|
@ -347,6 +348,13 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
|
||||||
};
|
};
|
||||||
flip_horizontal_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png").release_value_but_fixme_should_propagate_errors());
|
flip_horizontal_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png").release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
||||||
|
copy_code_point_button.on_click = [&](auto) {
|
||||||
|
StringBuilder glyph_builder;
|
||||||
|
glyph_builder.append_code_point(m_glyph_editor_widget->glyph());
|
||||||
|
GUI::Clipboard::the().set_plain_text(glyph_builder.build());
|
||||||
|
};
|
||||||
|
copy_code_point_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
||||||
GUI::Clipboard::the().on_change = [&](const String& data_type) {
|
GUI::Clipboard::the().on_change = [&](const String& data_type) {
|
||||||
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
|
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,6 +80,13 @@
|
||||||
button_style: "Coolbar"
|
button_style: "Coolbar"
|
||||||
focus_policy: "TabFocus"
|
focus_policy: "TabFocus"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::Widget {
|
||||||
|
shrink_to_fit: true
|
||||||
|
|
||||||
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
|
}
|
||||||
|
|
||||||
@GUI::Button {
|
@GUI::Button {
|
||||||
name: "rotate_90"
|
name: "rotate_90"
|
||||||
|
@ -88,6 +95,17 @@
|
||||||
button_style: "Coolbar"
|
button_style: "Coolbar"
|
||||||
focus_policy: "TabFocus"
|
focus_policy: "TabFocus"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GUI::Widget {
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::Button {
|
||||||
|
name: "copy_code_point"
|
||||||
|
fixed_width: 22
|
||||||
|
tooltip: "Copy this codepoint (not glyph)"
|
||||||
|
button_style: "Coolbar"
|
||||||
|
focus_policy: "TabFocus"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue