console.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*************************************************************************/
  2. /* console.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef CONSOLE_H
  30. #define CONSOLE_H
  31. #include "scene/gui/popup.h"
  32. #include "scene/gui/button.h"
  33. #include "scene/gui/tab_container.h"
  34. #include "scene/gui/tree.h"
  35. #include "scene/main/timer.h"
  36. #include "output_strings.h"
  37. #include "property_editor.h"
  38. #include "scene_tree_editor.h"
  39. #include "editor_data.h"
  40. class Console : public Popup {
  41. OBJ_TYPE( Console, Popup );
  42. TabContainer *tabs;
  43. OutputStrings *output;
  44. OutputStrings *errors;
  45. Control *status;
  46. Control *inspect;
  47. Control *globals;
  48. Button *close;
  49. int height;
  50. EditorHistory inspect_history;
  51. SceneTreeEditor *inspect_tree_editor;
  52. PropertyEditor *inspect_property_editor;
  53. PropertyEditor *globals_property_editor;
  54. Tree *stats_tree;
  55. struct StatsItems {
  56. TreeItem *render_objects_in_frame;
  57. TreeItem *material_changes_in_frame;
  58. TreeItem *usage_video_mem_total;
  59. TreeItem *usage_video_mem_used;
  60. TreeItem *usage_texture_mem_used;
  61. TreeItem *usage_vertex_mem_used;
  62. TreeItem *usage_static_memory_total;
  63. TreeItem *usage_static_memory;
  64. TreeItem *usage_dynamic_memory_total;
  65. TreeItem *usage_dynamic_memory;
  66. TreeItem *usage_objects_instanced;
  67. } stats;
  68. struct OutputQueue {
  69. OutputStrings::LineType type;
  70. Variant meta;
  71. String text;
  72. };
  73. Mutex *output_queue_mutex;
  74. List<OutputQueue> output_queue;
  75. ErrorHandlerList err_handler;
  76. PrintHandlerList print_handler;
  77. void _inspector_node_selected();
  78. static void _error_handle(void *p_this,const char*p_function,const char* p_file,int p_line,const char *p_error, const char *p_explanation,ErrorHandlerType p_type);
  79. static void _print_handle(void *p_this,const String& p_string);
  80. protected:
  81. virtual void _window_input_event(InputEvent p_event);
  82. virtual void _window_resize_event();
  83. void _stats_update_timer_callback();
  84. void _resized();
  85. void _close_pressed();
  86. void _notification(int p_what);
  87. static void _bind_methods();
  88. public:
  89. Console();
  90. ~Console();
  91. };
  92. #endif // CONSOLE_H