Skip to content

Commit

Permalink
Merge pull request #88547 from CookieBadger/ed-is-shortcut-macro
Browse files Browse the repository at this point in the history
Use `ED_IS_SHORTCUT` macro instead of `matches_event`
  • Loading branch information
akien-mga committed Feb 19, 2024
2 parents 35bf1e1 + 47dba6b commit 37cca2b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions editor/animation_bezier_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,20 +834,20 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}

if (p_event->is_pressed()) {
if (ED_GET_SHORTCUT("animation_editor/duplicate_selected_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/duplicate_selected_keys", p_event)) {
if (!read_only) {
duplicate_selected_keys(-1.0);
}
accept_event();
}
if (ED_GET_SHORTCUT("animation_editor/copy_selected_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/copy_selected_keys", p_event)) {
if (!read_only) {
copy_selected_keys(false);
}
accept_event();
}

if (ED_GET_SHORTCUT("animation_editor/paste_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/paste_keys", p_event)) {
if (!read_only) {
paste_keys(-1.0);
}
Expand All @@ -858,7 +858,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> key_press = p_event;

if (key_press.is_valid() && key_press->is_pressed()) {
if (ED_GET_SHORTCUT("animation_bezier_editor/focus")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_bezier_editor/focus", p_event)) {
SelectionSet focused_keys;
if (selection.is_empty()) {
for (int i = 0; i < edit_points.size(); ++i) {
Expand Down Expand Up @@ -927,15 +927,15 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
queue_redraw();
accept_event();
return;
} else if (ED_GET_SHORTCUT("animation_bezier_editor/select_all_keys")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("animation_bezier_editor/select_all_keys", p_event)) {
for (int i = 0; i < edit_points.size(); ++i) {
selection.insert(IntPair(edit_points[i].track, edit_points[i].key));
}

queue_redraw();
accept_event();
return;
} else if (ED_GET_SHORTCUT("animation_bezier_editor/deselect_all_keys")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("animation_bezier_editor/deselect_all_keys", p_event)) {
selection.clear();

queue_redraw();
Expand Down
10 changes: 5 additions & 5 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2685,33 +2685,33 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());

if (p_event->is_pressed()) {
if (ED_GET_SHORTCUT("animation_editor/duplicate_selected_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/duplicate_selected_keys", p_event)) {
if (!read_only) {
emit_signal(SNAME("duplicate_request"), -1.0);
}
accept_event();
}
if (ED_GET_SHORTCUT("animation_editor/cut_selected_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/cut_selected_keys", p_event)) {
if (!read_only) {
emit_signal(SNAME("cut_request"));
}
accept_event();
}
if (ED_GET_SHORTCUT("animation_editor/copy_selected_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/copy_selected_keys", p_event)) {
if (!read_only) {
emit_signal(SNAME("copy_request"));
}
accept_event();
}

if (ED_GET_SHORTCUT("animation_editor/paste_keys")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/paste_keys", p_event)) {
if (!read_only) {
emit_signal(SNAME("paste_request"), -1.0);
}
accept_event();
}

if (ED_GET_SHORTCUT("animation_editor/delete_selection")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("animation_editor/delete_selection", p_event)) {
if (!read_only) {
emit_signal(SNAME("delete_request"));
}
Expand Down
20 changes: 10 additions & 10 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,25 +1285,25 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
if (k->is_pressed()) {
if (ED_GET_SHORTCUT("canvas_item_editor/zoom_3.125_percent")->matches_event(p_event)) {
if (ED_IS_SHORTCUT("canvas_item_editor/zoom_3.125_percent", p_event)) {
_shortcut_zoom_set(1.0 / 32.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_6.25_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_6.25_percent", p_event)) {
_shortcut_zoom_set(1.0 / 16.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_12.5_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_12.5_percent", p_event)) {
_shortcut_zoom_set(1.0 / 8.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_25_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_25_percent", p_event)) {
_shortcut_zoom_set(1.0 / 4.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_50_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_50_percent", p_event)) {
_shortcut_zoom_set(1.0 / 2.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_100_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_100_percent", p_event)) {
_shortcut_zoom_set(1.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_200_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_200_percent", p_event)) {
_shortcut_zoom_set(2.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_400_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_400_percent", p_event)) {
_shortcut_zoom_set(4.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_800_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_800_percent", p_event)) {
_shortcut_zoom_set(8.0);
} else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_1600_percent")->matches_event(p_event)) {
} else if (ED_IS_SHORTCUT("canvas_item_editor/zoom_1600_percent", p_event)) {
_shortcut_zoom_set(16.0);
}
}
Expand Down

0 comments on commit 37cca2b

Please sign in to comment.