diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /scene/gui/gradient_edit.cpp | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) | |
download | redot-engine-0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a.tar.gz |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'scene/gui/gradient_edit.cpp')
-rw-r--r-- | scene/gui/gradient_edit.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index a6ed3d8de9..1617405dd3 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -93,11 +93,9 @@ GradientEdit::~GradientEdit() { } void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { - Ref<InputEventKey> k = p_event; if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) { - points.remove(grabbed); grabbed = -1; grabbing = false; @@ -129,7 +127,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { //Hold alt key to duplicate selected color if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && mb->get_alt()) { - int x = mb->get_position().x; grabbed = _get_point_from_pos(x); @@ -154,7 +151,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { //select if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) { - update(); int x = mb->get_position().x; int total_w = get_size().width - get_size().height - SPACING; @@ -187,7 +183,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { } if (pos == -1) { - prev.color = Color(0, 0, 0); prev.offset = 0; if (points.size()) { @@ -197,7 +192,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { next.offset = 1.0; } } else { - if (pos == points.size() - 1) { next.color = Color(1, 1, 1); next.offset = 1.0; @@ -222,7 +216,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { } if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) { - if (grabbing) { grabbing = false; emit_signal("ramp_changed"); @@ -233,7 +226,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid() && grabbing) { - int total_w = get_size().width - get_size().height - SPACING; int x = mm->get_position().x; @@ -273,7 +265,6 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { bool valid = true; for (int i = 0; i < points.size(); i++) { - if (points[i].offset == newofs && i != grabbed) { valid = false; break; @@ -300,14 +291,12 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { } void GradientEdit::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { if (!picker->is_connected("color_changed", callable_mp(this, &GradientEdit::_color_changed))) { picker->connect("color_changed", callable_mp(this, &GradientEdit::_color_changed)); } } if (p_what == NOTIFICATION_DRAW) { - int w = get_size().x; int h = get_size().y; @@ -328,7 +317,6 @@ void GradientEdit::_notification(int p_what) { prev.color = points[0].color; //Extend color of first point to the beginning. for (int i = -1; i < points.size(); i++) { - Gradient::Point next; //If there is no next point if (i + 1 == points.size()) { @@ -362,7 +350,6 @@ void GradientEdit::_notification(int p_what) { //Draw point markers for (int i = 0; i < points.size(); i++) { - Color col = points[i].color.contrasted(); col.a = 0.9; @@ -397,7 +384,6 @@ void GradientEdit::_notification(int p_what) { //Draw borders around color ramp if in focus if (has_focus()) { - draw_line(Vector2(-1, -1), Vector2(total_w + 1, -1), Color(1, 1, 1, 0.6)); draw_line(Vector2(total_w + 1, -1), Vector2(total_w + 1, h + 1), Color(1, 1, 1, 0.6)); draw_line(Vector2(total_w + 1, h + 1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6)); @@ -406,7 +392,6 @@ void GradientEdit::_notification(int p_what) { } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (!is_visible()) { grabbing = false; } @@ -435,12 +420,10 @@ void GradientEdit::_draw_checker(int x, int y, int w, int h) { } Size2 GradientEdit::get_minimum_size() const { - return Vector2(0, 16); } void GradientEdit::_color_changed(const Color &p_color) { - if (grabbed == -1) return; points.write[grabbed].color = p_color; @@ -449,7 +432,6 @@ void GradientEdit::_color_changed(const Color &p_color) { } void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) { - ERR_FAIL_COND(p_offsets.size() != p_colors.size()); points.clear(); for (int i = 0; i < p_offsets.size(); i++) { |