mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +00:00
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename the library to LibGfx. :^)
This commit is contained in:
parent
939a605334
commit
11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -38,7 +38,7 @@
|
|||
#include <LibGUI/GTextBox.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GUI::Widget* parent)
|
||||
FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font, GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
, m_edited_font(move(edited_font))
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon
|
|||
exit(0);
|
||||
};
|
||||
|
||||
m_ui->info_label->set_text_alignment(TextAlignment::CenterLeft);
|
||||
m_ui->info_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
m_ui->demo_label_1->set_font(m_edited_font);
|
||||
m_ui->demo_label_1->set_text("quick fox jumps nightly above wizard.");
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
virtual ~FontEditorWidget() override;
|
||||
|
||||
private:
|
||||
FontEditorWidget(const String& path, RefPtr<Font>&&, GUI::Widget* parent = nullptr);
|
||||
RefPtr<Font> m_edited_font;
|
||||
FontEditorWidget(const String& path, RefPtr<Gfx::Font>&&, GUI::Widget* parent = nullptr);
|
||||
RefPtr<Gfx::Font> m_edited_font;
|
||||
|
||||
GlyphMapWidget* m_glyph_map_widget { nullptr };
|
||||
GlyphEditorWidget* m_glyph_editor_widget { nullptr };
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
#include "GlyphEditorWidget.h"
|
||||
#include <LibGUI/GPainter.h>
|
||||
|
||||
GlyphEditorWidget::GlyphEditorWidget(Font& mutable_font, GUI::Widget* parent)
|
||||
GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font, GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
, m_font(mutable_font)
|
||||
{
|
||||
set_frame_thickness(2);
|
||||
set_frame_shadow(FrameShadow::Sunken);
|
||||
set_frame_shape(FrameShape::Container);
|
||||
set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
set_frame_shape(Gfx::FrameShape::Container);
|
||||
set_relative_rect({ 0, 0, preferred_width(), preferred_height() });
|
||||
}
|
||||
|
||||
|
|
|
@ -38,20 +38,20 @@ public:
|
|||
int preferred_width() const;
|
||||
int preferred_height() const;
|
||||
|
||||
Font& font() { return *m_font; }
|
||||
const Font& font() const { return *m_font; }
|
||||
Gfx::Font& font() { return *m_font; }
|
||||
const Gfx::Font& font() const { return *m_font; }
|
||||
|
||||
Function<void(u8)> on_glyph_altered;
|
||||
|
||||
private:
|
||||
GlyphEditorWidget(Font&, GUI::Widget* parent);
|
||||
GlyphEditorWidget(Gfx::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 GUI::MouseEvent&);
|
||||
|
||||
RefPtr<Font> m_font;
|
||||
RefPtr<Gfx::Font> m_font;
|
||||
u8 m_glyph { 0 };
|
||||
int m_scale { 10 };
|
||||
};
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
#include <LibDraw/Palette.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
|
||||
GlyphMapWidget::GlyphMapWidget(Font& mutable_font, GUI::Widget* parent)
|
||||
GlyphMapWidget::GlyphMapWidget(Gfx::Font& mutable_font, GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
, m_font(mutable_font)
|
||||
{
|
||||
set_frame_thickness(2);
|
||||
set_frame_shape(FrameShape::Container);
|
||||
set_frame_shadow(FrameShadow::Sunken);
|
||||
set_frame_shape(Gfx::FrameShape::Container);
|
||||
set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
set_relative_rect({ 0, 0, preferred_width(), preferred_height() });
|
||||
}
|
||||
|
||||
|
|
|
@ -43,21 +43,21 @@ public:
|
|||
int preferred_width() const;
|
||||
int preferred_height() const;
|
||||
|
||||
Font& font() { return *m_font; }
|
||||
const Font& font() const { return *m_font; }
|
||||
Gfx::Font& font() { return *m_font; }
|
||||
const Gfx::Font& font() const { return *m_font; }
|
||||
|
||||
void update_glyph(u8);
|
||||
|
||||
Function<void(u8)> on_glyph_selected;
|
||||
|
||||
private:
|
||||
GlyphMapWidget(Font&, GUI::Widget* parent);
|
||||
GlyphMapWidget(Gfx::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;
|
||||
|
||||
RefPtr<Font> m_font;
|
||||
RefPtr<Gfx::Font> m_font;
|
||||
int m_rows { 8 };
|
||||
int m_horizontal_spacing { 2 };
|
||||
int m_vertical_spacing { 2 };
|
||||
|
|
|
@ -47,12 +47,12 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
RefPtr<Font> edited_font;
|
||||
RefPtr<Gfx::Font> edited_font;
|
||||
String path;
|
||||
|
||||
if (argc == 2) {
|
||||
path = argv[1];
|
||||
edited_font = Font::load_from_file(path);
|
||||
edited_font = Gfx::Font::load_from_file(path);
|
||||
if (!edited_font) {
|
||||
fprintf(stderr, "Couldn't load font: %s\n", path.characters());
|
||||
return 1;
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char** argv)
|
|||
if (edited_font)
|
||||
edited_font = edited_font->clone();
|
||||
else
|
||||
edited_font = Font::default_font().clone();
|
||||
edited_font = Gfx::Font::default_font().clone();
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Font Editor");
|
||||
|
@ -71,7 +71,7 @@ int main(int argc, char** argv)
|
|||
auto font_editor = FontEditorWidget::construct(path, move(edited_font));
|
||||
window->set_main_widget(font_editor);
|
||||
window->show();
|
||||
window->set_icon(load_png("/res/icons/16x16/app-font-editor.png"));
|
||||
window->set_icon(Gfx::load_png("/res/icons/16x16/app-font-editor.png"));
|
||||
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
|
||||
|
@ -84,7 +84,7 @@ int main(int argc, char** argv)
|
|||
|
||||
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);
|
||||
GUI::AboutDialog::show("Font Editor", Gfx::load_png("/res/icons/FontEditor.png"), window);
|
||||
}));
|
||||
menubar->add_menu(move(help_menu));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue