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:
Timothy Slater 2022-11-16 17:31:31 -06:00 committed by Sam Atkins
parent 159f6cf0ac
commit 296b76095f
Notes: sideshowbarker 2024-07-17 09:37:30 +09:00
20 changed files with 20 additions and 20 deletions

View file

@ -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;

View file

@ -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:

View file

@ -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;

View file

@ -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; }

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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; }

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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; }

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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; }

View file

@ -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:

View file

@ -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() { }

View file

@ -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();

View file

@ -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; }