diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-06 11:56:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-06 11:56:38 +0100 |
commit | 11580babbfb1b8ae0acab2400f11d905c35642f5 (patch) | |
tree | 3b26fcd4bf7afe9ff92203468ba7cd95e192d55f /Applications/Piano | |
parent | 939a605334a71dd8b7af91cdcbe9047281f7b5b9 (diff) | |
download | serenity-11580babbfb1b8ae0acab2400f11d905c35642f5.zip |
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. :^)
Diffstat (limited to 'Applications/Piano')
-rw-r--r-- | Applications/Piano/KeysWidget.cpp | 13 | ||||
-rw-r--r-- | Applications/Piano/KeysWidget.h | 2 | ||||
-rw-r--r-- | Applications/Piano/KnobsWidget.cpp | 4 | ||||
-rw-r--r-- | Applications/Piano/RollWidget.cpp | 4 | ||||
-rw-r--r-- | Applications/Piano/WaveWidget.cpp | 4 | ||||
-rw-r--r-- | Applications/Piano/main.cpp | 4 |
6 files changed, 16 insertions, 15 deletions
diff --git a/Applications/Piano/KeysWidget.cpp b/Applications/Piano/KeysWidget.cpp index 77608e31bc..4f7963de3f 100644 --- a/Applications/Piano/KeysWidget.cpp +++ b/Applications/Piano/KeysWidget.cpp @@ -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; diff --git a/Applications/Piano/KeysWidget.h b/Applications/Piano/KeysWidget.h index a051457b8d..0c44487356 100644 --- a/Applications/Piano/KeysWidget.h +++ b/Applications/Piano/KeysWidget.h @@ -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; diff --git a/Applications/Piano/KnobsWidget.cpp b/Applications/Piano/KnobsWidget.cpp index f35f7869a3..a5cf1ac204 100644 --- a/Applications/Piano/KnobsWidget.cpp +++ b/Applications/Piano/KnobsWidget.cpp @@ -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); diff --git a/Applications/Piano/RollWidget.cpp b/Applications/Piano/RollWidget.cpp index 325cafe880..e39206788d 100644 --- a/Applications/Piano/RollWidget.cpp +++ b/Applications/Piano/RollWidget.cpp @@ -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 }); diff --git a/Applications/Piano/WaveWidget.cpp b/Applications/Piano/WaveWidget.cpp index 5a66c6e08f..817c80b029 100644 --- a/Applications/Piano/WaveWidget.cpp +++ b/Applications/Piano/WaveWidget.cpp @@ -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() diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp index b0d7d3f8f4..25ae0cc817 100644 --- a/Applications/Piano/main.cpp +++ b/Applications/Piano/main.cpp @@ -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)); |