mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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.
This commit is contained in:
parent
d28fb8926f
commit
280cbf2e18
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue