diff options
author | Mustafa Quraish <mustafaq9@gmail.com> | 2021-09-03 01:03:15 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-04 03:33:44 +0200 |
commit | 280cbf2e1865c9f5d867d3e715fd86de0a0f928e (patch) | |
tree | d15279fec4759dfb29095300bf1776f42c352076 /Userland | |
parent | d28fb8926f923fcba033ddb245cf9feafbcc8d61 (diff) | |
download | serenity-280cbf2e1865c9f5d867d3e715fd86de0a0f928e.zip |
PixelPaint: Make tools use the new API for property change shortcuts
Every tool that has a slider now registers the primary/secondary
sliders and now uses the same keyboard shortcuts to modify the
primary and secondary properties. `[` and `]` for the primary,
`{` and `}` for the secondary.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/PixelPaint/BrushTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/BucketTool.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/EllipseTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/EraseTool.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/GuideTool.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/LineTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/PenTool.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/RectangleSelectTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/SprayTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/ZoomTool.cpp | 1 |
10 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/BrushTool.cpp b/Userland/Applications/PixelPaint/BrushTool.cpp index 0a07f921ac..5eb63bf338 100644 --- a/Userland/Applications/PixelPaint/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/BrushTool.cpp @@ -141,6 +141,7 @@ GUI::Widget* BrushTool::get_properties_widget() size_slider.on_change = [&](int value) { m_size = value; }; + set_primary_slider(&size_slider); auto& hardness_container = m_properties_widget->add<GUI::Widget>(); hardness_container.set_fixed_height(20); @@ -157,6 +158,7 @@ GUI::Widget* BrushTool::get_properties_widget() hardness_slider.on_change = [&](int value) { m_hardness = value; }; + set_secondary_slider(&hardness_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/BucketTool.cpp b/Userland/Applications/PixelPaint/BucketTool.cpp index 6afab1d1a8..4161d61204 100644 --- a/Userland/Applications/PixelPaint/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/BucketTool.cpp @@ -109,6 +109,7 @@ GUI::Widget* BucketTool::get_properties_widget() threshold_slider.on_change = [&](int value) { m_threshold = value; }; + set_primary_slider(&threshold_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/EllipseTool.cpp b/Userland/Applications/PixelPaint/EllipseTool.cpp index d60ad0baee..d389e61133 100644 --- a/Userland/Applications/PixelPaint/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/EllipseTool.cpp @@ -106,6 +106,7 @@ void EllipseTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event) void EllipseTool::on_keydown(GUI::KeyEvent& event) { + Tool::on_keydown(event); if (event.key() == Key_Escape && m_drawing_button != GUI::MouseButton::None) { m_drawing_button = GUI::MouseButton::None; m_editor->update(); @@ -134,6 +135,7 @@ GUI::Widget* EllipseTool::get_properties_widget() thickness_slider.on_change = [&](int value) { m_thickness = value; }; + set_primary_slider(&thickness_slider); auto& mode_container = m_properties_widget->add<GUI::Widget>(); mode_container.set_fixed_height(46); diff --git a/Userland/Applications/PixelPaint/EraseTool.cpp b/Userland/Applications/PixelPaint/EraseTool.cpp index 40ae7fcb8b..cf2881fac1 100644 --- a/Userland/Applications/PixelPaint/EraseTool.cpp +++ b/Userland/Applications/PixelPaint/EraseTool.cpp @@ -102,6 +102,7 @@ GUI::Widget* EraseTool::get_properties_widget() thickness_slider.on_change = [&](int value) { m_thickness = value; }; + set_primary_slider(&thickness_slider); auto& checkbox_container = m_properties_widget->add<GUI::Widget>(); checkbox_container.set_fixed_height(20); diff --git a/Userland/Applications/PixelPaint/GuideTool.cpp b/Userland/Applications/PixelPaint/GuideTool.cpp index 33007c4472..2fee6f6b74 100644 --- a/Userland/Applications/PixelPaint/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/GuideTool.cpp @@ -206,6 +206,7 @@ GUI::Widget* GuideTool::get_properties_widget() snapping_slider.on_change = [&](int value) { m_snap_size = value; }; + set_primary_slider(&snapping_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/LineTool.cpp b/Userland/Applications/PixelPaint/LineTool.cpp index e05a6dd1cd..942056e3aa 100644 --- a/Userland/Applications/PixelPaint/LineTool.cpp +++ b/Userland/Applications/PixelPaint/LineTool.cpp @@ -105,6 +105,7 @@ void LineTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event) void LineTool::on_keydown(GUI::KeyEvent& event) { + Tool::on_keydown(event); if (event.key() == Key_Escape && m_drawing_button != GUI::MouseButton::None) { m_drawing_button = GUI::MouseButton::None; m_editor->update(); @@ -133,6 +134,7 @@ GUI::Widget* LineTool::get_properties_widget() thickness_slider.on_change = [&](int value) { m_thickness = value; }; + set_primary_slider(&thickness_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/PenTool.cpp b/Userland/Applications/PixelPaint/PenTool.cpp index 86c1b1381f..976255bee2 100644 --- a/Userland/Applications/PixelPaint/PenTool.cpp +++ b/Userland/Applications/PixelPaint/PenTool.cpp @@ -96,6 +96,7 @@ GUI::Widget* PenTool::get_properties_widget() thickness_slider.on_change = [&](int value) { m_thickness = value; }; + set_primary_slider(&thickness_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp index df109511fe..429ff6e546 100644 --- a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp @@ -110,6 +110,7 @@ void RectangleSelectTool::on_mouseup(Layer*, MouseEvent& event) void RectangleSelectTool::on_keydown(GUI::KeyEvent& key_event) { + Tool::on_keydown(key_event); if (key_event.key() == KeyCode::Key_Space) m_moving_mode = MovingMode::MovingOrigin; else if (key_event.key() == KeyCode::Key_Control) @@ -164,6 +165,7 @@ GUI::Widget* RectangleSelectTool::get_properties_widget() feather_slider.on_change = [&](int value) { m_edge_feathering = (float)value / (float)feather_slider_max; }; + set_primary_slider(&feather_slider); auto& mode_container = m_properties_widget->add<GUI::Widget>(); mode_container.set_fixed_height(20); diff --git a/Userland/Applications/PixelPaint/SprayTool.cpp b/Userland/Applications/PixelPaint/SprayTool.cpp index 22a464cf4f..0aa431aa8b 100644 --- a/Userland/Applications/PixelPaint/SprayTool.cpp +++ b/Userland/Applications/PixelPaint/SprayTool.cpp @@ -116,6 +116,7 @@ GUI::Widget* SprayTool::get_properties_widget() size_slider.on_change = [&](int value) { m_thickness = value; }; + set_primary_slider(&size_slider); auto& density_container = m_properties_widget->add<GUI::Widget>(); density_container.set_fixed_height(20); @@ -132,6 +133,7 @@ GUI::Widget* SprayTool::get_properties_widget() density_slider.on_change = [&](int value) { m_density = value; }; + set_secondary_slider(&density_slider); } return m_properties_widget.ptr(); diff --git a/Userland/Applications/PixelPaint/ZoomTool.cpp b/Userland/Applications/PixelPaint/ZoomTool.cpp index 1fe473288a..94a50484e9 100644 --- a/Userland/Applications/PixelPaint/ZoomTool.cpp +++ b/Userland/Applications/PixelPaint/ZoomTool.cpp @@ -51,6 +51,7 @@ GUI::Widget* ZoomTool::get_properties_widget() sensitivity_slider.on_change = [&](int value) { m_sensitivity = (double)value / 100.0; }; + set_primary_slider(&sensitivity_slider); } return m_properties_widget.ptr(); |