mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
PixelPaint: Change tool keydown handle to non-const
This was changed to const in PR #15788 but presents problems for tools that may need to forward this event to non-const event handlers.
This commit is contained in:
parent
159f6cf0ac
commit
296b76095f
Notes:
sideshowbarker
2024-07-17 09:37:30 +09:00
Author: https://github.com/tslater2006 Commit: https://github.com/SerenityOS/serenity/commit/296b76095f Pull-request: https://github.com/SerenityOS/serenity/pull/15828 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/gmta
20 changed files with 20 additions and 20 deletions
|
@ -114,7 +114,7 @@ void CloneTool::on_second_paint(Layer const*, GUI::PaintEvent& event)
|
|||
painter.draw_ellipse_intersecting(rect, m_marker_color, 1);
|
||||
}
|
||||
|
||||
bool CloneTool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool CloneTool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
if (event.key() == KeyCode::Key_Alt && !m_is_selecting_location) {
|
||||
m_is_selecting_location = true;
|
||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
|||
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual void on_keyup(GUI::KeyEvent&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -116,7 +116,7 @@ void EllipseTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
|
|||
draw_using(painter, preview_start, preview_end, AK::max(m_thickness * m_editor->scale(), 1));
|
||||
}
|
||||
|
||||
bool EllipseTool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool EllipseTool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
if (event.key() == Key_Escape && m_drawing_button != GUI::MouseButton::None) {
|
||||
m_drawing_button = GUI::MouseButton::None;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ void LassoSelectTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event
|
|||
painter.stroke_path(m_preview_path, Gfx::Color::Black, 1);
|
||||
}
|
||||
|
||||
bool LassoSelectTool::on_keydown(GUI::KeyEvent const& key_event)
|
||||
bool LassoSelectTool::on_keydown(GUI::KeyEvent& key_event)
|
||||
{
|
||||
Tool::on_keydown(key_event);
|
||||
if (key_event.key() == KeyCode::Key_Escape) {
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual void on_mousedown(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent& event) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void LineTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
|
|||
draw_using(painter, preview_start, preview_end, m_editor->color_for(m_drawing_button), AK::max(m_thickness * m_editor->scale(), 1));
|
||||
}
|
||||
|
||||
bool LineTool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool LineTool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
if (event.key() == Key_Escape && m_drawing_button != GUI::MouseButton::None) {
|
||||
m_drawing_button = GUI::MouseButton::None;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void MoveTool::on_mouseup(Layer* layer, MouseEvent& event)
|
|||
m_editor->did_complete_action(tool_name());
|
||||
}
|
||||
|
||||
bool MoveTool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool MoveTool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
if (event.key() == Key_Shift)
|
||||
m_keep_ascept_ratio = true;
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual void on_keyup(GUI::KeyEvent&) override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override;
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void PolygonalSelectTool::on_second_paint(Layer const* layer, GUI::PaintEvent& e
|
|||
painter.draw_line(last_line_start, last_line_stop, Color::Black, 1);
|
||||
}
|
||||
|
||||
bool PolygonalSelectTool::on_keydown(GUI::KeyEvent const& key_event)
|
||||
bool PolygonalSelectTool::on_keydown(GUI::KeyEvent& key_event)
|
||||
{
|
||||
if (key_event.key() == KeyCode::Key_Escape) {
|
||||
if (m_selecting) {
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual void on_doubleclick(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mousedown(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent& event) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
|
|
@ -103,7 +103,7 @@ void RectangleSelectTool::on_mouseup(Layer*, MouseEvent& event)
|
|||
m_editor->did_complete_action(tool_name());
|
||||
}
|
||||
|
||||
bool RectangleSelectTool::on_keydown(GUI::KeyEvent const& key_event)
|
||||
bool RectangleSelectTool::on_keydown(GUI::KeyEvent& key_event)
|
||||
{
|
||||
if (key_event.key() == KeyCode::Key_Space) {
|
||||
m_moving_mode = MovingMode::MovingOrigin;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual void on_mousedown(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent& event) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent& event) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual void on_keyup(GUI::KeyEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
|
|
|
@ -130,7 +130,7 @@ void RectangleTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
|
|||
draw_using(painter, start_position, end_position, AK::max(m_thickness * m_editor->scale(), 1), m_corner_radius * m_editor->scale());
|
||||
}
|
||||
|
||||
bool RectangleTool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool RectangleTool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
if (event.key() == Key_Escape && m_drawing_button != GUI::MouseButton::None) {
|
||||
m_drawing_button = GUI::MouseButton::None;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
virtual void on_mouseup(Layer*, MouseEvent&) override;
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void Tool::set_action(GUI::Action* action)
|
|||
m_action = action;
|
||||
}
|
||||
|
||||
bool Tool::on_keydown(GUI::KeyEvent const& event)
|
||||
bool Tool::on_keydown(GUI::KeyEvent& event)
|
||||
{
|
||||
switch (event.key()) {
|
||||
case KeyCode::Key_LeftBracket:
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
virtual void on_context_menu(Layer*, GUI::ContextMenuEvent&) { }
|
||||
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) { }
|
||||
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) { }
|
||||
virtual bool on_keydown(GUI::KeyEvent const&);
|
||||
virtual bool on_keydown(GUI::KeyEvent&);
|
||||
virtual void on_keyup(GUI::KeyEvent&) { }
|
||||
virtual void on_tool_activation() { }
|
||||
virtual void on_tool_deactivation() { }
|
||||
|
|
|
@ -37,7 +37,7 @@ static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint
|
|||
image.selection().merge(selection_mask, merge_mode);
|
||||
}
|
||||
|
||||
bool WandSelectTool::on_keydown(GUI::KeyEvent const& key_event)
|
||||
bool WandSelectTool::on_keydown(GUI::KeyEvent& key_event)
|
||||
{
|
||||
if (key_event.key() == KeyCode::Key_Escape) {
|
||||
m_editor->image().selection().clear();
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual ~WandSelectTool() = default;
|
||||
|
||||
virtual void on_mousedown(Layer*, MouseEvent& event) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent const&) override;
|
||||
virtual bool on_keydown(GUI::KeyEvent&) override;
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue