mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 02:58:12 +00:00
FontEditor: Allow specifying which font to edit on the command line.
Also add a quit button. The quit button has a tendency to freeze the kernel. That doesn't seem entirely right.
This commit is contained in:
parent
d459525725
commit
af21a45b1a
3 changed files with 34 additions and 10 deletions
|
@ -4,14 +4,14 @@
|
|||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GTextBox.h>
|
||||
|
||||
FontEditorWidget::FontEditorWidget(GWidget* parent)
|
||||
FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent)
|
||||
: GWidget(parent)
|
||||
, m_edited_font(move(edited_font))
|
||||
{
|
||||
m_edited_font = Font::load_from_file("/saved.font");
|
||||
if (m_edited_font)
|
||||
m_edited_font = m_edited_font->clone();
|
||||
if (path.is_empty())
|
||||
m_path = "/saved.font";
|
||||
else
|
||||
m_edited_font = Font::default_font().clone();
|
||||
m_path = path;
|
||||
|
||||
m_glyph_map_widget = new GlyphMapWidget(*m_edited_font, this);
|
||||
m_glyph_map_widget->move_to({ 90, 5 });
|
||||
|
@ -30,7 +30,15 @@ FontEditorWidget::FontEditorWidget(GWidget* parent)
|
|||
save_button->set_caption("Save");
|
||||
save_button->set_relative_rect({ 5, 170, 100, 20 });
|
||||
save_button->on_click = [this] (GButton&) {
|
||||
m_edited_font->write_to_file("/saved.font");
|
||||
dbgprintf("write to file: '%s'\n", m_path.characters());
|
||||
m_edited_font->write_to_file(m_path);
|
||||
};
|
||||
|
||||
auto* quit_button = new GButton(this);
|
||||
quit_button->set_caption("Quit");
|
||||
quit_button->set_relative_rect({ 110, 170, 100, 20 });
|
||||
quit_button->on_click = [] (GButton&) {
|
||||
exit(0);
|
||||
};
|
||||
|
||||
auto* info_label = new GLabel(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue