mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +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);
|
||||
}
|
||||
|
||||
switch (m_mode) {
|
||||
case Mode::Outline:
|
||||
switch (m_fill_mode) {
|
||||
case FillMode::Outline:
|
||||
painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness);
|
||||
break;
|
||||
case Mode::Fill:
|
||||
case FillMode::Fill:
|
||||
painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
|
||||
break;
|
||||
default:
|
||||
|
@ -148,10 +148,10 @@ GUI::Widget* EllipseTool::get_properties_widget()
|
|||
auto& fill_mode_radio = mode_radio_container.add<GUI::RadioButton>("Fill");
|
||||
|
||||
outline_mode_radio.on_checked = [&](bool) {
|
||||
m_mode = Mode::Outline;
|
||||
m_fill_mode = FillMode::Outline;
|
||||
};
|
||||
fill_mode_radio.on_checked = [&](bool) {
|
||||
m_mode = Mode::Fill;
|
||||
m_fill_mode = FillMode::Fill;
|
||||
};
|
||||
|
||||
outline_mode_radio.set_checked(true);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
private:
|
||||
enum class Mode {
|
||||
enum class FillMode {
|
||||
Outline,
|
||||
Fill,
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ private:
|
|||
Gfx::IntPoint m_ellipse_start_position;
|
||||
Gfx::IntPoint m_ellipse_end_position;
|
||||
int m_thickness { 1 };
|
||||
Mode m_mode { Mode::Outline };
|
||||
FillMode m_fill_mode { FillMode::Outline };
|
||||
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);
|
||||
}
|
||||
|
||||
switch (m_mode) {
|
||||
case Mode::Fill:
|
||||
switch (m_fill_mode) {
|
||||
case FillMode::Fill:
|
||||
painter.fill_rect(rect, m_editor->color_for(m_drawing_button));
|
||||
break;
|
||||
case Mode::Outline:
|
||||
case FillMode::Outline:
|
||||
painter.draw_rect(rect, m_editor->color_for(m_drawing_button));
|
||||
break;
|
||||
case Mode::Gradient:
|
||||
case FillMode::Gradient:
|
||||
painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color());
|
||||
break;
|
||||
default:
|
||||
|
@ -138,13 +138,13 @@ GUI::Widget* RectangleTool::get_properties_widget()
|
|||
auto& gradient_mode_radio = mode_radio_container.add<GUI::RadioButton>("Gradient");
|
||||
|
||||
outline_mode_radio.on_checked = [&](bool) {
|
||||
m_mode = Mode::Outline;
|
||||
m_fill_mode = FillMode::Outline;
|
||||
};
|
||||
fill_mode_radio.on_checked = [&](bool) {
|
||||
m_mode = Mode::Fill;
|
||||
m_fill_mode = FillMode::Fill;
|
||||
};
|
||||
gradient_mode_radio.on_checked = [&](bool) {
|
||||
m_mode = Mode::Gradient;
|
||||
m_fill_mode = FillMode::Gradient;
|
||||
};
|
||||
|
||||
outline_mode_radio.set_checked(true);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
private:
|
||||
enum class Mode {
|
||||
enum class FillMode {
|
||||
Outline,
|
||||
Fill,
|
||||
Gradient,
|
||||
|
@ -44,7 +44,7 @@ private:
|
|||
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
|
||||
Gfx::IntPoint m_rectangle_start_position;
|
||||
Gfx::IntPoint m_rectangle_end_position;
|
||||
Mode m_mode { Mode::Outline };
|
||||
FillMode m_fill_mode { FillMode::Outline };
|
||||
DrawMode m_draw_mode { DrawMode::FromCorner };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue