1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:17:44 +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:
Andreas Kling 2020-02-06 11:56:38 +01:00
parent 939a605334
commit 11580babbf
269 changed files with 1513 additions and 1315 deletions

View file

@ -34,8 +34,8 @@ KeysWidget::KeysWidget(GUI::Widget* parent, AudioEngine& audio_engine)
, m_audio_engine(audio_engine)
{
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_fill_with_background_color(true);
}
@ -188,7 +188,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event)
painter.draw_rect(rect, Color::Black);
if (i < white_key_labels_count) {
rect.set_height(rect.height() * 1.5);
painter.draw_text(rect, StringView(&white_key_labels[i], 1), TextAlignment::Center, Color::Black);
painter.draw_text(rect, StringView(&white_key_labels[i], 1), Gfx::TextAlignment::Center, Color::Black);
}
note += white_key_note_accumulator[i % white_keys_per_octave];
@ -210,7 +210,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event)
painter.draw_rect(rect, Color::Black);
if (i < black_key_labels_count) {
rect.set_height(rect.height() * 1.5);
painter.draw_text(rect, StringView(&black_key_labels[i], 1), TextAlignment::Center, Color::White);
painter.draw_text(rect, StringView(&black_key_labels[i], 1), Gfx::TextAlignment::Center, Color::White);
}
note += black_key_note_accumulator[i % black_keys_per_octave];
@ -249,11 +249,12 @@ static inline int note_from_white_keys(int white_keys)
return note;
}
int KeysWidget::note_for_event_position(Point point) const
int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const
{
if (!frame_inner_rect().contains(point))
if (!frame_inner_rect().contains(a_point))
return -1;
auto point = a_point;
point.move_by(-frame_thickness(), -frame_thickness());
int white_keys = point.x() / white_key_width;

View file

@ -50,7 +50,7 @@ private:
virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
int note_for_event_position(Point) const;
int note_for_event_position(const Gfx::Point&) const;
AudioEngine& m_audio_engine;

View file

@ -38,8 +38,8 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid
, m_main_widget(main_widget)
{
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_layout(make<GUI::VBoxLayout>());
set_fill_with_background_color(true);

View file

@ -38,8 +38,8 @@ RollWidget::RollWidget(GUI::Widget* parent, AudioEngine& audio_engine)
, m_audio_engine(audio_engine)
{
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_should_hide_unnecessary_scrollbars(true);
set_content_size({ 0, roll_height });

View file

@ -35,8 +35,8 @@ WaveWidget::WaveWidget(GUI::Widget* parent, AudioEngine& audio_engine)
, m_audio_engine(audio_engine)
{
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);
}
WaveWidget::~WaveWidget()

View file

@ -51,7 +51,7 @@ int main(int argc, char** argv)
window->set_main_widget(main_widget);
window->set_title("Piano");
window->set_rect(90, 90, 840, 600);
window->set_icon(load_png("/res/icons/16x16/app-piano.png"));
window->set_icon(Gfx::load_png("/res/icons/16x16/app-piano.png"));
window->show();
LibThread::Thread audio_thread([&] {
@ -82,7 +82,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("Piano", load_png("/res/icons/32x32/app-piano.png"), window);
GUI::AboutDialog::show("Piano", Gfx::load_png("/res/icons/32x32/app-piano.png"), window);
}));
menubar->add_menu(move(help_menu));