CE.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. /******************************************************************************/
  2. namespace Edit{
  3. /******************************************************************************/
  4. enum EXE_TYPE : Byte // Executable Type
  5. {
  6. EXE_EXE , // Windows Executable
  7. EXE_DLL , // Windows Dynamically Linked Library
  8. EXE_LIB , // Windows Statically Linked Library (currently not supported, reserved for future use)
  9. EXE_NEW , // Windows Universal App
  10. EXE_APK , // Android Application Package
  11. EXE_MAC , // Mac Application
  12. EXE_IOS , // iOS Application
  13. EXE_LINUX, // Linux
  14. EXE_WEB , // Web Html/JavaScript
  15. };
  16. enum EXPORT_MODE : Byte // Export Mode
  17. {
  18. EXPORT_EXE , // Export to project according to current Executable Type
  19. EXPORT_TXT , // Export to text files
  20. EXPORT_CPP , // Export to C++ files
  21. EXPORT_VS , // Export to Visual Studio version that is currently selected in the Editor
  22. EXPORT_VS2015 , // Export to Visual Studio 2015 project
  23. EXPORT_VS2017 , // Export to Visual Studio 2017 project
  24. EXPORT_ANDROID , // Export to Android project
  25. EXPORT_XCODE , // Export to Xcode project
  26. EXPORT_LINUX_MAKE , // Export to Linux project to be compiled using 'make'
  27. EXPORT_LINUX_NETBEANS, // Export to Linux project to be compiled using NetBeans
  28. };
  29. enum BUILD_MODE : Byte
  30. {
  31. BUILD_EXPORT , // activated through "Build/Export"
  32. BUILD_IDE , // activated through "Build/OpenInIDE"
  33. BUILD_PLAY , // activated through "Play" (Debug/Release)
  34. BUILD_DEBUG , // activated through "Build/Debug" (Debug/Release)
  35. BUILD_BUILD , // activated through "Build/Build,Rebuild" (Debug/Release)
  36. BUILD_PUBLISH, // activated through "Build/Publish" ( Release)
  37. };
  38. enum STORAGE_MODE : Byte
  39. {
  40. STORAGE_INTERNAL,
  41. STORAGE_EXTERNAL,
  42. STORAGE_AUTO ,
  43. };
  44. struct CodeEditorInterface
  45. {
  46. void del ();
  47. void clear ();
  48. void create (GuiObj &parent, Bool menu_on_top);
  49. void update (Bool active);
  50. void draw ();
  51. void resize ();
  52. void skinChanged();
  53. Bool initialized();
  54. Str title ();
  55. Str appPath (C Str &app_name);
  56. Str androidProjectPakPath();
  57. Str iOSProjectPakPath();
  58. Str windowsProjectPakPath();
  59. void saveChanges();
  60. void saveChanges(Memc<Edit::SaveChanges::Elm> &elms);
  61. void saveChanges(Memc<Edit::SaveChanges::Elm> &elms, void (*after_save_close)(Bool all_saved, Ptr user), Ptr user=null);
  62. void sourceRename (C UID &id ); // call this when source code file was renamed in the project
  63. Bool sourceCur (C Str &name); // set current source
  64. Bool sourceCur (C UID &id ); // set current source
  65. Bool sourceCurIs ( ); // if there is a current source
  66. Str sourceCurName ( ); // get current source
  67. UID sourceCurId ( ); // get current source
  68. Bool sourceCurModified( ); // get current source modified state
  69. Bool sourceCurConst ( ); // get current source const state
  70. void sourceDrawPreview(C Str &name); // draw preview of source
  71. void sourceDrawPreview(C UID &id ); // draw preview of source
  72. void sourceAuto (C Str &data); // set data of the automatically generated source
  73. void sourceRemove (C UID &id ); // remove selected source
  74. void sourceOverwrite (C UID &id ); // overwrite any changes of selected source
  75. Bool sourceDataGet (C UID &id, Str &data); // get source data, false if source is not loaded
  76. Bool sourceDataSet (C UID &id, C Str &data); // set source data, false if source is not loaded
  77. void projectsBuildPath(C Str &path); // set build path of all projects
  78. void menuEnabled (Bool on);
  79. void kbSet ();
  80. void close ();
  81. void closeAll ();
  82. void hideAll ();
  83. Bool visibleOptions ();
  84. void visibleOptions (Bool on);
  85. Bool visibleOpenedFiles ();
  86. void visibleOpenedFiles (Bool on);
  87. Bool visibleOutput ();
  88. void visibleOutput (Bool on);
  89. Bool visibleAndroidDevLog();
  90. void visibleAndroidDevLog(Bool on);
  91. Bool importPaths ()C;
  92. Bool importImageMipMaps()C;
  93. void saveSettings( TextNode &code);
  94. void loadSettings(C TextNode &code);
  95. void clearActiveSources(); // set all sources to be inactive (this must be called when changing app)
  96. void activateSource(C UID &id ); // make project based source active
  97. void activateSource(C Str &name ); // make file based source active
  98. void activateApp (Bool rebuild); // finalize changing app
  99. void paste(C MemPtr<UID> &elms, GuiObj *obj, C Vec2 &screen_pos); // paste project elements at specified position
  100. void paste(C Str &text , GuiObj *obj, C Vec2 &screen_pos); // paste text at specified position
  101. void paste(C Str &text ); // paste text at current position
  102. C Memx<Item>& items(); // get Esenthel Engine items
  103. void play();
  104. void debug();
  105. void runToCursor();
  106. void publish();
  107. void build();
  108. void rebuild();
  109. void rebuildSymbols();
  110. void clean();
  111. void cleanAll();
  112. void stop();
  113. void openIDE();
  114. void exportPaths(Bool relative);
  115. Bool Export(EXPORT_MODE mode);
  116. void configDebug(Bool debug);
  117. Bool configDebug( );
  118. void config32Bit(Bool bit32);
  119. Bool config32Bit( );
  120. void configDX9 (Bool dx9 );
  121. Bool configDX9 ( );
  122. void configEXE (EXE_TYPE exe );
  123. EXE_TYPE configEXE ( );
  124. virtual void visibleChangedOptions () {}
  125. virtual void visibleChangedOpenedFiles () {}
  126. virtual void visibleChangedOutput () {}
  127. virtual void visibleChangedAndroidDevLog() {}
  128. virtual void configChangedDebug() {}
  129. virtual void configChanged32Bit() {}
  130. virtual void configChangedDX9 () {}
  131. virtual void configChangedEXE () {}
  132. virtual UID projectID() {return UIDZero;} // get active Project ID
  133. virtual UID appID () {return UIDZero;} // get ID of current app
  134. virtual Str appName () {return S;} // get name of current app
  135. virtual Str appDirsWindows () {return S;} // get all directories of current app
  136. virtual Str appDirsNonWindows () {return S;} // get all directories of current app
  137. virtual Str appHeadersWindows () {return S;} // get all headers of current app
  138. virtual Str appHeadersMac () {return S;} // get all headers of current app
  139. virtual Str appHeadersLinux () {return S;} // get all headers of current app
  140. virtual Str appHeadersAndroid () {return S;} // get all headers of current app
  141. virtual Str appHeadersiOS () {return S;} // get all headers of current app
  142. virtual Str appLibsWindows () {return S;} // get all libraries of current app
  143. virtual Str appLibsMac () {return S;} // get all libraries of current app
  144. virtual Str appLibsLinux () {return S;} // get all libraries of current app
  145. virtual Str appLibsAndroid () {return S;} // get all libraries of current app
  146. virtual Str appLibsiOS () {return S;} // get all libraries of current app
  147. virtual Str appPackage () {return S;} // get package name of current app
  148. virtual Str appLicenseKey () {return S;} // get android license key of current app
  149. virtual Str appLocationUsageReason () {return S;} // get location usage reason of current app
  150. virtual Int appBuild () {return 1;} // get build number of current app
  151. virtual ULong appFacebookAppID () {return 0;} // get Facebook App ID of current app
  152. virtual Str appChartboostAppIDiOS () {return S;} // get Chartboost App ID of current app for iOS platform
  153. virtual Str appChartboostAppSignatureiOS () {return S;} // get Chartboost App Signature of current app for iOS platform
  154. virtual Str appChartboostAppIDGooglePlay () {return S;} // get Chartboost App ID of current app for Google Play platform
  155. virtual Str appChartboostAppSignatureGooglePlay() {return S;} // get Chartboost App Signature of current app for Google Play platform
  156. virtual STORAGE_MODE appPreferredStorage () {return STORAGE_INTERNAL;} // get preferred storage of current app
  157. virtual UInt appSupportedOrientations () {return 0;} // get supported orientations (DIR_FLAG) of current app
  158. virtual UID appGuiSkin () {return UIDZero;} // get default Gui Skin of current app
  159. virtual ImagePtr appIcon () {return null;} // get icon of current app
  160. virtual ImagePtr appImagePortrait () {return null;} // get portrait splash screen of current app
  161. virtual ImagePtr appImageLandscape () {return null;} // get landscape splash screen of current app
  162. virtual ImagePtr appNotificationIcon () {return null;} // get notification icon of current app
  163. virtual Int appEmbedEngineData () {return 0;} // get if embed engine data of current app
  164. virtual Cipher* appEmbedCipher () {return null;} // get cipher used for embedding data of current app
  165. virtual COMPRESS_TYPE appEmbedCompress () {return COMPRESS_NONE;} // get compression used for embedding data of current app
  166. virtual Int appEmbedCompressLevel () {return 0;} // get compression used for embedding data of current app
  167. virtual DateTime appEmbedSettingsTime () {return DateTime().zero();} // get settings time for embedding data of current app
  168. virtual Bool appPublishProjData () {return true;} // get if publish project data of current app
  169. virtual Bool appPublishPhysxDll () {return true;} // get if copy PhysX dll's of current app
  170. virtual Bool appPublishSteamDll () {return false;} // get if copy Steam dll of current app
  171. virtual Bool appPublishOpenVRDll () {return false;} // get if copy OpenVR dll of current app
  172. virtual Bool appPublishDataAsPak () {return true;} // get if publish data as paks of current app
  173. virtual Bool appWindowsCodeSign () {return false;} // get if code sign exe of current app
  174. virtual Bool appAndroidExpansion () {return false;} // get if download android expansion files of current app
  175. virtual void appSpecificFiles (MemPtr<PakFileData> files) {} // get specific files of current app
  176. virtual void appInvalidProperty (C Str &msg ) {} // called when application property was detected as invalid
  177. virtual Rect menuRect ( ) {return D.rect();}
  178. virtual Rect sourceRect ( ) {return D.rect();}
  179. virtual Str sourceProjPath(C UID &id ) {return S;}
  180. virtual ERROR_TYPE sourceDataLoad(C UID &id, Str &data) {return EE_ERR_ELM_NOT_FOUND;}
  181. virtual Bool sourceDataSave(C UID &id, C Str &data) {return false;}
  182. virtual void sourceChanged (Bool activate=false) {} // called on change of current source
  183. virtual void publishSuccess(C Str &exe_name, EXE_TYPE exe_type, BUILD_MODE build_mode, C UID &project_id) {}
  184. virtual void validateActiveSources() {} // called when sources need to have their activation reset
  185. virtual Bool elmValid (C UID &id ) {return false;} // if element of this ID exists in the project
  186. virtual Str elmBaseName (C UID &id ) {return S;} // get base name of element
  187. virtual Str elmFullName (C UID &id ) {return S;} // get full name of element
  188. virtual void elmHighlight(C UID &id, C Str &name) { } // highlight element
  189. virtual void elmOpen (C UID &id ) { } // open element
  190. virtual void elmLocate (C UID &id ) { } // locate element
  191. virtual void elmPreview (C UID &id, C Vec2 &pos, Bool mouse, C Rect &clip) {} // draw element preview at 'pos' position, 'mouse'=if triggered by mouse
  192. virtual Str idToText(C UID &id, Bool *valid=null) {if(valid)*valid=false; return S;} // return ID in text format (this can be element/object/waypoint/.. ID)
  193. struct ElmLink
  194. {
  195. UID id;
  196. Str full_name;
  197. ImagePtr icon;
  198. void set(C UID &id, C Str &full_name, C ImagePtr &icon) {T.id=id; T.full_name=full_name; T.icon=icon;}
  199. };
  200. virtual void getProjPublishElms(Memc<ElmLink> &elms) {} // get list of project elements for publishing
  201. };
  202. #if EE_PRIVATE
  203. /******************************************************************************/
  204. struct VisualStudioInstallation
  205. {
  206. Str name, path;
  207. VecI4 ver; // 9="VS 2008", 10="VS 2010", 11="VS 2012", 12="VS 2013", 14="VS 2015", 15="VS 2017", ..
  208. };
  209. Bool CheckVisualStudio(C VecI4 &vs_ver, Str *message=null, Bool check_minor=true); // check if specified VS version is supported, 'message'=optional message, false on fail
  210. Bool GetVisualStudioInstallations(MemPtr<VisualStudioInstallation> installs); // false on fail
  211. Str MSBuildPath(C Str &vs_path=S, C VecI4 &vs_ver=0); // 'vs_path'=preferred Visual Studio installation path, use empty for auto-detect
  212. Str MSBuildParams(C Str &project, C Str &config, C Str &platform=S);
  213. Str VSBuildParams(C Str &project, C Str &config, C Str &platform=S, C Str &log=S);
  214. Str XcodeBuildParams (C Str &project, C Str &config, C Str &platform, C Str &sdk=S);
  215. Str XcodeBuildCleanParams(C Str &project, C Str &config, C Str &platform, C Str &sdk=S);
  216. Str LinuxBuildParams(C Str &project, C Str &config, Int build_threads=Cpu.threads());
  217. /******************************************************************************/
  218. struct ColorTheme
  219. {
  220. Color colors[TOKEN_TYPES];
  221. void save( TextNode &node)C;
  222. void load(C TextNode &node);
  223. }extern
  224. Theme, ThemeCustom;
  225. /******************************************************************************/
  226. const_mem_addr struct CodeEditor
  227. {
  228. GuiObj * parent;
  229. Source *_cur;
  230. Memx<Item> items;
  231. Memx<Source> sources;
  232. Button b_close;
  233. WindowIO load_source;
  234. Bool config_debug, config_32_bit, config_dx9, symbols_loaded, menu_on_top;
  235. EXE_TYPE config_exe;
  236. Str ee_h_path;
  237. TextStyle ts, ts_small, ts_cjk;
  238. GuiSkin source_skin, suggestions_skin, find_result_skin, cjk_skin;
  239. struct BuildResult
  240. {
  241. Byte mode; // 0=default, 1=warning, 2=error
  242. Str text;
  243. UID line;
  244. Color color;
  245. SourceLoc source_loc;
  246. void clear() {mode=0; text.clear(); source_loc.clear(); line.zero(); setColor();}
  247. BuildResult& set(C Str &text ) {clear(); T.text=text; return T;}
  248. BuildResult& set(C Str &text, Source *source) {clear(); T.text=text; if(source){T.source_loc= source->loc; } return T;}
  249. BuildResult& set(C Str &text, Line *line ) {clear(); T.text=text; if(line ){T.source_loc=line->source->loc; T.line=line->id;} return T;}
  250. BuildResult& set(C Str &text, Token *token ) {return set(text, token ? token ->line : null);}
  251. BuildResult& set(C Str &text, Symbol *symbol) {return set(text, symbol ? symbol->getToken() : null);}
  252. void setWarning();
  253. void setError ();
  254. void setColor ();
  255. Bool jumpTo(); // jump to source and line, false on fail
  256. BuildResult() {mode=0; line.zero(); setColor();}
  257. };
  258. struct BuildFile
  259. {
  260. enum MODE : Byte
  261. {
  262. SOURCE, // .cpp .h
  263. TEXT , // .txt
  264. LIB , // .lib
  265. PAK , // .pak
  266. IGNORE, //
  267. };
  268. MODE mode;
  269. Str src_proj_path, dest_file_path, dest_proj_path, ext_not;
  270. SourceLoc src_loc;
  271. ULong xcode_file_id, xcode_mac_id, xcode_ios_id;
  272. Bool includeInProj() {return mode==SOURCE || mode==LIB || mode==TEXT;}
  273. BuildFile& set(MODE mode, C Str &src_proj_path, C SourceLoc &src_loc)
  274. {
  275. T.mode =mode;
  276. T.src_proj_path=src_proj_path;
  277. T.src_loc =src_loc;
  278. return T;
  279. }
  280. void adjustPaths(C Str &path)
  281. {
  282. switch(mode)
  283. {
  284. case SOURCE:
  285. {
  286. dest_proj_path=S+"Source\\"+ext_not+".cpp";
  287. dest_file_path=path+dest_proj_path;
  288. }break;
  289. }
  290. }
  291. BuildFile() {mode=IGNORE; xcode_file_id=xcode_mac_id=xcode_ios_id=0;}
  292. };
  293. STRUCT(BuildList , List<BuildResult>)
  294. //{
  295. Int highlight_line;
  296. Dbl highlight_time;
  297. virtual void update(C GuiPC &gpc);
  298. virtual void draw (C GuiPC &gpc);
  299. BuildList() {highlight_line=0; highlight_time=0;}
  300. };
  301. struct DeviceLog
  302. {
  303. enum MODE : Byte
  304. {
  305. DEFAULT,
  306. WARNING,
  307. ERROR ,
  308. APP ,
  309. }mode;
  310. Color color;
  311. Str time, app, message;
  312. Str asText();
  313. void setWarning();
  314. void setError ();
  315. void setApp ();
  316. void setColor ();
  317. DeviceLog() {mode=DEFAULT; setColor();}
  318. };
  319. struct BuildEmbed
  320. {
  321. UInt type;
  322. Str path;
  323. BuildEmbed& set(UInt type, C Str &path) {T.type=type; T.path=path; return T;}
  324. };
  325. BUILD_MODE build_mode;
  326. EXE_TYPE build_exe_type;
  327. Memc<BuildFile > build_files;
  328. Memc<BuildResult> build_data;
  329. Memc<BuildEmbed > build_embed;
  330. BuildList build_list;
  331. Button build_close, build_export, build_copy;
  332. Region build_region;
  333. Progress build_progress;
  334. ConsoleProcess build_process;
  335. Bool build_debug, build_windows_code_sign;
  336. Int build_phase, build_phases, build_step, build_steps;
  337. Flt build_refresh;
  338. UID build_project_id;
  339. Str build_path, build_project_name, build_project_file, build_source, build_exe, build_package, build_output, build_log, adb_path;
  340. Cache<LineMap> build_line_maps;
  341. WindowIO build_io;
  342. Str devlog_text;
  343. Memc<DeviceLog> devlog_data;
  344. List<DeviceLog> devlog_list;
  345. Region devlog_region;
  346. ConsoleProcess devlog_process, adb_server;
  347. Button devlog_close, devlog_export, devlog_filter, devlog_clear;
  348. WindowIO devlog_io;
  349. MemberDesc devlog_time_sort;
  350. Str projects_build_path, vs_path, devenv_path, android_sdk, android_ndk, jdk_path, netbeans_path, cert_file, cert_pass;
  351. VecI4 devenv_version;
  352. Bool devenv_express, devenv_com, build_msbuild;
  353. STRUCT(GotoLineWindow , ClosableWindow)
  354. //{
  355. TextLine textline;
  356. CodeEditor *ce;
  357. void create (CodeEditor &ce);
  358. virtual GuiObj& activate();
  359. virtual void update (C GuiPC &gpc);
  360. GotoLineWindow() {ce=null;}
  361. };
  362. GotoLineWindow goto_line_window;
  363. STRUCT(Options , ClosableWindow)
  364. //{
  365. STRUCT(VSVersions , ClosableWindow)
  366. //{
  367. CodeEditor *ce;
  368. VSVersions() {ce=null;}
  369. STRUCT(Version , Button)
  370. //{
  371. static void OK(Version &ver)
  372. {
  373. Str msg; if(!CheckVisualStudio(ver.install.ver, &msg))Error(msg);else
  374. if(ver.ce){ver.ce->setVSPath(ver.install.path); ver.ce->options.vs_versions.hide();}
  375. }
  376. VisualStudioInstallation install;
  377. CodeEditor *ce;
  378. Version() {ce=null;}
  379. Button& create(C Vec2 &pos, C VisualStudioInstallation &install, CodeEditor *ce)
  380. {
  381. T.install=install;
  382. T.ce =ce;
  383. super::create(Rect_C(pos, 0.7f, 0.06f), install.name).func(OK, T).desc(S+"Path: "+install.path+"\nVersion: "+install.ver.asTextDots());
  384. return T;
  385. }
  386. };
  387. Memx<Version> versions; // must be Memx
  388. void create(CodeEditor &ce);
  389. virtual Window& show ();
  390. };
  391. struct FontSize
  392. {
  393. Int size;
  394. Str text;
  395. void set(Int size, C Str &text) {T.size=size; T.text=text;}
  396. };
  397. struct FontData
  398. {
  399. Int size;
  400. Vec2 spacing;
  401. Str font, custom_chars;
  402. Memc<LANG_TYPE> langs;
  403. FontData();
  404. Str chars()C;
  405. Bool make (Font &font, C Str *chars=null)C;
  406. void save( TextNode &node)C;
  407. void load(C TextNode &node);
  408. };
  409. STRUCT(FontParams , FontData)
  410. //{
  411. Str sample_text;
  412. Bool chinese, japanese, korean;
  413. FontParams();
  414. void load(C TextNode &node);
  415. };
  416. STRUCT(ColorThemeEditor, ClosableWindow)
  417. //{
  418. TextStyle ts;
  419. Memx<Property> props;
  420. ColorThemeEditor& create();
  421. void skinChanged();
  422. };
  423. STRUCT(FontEditor, ClosableWindow)
  424. //{
  425. TextStyle ts;
  426. FontParams params;
  427. Memx<Property> props;
  428. Button apply;
  429. Font font;
  430. Viewport viewport;
  431. Thread thread;
  432. SyncLock lock;
  433. ~FontEditor() {del();} // delete thread before other members
  434. Bool make ();
  435. void preview();
  436. void skinChanged();
  437. virtual FontEditor& del ();
  438. virtual FontEditor& create();
  439. virtual FontEditor& hide();
  440. virtual FontEditor& show();
  441. };
  442. TextStyle ts;
  443. Tabs tabs;
  444. Text t_vs_path, t_netbeans_path, t_android_sdk, t_android_ndk, t_jdk_path, t_cert_file, t_cert_pass, t_font_size, t_color_theme, t_export_path_mode, t_import_path_mode;
  445. TextLine vs_path, netbeans_path, android_sdk, android_ndk, jdk_path, cert_file, cert_pass;
  446. Button b_vs_path, b_netbeans_path, b_android_sdk, b_android_ndk, b_jdk_path, b_cert_file, cert_create, facebook_android_key_hash, authenticode, vs_path_auto, netbeans_path_auto, android_sdk_auto, android_ndk_auto, jdk_path_auto, d_vs, d_netbeans, d_android_sdk, d_android_ndk, d_jdk, color_theme_edit, font_edit;
  447. ComboBox font_size, color_theme, export_path_mode, import_path_mode;
  448. Button ac_on_enter, simple, imm_scroll, eol_clip, line_numbers, hide_horizontal_slidebar, auto_hide_menu, import_image_mip_maps;
  449. WindowIO w_vs_path, w_netbeans_path, w_android_sdk, w_android_ndk, w_jdk_path, w_cert_file;
  450. VSVersions vs_versions;
  451. ColorThemeEditor color_theme_editor;
  452. FontEditor font_editor;
  453. CodeEditor *ce;
  454. Memc<FontSize> font_sizes;
  455. Bool guided ()C {return !simple();}
  456. void activatePaths();
  457. void activateCert ();
  458. void create (CodeEditor &ce);
  459. void skinChanged ();
  460. virtual Window& show ();
  461. virtual Window& hide ();
  462. Options() {ce=null;}
  463. };
  464. Options options;
  465. STRUCT(AndroidCertificate , ClosableWindow)
  466. //{
  467. Text torg_name, tpass;
  468. TextLine org_name, pass;
  469. Button save;
  470. WindowIO win_io;
  471. void create(CodeEditor &ce);
  472. virtual Window& hide ();
  473. };
  474. AndroidCertificate android_certificate;
  475. struct CurPos
  476. {
  477. Int col;
  478. UID line;
  479. Source *source;
  480. Bool operator==(C CurPos &cp) {return col==cp.col && line==cp.line && source==cp.source;}
  481. Bool operator!=(C CurPos &cp) {return !(T==cp);}
  482. CurPos() {}
  483. CurPos(Int col, C UID &line, Source *source) {T.col=col; T.line=line; T.source=source;}
  484. };
  485. Memc<CurPos> curpos;
  486. Int curposi;
  487. Find find;
  488. ReplaceText replace;
  489. Bool view_elm_names, view_comments, view_funcs, view_func_bodies, view_private_members;
  490. Button view_mode, b_find;
  491. ComboBox view_what;
  492. SaveChanges save_changes;
  493. STRUCT(MenuBarEx , MenuBar)
  494. //{
  495. C Rect& rect ()C {return GuiObj::rect();}
  496. virtual MenuBarEx& rect (C Rect &rect);
  497. virtual void parentClientRectChanged(C Rect *old_client, C Rect *new_client);
  498. };
  499. MenuBarEx menu;
  500. CodeEditorInterface *cei_ptr, cei_temp; // 'cei_ptr' must always point to something
  501. CodeEditorInterface& cei() {return *cei_ptr;} void cei(CodeEditorInterface &cei) {cei_ptr=&cei;} // get/set CEI
  502. ~CodeEditor() {_cur=null;}
  503. CodeEditor();
  504. // get
  505. Rect sourceRect();
  506. Flt lineNumberSize()C;
  507. Flt fontSpaceOffset()C;
  508. Source* findSource(C SourceLoc &loc);
  509. Source* getSource(C SourceLoc &loc, ERROR_TYPE *error=null);
  510. Int curI();
  511. Source* cur ();
  512. Str title();
  513. Str zipalignPath()C;
  514. Str adbPath()C;
  515. Str ndkBuildPath()C;
  516. // main
  517. void del ();
  518. void replacePath(C Str &src, C Str &dest);
  519. void setMenu (Node<MenuElm> &menu);
  520. void create (GuiObj *parent, Bool menu_on_top);
  521. void init ();
  522. void update (Bool active);
  523. void draw ();
  524. void rebuild3rdPartyHeaders();
  525. void rebuildSymbols (Bool rebuild_3rd_party_headers);
  526. void validateActiveSources (Bool rebuild_3rd_party_headers=false);
  527. // parser
  528. void parseHeaderEx(Str h, C Str &parent_path, Bool try_system, Memc<Token> &dest, Memc<Macro> &macros, Memc<SymbolPtr> &usings, Bool ee, Memc<PrepCond> &prep_if);
  529. void parseHeader (C Str &h, Memc<Macro> &macros, Memc<SymbolPtr> &usings, Bool ee);
  530. // gui
  531. void hideAll ();
  532. void resize ();
  533. void skinChanged();
  534. void zoom (Int zoom);
  535. void fontChanged();
  536. void themeChanged();
  537. void scrollChanged();
  538. void hideSlideBarChanged();
  539. void setMenuBarVisibility();
  540. void buildClear ();
  541. BuildResult& buildNew ();
  542. void buildNew (Memc<Message> &msgs);
  543. void buildUpdate (Bool show=true);
  544. Bool visibleOpenedFiles ( );
  545. void visibleOpenedFiles (Bool on);
  546. Bool visibleOutput ( );
  547. void visibleOutput (Bool on);
  548. Bool visibleAndroidDevLog( );
  549. void visibleAndroidDevLog(Bool on);
  550. static void HideAndFocusCE(GuiObj &go);
  551. // edit
  552. void undo ( ) {if(cur())cur()->undo ();}
  553. void redo ( ) {if(cur())cur()->redo ();}
  554. void cut ( ) {if(cur())cur()->cut ();}
  555. void copy ( ) {if(cur())cur()->copy ();}
  556. void paste (Bool move_cur=true) {if(cur())cur()->paste (null, move_cur);}
  557. void separator ( ) {if(cur())cur()->separator();}
  558. void selectAll ( ) {if(cur())cur()->selAll ();}
  559. void selectWord( ) {if(cur())cur()->selWord ();}
  560. void makeCase (Bool upper ) {if(cur())cur()->makeCase (upper);}
  561. // C++
  562. void VS (C Str &command, Bool console, Bool hidden );
  563. void VSClean(C Str &project );
  564. void VSBuild(C Str &project, C Str &config , C Str &platform, C Str &out);
  565. void VSRun (C Str &project , C Str &out);
  566. void VSOpen (C Str &project, C Str &file=S );
  567. void VSDebug(C Str &exe );
  568. void validateDevEnv ();
  569. void setVSPath (C Str &path);
  570. void setNBPath (C Str &path);
  571. void setASPath (C Str &path);
  572. void setANPath (C Str &path);
  573. void setJDKPath (C Str &path);
  574. void setCertPath (C Str &path);
  575. void setCertPass (C Str &pass);
  576. Bool verifyVS ();
  577. Bool verifyXcode ();
  578. Bool verifyAndroid ();
  579. Bool verifyLinuxMake ();
  580. Bool verifyLinuxNetBeans();
  581. Bool getBuildPath (Str &build_path, Str &build_project_name, C Str *app_name=null); // 'app_name'=if use custom app or current one
  582. Bool verifyBuildPath ();
  583. Bool verifyBuildFiles(Memc<Message> &msgs);
  584. Bool adjustBuildFiles();
  585. Bool generateTXT(Memc<Message> &msgs);
  586. void generateHeadersH(Memc<Symbol*> &sorted_classes, EXPORT_MODE export_mode, Bool gcc);
  587. Bool generateCPPH(Memc<Symbol*> &sorted_classes, EXPORT_MODE export_mode);
  588. Bool generateVSProj(Int version);
  589. Bool generateXcodeProj();
  590. Bool generateAndroidProj();
  591. Bool generateLinuxMakeProj();
  592. Bool generateLinuxNBProj ();
  593. Bool Export(EXPORT_MODE mode, BUILD_MODE build_mode);
  594. void stopBuild();
  595. void killBuild();
  596. void build(BUILD_MODE mode=BUILD_BUILD);
  597. void play();
  598. void debug();
  599. void openIDE();
  600. void runToCursor();
  601. void clean();
  602. void cleanAll();
  603. void rebuild();
  604. void configDebug(Bool debug);
  605. void config32Bit(Bool bit32);
  606. void configDX9 (Bool dx9 );
  607. void configEXE (EXE_TYPE exe );
  608. void createFuncList ();
  609. void playEsenthelCompiler();
  610. // sources
  611. void cur (Source *cur);
  612. Source& New ();
  613. void sourceRemoved (Source &src);
  614. void closeDo ();
  615. void closeAll (); // close all sources ignoring any unsaved changes
  616. void close ();
  617. void saveChanges ();
  618. void saveChanges (Memc<Edit::SaveChanges::Elm> &elms);
  619. void removeUselessSources();
  620. CurPos curPos();
  621. void markCurPos();
  622. void prevCurPos();
  623. void nextCurPos();
  624. void nextFile(); // activate next opened source
  625. void prevFile(); // activate prev opened source
  626. void prevIssue();
  627. void nextIssue();
  628. void jumpTo(CurPos &cp);
  629. void jumpTo(Source *source, Int line);
  630. void jumpTo(Macro *macro );
  631. void jumpTo(Symbol *symbol);
  632. void findAllReferences(C Str &text);
  633. void findAllReferences(Symbol *symbol);
  634. void findAllReferences(C UID &id);
  635. // io
  636. void genSymbols(C Str &ee_editor_bin);
  637. Bool saveSymbols(C Str &file);
  638. Bool loadSymbols(C Str &file, Bool all=true);
  639. void saveSettings( TextNode &code);
  640. void loadSettings(C TextNode &code);
  641. Bool load ( C SourceLoc &loc, Bool quiet=false, Bool Const=false);
  642. void save (Source *source, C SourceLoc &loc);
  643. void overwrite();
  644. void save ();
  645. void load ();
  646. NO_COPY_CONSTRUCTOR(CodeEditor);
  647. }extern
  648. CE;
  649. /******************************************************************************/
  650. extern Memc<Macro > EEMacros, ProjectMacros;
  651. extern Memc<SymbolPtr> EEUsings, ProjectUsings;
  652. extern Memc<Str > Suggestions;
  653. /******************************************************************************/
  654. void SuggestionsUsed (C Str &text);
  655. Int SuggestionsPriority(C Str &suggestion, C Str &text, Bool all_up_case);
  656. #endif
  657. } // namespace
  658. /******************************************************************************/