mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
PixelPaint: Rename Mode
to FillMode
for Ellipse/Rectangle
The prior commits add the `DrawMode` enum to keep track of where the shape is being drawn from. With this addition, the prior `Mode` enum name is confusing, so this commit renames it to `FillMode` to be more explicit :^)
This commit is contained in:
parent
6ccdc018b4
commit
c853bc2ba6
4 changed files with 16 additions and 16 deletions
|
@ -37,11 +37,11 @@ void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_p
|
||||||
ellipse_intersecting_rect = Gfx::IntRect::from_two_points(start_position, end_position);
|
ellipse_intersecting_rect = Gfx::IntRect::from_two_points(start_position, end_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_mode) {
|
switch (m_fill_mode) {
|
||||||
case Mode::Outline:
|
case FillMode::Outline:
|
||||||
painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness);
|
painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness);
|
||||||
break;
|
break;
|
||||||
case Mode::Fill:
|
case FillMode::Fill:
|
||||||
painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
|
painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -148,10 +148,10 @@ GUI::Widget* EllipseTool::get_properties_widget()
|
||||||
auto& fill_mode_radio = mode_radio_container.add<GUI::RadioButton>("Fill");
|
auto& fill_mode_radio = mode_radio_container.add<GUI::RadioButton>("Fill");
|
||||||
|
|
||||||
outline_mode_radio.on_checked = [&](bool) {
|
outline_mode_radio.on_checked = [&](bool) {
|
||||||
m_mode = Mode::Outline;
|
m_fill_mode = FillMode::Outline;
|
||||||
};
|
};
|
||||||
fill_mode_radio.on_checked = [&](bool) {
|
fill_mode_radio.on_checked = [&](bool) {
|
||||||
m_mode = Mode::Fill;
|
m_fill_mode = FillMode::Fill;
|
||||||
};
|
};
|
||||||
|
|
||||||
outline_mode_radio.set_checked(true);
|
outline_mode_radio.set_checked(true);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Mode {
|
enum class FillMode {
|
||||||
Outline,
|
Outline,
|
||||||
Fill,
|
Fill,
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,7 @@ private:
|
||||||
Gfx::IntPoint m_ellipse_start_position;
|
Gfx::IntPoint m_ellipse_start_position;
|
||||||
Gfx::IntPoint m_ellipse_end_position;
|
Gfx::IntPoint m_ellipse_end_position;
|
||||||
int m_thickness { 1 };
|
int m_thickness { 1 };
|
||||||
Mode m_mode { Mode::Outline };
|
FillMode m_fill_mode { FillMode::Outline };
|
||||||
DrawMode m_draw_mode { DrawMode::FromCorner };
|
DrawMode m_draw_mode { DrawMode::FromCorner };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,14 @@ void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start
|
||||||
rect = Gfx::IntRect::from_two_points(start_position, end_position);
|
rect = Gfx::IntRect::from_two_points(start_position, end_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_mode) {
|
switch (m_fill_mode) {
|
||||||
case Mode::Fill:
|
case FillMode::Fill:
|
||||||
painter.fill_rect(rect, m_editor->color_for(m_drawing_button));
|
painter.fill_rect(rect, m_editor->color_for(m_drawing_button));
|
||||||
break;
|
break;
|
||||||
case Mode::Outline:
|
case FillMode::Outline:
|
||||||
painter.draw_rect(rect, m_editor->color_for(m_drawing_button));
|
painter.draw_rect(rect, m_editor->color_for(m_drawing_button));
|
||||||
break;
|
break;
|
||||||
case Mode::Gradient:
|
case FillMode::Gradient:
|
||||||
painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color());
|
painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -138,13 +138,13 @@ GUI::Widget* RectangleTool::get_properties_widget()
|
||||||
auto& gradient_mode_radio = mode_radio_container.add<GUI::RadioButton>("Gradient");
|
auto& gradient_mode_radio = mode_radio_container.add<GUI::RadioButton>("Gradient");
|
||||||
|
|
||||||
outline_mode_radio.on_checked = [&](bool) {
|
outline_mode_radio.on_checked = [&](bool) {
|
||||||
m_mode = Mode::Outline;
|
m_fill_mode = FillMode::Outline;
|
||||||
};
|
};
|
||||||
fill_mode_radio.on_checked = [&](bool) {
|
fill_mode_radio.on_checked = [&](bool) {
|
||||||
m_mode = Mode::Fill;
|
m_fill_mode = FillMode::Fill;
|
||||||
};
|
};
|
||||||
gradient_mode_radio.on_checked = [&](bool) {
|
gradient_mode_radio.on_checked = [&](bool) {
|
||||||
m_mode = Mode::Gradient;
|
m_fill_mode = FillMode::Gradient;
|
||||||
};
|
};
|
||||||
|
|
||||||
outline_mode_radio.set_checked(true);
|
outline_mode_radio.set_checked(true);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Mode {
|
enum class FillMode {
|
||||||
Outline,
|
Outline,
|
||||||
Fill,
|
Fill,
|
||||||
Gradient,
|
Gradient,
|
||||||
|
@ -44,7 +44,7 @@ private:
|
||||||
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
|
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
|
||||||
Gfx::IntPoint m_rectangle_start_position;
|
Gfx::IntPoint m_rectangle_start_position;
|
||||||
Gfx::IntPoint m_rectangle_end_position;
|
Gfx::IntPoint m_rectangle_end_position;
|
||||||
Mode m_mode { Mode::Outline };
|
FillMode m_fill_mode { FillMode::Outline };
|
||||||
DrawMode m_draw_mode { DrawMode::FromCorner };
|
DrawMode m_draw_mode { DrawMode::FromCorner };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue