1 #ifndef IDE_H
2 #define IDE_H
3
4 #include <ide/Common/Common.h>
5
6 #include <RichEdit/RichEdit.h>
7
8 #include <Report/Report.h>
9
10 #include <ide/Browser/Browser.h>
11 #include <TabBar/TabBar.h>
12 #include <CodeEditor/CodeEditor.h>
13 #include <urepo/urepo.h>
14 #include <ide/IconDes/IconDes.h>
15 #include <ide/Java/Java.h>
16 #include <ide/LayDes/LayDes.h>
17 #include <ide/Debuggers/Debuggers.h>
18 #include <TextDiffCtrl/TextDiffCtrl.h>
19 #include <ide/Designers/Designers.h>
20 #include <ide/Android/Android.h>
21
22 #include "About.h"
23 #include "MethodsCtrls.h"
24
25 #define LAYOUTFILE <ide/ide.lay>
26 #include <CtrlCore/lay.h>
27
28 #define IMAGECLASS IdeImg
29 #define IMAGEFILE <ide/ide.iml>
30 #include <Draw/iml_header.h>
31
32 #define KEYGROUPNAME "Ide"
33 #define KEYNAMESPACE IdeKeys
34 #define KEYFILE <ide/ide.key>
35 #include <CtrlLib/key_header.h>
36
37 #include "version.h"
38
39 #include <plugin/astyle/astyle.h>
40
41 #include <ide/Builders/Builders.h>
42
43 const char *FindTag(const char *txt, const char *tag);
44 const char *FindAfter(const char *txt, const char *tag);
45 int IdeLocateLine(String old_file, int old_line, String new_file);
46
47 #include "UppDlg.h"
48
49 bool IsTextFile(const String& file, int maxline = INT_MAX);
50
51 void Puts(const char *s);
52
53 Display& BoldDisplay();
54
55 class Console : public CodeEditor {
56 public:
57 virtual bool Key(dword key, int count);
58 virtual void LeftDouble(Point p, dword);
59 virtual void RightDown(Point p, dword);
60 virtual void Append(const String& s);
61
62 protected:
63 struct Slot {
SlotSlot64 Slot() : outfile(NULL), quiet(true), exitcode(Null) { serial = INT_MAX; }
65
66 One<AProcess> process;
67 String cmdline;
68 String output;
69 String key;
70 String group;
71 Stream *outfile;
72 bool quiet;
73 int exitcode;
74 int last_msecs;
75 int serial;
76 };
77
78 struct Group {
GroupGroup79 Group() : count(0), start_time(::msecs()), finished(false), msecs(0), raw_msecs(0) {}
80
81 int count;
82 int start_time;
83 bool finished;
84 int msecs;
85 int raw_msecs;
86 };
87
88 struct Finisher {
89 int serial;
90 Event<> cb;
91 };
92
93 Array<Slot> processes;
94 ArrayMap<String, Group> groups;
95 Array<Finisher> finisher;
96 Vector<String> error_keys;
97 String current_group;
98 String spooled_output;
99 int console_lock;
100 bool wrap_text;
101 FrameBottom<EditString> input;
102 String line;
103 int serial;
104
105 void CheckEndGroup();
106 void FlushConsole();
107
108 public:
109 Event<> WhenSelect;
110 Event<Bar&> WhenBar;
111 Event<const String&> WhenLine;
112 Event<> WhenRunEnd;
113 bool console;
114 bool verbosebuild;
115
116 int Execute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, bool noconvert = false);
117 int Execute(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false);
GetSlotCount()118 int GetSlotCount() const { return processes.GetCount(); }
119 int AllocSlot();
120 bool Run(const char *cmdline, Stream *out = NULL, const char *endptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
121 bool Run(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
122 void BeginGroup(String group);
123 void EndGroup();
124
125 Console& operator<<(const String& s) { Append(s); return *this; }
126
127 void ToErrors(const String& s);
128 void AppendOutput(const String& s);
129 bool IsRunning();
130 bool IsRunning(int slot);
131 int Flush();
132 void Kill(int slot);
133 void Kill();
ClearError()134 void ClearError() { error_keys.Clear(); line.Clear(); WhenRunEnd(); }
PickErrors()135 Vector<String> PickErrors() { Vector<String> e = pick(error_keys); error_keys.Clear(); return pick(e); }
136 void Wait(int slot);
137 bool Wait();
138
139 void OnFinish(Event<> cb);
140
WrapText(bool w)141 void WrapText(bool w) { wrap_text = w; }
142
143 void SetSlots(int s);
144
145 void Input(bool b);
146
147 Console();
148 };
149
150 VectorMap<String, Builder *(*)()>& BuilderMap();
151
152 String SelectAnyPackage();
153
154 String FindInDirs(const Vector<String>& dir, const String& file);
155 String FindCommand(const Vector<String>& exedir, const String& cmdline);
156
157 void DlCharset(DropList& d);
158 void DlCharsetD(DropList& d);
159
160 void SetupBuildMethods();
161 VectorMap<String, String> GetMethodVars(const String& method);
162 String GetDefaultMethod();
163
164 bool CheckLicense();
165 bool Install(bool& hasvars);
166 void AutoInstantSetup();
167
168 #define HELPNAME "Help Topics"
169 #define METAPACKAGE "<meta>"
170
171 bool IsHelpName(const char *path);
172
173 class TopicCtrl : public HelpWindow {
174 public:
175 virtual Topic AcquireTopic(const String& topic);
176 virtual void BarEx(Bar& bar);
177 virtual bool Key(dword key, int count);
178 virtual void FinishText(RichText& text);
179
180 private:
181 EditString search;
182 DropList lang;
183 bool internal;
184 bool showwords, all;
185
186 VectorMap<String, VectorMap<String, Index<String> > > map;
187 Index<String> lang_list;
188 Vector<int> spos;
189
190 static Index<String> idelink;
191
192 void OpenTopic();
193 void Search();
194 void ShowWords();
195 void All();
196 void Lang();
197 void SShow();
198 void ScanDirForTpp(const char *dir, const String& rel, Index<String>& donepackage,
199 Index<String>& lang_list);
200 void LoadMap();
201 void FocusSearch();
202 void Prev();
203 void Next();
204
205 public:
206 Event<> WhenTopic;
207
208 void SyncDocTree();
209 void SearchWord(const String& s);
210 void Serialize(Stream& s);
211
212 typedef TopicCtrl CLASSNAME;
213
214 TopicCtrl();
215 };
216
217 struct IdeCalc : CodeEditor {
218 virtual bool Key(dword key, int count);
219 virtual void LeftDouble(Point p, dword flags);
220
221 ArrayMap<String, EscValue> vars;
222
223 void Execute();
224
225 IdeCalc();
226 };
227
228 extern bool splash_screen;
229 void HideSplash();
230 void ShowSplash();
231 bool IsSplashOpen();
232
233 class RightTabs : public FrameCtrl<Ctrl> {
234 public:
235 virtual void Paint(Draw& w);
236 virtual void LeftDown(Point p, dword);
237 virtual void MouseMove(Point p, dword);
238 virtual void MouseLeave();
239 virtual void CancelMode();
240 virtual void FramePaint(Draw& w, const Rect& r);
241 virtual void FrameLayout(Rect& r);
242 virtual void FrameAddSize(Size& sz);
243
244 private:
245 enum { SPACE = 7 };
246
247 struct Tab {
248 int y;
249 Image img;
250 String tip;
251
GetHeightTab252 int GetHeight() const { return img.GetSize().cy + SPACE; }
GetRightTab253 int GetRight() const { return y + GetHeight(); }
254 };
255
256 Array<Tab> tab;
257 int cx;
258 int hl;
259 int cursor;
260
261 void Repos();
262 void PaintTab(Draw& w, int x, int y, int cx, int cy, Color paper, const Image& img, Color hl);
263 int GetPos(Point p);
264
265 public:
266 void Clear();
267 void Add(const Image& img, const String& tip);
268 void SetCursor(int i);
GetCursor()269 int GetCursor() const { return cursor; }
270
271 RightTabs();
272 };
273
274 struct EditorTabBar : public FileTabs {
275 EditorTabBar();
276
277 String GetFile(int n) const;
278 bool FindSetFile(const String& fn);
279 void SetAddFile(const String& fn);
280 void RenameFile(const String& fn, const String& nn);
281 void SetSplitColor(const String& fn, const Color& c);
282 void ClearSplitColor();
283 void FixIcons();
284
285 typedef EditorTabBar CLASSNAME;
286 };
287
288 int memcmp_i(const char *s, const char *t, int n);
289
290 String ResolveTParam(const String& type, const Vector<String>& tparam);
291 void ResolveTParam(Vector<String>& type, const Vector<String>& tparam);
292 String Qualify(const String& scope, const String& type, const String& usings);
293
294 int CharFilterMacro(int c);
295 int CharFilterFileName(int c);
296
297 bool isincludefnchar(int c);
298
299 Size GetDrawFileNameSize(const String& h);
300 void DrawFileName(Draw& w, const Rect& r, const String& h, Color ink);
301
302 void AddPath(EditString *es);
303 void InsertPath(EditString *es);
304
305 void DlSpellerLangs(DropList& dl);
306
307 #include "Assist.h"
308
309 void DirSel(EditField& f, FrameRight<Button>& b);
310 bool CopyFolder(const char *dst, const char *src, Progress *pi);
311 void RepoSyncDirs(const Vector<String>& working);
312
313 struct FindInFilesDlg : WithFindInFilesLayout<TopWindow> {
314 WString itext;
315
316 virtual bool Key(dword key, int count);
317
318 void Setup(bool replace);
319 void Sync();
320
321 typedef FindInFilesDlg CLASSNAME;
322
323 FindInFilesDlg();
324 };
325
326 struct Ide : public TopWindow, public WorkspaceWork, public IdeContext, public MakeBuild {
327 public:
328 virtual void Paint(Draw& w);
329 virtual bool Key(dword key, int count);
330 virtual bool HotKey(dword key);
331 virtual void FileCursor();
332 virtual void PackageCursor();
333 virtual void SyncWorkspace();
334 virtual void BuildFileMenu(Bar& menu);
335 virtual void ProjectRepo(Bar& bar);
336 virtual void FilePropertiesMenu0(Bar& menu);
337 virtual void FilePropertiesMenu(Bar& menu);
338 virtual String GetOutputDir();
339 virtual String GetConfigDir();
340 virtual void FileSelected();
341 virtual void Serialize(Stream& s);
342 virtual void FileRename(const String& nm);
343 virtual bool FileRemove();
344 virtual void DragAndDrop(Point p, PasteClip& d);
345 virtual void DeactivateBy(Ctrl *new_focus);
346 virtual void Activate();
347 virtual void Layout();
348
349 virtual bool IsVerbose() const;
350 virtual void PutConsole(const char *s);
351 virtual void PutVerbose(const char *s);
352 virtual void PutLinking();
353 virtual void PutLinkingEnd(bool ok);
354
355 virtual const Workspace& IdeWorkspace() const;
356 virtual bool IdeIsBuilding() const;
357 virtual String IdeGetOneFile() const;
358 virtual int IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, bool noconvert = false);
359 virtual int IdeConsoleExecute(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false);
360 virtual int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet, bool noconvert);
361 virtual int IdeConsoleAllocSlot();
362 virtual bool IdeConsoleRun(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
363 virtual bool IdeConsoleRun(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
364 virtual void IdeConsoleFlush();
365 virtual void IdeConsoleBeginGroup(String group);
366 virtual void IdeConsoleEndGroup();
367 virtual bool IdeConsoleWait();
368 virtual bool IdeConsoleWait(int slot);
369 virtual void IdeConsoleOnFinish(Event<> cb);
370
371 virtual bool IdeIsDebug() const;
372 virtual void IdeEndDebug();
373 virtual void IdeSetBottom(Ctrl& ctrl);
374 virtual void IdeActivateBottom();
375 virtual void IdeRemoveBottom(Ctrl& ctrl);
376 virtual void IdeSetRight(Ctrl& ctrl);
377 virtual void IdeRemoveRight(Ctrl& ctrl);
378
379 virtual String IdeGetFileName() const;
380 virtual int IdeGetFileLine();
381 virtual String IdeGetLine(int i) const;
382
383 virtual void IdeSetDebugPos(const String& fn, int line, const Image& img, int i);
384 virtual void IdeHidePtr();
385 virtual bool IdeDebugLock();
386 virtual bool IdeDebugUnLock();
387 virtual bool IdeIsDebugLock() const;
388
389 virtual void IdeSetBar();
390 virtual void IdeGotoCodeRef(String coderef);
391 virtual void IdeOpenTopicFile(const String& file);
392 virtual void IdeFlushFile();
393
394 virtual String IdeGetFileName();
395 virtual String IdeGetNestFolder();
396
397 virtual String IdeGetIncludePath();
398
399 virtual bool IsPersistentFindReplace();
400
401 virtual int IdeGetHydraThreads();
402 virtual String IdeGetCurrentBuildMethod();
403 virtual String IdeGetCurrentMainPackage();
404 virtual void IdePutErrorLine(const String& e);
405 virtual void IdeGotoFileAndId(const String& path, const String& id);
406
407 virtual void ConsoleShow();
408 virtual void ConsoleSync();
409 virtual void ConsoleClear();
410 virtual void SetupDefaultMethod();
411 virtual Vector<String> PickErrors();
412 virtual void BeginBuilding(bool sync_files, bool clear_console);
413 virtual void EndBuilding(bool ok);
414 virtual void ClearErrorEditor();
415 virtual void DoProcessEvents();
416 virtual void ReQualifyCodeBase();
417 virtual void SetErrorEditor();
418 virtual String GetMain();
419
420 enum {
421 EDITING, BUILDING, RUNNING, DEBUGGING,
422 };
423
424 String pocfg;
425
426 MenuBar menubar;
427 ToolBar toolbar;
428 StatusBar statusbar;
429 StaticRect editpane;
430
431 int idestate;
432 int debuglock;
433 int hydra1_threads;
434
435 int chstyle;
436
437 One<IdeDesigner> designer;
438 AssistEditor editor;
439 FileIn view_file;
440 AssistEditor editor2; // no edits happen in editor2, just view
441 FileIn view_file2;
442 EditorTabBar tabs;
443 EscValue macro_api;
444
445 RightTabs btabs;
446 StaticRect bottom;
447 Splitter editor_bottom;
448 Console console;
449
450 ArrayCtrl ffound[3];
451 int ffoundi_next = 0;
452
453 ArrayCtrl error;
454 int error_count;
455 int warning_count;
456 bool addnotes;
457 ValueArray prenotes;
458 bool linking;
459 Vector<String> linking_line;
460 bool removing_notes;
461
462 IdeCalc calc;
463 Ptr<Ctrl> bottomctrl;
464
465 enum Bottoms { BCLOSE, BCONSOLE, BERRORS, BFINDINFILES1, BFINDINFILES2, BFINDINFILES3, BCALC, BDEBUG };
466
467 FileOut stdout_fout;
468
469 Splitter editorsplit;
470 Splitter pfsplit;
471 StaticRect wepane;
472 SplitterFrame weframe;
473
474 Splitter right_split;
475 StaticRect right;
476
477 String editfile;
478 FileTime edittime;
479 int editfile_line_endings;
480 int editfile_repo;
481 bool editfile_isfolder;
482 String editfile_includes;
483
484 String editfile2;
485
486 Vector<String> tablru;
487 int tabi;
488 bool blocktabs;
489
490 struct Bookmark : Moveable<Bookmark> {
491 String file;
492 LineEdit::EditPos pos;
493
SerializeIde::Bookmark494 void Serialize(Stream& s) { s % file; s % pos; }
495 }
496 bookmark[10];
497
498 struct FileData {
499 Time filetime;
500 LineEdit::EditPos editpos;
501 Point columnline;
502 LineEdit::UndoData undodata;
503 LineInfo lineinfo;
504 LineInfoRem lineinforem;
505
ClearIde::FileData506 void Clear() {
507 filetime = Null; editpos.Clear(); undodata.Clear();
508 columnline = Null; lineinfo.Clear(); lineinforem.Clear();
509 }
ClearPIde::FileData510 void ClearP() {
511 lineinforem.Clear();
512 undodata.Clear();
513 }
514 };
515
516 String posfile[2];
517 int posline[2];
518 Image posimg[2];
519
520 Vector<Bookmark> history;
521 int histi;
522
523 ArrayMap<String, FileData> filedata;
524 Index<String> editastext;
525 Index<String> editashex;
526
527 DropList mainconfiglist;
528 String mainconfigname;
529
530 int build_time;
531
532 MultiButton buildmode;
533 PopUpTable methodlist;
534 PopUpTable modelist;
535 VectorMap<String, String> recent_buildmode;
536
537 Vector<String> recentoutput;
538 Vector<String> recentflags;
539
540 String runarg;
541 String recent_runarg;
542 String rundir;
543 enum { RUN_WINDOW, RUN_CONSOLE, RUN_FILE, RUN_FILE_CONSOLE };
544 int runmode;
545 bool runexternal;
546 bool console_utf8;
547 int consolemode;
548 bool disable_uhd = false;
549 bool darkmode = false;
550 String stdout_file;
551 String recent_stdout_file;
552
553 // ------------------------------------
554 enum LineEndingEnum { LF, CRLF, DETECT_LF, DETECT_CRLF };
555
556 One<Debugger> debugger;
557
558 Time start_time;
559 Time build_start_time;
560 int stat_build_time;
561
562 Font editorfont;
563 Font veditorfont;
564 Font consolefont;
565 Font font1;
566 Font font2;
567 Font tfont;
568 int editortabsize;
569 int indent_amount;
570 byte default_charset;
571 bool indent_spaces;
572 bool show_status_bar;
573 bool toolbar_in_row;
574 bool show_tabs;
575 bool show_spaces;
576 bool warnwhitespace;
577 int line_endings;
578 bool tabs_icons;
579 int tabs_crosses;
580 bool tabs_grouping;
581 bool tabs_stacking;
582 bool tabs_serialize;
583 bool no_parenthesis_indent;
584 bool hilite_if_endif;
585 bool thousands_separator;
586 bool hline, vline;
587 bool wrap_console_text;
588 bool mute_sounds;
589 bool line_numbers;
590 bool header_guards;
591 int filetabs;
592 bool auto_enclose;
593 bool mark_lines;
594 bool find_pick_sel;
595 bool find_pick_text;
596 bool deactivate_save;
597 int insert_include;
598 int bordercolumn;
599 Color bordercolor;
600 bool persistent_find_replace;
601 bool find_replace_restore_pos;
602 bool auto_rescan;
603 bool auto_check;
604 int spellcheck_comments;
605 bool wordwrap_comments = true;
606 bool wordwrap = false;
607 bool setmain_newide;
608 bool gui_font_override = false;
609 Font gui_font = StdFont();
610 /*
611 astyle code formatter control vars
612 added 2008.01.27 by Massimo Del Fedele
613 */
614 bool astyle_BracketIndent;
615 bool astyle_NamespaceIndent;
616 bool astyle_BlockIndent;
617 bool astyle_CaseIndent;
618 bool astyle_ClassIndent;
619 bool astyle_LabelIndent;
620 bool astyle_SwitchIndent;
621 bool astyle_PreprocessorIndent;
622 int astyle_MinInStatementIndentLength;
623 int astyle_MaxInStatementIndentLength;
624 bool astyle_BreakClosingHeaderBracketsMode;
625 bool astyle_BreakElseIfsMode;
626 bool astyle_BreakOneLineBlocksMode;
627 bool astyle_SingleStatementsMode;
628 bool astyle_BreakBlocksMode;
629 bool astyle_BreakClosingHeaderBlocksMode;
630 int astyle_BracketFormatMode;
631 int astyle_ParensPaddingMode;
632 bool astyle_ParensUnPaddingMode;
633 bool astyle_OperatorPaddingMode;
634 bool astyle_EmptyLineFill;
635 bool astyle_TabSpaceConversionMode;
636 WString astyle_TestBox;
637
638 // Formats a string of code with a given formatter
639 WString FormatCodeString(WString const &Src, astyle::ASFormatter &Formatter);
640
641 // Formats editor's code with Ide format parameters
642 void FormatCode();
643
644 bool browser_closeesc;
645 bool bookmark_pos;
646
647 FrameTop<StaticBarArea> bararea;
648 Label display;
649
650
651 byte hilite_scope;
652 int hilite_bracket;
653 int hilite_ifdef;
654 bool barline;
655 bool qtfsel;
656
657 enum { STYLE_NO_REPLACE, STYLE_CONFIRM_REPLACE, STYLE_AUTO_REPLACE };
658
659 String find_file_search_string;
660 bool find_file_search_in_current_package;
661
662 FindInFilesDlg ff;
663 String iwc;
664
665 int doc_serial;
666 TopicCtrl doc;
667 TopicCtrl windoc;
668
669 int state_icon;
670
671 String export_dir;
672 VectorMap<String, String> abbr;
673
674 int issaving;
675 int isscanning;
676
677 String current_builder;
678
679 bool hlstyle_is_default = true; // default style reacts to dark / light theme settings
680
681 // ------------------------------------
682
683 Time config_time;
684 Time ConfigTime();
685 void LoadConfig();
686 void SaveConfig();
687 void FinishConfig();
688 void SaveConfigOnTime();
689
690 int GetPackageIndex();
691 void AddPackage(const String& p);
692
BeepMuteExclamationIde693 void BeepMuteExclamation() { if(!mute_sounds) BeepExclamation(); }
BeepMuteInformationIde694 void BeepMuteInformation() { if(!mute_sounds) BeepInformation(); }
695
696 void BookKey(int key);
697 void AddHistory();
698 int GetHistory(int d);
699 void History(int dir);
700 void EditorEdit();
701 void GotoBookmark(const Bookmark& b);
702 bool IsHistDiff(int i);
703
704 void IdePaste(String& s);
705
706 bool HasFileData(const String& file);
707 FileData& Filedata(const String& file);
708
709 void BTabs();
710 void SyncBottom();
711 void HideBottom();
712 void SetBottom(int i);
713 void ToggleBottom(int i);
714 void ShowBottom(int i);
ShowConsoleIde715 void ShowConsole() { ShowBottom(1); }
ToggleConsoleIde716 void ToggleConsole() { ToggleBottom(1); }
717 void SwapBottom();
718 bool IsBottomShown() const;
BottomIsFindInFilesIde719 bool BottomIsFindInFiles() const { return findarg(btabs.GetCursor(), BFINDINFILES1, BFINDINFILES2, BFINDINFILES3) >= 0; }
720
721 void EditorFontScroll(int d);
722
723 void MakeTitle();
724 void MakeIcon();
725 void AdjustMainConfig();
726 String GetFirstFile();
727 void SetMain(const String& package);
728 void ChangeFileCharset(const String& name, Package& p, byte charset);
729 void ChangeCharset();
730 void FlushFile();
731 void EditFile0(const String& path, byte charset, int spellcheck_comments,
732 const String& headername = Null);
733 void EditFile(const String& path);
734 void AddEditFile(const String& path);
735 void ReloadFile();
736 void AddLru();
737 bool CanToggleReadOnly();
738 void ToggleReadOnly();
739 void PosSync();
740 String IncludesMD5();
741
742 void EditFileAssistSync2();
743 void EditFileAssistSync();
744
745 TimeCallback text_updated;
746 std::atomic<int> file_scan;
747 bool file_scanned = false;
748
749 void TriggerAssistSync();
750
751 void AKEditor();
752
753 void PackageMenu(Bar& menu);
754
755 void UscFile(const String& file);
756 void UscProcessDir(const String& dir);
757 void UscProcessDirDeep(const String& dir);
758 void SyncUsc();
759 void CodeBaseSync();
760
761 void RefreshBrowser();
762
763 void SetupOutputMode();
764 void SyncBuildMode();
765 void SetupBuildMethods();
766 void DropMethodList();
767 void SetMethod(const String& m);
768 void SelectMethod();
769 void DropModeList();
770 void SelectMode();
771 void SerializeOutputMode(Stream& s);
772
773 void GotoPos(String path, int line);
774 void GotoCpp(const CppItem& pos);
775
776 void LoadAbbr();
777 void SaveAbbr();
778
779 void File(Bar& menu);
780 void EditWorkspace();
781 void EditAnyFile();
782 bool IsProjectFile(const String& f) const;
783 void SaveEditorFile(Stream& out);
784 void SaveFile0(bool always);
785 void SaveFile(bool always = false);
DoSaveFileIde786 void DoSaveFile() { SaveFile(); }
787 void FileBookmark (Bar& menu);
788 void SwapPackagesFiles();
789 void Times();
790 void Statistics();
791 void Licenses();
792 void Exit();
793 String GetOpposite();
794 void GoOpposite();
795 void Print();
796 void Diff();
797 void DiffLog();
798 void DiffFiles(const char *lname, const String& l, const char *rname, const String& r);
799 String LoadConflictFile(const String& n);
800 void GotoDiffLeft(int line, DiffDlg *df);
801 void GotoDiffRight(int line, FileDiff *df);
802 void SvnHistory();
803
804 void Edit(Bar& menu);
805 bool IsDesignerFile(const String& path);
806 void DoEditAsText(const String& path);
807 void EditAsText();
808 void EditAsHex();
809 void EditUsingDesigner();
EditMakeTabsIde810 void EditMakeTabs() { editor.MakeTabsOrSpaces(true); }
EditMakeSpacesIde811 void EditMakeSpaces() { editor.MakeTabsOrSpaces(false); }
EditMakeLineEndsIde812 void EditMakeLineEnds() { editor.MakeLineEnds(); }
813
814 void FindInFiles(bool replace);
815 void FindFileName();
816 void FindString(bool back);
817 void ClearEditedFile();
818 void ClearEditedAll();
819 void FindFileAll(const Vector<Tuple<int64, int>>& f);
820 void InsertColor();
821 void InsertLay(const String& fn);
822 void InsertIml(const Package& pkg, const String& fn, String classname);
823 void InsertText(const String& text);
824 void InsertAs(const String& data);
825 void InsertAs();
826 void InsertFilePath(bool c);
827 void InsertFileBase64();
828 void InsertMenu(Bar& bar);
829 void InsertInclude(Bar& bar);
830 void InsertAdvanced(Bar& bar);
831 void AssistEdit(Bar& menu);
832 void EditorMenu(Bar& bar);
833 void ToggleWordwrap();
834
835 void OnlineSearchMenu(Bar& menu);
836 void OnlineSearch();
837 void OnlineSearchOnTheOfficialSite();
838
839 void SearchMenu(Bar& bar);
EditFindIde840 void EditFind() { editor.FindReplace(find_pick_sel, find_pick_text, false); }
EditReplaceIde841 void EditReplace() { editor.FindReplace(find_pick_sel, find_pick_text, true); }
EditFindReplacePickTextIde842 void EditFindReplacePickText() { editor.FindReplace(true, true, false); }
EditFindNextIde843 void EditFindNext() { editor.FindNext(); }
EditFindPreviousIde844 void EditFindPrevious() { editor.FindPrev(); }
EditPasteIde845 void EditPaste() { editor.Paste(); }
846 bool Next(ArrayCtrl& ctrl, int d);
847 void FindNextError();
848 void FindPrevError();
849
850 void EditSpecial(Bar& menu);
851 void TranslateString();
SwapCharsIde852 void SwapChars() { editor.SwapChars(); }
CopyWordIde853 void CopyWord() { editor.CopyWord(); }
DuplicateLineIde854 void DuplicateLine() { editor.DuplicateLine(); }
855 void AlterText(WString (*op)(const WString& in));
856 void TextToUpper();
857 void TextToLower();
858 void TextToAscii();
859 void TextInitCaps();
860 void SwapCase();
861 void ToCString();
862 void ToComment();
863 void CommentLines();
864 void UnComment();
865 void ReformatComment();
866
867 void MacroMenu(Bar& menu);
868 bool HasMacros();
869 void EditMacroMenu(Bar& menu, ValueArray items);
870 void EditMacro(int i);
871
872 void Project(Bar& menu);
873 void SyncT(int kind);
874 void ConvertST();
875 void ExportMakefile(const String& ep);
876 void ExportProject(const String& ep, bool all, bool gui, bool deletedir = true);
877 void SyncRepoDirs(const Vector<String>& working);
878 void SyncRepoDir(const String& working);
879 void SyncRepo();
880
881 void BuildMenu(Bar& menu);
882 void BuildPackageMenu(Bar& menu);
883
884 void DoBuild();
885 void PackageBuild();
886 void StopBuild();
887 void PackageClean();
888 void CreateMakefile();
889 void CleanUppOut();
890 void SwitchHeader();
891 void FileCompile();
892 void Preprocess(bool asmout);
893 void ToggleStopOnErrors();
894 One<Host> CreateHostRunDir();
895 void OpenOutputFolder();
896 void PreprocessInternal();
897
898 void DebugMenu(Bar& menu);
899 void RunArgs();
900 bool ShouldHaveConsole();
901 void BuildAndExecute();
902 void ExecuteBinary();
903 void ExecuteApk();
904 void BuildAndDebug0(const String& srcfile);
905 void BuildAndDebug(bool runto);
906 void BuildAndExtDebug();
907 void BuildAndExtDebugFile();
908 bool IsValgrind();
909 void Valgrind();
910
911 void StartDebug();
912 void StopDebug();
913 void DebugToggleBreak();
914 void ConditionalBreak();
915 void DebugClearBreakpoints();
916 void OnBreakpoint(int i);
917
918 bool EditorTip(CodeEditor::MouseTip& mt);
919
920 void Setup(Bar& menu);
921 void SetupFormat();
922 void DoEditKeys();
923 void ToggleVerboseBuild();
924 void AutoSetup();
925 void CheckUpdates(bool verbose);
926 void CheckUpdatesManual();
927 void SetUpdateTimer(int period);
928 void Abbreviations();
929 void DoMacroManager();
930 void UpgradeTheIDE();
931 void InstallDesktop();
932
933 void SetupMobilePlatforms(Bar& bar);
934 void SetupAndroidMobilePlatform(Bar& bar, const AndroidSDK& androidSDK);
935 void LaunchAndroidSDKManager(const AndroidSDK& androidSDK);
936 void LaunchAndroidAVDManager(const AndroidSDK& androidSDK);
937 void LauchAndroidDeviceMonitor(const AndroidSDK& androidSDK);
938
939 void BrowseMenu(Bar& menu);
940 void CheckCodeBase();
941 void RescanCode();
942 void QueryId();
943 void OpenTopic(const String& topic, const String& createafter, bool before);
944 void OpenTopic(const String& topic);
945 void OpenATopic();
946 void ToggleNavigator();
947 void SearchCode();
948 void Goto();
949 void NavigatorDlg();
950 void ScanFile(bool check_includes);
951 bool SwapSIf(const char *cref);
952 void SwapS();
953 void FindId(const String& id);
954 bool OpenLink(const String& s, int pos);
955 void ContextGoto0(int pos);
956 void ContextGoto();
957 void GoToLine();
958 void CtrlClick(int64 pos);
959 void Qtf();
960 void Xml();
961 void Json();
962 void GotoDirDiffLeft(int line, DirDiffDlg *df);
963 void GotoDirDiffRight(int line, DirDiffDlg *df);
964 void DoDirDiff();
965 void DoPatchDiff();
966 void AsErrors();
967 void RemoveDs();
968
969 void HelpMenu(Bar& menu);
970 void ViewIdeLogFile();
971 void About();
972
973 void ConsoleMenu(Bar& menu);
974 void ConsoleCopy();
975 void ConsolePaste();
976
977 void MainMenu(Bar& menu);
978 void MainTool(Bar& bar);
979
980 void SaveWorkspace();
981 String WorkspaceFile();
982 void SerializeWorkspace(Stream& s);
983
984 void SerializeLastMain(Stream& s);
985 void SaveLastMain();
986 void LoadLastMain();
987 void EditorMode();
988 bool IsEditorMode() const;
989
990 // void PrintTime(dword time);
991 void SetIdeState(int newstate);
992
993 void MainConfig();
994 void SyncMainConfigList();
995 void OnMainConfigList();
996 void SetMainConfigList();
997
998 void FileProperties();
999
1000 void CustomSteps();
1001
1002 void CycleFiles();
1003
1004 void Renumber();
1005
1006 String GetTargetLogPath();
1007 String GetIdeLogPath();
1008 void OpenLog(const String& logFilePath);
1009
1010 // Console& GetConsole();
1011
1012 struct FindLineErrorCache {
1013 VectorMap<String, String> file;
1014 Vector<String> wspc_paths;
1015 String upp;
1016 bool is_java;
1017 bool init;
1018
ClearIde::FindLineErrorCache1019 void Clear() { init = false; file.Clear(); wspc_paths.Clear(); }
1020 };
1021
1022 struct ErrorInfo {
1023 String file;
1024 int lineno;
1025 int linepos;
1026 int len;
1027 int kind;
1028 String message;
1029 String error_pos;
1030
ErrorInfoIde::ErrorInfo1031 ErrorInfo() { lineno = linepos = kind = len = 0; }
1032 };
1033
1034 FindLineErrorCache error_cache;
1035 void ConsoleLine(const String& line, bool assist = false);
1036 void ConsoleRunEnd();
1037 void SyncErrorsMessage();
1038 String GetErrorsText(bool all, bool src);
1039 void CopyError(bool all);
1040 void ErrorMenu(Bar& bar);
1041 void ShowError();
1042 void SetFFound(int ii);
1043 ArrayCtrl& FFound();
1044 void ShowFound();
1045 void CopyFound(bool all);
1046 void FFoundMenu(Bar& bar);
1047 void SelError();
1048 void ClearErrorsPane();
1049 WString FormatErrorLine(const String& text, int& linecy);
1050 WString FormatErrorLineEP(const String& text, const char *ep, int& linecy);
1051
1052 struct FoundDisplay : Display {
1053 virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;
1054 };
1055
1056 struct TopAlignedDisplay : Display {
1057 virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;
1058 };
1059
1060 struct FoundFileDisplay : Display {
1061 virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;
1062 virtual Size GetStdSize(const Value& q) const;
1063 };
1064
1065 bool FindLineError(int l);
1066 void GoToError(const ErrorInfo& f);
1067 void GoToError(ArrayCtrl& a);
1068
1069 bool FindLineError(const String& ln, FindLineErrorCache& cache, ErrorInfo& f);
1070 void FindError();
1071 void ClearErrorEditor(String file);
1072
1073 void FindWildcard();
1074 void FindFolder();
1075 void FindSetStdDir(String n);
1076 void FindStdDir();
1077 void InsertWildcard(const char *s);
1078 void AddFoundFile(const String& fn, int ln, const String& line, int pos, int count);
1079 bool SearchInFile(const String& fn, const String& pattern,
1080 bool wholeword, bool ignorecase, int& n, RegExp *regexp);
1081 void SyncFindInFiles();
1082 void ConstructFindInFiles();
1083 void SerializeFindInFiles(Stream& s);
1084
1085 void SetupEditor(int font, String highlight, String fn);
1086 void SetupEditor();
1087
1088 void DoDisplay();
1089 void ManageDisplayVisibility();
1090
1091 void SetIcon();
1092 bool IsCppBaseFile();
1093 void CheckFileUpdate();
1094 void Periodic();
1095
1096 void PassEditor();
1097 void SyncEditorSplit();
1098 void SplitEditor(bool horz);
1099 void CloseSplit();
1100 void KeySplit(bool horz);
1101 void SwapEditors();
1102 void TabFile();
1103 void ClearTab();
1104 void ClearTabs();
1105 void CloseRest(EditorTabBar *tabs);
1106 void TabsLR( int jd );
1107 void TabsStackLR( int jd );
1108
1109 void RefreshFrame(bool auto_disasm);
1110 void RefreshLine(int frame, bool auto_disasm);
1111
1112 void ResolveUvsConflict();
1113
1114 void SetBar();
1115 void SetMenuBar();
1116 void SetToolBar();
1117 TimeCallback delayed_toolbar;
1118
1119
1120 void UpdateFormat(CodeEditor& editor);
1121 void UpdateFormat();
1122 void ReadHlStyles(ArrayCtrl& hlstyle);
1123
1124 bool OpenMainPackage();
1125 void NewMainPackage();
1126
1127 bool GotoDesignerFile(const String& path, const String& scope, const String& name, int line);
1128 void JumpToDefinition(const Array<CppItem>& n, int q, const String& scope);
1129 void GotoFileAndId(const String& path, const String& id);
1130 void SearchTopics();
1131 void ShowTopics();
1132 void ShowTopicsWin();
1133
1134 String GetIncludePath();
1135
1136 void TopicBack();
1137
1138 void SetupBars();
1139
1140 EscValue MacroEditor();
1141 void MacroGetLength(EscEscape& e);
1142 void MacroGetLineCount(EscEscape& e);
1143 void MacroGetLinePos(EscEscape& e);
1144 void MacroGetLineLength(EscEscape& e);
1145 void MacroGetCursor(EscEscape& e);
1146 void MacroGetLine(EscEscape& e);
1147 void MacroGetColumn(EscEscape& e);
1148 void MacroGetSelBegin(EscEscape& e);
1149 void MacroGetSelEnd(EscEscape& e);
1150 void MacroGetSelCount(EscEscape& e);
1151 void MacroSetCursor(EscEscape& e);
1152 void MacroSetSelection(EscEscape& e);
1153 void MacroClearSelection(EscEscape& e);
1154 void MacroGet(EscEscape& e);
1155 void MacroRemove(EscEscape& e);
1156 void MacroInsert(EscEscape& e);
1157 void MacroFind(EscEscape& e);
1158 void MacroReplace(EscEscape& e);
1159 void MacroFindMatchingBrace(EscEscape& e);
1160 void MacroFindClosingBrace(EscEscape& e);
1161 void MacroFindOpeningBrace(EscEscape& e);
1162 void MacroMoveLeft(EscEscape& e);
1163 void MacroMoveRight(EscEscape& e);
1164 void MacroMoveWordLeft(EscEscape& e);
1165 void MacroMoveWordRight(EscEscape& e);
1166 void MacroMoveUp(EscEscape& e);
1167 void MacroMoveDown(EscEscape& e);
1168 void MacroMoveHome(EscEscape& e);
1169 void MacroMoveEnd(EscEscape& e);
1170 void MacroMovePageUp(EscEscape& e);
1171 void MacroMovePageDown(EscEscape& e);
1172 void MacroMoveTextBegin(EscEscape& e);
1173 void MacroMoveTextEnd(EscEscape& e);
1174 void MacroInput(EscEscape& e);
1175 void MacroBuild(EscEscape& e);
1176 void MacroBuildProject(EscEscape& e);
1177 void MacroExecute(EscEscape& e);
1178 void MacroLaunch(EscEscape& e);
1179 void MacroClearConsole(EscEscape& e);
1180 void MacroEditFile(EscEscape& e);
1181 void MacroSaveCurrentFile(EscEscape& e);
1182 void MacroFileName(EscEscape& e);
1183 void MacroMainPackage(EscEscape& e);
1184 void MacroActivePackage(EscEscape& e);
1185 void MacroPackageDir(EscEscape& e);
1186 void MacroAssembly(EscEscape& e);
1187 void MacroBuildMethod(EscEscape& e);
1188 void MacroBuildMode(EscEscape& e);
1189 void MacroFlags(EscEscape& e);
1190 void MacroEcho(EscEscape& e);
1191 void MacroCloseFile(EscEscape& e);
1192 void MacroPackageFiles(EscEscape& e);
1193 void MacroAllPackages(EscEscape& e);
1194 void MacroTarget(EscEscape& e);
1195
1196 String GetAndroidSdkPath();
1197
1198 typedef Ide CLASSNAME;
1199
1200 enum {
1201 TIMEID_PERIODIC = TopWindow::TIMEID_COUNT,
1202 TIMEID_COUNT,
1203 };
1204
1205 Ide();
1206 ~Ide();
1207
1208
1209 // THIS IS SANDBOX FOR DEVELOPING NEW NAVIGATOR
1210 // void CodeBrowser();
1211 };
1212
ShowConsole()1213 inline void ShowConsole() { if(TheIde()) ((Ide *)TheIde())->ShowConsole(); }
1214
1215 void InstantSetup();
1216
1217 bool SetupSVNTrunk();
1218
1219 #endif
1220