1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

HackStudio: Reduce debug spam

This commit is contained in:
Ben Wiederhake 2020-08-29 00:07:44 +02:00 committed by Andreas Kling
parent da966ac8d8
commit 04e3122526
2 changed files with 13 additions and 1 deletions

View file

@ -31,11 +31,15 @@
#include <AK/LogStream.h>
#include <LibGfx/Palette.h>
//#define DEBUG_CURSOR_TOOL
namespace HackStudio {
void CursorTool::on_mousedown(GUI::MouseEvent& event)
{
#ifdef DEBUG_CURSOR_TOOL
dbg() << "CursorTool::on_mousedown";
#endif
auto& form_widget = m_editor.form_widget();
auto result = form_widget.hit_test(event.position(), GUI::Widget::ShouldRespectGreediness::No);
@ -45,7 +49,9 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event)
m_editor.selection().toggle(*result.widget);
} else if (!event.modifiers()) {
if (!m_editor.selection().contains(*result.widget)) {
#ifdef DEBUG_CURSOR_TOOL
dbg() << "Selection didn't contain " << *result.widget << ", making it the only selected one";
#endif
m_editor.selection().set(*result.widget);
}
@ -70,7 +76,9 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event)
void CursorTool::on_mouseup(GUI::MouseEvent& event)
{
#ifdef DEBUG_CURSOR_TOOL
dbg() << "CursorTool::on_mouseup";
#endif
if (event.button() == GUI::MouseButton::Left) {
auto& form_widget = m_editor.form_widget();
auto result = form_widget.hit_test(event.position(), GUI::Widget::ShouldRespectGreediness::No);
@ -89,7 +97,9 @@ void CursorTool::on_mouseup(GUI::MouseEvent& event)
void CursorTool::on_mousemove(GUI::MouseEvent& event)
{
#ifdef DEBUG_CURSOR_TOOL
dbg() << "CursorTool::on_mousemove";
#endif
auto& form_widget = m_editor.form_widget();
if (m_rubber_banding) {
@ -126,7 +136,9 @@ void CursorTool::on_mousemove(GUI::MouseEvent& event)
void CursorTool::on_keydown(GUI::KeyEvent& event)
{
#ifdef DEBUG_CURSOR_TOOL
dbg() << "CursorTool::on_keydown";
#endif
auto move_selected_widgets_by = [this](int x, int y) {
m_editor.selection().for_each([&](auto& widget) {