2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-02-02 10:05:14 +03:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-22 21:12:53 +03:00
|
|
|
#include "UndoGlyph.h"
|
|
|
|
#include <LibGUI/ActionGroup.h>
|
|
|
|
#include <LibGUI/UndoStack.h>
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/Widget.h>
|
2020-12-31 16:01:59 +03:00
|
|
|
#include <LibGfx/BitmapFont.h>
|
2019-02-02 10:05:14 +03:00
|
|
|
|
|
|
|
class GlyphEditorWidget;
|
|
|
|
class GlyphMapWidget;
|
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
class FontEditorWidget final : public GUI::Widget {
|
2019-09-21 21:04:00 +03:00
|
|
|
C_OBJECT(FontEditorWidget)
|
2019-02-02 10:05:14 +03:00
|
|
|
public:
|
|
|
|
virtual ~FontEditorWidget() override;
|
|
|
|
|
2021-11-29 17:07:47 +03:00
|
|
|
bool open_file(String const&);
|
2021-11-29 20:06:10 +03:00
|
|
|
bool save_as(String const&);
|
2021-04-26 16:11:14 +03:00
|
|
|
bool request_close();
|
|
|
|
void update_title();
|
2020-07-11 04:20:39 +03:00
|
|
|
|
2021-11-29 20:06:10 +03:00
|
|
|
String const& path() { return m_path; }
|
|
|
|
Gfx::BitmapFont const& edited_font() { return *m_edited_font; }
|
|
|
|
void initialize(String const& path, RefPtr<Gfx::BitmapFont>&&);
|
2021-07-21 22:21:03 +03:00
|
|
|
void initialize_menubar(GUI::Window&);
|
2021-04-06 19:04:21 +03:00
|
|
|
|
|
|
|
bool is_showing_font_metadata() { return m_font_metadata; }
|
|
|
|
void set_show_font_metadata(bool b);
|
|
|
|
|
|
|
|
Function<void()> on_initialize;
|
2020-07-11 04:20:39 +03:00
|
|
|
|
2019-02-02 10:05:14 +03:00
|
|
|
private:
|
2021-11-29 17:07:47 +03:00
|
|
|
FontEditorWidget();
|
2021-04-22 21:12:53 +03:00
|
|
|
|
2021-10-13 23:16:25 +03:00
|
|
|
virtual void drop_event(GUI::DropEvent&) override;
|
|
|
|
|
2021-04-22 21:12:53 +03:00
|
|
|
void undo();
|
|
|
|
void redo();
|
2021-04-26 16:11:14 +03:00
|
|
|
void did_modify_font();
|
2021-11-29 18:05:57 +03:00
|
|
|
void did_resize_glyph_editor();
|
2021-09-22 16:25:25 +03:00
|
|
|
void update_statusbar();
|
|
|
|
void update_preview();
|
2021-04-22 21:12:53 +03:00
|
|
|
|
2020-12-31 16:01:59 +03:00
|
|
|
RefPtr<Gfx::BitmapFont> m_edited_font;
|
2019-02-03 01:13:12 +03:00
|
|
|
|
2020-03-04 21:07:55 +03:00
|
|
|
RefPtr<GlyphMapWidget> m_glyph_map_widget;
|
|
|
|
RefPtr<GlyphEditorWidget> m_glyph_editor_widget;
|
2019-02-05 09:23:01 +03:00
|
|
|
|
2021-04-10 20:40:59 +03:00
|
|
|
RefPtr<GUI::Action> m_new_action;
|
|
|
|
RefPtr<GUI::Action> m_open_action;
|
|
|
|
RefPtr<GUI::Action> m_save_action;
|
|
|
|
RefPtr<GUI::Action> m_save_as_action;
|
|
|
|
|
|
|
|
RefPtr<GUI::Action> m_cut_action;
|
|
|
|
RefPtr<GUI::Action> m_copy_action;
|
|
|
|
RefPtr<GUI::Action> m_paste_action;
|
|
|
|
RefPtr<GUI::Action> m_delete_action;
|
|
|
|
|
2021-04-22 21:12:53 +03:00
|
|
|
RefPtr<GUI::Action> m_undo_action;
|
|
|
|
RefPtr<GUI::Action> m_redo_action;
|
|
|
|
RefPtr<UndoGlyph> m_undo_glyph;
|
|
|
|
OwnPtr<GUI::UndoStack> m_undo_stack;
|
|
|
|
|
2021-09-09 14:43:19 +03:00
|
|
|
RefPtr<GUI::Action> m_go_to_glyph_action;
|
|
|
|
RefPtr<GUI::Action> m_previous_glyph_action;
|
|
|
|
RefPtr<GUI::Action> m_next_glyph_action;
|
|
|
|
|
2021-04-10 20:40:59 +03:00
|
|
|
RefPtr<GUI::Action> m_open_preview_action;
|
|
|
|
RefPtr<GUI::Action> m_show_metadata_action;
|
|
|
|
|
2021-04-22 21:04:19 +03:00
|
|
|
GUI::ActionGroup m_glyph_editor_scale_actions;
|
|
|
|
RefPtr<GUI::Action> m_scale_five_action;
|
|
|
|
RefPtr<GUI::Action> m_scale_ten_action;
|
|
|
|
RefPtr<GUI::Action> m_scale_fifteen_action;
|
|
|
|
|
2021-11-29 17:26:24 +03:00
|
|
|
GUI::ActionGroup m_glyph_tool_actions;
|
|
|
|
RefPtr<GUI::Action> m_move_glyph_action;
|
|
|
|
RefPtr<GUI::Action> m_paint_glyph_action;
|
|
|
|
|
|
|
|
RefPtr<GUI::Action> m_flip_horizontal_action;
|
|
|
|
RefPtr<GUI::Action> m_flip_vertical_action;
|
|
|
|
RefPtr<GUI::Action> m_rotate_clockwise_action;
|
|
|
|
RefPtr<GUI::Action> m_rotate_counterclockwise_action;
|
|
|
|
RefPtr<GUI::Action> m_copy_character_action;
|
|
|
|
|
2021-09-22 16:25:25 +03:00
|
|
|
RefPtr<GUI::Statusbar> m_statusbar;
|
2021-04-06 19:04:21 +03:00
|
|
|
RefPtr<GUI::Window> m_font_preview_window;
|
|
|
|
RefPtr<GUI::Widget> m_left_column_container;
|
|
|
|
RefPtr<GUI::Widget> m_glyph_editor_container;
|
2021-04-10 20:40:59 +03:00
|
|
|
RefPtr<GUI::ComboBox> m_weight_combobox;
|
2021-09-24 03:07:34 +03:00
|
|
|
RefPtr<GUI::ComboBox> m_slope_combobox;
|
2021-04-06 19:04:21 +03:00
|
|
|
RefPtr<GUI::SpinBox> m_spacing_spinbox;
|
|
|
|
RefPtr<GUI::SpinBox> m_baseline_spinbox;
|
|
|
|
RefPtr<GUI::SpinBox> m_mean_line_spinbox;
|
|
|
|
RefPtr<GUI::SpinBox> m_presentation_spinbox;
|
|
|
|
RefPtr<GUI::SpinBox> m_glyph_editor_width_spinbox;
|
2021-04-18 21:12:52 +03:00
|
|
|
RefPtr<GUI::CheckBox> m_glyph_editor_present_checkbox;
|
2021-04-06 19:04:21 +03:00
|
|
|
RefPtr<GUI::TextBox> m_name_textbox;
|
|
|
|
RefPtr<GUI::TextBox> m_family_textbox;
|
|
|
|
RefPtr<GUI::CheckBox> m_fixed_width_checkbox;
|
|
|
|
RefPtr<GUI::GroupBox> m_font_metadata_groupbox;
|
|
|
|
|
2019-02-05 09:23:01 +03:00
|
|
|
String m_path;
|
2021-04-10 20:40:59 +03:00
|
|
|
Vector<String> m_font_weight_list;
|
2021-09-24 03:07:34 +03:00
|
|
|
Vector<String> m_font_slope_list;
|
2021-04-06 19:04:21 +03:00
|
|
|
bool m_font_metadata { true };
|
2019-02-02 10:05:14 +03:00
|
|
|
};
|