Run clang-format

This commit is contained in:
Alexander Montag 2024-09-25 16:17:44 +00:00
parent f523af2d13
commit b4974bffd2
3 changed files with 27 additions and 30 deletions

View File

@ -23,17 +23,17 @@
#include "core/object/script_language.h" #include "core/object/script_language.h"
#include "editor/themes/editor_scale.h" #include "editor/themes/editor_scale.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/label.h" #include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/classes/editor_interface.hpp> #include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/script.hpp>
#include <godot_cpp/classes/h_box_container.hpp> #include <godot_cpp/classes/h_box_container.hpp>
#include <godot_cpp/classes/v_box_container.hpp>
#include <godot_cpp/classes/texture_rect.hpp>
#include <godot_cpp/classes/label.hpp> #include <godot_cpp/classes/label.hpp>
#include <godot_cpp/classes/script.hpp>
#include <godot_cpp/classes/texture_rect.hpp>
#include <godot_cpp/classes/v_box_container.hpp>
using namespace godot; using namespace godot;
#endif // LIMBOAI_GDEXTENSION #endif // LIMBOAI_GDEXTENSION
@ -437,7 +437,7 @@ void TaskTree::_normalize_drop(TreeItem *item, int type, int &to_pos, Ref<BTTask
to_pos = to_task->get_index(); to_pos = to_task->get_index();
{ {
Vector<Ref<BTTask>> selected = get_selected_tasks(); Vector<Ref<BTTask>> selected = get_selected_tasks();
if (to_task == selected[selected.size()-1]) { if (to_task == selected[selected.size() - 1]) {
to_pos += 1; to_pos += 1;
} }
} }
@ -577,7 +577,7 @@ TaskTree::TaskTree() {
// for Tree + TreeSearch, we want a VBoxContainer. For now, rather than changing this classes type, let's do nesting: // for Tree + TreeSearch, we want a VBoxContainer. For now, rather than changing this classes type, let's do nesting:
// TaskTree -> VBoxContainer -> [Tree, TreeSearchPanel] // TaskTree -> VBoxContainer -> [Tree, TreeSearchPanel]
VBoxContainer * vbox_container = memnew(VBoxContainer); VBoxContainer *vbox_container = memnew(VBoxContainer);
add_child(vbox_container); add_child(vbox_container);
vbox_container->set_anchors_preset(PRESET_FULL_RECT); vbox_container->set_anchors_preset(PRESET_FULL_RECT);

View File

@ -22,19 +22,19 @@
#include "core/math/math_funcs.h" #include "core/math/math_funcs.h"
#include "editor/editor_interface.h" #include "editor/editor_interface.h"
#include "editor/themes/editor_scale.h" #include "editor/themes/editor_scale.h"
#include "scene/resources/font.h"
#include "scene/gui/separator.h" #include "scene/gui/separator.h"
#include "scene/resources/style_box_flat.h"
#include "scene/main/viewport.h" #include "scene/main/viewport.h"
#include "scene/resources/font.h"
#include "scene/resources/style_box_flat.h"
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/core/math.hpp>
#include <godot_cpp/classes/editor_interface.hpp> // for edge scale #include <godot_cpp/classes/editor_interface.hpp> // for edge scale
#include <godot_cpp/classes/font.hpp> #include <godot_cpp/classes/font.hpp>
#include <godot_cpp/classes/h_separator.hpp> #include <godot_cpp/classes/h_separator.hpp>
#include <godot_cpp/classes/style_box_flat.hpp> #include <godot_cpp/classes/style_box_flat.hpp>
#include <godot_cpp/classes/viewport.hpp> #include <godot_cpp/classes/viewport.hpp>
#include <godot_cpp/core/math.hpp>
#endif // LIMBOAI_GDEXTENSION #endif // LIMBOAI_GDEXTENSION
#define UPPER_BOUND (1 << 15) // for substring search. #define UPPER_BOUND (1 << 15) // for substring search.
@ -141,8 +141,7 @@ void TreeSearchPanel::show_and_focus() {
/* ------- TreeSearch ------- */ /* ------- TreeSearch ------- */
void TreeSearch::_filter_tree(TreeItem *p_tree_item, const String &p_search_mask) { void TreeSearch::_filter_tree(TreeItem *p_tree_item, const String &p_search_mask) {
for (int i = 0; i < ordered_tree_items.size(); i++){ for (int i = 0; i < ordered_tree_items.size(); i++) {
} }
PRINT_LINE("filter tree not yet implemented!", p_search_mask); PRINT_LINE("filter tree not yet implemented!", p_search_mask);
} }
@ -153,8 +152,9 @@ void TreeSearch::_highlight_tree(const String &p_search_mask) {
TreeItem *entry = ordered_tree_items[i]; TreeItem *entry = ordered_tree_items[i];
int num_m = number_matches.has(entry) ? number_matches.get(entry) : 0; int num_m = number_matches.has(entry) ? number_matches.get(entry) : 0;
if (num_m == 0){ if (num_m == 0) {
continue;; continue;
;
} }
// make sure to also call any draw method already defined. // make sure to also call any draw method already defined.
@ -192,7 +192,6 @@ void TreeSearch::_draw_highlight_item(TreeItem *p_tree_item, Rect2 p_rect, Strin
// first part: outline // first part: outline
if (matching_entries.has(p_tree_item)) { if (matching_entries.has(p_tree_item)) {
// font info // font info
Ref<Font> font = p_tree_item->get_custom_font(0); Ref<Font> font = p_tree_item->get_custom_font(0);
if (font.is_null()) { if (font.is_null()) {
@ -409,16 +408,16 @@ void TreeSearch::_select_next_match() {
_select_first_match(); // wrap around. _select_first_match(); // wrap around.
} }
void TreeSearch::on_item_edited(TreeItem * item) { void TreeSearch::on_item_edited(TreeItem *item) {
if (item->get_cell_mode(0) != TreeItem::CELL_MODE_CUSTOM){ if (item->get_cell_mode(0) != TreeItem::CELL_MODE_CUSTOM) {
return; return;
} }
if (!callable_cache.has(item) || item->get_custom_draw_callback(0) == callable_cache.get(item)){ if (!callable_cache.has(item) || item->get_custom_draw_callback(0) == callable_cache.get(item)) {
return; return;
} }
item->set_custom_draw_callback(0,callable_cache.get(item)); item->set_custom_draw_callback(0, callable_cache.get(item));
} }
// Call this as a post-processing step for the already constructed tree. // Call this as a post-processing step for the already constructed tree.
@ -440,7 +439,6 @@ void TreeSearch::update_search(Tree *p_tree) {
_update_matching_entries(search_mask); _update_matching_entries(search_mask);
_update_number_matches(); _update_number_matches();
if (search_mode == TreeSearchMode::HIGHLIGHT) { if (search_mode == TreeSearchMode::HIGHLIGHT) {
_highlight_tree(search_mask); _highlight_tree(search_mask);
if (!search_panel->is_connected("text_submitted", callable_mp(this, &TreeSearch::_select_next_match))) { if (!search_panel->is_connected("text_submitted", callable_mp(this, &TreeSearch::_select_next_match))) {

View File

@ -83,7 +83,7 @@ private:
} }
}; };
Tree * tree_reference; Tree *tree_reference;
Vector<TreeItem *> ordered_tree_items; Vector<TreeItem *> ordered_tree_items;
Vector<TreeItem *> matching_entries; Vector<TreeItem *> matching_entries;
@ -99,13 +99,12 @@ private:
Vector<TreeItem *> _find_matching_entries(TreeItem *tree_item, const String &search_mask, Vector<TreeItem *> &buffer); Vector<TreeItem *> _find_matching_entries(TreeItem *tree_item, const String &search_mask, Vector<TreeItem *> &buffer);
StringSearchIndices _substring_bounds(const String &searchable, const String &search_mask) const; StringSearchIndices _substring_bounds(const String &searchable, const String &search_mask) const;
void _select_item(TreeItem * item); void _select_item(TreeItem *item);
void _select_first_match(); void _select_first_match();
void _select_next_match(); void _select_next_match();
protected: protected:
static void _bind_methods(){} static void _bind_methods() {}
public: public:
// we will add everything from TaskTree.h // we will add everything from TaskTree.h