diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-02 15:07:41 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-02 15:15:33 +0100 |
commit | c5bd9d4ed1d80ac91d46146565127b0c185f1b43 (patch) | |
tree | b4ee9ba5999778450f8eb4006df89110617b4a10 /Applications/FontEditor | |
parent | 2d39da5405a4527e91e853ddb1e56a539c96c6c1 (diff) | |
download | serenity-c5bd9d4ed1d80ac91d46146565127b0c185f1b43.zip |
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
Diffstat (limited to 'Applications/FontEditor')
-rw-r--r-- | Applications/FontEditor/FontEditor.cpp | 6 | ||||
-rw-r--r-- | Applications/FontEditor/FontEditor.h | 5 | ||||
-rw-r--r-- | Applications/FontEditor/FontEditorBottom.frm | 2 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphEditorWidget.cpp | 22 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphEditorWidget.h | 12 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphMapWidget.cpp | 12 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphMapWidget.h | 8 | ||||
-rw-r--r-- | Applications/FontEditor/main.cpp | 18 |
8 files changed, 42 insertions, 43 deletions
diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 2983a187ef..815ab629d5 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -38,8 +38,8 @@ #include <LibGUI/GTextBox.h> #include <stdlib.h> -FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GWidget* parent) - : GWidget(parent) +FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GUI::Widget* parent) + : GUI::Widget(parent) , m_edited_font(move(edited_font)) { set_fill_with_background_color(true); @@ -75,7 +75,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon }; m_ui->save_button->set_text("Save"); - m_ui->save_button->on_click = [this](GButton&) { + m_ui->save_button->on_click = [this](GUI::Button&) { dbgprintf("write to file: '%s'\n", m_path.characters()); m_edited_font->write_to_file(m_path); }; diff --git a/Applications/FontEditor/FontEditor.h b/Applications/FontEditor/FontEditor.h index b5bbab5514..163ad3efd8 100644 --- a/Applications/FontEditor/FontEditor.h +++ b/Applications/FontEditor/FontEditor.h @@ -31,17 +31,16 @@ class GlyphEditorWidget; class GlyphMapWidget; -class GTextBox; struct UI_FontEditorBottom; -class FontEditorWidget final : public GWidget { +class FontEditorWidget final : public GUI::Widget { C_OBJECT(FontEditorWidget) public: virtual ~FontEditorWidget() override; private: - FontEditorWidget(const String& path, RefPtr<Font>&&, GWidget* parent = nullptr); + FontEditorWidget(const String& path, RefPtr<Font>&&, GUI::Widget* parent = nullptr); RefPtr<Font> m_edited_font; GlyphMapWidget* m_glyph_map_widget { nullptr }; diff --git a/Applications/FontEditor/FontEditorBottom.frm b/Applications/FontEditor/FontEditorBottom.frm index d0c12834a8..d690a27797 100644 --- a/Applications/FontEditor/FontEditorBottom.frm +++ b/Applications/FontEditor/FontEditorBottom.frm @@ -1 +1 @@ -{"name":"FontEditorBottom","widgets":[{"enabled":true,"forecolor":"#000000ff","autofill":false,"x":5,"tooltip":"[null]","name":"info_label","height":16,"width":66,"y":15,"class":"GLabel","text":"info_label","backcolor":"#d4d0c8ff","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":95,"tooltip":null,"name":"demo_label_1","height":16,"width":276,"y":15,"class":"GLabel","text":"demo_label_1","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":95,"tooltip":null,"name":"demo_label_2","height":16,"width":276,"y":40,"class":"GLabel","text":"demo_label_2","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"label1","height":16,"width":66,"y":40,"class":"GLabel","text":"Glyph width:","backcolor":"#00000000","visible":true},{"forecolor":"#00000000","name":"width_spinbox","height":21,"backcolor":"#00000000","enabled":true,"value":0,"tooltip":null,"max":32,"visible":true,"y":60,"width":71,"autofill":false,"x":5,"class":"GSpinBox","min":0},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"gb1","height":76,"width":300,"y":95,"class":"GGroupBox","backcolor":"#d4d0c8ff","title":"Font metadata","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":15,"tooltip":null,"name":"label2","height":16,"width":40,"y":105,"class":"GLabel","text":"Name:","backcolor":"#00000000","visible":true},{"tooltip":null,"forecolor":"#00000000","name":"name_textbox","y":120,"autofill":false,"x":15,"class":"GTextBox","backcolor":"#00000000","ruler_visible":false,"height":21,"enabled":true,"text":"","visible":true,"width":196},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":215,"tooltip":null,"name":"label3","height":16,"width":80,"y":105,"class":"GLabel","text":"Glyph spacing:","backcolor":"#00000000","visible":true},{"forecolor":"#00000000","name":"spacing_spinbox","height":21,"backcolor":"#00000000","enabled":true,"value":0,"tooltip":null,"max":255,"visible":true,"y":120,"width":80,"autofill":false,"x":215,"class":"GSpinBox","min":0},{"tooltip":null,"checked":false,"forecolor":"#00000000","name":"fixed_width_checkbox","y":145,"autofill":false,"x":15,"class":"GCheckBox","backcolor":"#00000000","height":21,"enabled":true,"text":"Fixed width","visible":true,"width":101},{"tooltip":null,"forecolor":"#00000000","name":"path_textbox","y":175,"autofill":false,"x":5,"class":"GTextBox","backcolor":"#00000000","ruler_visible":false,"height":21,"enabled":true,"text":"","visible":true,"width":216},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"save_button","height":21,"width":106,"y":205,"class":"GButton","text":"Save","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":115,"tooltip":null,"name":"quit_button","height":21,"width":106,"y":205,"class":"GButton","text":"Quit","backcolor":"#00000000","visible":true}]} +{"name":"FontEditorBottom","widgets":[{"enabled":true,"forecolor":"#000000ff","autofill":false,"x":5,"tooltip":"[null]","name":"info_label","height":16,"width":66,"y":15,"class":"GUI::Label","text":"info_label","backcolor":"#d4d0c8ff","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":95,"tooltip":null,"name":"demo_label_1","height":16,"width":276,"y":15,"class":"GUI::Label","text":"demo_label_1","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":95,"tooltip":null,"name":"demo_label_2","height":16,"width":276,"y":40,"class":"GUI::Label","text":"demo_label_2","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"label1","height":16,"width":66,"y":40,"class":"GUI::Label","text":"Glyph width:","backcolor":"#00000000","visible":true},{"forecolor":"#00000000","name":"width_spinbox","height":21,"backcolor":"#00000000","enabled":true,"value":0,"tooltip":null,"max":32,"visible":true,"y":60,"width":71,"autofill":false,"x":5,"class":"GUI::SpinBox","min":0},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"gb1","height":76,"width":300,"y":95,"class":"GUI::GroupBox","backcolor":"#d4d0c8ff","title":"Font metadata","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":15,"tooltip":null,"name":"label2","height":16,"width":40,"y":105,"class":"GUI::Label","text":"Name:","backcolor":"#00000000","visible":true},{"tooltip":null,"forecolor":"#00000000","name":"name_textbox","y":120,"autofill":false,"x":15,"class":"GUI::TextBox","backcolor":"#00000000","ruler_visible":false,"height":21,"enabled":true,"text":"","visible":true,"width":196},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":215,"tooltip":null,"name":"label3","height":16,"width":80,"y":105,"class":"GUI::Label","text":"Glyph spacing:","backcolor":"#00000000","visible":true},{"forecolor":"#00000000","name":"spacing_spinbox","height":21,"backcolor":"#00000000","enabled":true,"value":0,"tooltip":null,"max":255,"visible":true,"y":120,"width":80,"autofill":false,"x":215,"class":"GUI::SpinBox","min":0},{"tooltip":null,"checked":false,"forecolor":"#00000000","name":"fixed_width_checkbox","y":145,"autofill":false,"x":15,"class":"GUI::CheckBox","backcolor":"#00000000","height":21,"enabled":true,"text":"Fixed width","visible":true,"width":101},{"tooltip":null,"forecolor":"#00000000","name":"path_textbox","y":175,"autofill":false,"x":5,"class":"GUI::TextBox","backcolor":"#00000000","ruler_visible":false,"height":21,"enabled":true,"text":"","visible":true,"width":216},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":5,"tooltip":null,"name":"save_button","height":21,"width":106,"y":205,"class":"GUI::Button","text":"Save","backcolor":"#00000000","visible":true},{"enabled":true,"forecolor":"#00000000","autofill":false,"x":115,"tooltip":null,"name":"quit_button","height":21,"width":106,"y":205,"class":"GUI::Button","text":"Quit","backcolor":"#00000000","visible":true}]} diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index 672808ce72..44ac553de9 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -27,8 +27,8 @@ #include "GlyphEditorWidget.h" #include <LibGUI/GPainter.h> -GlyphEditorWidget::GlyphEditorWidget(Font& mutable_font, GWidget* parent) - : GFrame(parent) +GlyphEditorWidget::GlyphEditorWidget(Font& mutable_font, GUI::Widget* parent) + : GUI::Frame(parent) , m_font(mutable_font) { set_frame_thickness(2); @@ -49,11 +49,11 @@ void GlyphEditorWidget::set_glyph(u8 glyph) update(); } -void GlyphEditorWidget::paint_event(GPaintEvent& event) +void GlyphEditorWidget::paint_event(GUI::PaintEvent& event) { - GFrame::paint_event(event); + GUI::Frame::paint_event(event); - GPainter painter(*this); + GUI::Painter painter(*this); painter.add_clip_rect(frame_inner_rect()); painter.add_clip_rect(event.rect()); painter.fill_rect(frame_inner_rect(), Color::White); @@ -81,21 +81,21 @@ void GlyphEditorWidget::paint_event(GPaintEvent& event) } } -void GlyphEditorWidget::mousedown_event(GMouseEvent& event) +void GlyphEditorWidget::mousedown_event(GUI::MouseEvent& event) { draw_at_mouse(event); } -void GlyphEditorWidget::mousemove_event(GMouseEvent& event) +void GlyphEditorWidget::mousemove_event(GUI::MouseEvent& event) { - if (event.buttons() & (GMouseButton::Left | GMouseButton::Right)) + if (event.buttons() & (GUI::MouseButton::Left | GUI::MouseButton::Right)) draw_at_mouse(event); } -void GlyphEditorWidget::draw_at_mouse(const GMouseEvent& event) +void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event) { - bool set = event.buttons() & GMouseButton::Left; - bool unset = event.buttons() & GMouseButton::Right; + bool set = event.buttons() & GUI::MouseButton::Left; + bool unset = event.buttons() & GUI::MouseButton::Right; if (!(set ^ unset)) return; int x = (event.x() - 1) / m_scale; diff --git a/Applications/FontEditor/GlyphEditorWidget.h b/Applications/FontEditor/GlyphEditorWidget.h index 8bba197a8e..a54258aabd 100644 --- a/Applications/FontEditor/GlyphEditorWidget.h +++ b/Applications/FontEditor/GlyphEditorWidget.h @@ -27,7 +27,7 @@ #include <AK/Function.h> #include <LibGUI/GFrame.h> -class GlyphEditorWidget final : public GFrame { +class GlyphEditorWidget final : public GUI::Frame { C_OBJECT(GlyphEditorWidget) public: virtual ~GlyphEditorWidget() override; @@ -44,12 +44,12 @@ public: Function<void(u8)> on_glyph_altered; private: - GlyphEditorWidget(Font&, GWidget* parent); - virtual void paint_event(GPaintEvent&) override; - virtual void mousedown_event(GMouseEvent&) override; - virtual void mousemove_event(GMouseEvent&) override; + GlyphEditorWidget(Font&, GUI::Widget* parent); + virtual void paint_event(GUI::PaintEvent&) override; + virtual void mousedown_event(GUI::MouseEvent&) override; + virtual void mousemove_event(GUI::MouseEvent&) override; - void draw_at_mouse(const GMouseEvent&); + void draw_at_mouse(const GUI::MouseEvent&); RefPtr<Font> m_font; u8 m_glyph { 0 }; diff --git a/Applications/FontEditor/GlyphMapWidget.cpp b/Applications/FontEditor/GlyphMapWidget.cpp index 5524ece667..95ac188514 100644 --- a/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Applications/FontEditor/GlyphMapWidget.cpp @@ -28,8 +28,8 @@ #include <LibDraw/Palette.h> #include <LibGUI/GPainter.h> -GlyphMapWidget::GlyphMapWidget(Font& mutable_font, GWidget* parent) - : GFrame(parent) +GlyphMapWidget::GlyphMapWidget(Font& mutable_font, GUI::Widget* parent) + : GUI::Frame(parent) , m_font(mutable_font) { set_frame_thickness(2); @@ -80,11 +80,11 @@ void GlyphMapWidget::update_glyph(u8 glyph) update(get_outer_rect(glyph)); } -void GlyphMapWidget::paint_event(GPaintEvent& event) +void GlyphMapWidget::paint_event(GUI::PaintEvent& event) { - GFrame::paint_event(event); + GUI::Frame::paint_event(event); - GPainter painter(*this); + GUI::Painter painter(*this); painter.add_clip_rect(event.rect()); painter.set_font(font()); @@ -110,7 +110,7 @@ void GlyphMapWidget::paint_event(GPaintEvent& event) } } -void GlyphMapWidget::mousedown_event(GMouseEvent& event) +void GlyphMapWidget::mousedown_event(GUI::MouseEvent& event) { // FIXME: This is a silly loop. for (unsigned glyph = 0; glyph < 256; ++glyph) { diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h index 197ca6528b..0ad9884e34 100644 --- a/Applications/FontEditor/GlyphMapWidget.h +++ b/Applications/FontEditor/GlyphMapWidget.h @@ -29,7 +29,7 @@ #include <AK/Function.h> #include <LibGUI/GFrame.h> -class GlyphMapWidget final : public GFrame { +class GlyphMapWidget final : public GUI::Frame { C_OBJECT(GlyphMapWidget) public: virtual ~GlyphMapWidget() override; @@ -51,9 +51,9 @@ public: Function<void(u8)> on_glyph_selected; private: - GlyphMapWidget(Font&, GWidget* parent); - virtual void paint_event(GPaintEvent&) override; - virtual void mousedown_event(GMouseEvent&) override; + GlyphMapWidget(Font&, GUI::Widget* parent); + virtual void paint_event(GUI::PaintEvent&) override; + virtual void mousedown_event(GUI::MouseEvent&) override; Rect get_outer_rect(u8 glyph) const; diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp index 09a2588834..94819dd3cb 100644 --- a/Applications/FontEditor/main.cpp +++ b/Applications/FontEditor/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) return 1; } - GApplication app(argc, argv); + GUI::Application app(argc, argv); if (pledge("stdio shared_buffer rpath accept cpath wpath", nullptr) < 0) { perror("pledge"); @@ -64,7 +64,7 @@ int main(int argc, char** argv) else edited_font = Font::default_font().clone(); - auto window = GWindow::construct(); + auto window = GUI::Window::construct(); window->set_title("Font Editor"); window->set_rect({ 50, 50, 390, 342 }); @@ -73,18 +73,18 @@ int main(int argc, char** argv) window->show(); window->set_icon(load_png("/res/icons/16x16/app-font-editor.png")); - auto menubar = make<GMenuBar>(); + auto menubar = make<GUI::MenuBar>(); - auto app_menu = GMenu::construct("Font Editor"); - app_menu->add_action(GCommonActions::make_quit_action([](auto&) { - GApplication::the().quit(0); + auto app_menu = GUI::Menu::construct("Font Editor"); + app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) { + GUI::Application::the().quit(0); return; })); menubar->add_menu(move(app_menu)); - auto help_menu = GMenu::construct("Help"); - help_menu->add_action(GAction::create("About", [&](const GAction&) { - GAboutDialog::show("Font Editor", load_png("/res/icons/FontEditor.png"), window); + auto help_menu = GUI::Menu::construct("Help"); + help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { + GUI::AboutDialog::show("Font Editor", load_png("/res/icons/FontEditor.png"), window); })); menubar->add_menu(move(help_menu)); |