1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 13:17:43 +00:00

FontEditor: Convert to east const

This commit is contained in:
thankyouverycool 2021-11-29 12:06:10 -05:00 committed by Andreas Kling
parent de77e28360
commit ca062d83db
8 changed files with 19 additions and 19 deletions

View file

@ -41,7 +41,7 @@
#include <stdlib.h> #include <stdlib.h>
static constexpr int s_pangram_count = 7; static constexpr int s_pangram_count = 7;
static const char* pangrams[s_pangram_count] = { static char const* pangrams[s_pangram_count] = {
"quick fox jumps nightly above wizard", "quick fox jumps nightly above wizard",
"five quacking zephyrs jolt my wax bed", "five quacking zephyrs jolt my wax bed",
"pack my box with five dozen liquor jugs", "pack my box with five dozen liquor jugs",
@ -362,7 +362,7 @@ FontEditorWidget::FontEditorWidget()
glyph_transform_toolbar.add_action(*m_rotate_counterclockwise_action); glyph_transform_toolbar.add_action(*m_rotate_counterclockwise_action);
glyph_transform_toolbar.add_action(*m_rotate_clockwise_action); glyph_transform_toolbar.add_action(*m_rotate_clockwise_action);
GUI::Clipboard::the().on_change = [&](const String& data_type) { GUI::Clipboard::the().on_change = [&](String const& data_type) {
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor"); m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
}; };
@ -488,7 +488,7 @@ FontEditorWidget::~FontEditorWidget()
{ {
} }
void FontEditorWidget::initialize(const String& path, RefPtr<Gfx::BitmapFont>&& edited_font) void FontEditorWidget::initialize(String const& path, RefPtr<Gfx::BitmapFont>&& edited_font)
{ {
if (m_edited_font == edited_font) if (m_edited_font == edited_font)
return; return;
@ -604,7 +604,7 @@ void FontEditorWidget::initialize_menubar(GUI::Window& window)
help_menu.add_action(GUI::CommonActions::make_about_action("Font Editor", GUI::Icon::default_icon("app-font-editor"), &window)); help_menu.add_action(GUI::CommonActions::make_about_action("Font Editor", GUI::Icon::default_icon("app-font-editor"), &window));
} }
bool FontEditorWidget::save_as(const String& path) bool FontEditorWidget::save_as(String const& path)
{ {
auto saved_font = m_edited_font->masked_character_set(); auto saved_font = m_edited_font->masked_character_set();
auto ret_val = saved_font->write_to_file(path); auto ret_val = saved_font->write_to_file(path);

View file

@ -21,13 +21,13 @@ public:
virtual ~FontEditorWidget() override; virtual ~FontEditorWidget() override;
bool open_file(String const&); bool open_file(String const&);
bool save_as(const String&); bool save_as(String const&);
bool request_close(); bool request_close();
void update_title(); void update_title();
const String& path() { return m_path; } String const& path() { return m_path; }
const Gfx::BitmapFont& edited_font() { return *m_edited_font; } Gfx::BitmapFont const& edited_font() { return *m_edited_font; }
void initialize(const String& path, RefPtr<Gfx::BitmapFont>&&); void initialize(String const& path, RefPtr<Gfx::BitmapFont>&&);
void initialize_menubar(GUI::Window&); void initialize_menubar(GUI::Window&);
bool is_showing_font_metadata() { return m_font_metadata; } bool is_showing_font_metadata() { return m_font_metadata; }

View file

@ -224,7 +224,7 @@ void GlyphEditorWidget::enter_event(Core::Event&)
set_override_cursor(Gfx::StandardCursor::None); set_override_cursor(Gfx::StandardCursor::None);
} }
void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event) void GlyphEditorWidget::draw_at_mouse(GUI::MouseEvent const& event)
{ {
bool set = event.buttons() & GUI::MouseButton::Primary; bool set = event.buttons() & GUI::MouseButton::Primary;
bool unset = event.buttons() & GUI::MouseButton::Secondary; bool unset = event.buttons() & GUI::MouseButton::Secondary;
@ -245,7 +245,7 @@ void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event)
update(); update();
} }
void GlyphEditorWidget::move_at_mouse(const GUI::MouseEvent& event) void GlyphEditorWidget::move_at_mouse(GUI::MouseEvent const& event)
{ {
int x_delta = ((event.x() - 1) / m_scale) - m_scaled_offset_x; int x_delta = ((event.x() - 1) / m_scale) - m_scaled_offset_x;
int y_delta = ((event.y() - 1) / m_scale) - m_scaled_offset_y; int y_delta = ((event.y() - 1) / m_scale) - m_scaled_offset_y;

View file

@ -44,7 +44,7 @@ public:
int preferred_height() const; int preferred_height() const;
Gfx::BitmapFont& font() { return *m_font; } Gfx::BitmapFont& font() { return *m_font; }
const Gfx::BitmapFont& font() const { return *m_font; } Gfx::BitmapFont const& font() const { return *m_font; }
int scale() const { return m_scale; } int scale() const { return m_scale; }
void set_scale(int scale); void set_scale(int scale);
@ -63,8 +63,8 @@ private:
virtual void mouseup_event(GUI::MouseEvent&) override; virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void enter_event(Core::Event&) override; virtual void enter_event(Core::Event&) override;
void draw_at_mouse(const GUI::MouseEvent&); void draw_at_mouse(GUI::MouseEvent const&);
void move_at_mouse(const GUI::MouseEvent&); void move_at_mouse(GUI::MouseEvent const&);
RefPtr<Gfx::BitmapFont> m_font; RefPtr<Gfx::BitmapFont> m_font;
int m_glyph { 0 }; int m_glyph { 0 };

View file

@ -25,7 +25,7 @@ public:
int columns() const { return m_columns; } int columns() const { return m_columns; }
Gfx::BitmapFont& font() { return *m_font; } Gfx::BitmapFont& font() { return *m_font; }
const Gfx::BitmapFont& font() const { return *m_font; } Gfx::BitmapFont const& font() const { return *m_font; }
Function<void(int)> on_glyph_selected; Function<void(int)> on_glyph_selected;

View file

@ -93,7 +93,7 @@ private:
if (event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary)) if (event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary))
draw_at_mouse(event); draw_at_mouse(event);
} }
void draw_at_mouse(const MouseEvent& event) void draw_at_mouse(MouseEvent const& event)
{ {
bool set = event.buttons() & MouseButton::Primary; bool set = event.buttons() & MouseButton::Primary;
bool unset = event.buttons() & MouseButton::Secondary; bool unset = event.buttons() & MouseButton::Secondary;

View file

@ -12,7 +12,7 @@
class UndoGlyph : public RefCounted<UndoGlyph> { class UndoGlyph : public RefCounted<UndoGlyph> {
public: public:
explicit UndoGlyph(const u32 code_point, const Gfx::BitmapFont& font) explicit UndoGlyph(u32 const code_point, Gfx::BitmapFont const& font)
: m_code_point(code_point) : m_code_point(code_point)
, m_font(font) , m_font(font)
{ {
@ -27,7 +27,7 @@ public:
state->m_width = glyph.width(); state->m_width = glyph.width();
return state; return state;
} }
void restore_state(const UndoGlyph& state) const void restore_state(UndoGlyph const& state) const
{ {
auto bitmap = font().glyph(state.m_code_point).glyph_bitmap(); auto bitmap = font().glyph(state.m_code_point).glyph_bitmap();
for (int x = 0; x < font().max_glyph_width(); x++) for (int x = 0; x < font().max_glyph_width(); x++)
@ -38,7 +38,7 @@ public:
} }
void set_code_point(u32 code_point) { m_code_point = code_point; } void set_code_point(u32 code_point) { m_code_point = code_point; }
void set_font(Gfx::BitmapFont& font) { m_font = font; } void set_font(Gfx::BitmapFont& font) { m_font = font; }
const Gfx::BitmapFont& font() const { return *m_font; } Gfx::BitmapFont const& font() const { return *m_font; }
u8 restored_width() const { return m_restored_width; } u8 restored_width() const { return m_restored_width; }
u32 restored_code_point() const { return m_restored_code_point; } u32 restored_code_point() const { return m_restored_code_point; }

View file

@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath")); TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath"));
const char* path = nullptr; char const* path = nullptr;
Core::ArgsParser args_parser; Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No); args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No);
args_parser.parse(arguments); args_parser.parse(arguments);