PixelPaint: Rename original_event => image_event

These events are in image coordinates, not really original coordinates.
This commit is contained in:
Andreas Kling 2020-05-21 21:57:57 +02:00
parent 45dfa094e9
commit 84b508befa
Notes: sideshowbarker 2024-07-19 06:16:06 +09:00
11 changed files with 32 additions and 32 deletions

View file

@ -35,7 +35,7 @@ public:
BucketTool();
virtual ~BucketTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
private:
virtual const char* class_name() const override { return "BucketTool"; }

View file

@ -37,9 +37,9 @@ public:
EllipseTool();
virtual ~EllipseTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
virtual void on_second_paint(const Layer&, GUI::PaintEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;

View file

@ -38,8 +38,8 @@ public:
EraseTool();
virtual ~EraseTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
private:

View file

@ -153,8 +153,8 @@ void ImageEditor::mousedown_event(GUI::MouseEvent& event)
return;
auto layer_event = event_adjusted_for_layer(event, *m_active_layer);
auto original_event = event_with_pan_and_scale_applied(event);
m_active_tool->on_mousedown(*m_active_layer, layer_event, original_event);
auto image_event = event_with_pan_and_scale_applied(event);
m_active_tool->on_mousedown(*m_active_layer, layer_event, image_event);
}
void ImageEditor::mousemove_event(GUI::MouseEvent& event)
@ -172,9 +172,9 @@ void ImageEditor::mousemove_event(GUI::MouseEvent& event)
if (!m_active_layer || !m_active_tool)
return;
auto layer_event = event_adjusted_for_layer(event, *m_active_layer);
auto original_event = event_with_pan_and_scale_applied(event);
auto image_event = event_with_pan_and_scale_applied(event);
m_active_tool->on_mousemove(*m_active_layer, layer_event, original_event);
m_active_tool->on_mousemove(*m_active_layer, layer_event, image_event);
}
void ImageEditor::mouseup_event(GUI::MouseEvent& event)
@ -182,8 +182,8 @@ void ImageEditor::mouseup_event(GUI::MouseEvent& event)
if (!m_active_layer || !m_active_tool)
return;
auto layer_event = event_adjusted_for_layer(event, *m_active_layer);
auto original_event = event_with_pan_and_scale_applied(event);
m_active_tool->on_mouseup(*m_active_layer, layer_event, original_event);
auto image_event = event_with_pan_and_scale_applied(event);
m_active_tool->on_mouseup(*m_active_layer, layer_event, image_event);
}
void ImageEditor::mousewheel_event(GUI::MouseEvent& event)

View file

@ -37,9 +37,9 @@ public:
LineTool();
virtual ~LineTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
virtual void on_second_paint(const Layer&, GUI::PaintEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;

View file

@ -43,23 +43,23 @@ MoveTool::~MoveTool()
{
}
void MoveTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent& original_event)
void MoveTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent& image_event)
{
if (event.button() != GUI::MouseButton::Left)
return;
if (!layer.rect().contains(event.position()))
return;
m_layer_being_moved = layer;
m_event_origin = original_event.position();
m_event_origin = image_event.position();
m_layer_origin = layer.location();
m_editor->window()->set_override_cursor(GUI::StandardCursor::Move);
}
void MoveTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& original_event)
void MoveTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event)
{
if (!m_layer_being_moved)
return;
auto delta = original_event.position() - m_event_origin;
auto delta = image_event.position() - m_event_origin;
m_layer_being_moved->set_location(m_layer_origin.translated(delta));
m_editor->layers_did_change();
}

View file

@ -35,9 +35,9 @@ public:
MoveTool();
virtual ~MoveTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_keydown(GUI::KeyEvent&) override;
virtual void on_context_menu(Layer&, GUI::ContextMenuEvent&) override;

View file

@ -37,9 +37,9 @@ public:
PenTool();
virtual ~PenTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
private:

View file

@ -35,7 +35,7 @@ public:
PickerTool();
virtual ~PickerTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
private:
virtual const char* class_name() const override { return "PickerTool"; }

View file

@ -37,9 +37,9 @@ public:
RectangleTool();
virtual ~RectangleTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
virtual void on_second_paint(const Layer&, GUI::PaintEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;

View file

@ -38,9 +38,9 @@ public:
SprayTool();
virtual ~SprayTool() override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& original_event) override;
virtual void on_mousedown(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) override;
private: