/** * task_palette.cpp * ============================================================================= * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= */ #ifdef TOOLS_ENABLED #include "task_palette.h" #include "../util/limbo_compat.h" #include "../util/limbo_string_names.h" #include "../util/limbo_task_db.h" #include "../util/limbo_utility.h" #ifdef LIMBOAI_MODULE #include "core/config/project_settings.h" #include "core/error/error_macros.h" #include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_scale.h" #include "editor/plugins/script_editor_plugin.h" #include "scene/gui/check_box.h" #endif // LIMBO_MODULE #ifdef LIMBOAI_GDEXTENSION #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace godot; #endif // LIMBOAI_GDEXTENSION //**** TaskButton void TaskButton::_bind_methods() { } Control *TaskButton::_do_make_tooltip(const String &p_text) const { #ifdef LIMBOAI_MODULE EditorHelpBit *help_bit = memnew(EditorHelpBit); help_bit->get_rich_text()->set_custom_minimum_size(Size2(360 * EDSCALE, 1)); String help_text; if (!p_text.is_empty()) { help_text = p_text; } else { help_text = "[i]" + TTR("No description.") + "[/i]"; } help_bit->set_text(help_text); return help_bit; #endif // LIMBOAI_MODULE #ifdef LIMBOAI_GDEXTENSION // TODO: When we figure out how to retrieve documentation in GDEXTENSION, should add a tooltip control here. #endif // LIMBOAI_GDEXTENSION return nullptr; } TaskButton::TaskButton() { set_focus_mode(FOCUS_NONE); } //**** TaskButton ^ //**** TaskPaletteSection void TaskPaletteSection::_on_task_button_pressed(const String &p_task) { emit_signal(LW_NAME(task_button_pressed), p_task); } void TaskPaletteSection::_on_task_button_gui_input(const Ref &p_event, const String &p_task) { if (!p_event->is_pressed()) { return; } Ref mb = p_event; if (mb.is_valid() && mb->get_button_index() == LW_MBTN(RIGHT)) { emit_signal(LW_NAME(task_button_rmb), p_task); } } void TaskPaletteSection::_on_header_pressed() { set_collapsed(!is_collapsed()); } void TaskPaletteSection::set_filter(String p_filter_text) { int num_hidden = 0; if (p_filter_text.is_empty()) { for (int i = 0; i < tasks_container->get_child_count(); i++) { Object::cast_to