1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

Applications: Run clang-format on everything.

This commit is contained in:
Andreas Kling 2019-06-07 11:48:03 +02:00
parent e09c3a1ae8
commit fd604a7c68
24 changed files with 350 additions and 294 deletions

View file

@ -1,13 +1,13 @@
#include "FontEditor.h"
#include "GlyphMapWidget.h"
#include "GlyphEditorWidget.h"
#include <LibGUI/GPainter.h>
#include "GlyphMapWidget.h"
#include <LibGUI/GButton.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GTextBox.h>
#include <LibGUI/GCheckBox.h>
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GGroupBox.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GPainter.h>
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GTextBox.h>
#include <stdlib.h>
FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent)
@ -52,7 +52,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
auto* save_button = new GButton(this);
save_button->set_text("Save");
save_button->set_relative_rect({ 5, 300, 105, 20 });
save_button->on_click = [this] (GButton&) {
save_button->on_click = [this](GButton&) {
dbgprintf("write to file: '%s'\n", m_path.characters());
m_edited_font->write_to_file(m_path);
};
@ -60,7 +60,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
auto* quit_button = new GButton(this);
quit_button->set_text("Quit");
quit_button->set_relative_rect({ 110, 300, 105, 20 });
quit_button->on_click = [] (GButton&) {
quit_button->on_click = [](GButton&) {
exit(0);
};
@ -91,25 +91,25 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
demo_label_2->update();
};
m_glyph_editor_widget->on_glyph_altered = [this, update_demo] (byte glyph) {
m_glyph_editor_widget->on_glyph_altered = [this, update_demo](byte glyph) {
m_glyph_map_widget->update_glyph(glyph);
update_demo();
};
m_glyph_map_widget->on_glyph_selected = [this, info_label, width_spinbox] (byte glyph) {
m_glyph_map_widget->on_glyph_selected = [this, info_label, width_spinbox](byte glyph) {
m_glyph_editor_widget->set_glyph(glyph);
width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph()));
info_label->set_text(String::format("0x%b (%c)", glyph, glyph));
};
fixed_width_checkbox->on_checked = [this, width_spinbox, update_demo] (bool checked) {
fixed_width_checkbox->on_checked = [this, width_spinbox, update_demo](bool checked) {
m_edited_font->set_fixed_width(checked);
width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph()));
m_glyph_editor_widget->update();
update_demo();
};
width_spinbox->on_change = [this, update_demo] (int value) {
width_spinbox->on_change = [this, update_demo](int value) {
m_edited_font->set_glyph_width(m_glyph_map_widget->selected_glyph(), value);
m_glyph_editor_widget->update();
m_glyph_map_widget->update_glyph(m_glyph_map_widget->selected_glyph());

View file

@ -44,7 +44,8 @@ Rect GlyphMapWidget::get_outer_rect(byte glyph) const
row * (font().glyph_height() + m_vertical_spacing) + 1,
font().max_glyph_width() + m_horizontal_spacing,
font().glyph_height() + m_horizontal_spacing
}.translated(frame_thickness(), frame_thickness());
}
.translated(frame_thickness(), frame_thickness());
}
void GlyphMapWidget::update_glyph(byte glyph)
@ -71,8 +72,7 @@ void GlyphMapWidget::paint_event(GPaintEvent& event)
outer_rect.x() + m_horizontal_spacing / 2,
outer_rect.y() + m_vertical_spacing / 2,
font().max_glyph_width(),
font().glyph_height()
);
font().glyph_height());
if (glyph == m_selected_glyph) {
painter.fill_rect(outer_rect, Color::from_rgb(0x84351a));
painter.draw_glyph(inner_rect.location(), glyph, Color::White);