Skip to content

Commit

Permalink
Merge pull request #44569 from madmiraal/rename-unselect-deselect
Browse files Browse the repository at this point in the history
Rename unselect to deselect
  • Loading branch information
akien-mga authored Dec 28, 2020
2 parents e4c0572 + 7b293ed commit feb4e5e
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions doc/classes/FileDialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
Clear all the added filters in the dialog.
</description>
</method>
<method name="deselect_items">
<method name="deselect_all">
<return type="void">
</return>
<description>
Clear currently selected items in the dialog.
Clear all currently selected items in the dialog.
</description>
</method>
<method name="get_line_edit">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/GraphEdit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
Emitted when a GraphNode is selected.
</description>
</signal>
<signal name="node_unselected">
<signal name="node_deselected">
<argument index="0" name="node" type="Node">
</argument>
<description>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/ItemList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
Sorts items in the list by their text.
</description>
</method>
<method name="unselect">
<method name="deselect">
<return type="void">
</return>
<argument index="0" name="idx" type="int">
Expand All @@ -480,7 +480,7 @@
Ensures the item associated with the specified index is not selected.
</description>
</method>
<method name="unselect_all">
<method name="deselect_all">
<return type="void">
</return>
<description>
Expand Down
2 changes: 1 addition & 1 deletion editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void CreateDialog::_favorite_selected() {
}

search_box->set_text(item->get_text(0).get_slicec(' ', 0));
recent->unselect_all();
recent->deselect_all();
_update_search();
}

Expand Down
8 changes: 4 additions & 4 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void EditorFileDialog::_multi_selected(int p_item, bool p_selected) {
}

void EditorFileDialog::_items_clear_selection() {
item_list->unselect_all();
item_list->deselect_all();

// If nothing is selected, then block Open button.
switch (mode) {
Expand Down Expand Up @@ -595,7 +595,7 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p
void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
// Right click on folder background. Deselect all files so that actions are applied on the current folder.
for (int i = 0; i < item_list->get_item_count(); i++) {
item_list->unselect(i);
item_list->deselect(i);
}

item_menu->clear();
Expand Down Expand Up @@ -849,7 +849,7 @@ void EditorFileDialog::update_file_list() {
}

if (favorites->get_current() >= 0) {
favorites->unselect(favorites->get_current());
favorites->deselect(favorites->get_current());
}

favorite->set_pressed(false);
Expand Down Expand Up @@ -1226,7 +1226,7 @@ void EditorFileDialog::_update_favorites() {
if (setthis) {
favorite->set_pressed(true);
favorites->set_current(favorites->get_item_count() - 1);
recent->unselect_all();
recent->deselect_all();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_layouts_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all));
name->connect("focus_entered", callable_mp(layout_names, &ItemList::deselect_all));
}

void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
Expand Down
2 changes: 1 addition & 1 deletion editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,7 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) {
continue;
}
if (files->get_item_text(p_item) == "..") {
files->unselect(i);
files->deselect(i);
continue;
}
paths.push_back(files->get_item_metadata(i));
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/tile_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Vector<int> TileMapEditor::get_selected_tiles() const {
}

void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
palette->unselect_all();
palette->deselect_all();

for (int i = p_tiles.size() - 1; i >= 0; i--) {
int idx = palette->find_metadata(p_tiles[i]);
Expand Down
2 changes: 1 addition & 1 deletion editor/project_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
export_path->hide();
runnable->set_disabled(true);
parameters->edit(nullptr);
presets->unselect_all();
presets->deselect_all();
duplicate_preset->set_disabled(true);
delete_preset->set_disabled(true);
sections->hide();
Expand Down
2 changes: 1 addition & 1 deletion modules/gridmap/grid_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
return true;
} else {
selected_palette = -1;
mesh_library_palette->unselect_all();
mesh_library_palette->deselect_all();
update_palette();
_update_cursor_instance();
return true;
Expand Down
10 changes: 5 additions & 5 deletions scene/gui/file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void FileDialog::update_dir() {
}

// Deselect any item, to make "Select Current Folder" button text by default.
deselect_items();
deselect_all();
}

void FileDialog::_dir_entered(String p_dir) {
Expand Down Expand Up @@ -172,7 +172,7 @@ void FileDialog::_post_popup() {

// For open dir mode, deselect all items on file dialog open.
if (mode == FILE_MODE_OPEN_DIR) {
deselect_items();
deselect_all();
file_box->set_visible(false);
} else {
file_box->set_visible(true);
Expand Down Expand Up @@ -318,7 +318,7 @@ void FileDialog::_go_up() {
update_dir();
}

void FileDialog::deselect_items() {
void FileDialog::deselect_all() {
// Clear currently selected items in file manager.
tree->deselect_all();

Expand Down Expand Up @@ -808,7 +808,7 @@ void FileDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_file_name"), &FileDialog::update_file_name);
ClassDB::bind_method(D_METHOD("_update_dir"), &FileDialog::update_dir);
ClassDB::bind_method(D_METHOD("_update_file_list"), &FileDialog::update_file_list);
ClassDB::bind_method(D_METHOD("deselect_items"), &FileDialog::deselect_items);
ClassDB::bind_method(D_METHOD("deselect_all"), &FileDialog::deselect_all);

ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate);

Expand Down Expand Up @@ -932,7 +932,7 @@ FileDialog::FileDialog() {
tree->connect("multi_selected", callable_mp(this, &FileDialog::_tree_multi_selected), varray(), CONNECT_DEFERRED);
tree->connect("cell_selected", callable_mp(this, &FileDialog::_tree_selected), varray(), CONNECT_DEFERRED);
tree->connect("item_activated", callable_mp(this, &FileDialog::_tree_item_activated), varray());
tree->connect("nothing_selected", callable_mp(this, &FileDialog::deselect_items));
tree->connect("nothing_selected", callable_mp(this, &FileDialog::deselect_all));
dir->connect("text_entered", callable_mp(this, &FileDialog::_dir_entered));
file->connect("text_entered", callable_mp(this, &FileDialog::_file_entered));
filter->connect("item_selected", callable_mp(this, &FileDialog::_filter_selected));
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class FileDialog : public ConfirmationDialog {

void invalidate();

void deselect_items();
void deselect_all();

FileDialog();
~FileDialog();
Expand Down
14 changes: 7 additions & 7 deletions scene/gui/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,13 +1081,13 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (!gn->is_selected() && box_selection_mode_additive) {
emit_signal("node_selected", gn);
} else if (gn->is_selected() && !box_selection_mode_additive) {
emit_signal("node_unselected", gn);
emit_signal("node_deselected", gn);
}
gn->set_selected(box_selection_mode_additive);
} else {
bool select = (previus_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
emit_signal("node_unselected", gn);
emit_signal("node_deselected", gn);
} else if (!gn->is_selected() && select) {
emit_signal("node_selected", gn);
}
Expand All @@ -1112,7 +1112,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {

bool select = (previus_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
emit_signal("node_unselected", gn);
emit_signal("node_deselected", gn);
} else if (!gn->is_selected() && select) {
emit_signal("node_selected", gn);
}
Expand Down Expand Up @@ -1141,7 +1141,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
Rect2 r = gn->get_rect();
r.size *= zoom;
if (r.has_point(b->get_position())) {
emit_signal("node_unselected", gn);
emit_signal("node_deselected", gn);
gn->set_selected(false);
}
}
Expand Down Expand Up @@ -1204,7 +1204,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
o_gn->set_selected(true);
} else {
if (o_gn->is_selected()) {
emit_signal("node_unselected", o_gn);
emit_signal("node_deselected", o_gn);
}
o_gn->set_selected(false);
}
Expand Down Expand Up @@ -1264,7 +1264,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
if (gn2->is_selected()) {
emit_signal("node_unselected", gn2);
emit_signal("node_deselected", gn2);
}
gn2->set_selected(false);
}
Expand Down Expand Up @@ -1628,7 +1628,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("copy_nodes_request"));
ADD_SIGNAL(MethodInfo("paste_nodes_request"));
ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("node_unselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("node_deselected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING_NAME, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("connection_from_empty", PropertyInfo(Variant::STRING_NAME, "to"), PropertyInfo(Variant::INT, "to_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
Expand Down
12 changes: 6 additions & 6 deletions scene/gui/item_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void ItemList::select(int p_idx, bool p_single) {
update();
}

void ItemList::unselect(int p_idx) {
void ItemList::deselect(int p_idx) {
ERR_FAIL_INDEX(p_idx, items.size());

if (select_mode != SELECT_MULTI) {
Expand All @@ -345,7 +345,7 @@ void ItemList::unselect(int p_idx) {
update();
}

void ItemList::unselect_all() {
void ItemList::deselect_all() {
if (items.size() < 1) {
return;
}
Expand Down Expand Up @@ -573,7 +573,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
int i = closest;

if (select_mode == SELECT_MULTI && items[i].selected && mb->get_command()) {
unselect(i);
deselect(i);
emit_signal("multi_selected", i, false);

} else if (select_mode == SELECT_MULTI && mb->get_shift() && current >= 0 && current < items.size() && current != i) {
Expand Down Expand Up @@ -759,7 +759,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
select(current, false);
emit_signal("multi_selected", current, true);
} else if (items[current].selected) {
unselect(current);
deselect(current);
emit_signal("multi_selected", current, false);
}
}
Expand Down Expand Up @@ -1519,8 +1519,8 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &ItemList::get_item_tooltip);

ClassDB::bind_method(D_METHOD("select", "idx", "single"), &ItemList::select, DEFVAL(true));
ClassDB::bind_method(D_METHOD("unselect", "idx"), &ItemList::unselect);
ClassDB::bind_method(D_METHOD("unselect_all"), &ItemList::unselect_all);
ClassDB::bind_method(D_METHOD("deselect", "idx"), &ItemList::deselect);
ClassDB::bind_method(D_METHOD("deselect_all"), &ItemList::deselect_all);

ClassDB::bind_method(D_METHOD("is_selected", "idx"), &ItemList::is_selected);
ClassDB::bind_method(D_METHOD("get_selected_items"), &ItemList::get_selected_items);
Expand Down
4 changes: 2 additions & 2 deletions scene/gui/item_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ class ItemList : public Control {
Color get_item_custom_fg_color(int p_idx) const;

void select(int p_idx, bool p_single = true);
void unselect(int p_idx);
void unselect_all();
void deselect(int p_idx);
void deselect_all();
bool is_selected(int p_idx) const;
Vector<int> get_selected_items();
bool is_anything_selected();
Expand Down

0 comments on commit feb4e5e

Please sign in to comment.