godotsharp_editor.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*************************************************************************/
  2. /* godotsharp_editor.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GODOTSHARP_EDITOR_H
  31. #define GODOTSHARP_EDITOR_H
  32. #include "godotsharp_builds.h"
  33. #include "monodevelop_instance.h"
  34. class GodotSharpEditor : public Node {
  35. GDCLASS(GodotSharpEditor, Object)
  36. EditorNode *editor;
  37. MenuButton *menu_button;
  38. PopupMenu *menu_popup;
  39. AcceptDialog *error_dialog;
  40. AcceptDialog *about_dialog;
  41. CheckBox *about_dialog_checkbox;
  42. ToolButton *bottom_panel_btn;
  43. GodotSharpBuilds *godotsharp_builds;
  44. MonoDevelopInstance *monodevelop_instance;
  45. #ifdef OSX_ENABLED
  46. MonoDevelopInstance *visualstudio_mac_instance;
  47. #endif
  48. bool _create_project_solution();
  49. void _make_api_solutions_if_needed();
  50. void _make_api_solutions_if_needed_impl();
  51. void _remove_create_sln_menu_option();
  52. void _show_about_dialog();
  53. void _toggle_about_dialog_on_start(bool p_enabled);
  54. void _menu_option_pressed(int p_id);
  55. static GodotSharpEditor *singleton;
  56. protected:
  57. void _notification(int p_notification);
  58. static void _bind_methods();
  59. public:
  60. enum MenuOptions {
  61. MENU_CREATE_SLN,
  62. MENU_ABOUT_CSHARP,
  63. };
  64. enum ExternalEditor {
  65. EDITOR_NONE,
  66. #ifdef WINDOWS_ENABLED
  67. //EDITOR_VISUALSTUDIO, // TODO
  68. EDITOR_MONODEVELOP,
  69. EDITOR_VSCODE
  70. #elif OSX_ENABLED
  71. EDITOR_VISUALSTUDIO_MAC,
  72. EDITOR_MONODEVELOP,
  73. EDITOR_VSCODE
  74. #elif UNIX_ENABLED
  75. EDITOR_MONODEVELOP,
  76. EDITOR_VSCODE
  77. #endif
  78. };
  79. _FORCE_INLINE_ static GodotSharpEditor *get_singleton() { return singleton; }
  80. static void register_internal_calls();
  81. void show_error_dialog(const String &p_message, const String &p_title = "Error");
  82. Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col);
  83. bool overrides_external_editor();
  84. GodotSharpEditor(EditorNode *p_editor);
  85. ~GodotSharpEditor();
  86. };
  87. class MonoReloadNode : public Node {
  88. GDCLASS(MonoReloadNode, Node)
  89. Timer *reload_timer;
  90. void _reload_timer_timeout();
  91. static MonoReloadNode *singleton;
  92. protected:
  93. static void _bind_methods();
  94. void _notification(int p_what);
  95. public:
  96. _FORCE_INLINE_ static MonoReloadNode *get_singleton() { return singleton; }
  97. void restart_reload_timer();
  98. MonoReloadNode();
  99. ~MonoReloadNode();
  100. };
  101. #endif // GODOTSHARP_EDITOR_H