2
0

PolycodeIDEApp.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. Copyright (C) 2012 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #if defined(__APPLE__) && defined(__MACH__)
  20. #import "PolycodeView.h"
  21. #elif defined(_WINDOWS)
  22. #include "PolycodeWinIDEView.h"
  23. #else
  24. #include "PolycodeView.h"
  25. #endif
  26. #include "PolycodeGlobals.h"
  27. #include "PolycodeProjectManager.h"
  28. #include "PolycodeEditorManager.h"
  29. #include "Polycode.h"
  30. //#include "PolyCocoaCore.h"
  31. #include "PolycodeUI.h"
  32. #include "PolycodeFrame.h"
  33. #include "PolycodeImageEditor.h"
  34. #include "PolycodeMaterialEditor.h"
  35. #include "PolycodeFontEditor.h"
  36. #include "PolycodeTextEditor.h"
  37. #include "PolycodeProjectEditor.h"
  38. #include "PolycodeSpriteEditor.h"
  39. #include "PolycodeMeshEditor.h"
  40. #include "PolycodeEntityEditor.h"
  41. #include "PolycodeToolLauncher.h"
  42. #include "PolycodeRemoteDebugger.h"
  43. #include "PolycodeClipboard.h"
  44. using namespace Polycode;
  45. class PolycodeIDEApp : public EventDispatcher {
  46. public:
  47. #ifdef _WINDOWS
  48. PolycodeIDEApp(PolycodeWinIDEView *view);
  49. #else
  50. PolycodeIDEApp(PolycodeView *view);
  51. #endif
  52. ~PolycodeIDEApp();
  53. void handleEvent(Event *event);
  54. bool Update();
  55. void saveConfigFile();
  56. void loadConfigFile();
  57. void openFileInProject(PolycodeProject *project, String filePath);
  58. void openFile(OSFileEntry file);
  59. void stopProject();
  60. // menu commands
  61. void renameFile();
  62. void removeFile();
  63. void doRemoveFile();
  64. void browseExamples();
  65. void newProject();
  66. void newFile();
  67. void showAbout();
  68. void openDocs();
  69. void addFiles();
  70. void importAssets();
  71. void newGroup();
  72. void openProject();
  73. void closeProject();
  74. void closeFile();
  75. void saveFile();
  76. void findText();
  77. void runProject();
  78. void doRunProject();
  79. void exportProject();
  80. void toggleConsole();
  81. void showSettings();
  82. void createNewTab();
  83. void closeTab();
  84. void showNextTab();
  85. void showPreviousTab();
  86. void removeEditor(PolycodeEditor *editor);
  87. // system callbacks
  88. void openProject(String projectFile);
  89. void refreshProject();
  90. bool quitApp();
  91. bool needsRedraw;
  92. bool lastConnected;
  93. const static int EVENT_SHOW_MENU = 1;
  94. Core *core;
  95. void saveFiles(std::vector<PolycodeEditor*> editors);
  96. void closeFiles(std::vector<PolycodeEditor*> editors, String saveMsg="");
  97. bool filesHaveChanges(std::vector<PolycodeEditor*> editors);
  98. protected:
  99. bool quittingApp;
  100. bool runNextFrame;
  101. Object configFile;
  102. bool willRunProject;
  103. PolycodeFrame *frame;
  104. PolycodeEditorManager *editorManager;
  105. PolycodeProjectManager *projectManager;
  106. PolycodeRemoteDebugger *debugger;
  107. UIMenuBar *menuBar;
  108. private:
  109. void applyFinalConfig();
  110. std::vector<ObjectEntry*> projectsToOpen;
  111. void doCloseProject();
  112. void doCloseFiles(std::vector<PolycodeEditor*> editors);
  113. // used in saving/closing files via popup dialog prompts
  114. std::vector<PolycodeEditor*> tempEditorStore;
  115. };