ide.h

Zbigniew Rebacz, 05/16/2014 04:17 PM

Download (30.7 KB)

 
1
#ifndef IDE_H
2
#define IDE_H
3

    
4
#include <ide/Common/Common.h>
5

    
6
#include <RichEdit/RichEdit.h>
7

    
8
#include <ide/Browser/Browser.h>
9
#include <TabBar/TabBar.h>
10
#include <CodeEditor/CodeEditor.h>
11
#include <usvn/usvn.h>
12
#include <ide/IconDes/IconDes.h>
13
#include <ide/LayDes/LayDes.h>
14
#include <TextDiffCtrl/TextDiffCtrl.h>   
15

    
16
#define LAYOUTFILE <ide/ide.lay>
17
#include <CtrlCore/lay.h>
18

    
19
#define IMAGECLASS IdeImg
20
#define IMAGEFILE  <ide/ide.iml>
21
#include <Draw/iml_header.h>
22

    
23
#define KEYGROUPNAME "Ide"
24
#define KEYNAMESPACE IdeKeys
25
#define KEYFILE      <ide/ide.key>
26
#include             <CtrlLib/key_header.h>
27

    
28
#include "version.h"
29

    
30
#include <plugin/astyle/astyle.h>
31

    
32
#include <ide/Builders/Builders.h>
33

    
34
#ifdef PLATFORM_POSIX
35
#include <ide/SrcUpdater/SrcUpdater.h>
36
#endif
37

    
38
const char *FindTag(const char *txt, const char *tag);
39
const char *FindAfter(const char *txt, const char *tag);
40
int         IdeLocateLine(String old_file, int old_line, String new_file);
41

    
42
#include "UppDlg.h"
43

    
44
void Puts(const char *s);
45

    
46
class Console : public LineEdit {
47
public:
48
        virtual bool Key(dword key, int count);
49
        virtual void LeftDouble(Point p, dword);
50
        virtual void RightDown(Point p, dword);
51
        virtual void Append(const String& s);
52

    
53
protected:
54
        struct Slot {
55
                Slot() : outfile(NULL), quiet(true), exitcode(Null) {}
56

    
57
                One<AProcess>     process;
58
                String            cmdline;
59
                String            output;
60
                String            key;
61
                String            group;
62
                Stream            *outfile;
63
                bool              quiet;
64
                int               exitcode;
65
                int               last_msecs;
66
        };
67

    
68
        struct Group {
69
                Group() : count(0), start_time(::msecs()), finished(false), msecs(0), raw_msecs(0) {}
70

    
71
                int               count;
72
                int               start_time;
73
                bool              finished;
74
                int               msecs;
75
                int               raw_msecs;
76
        };
77

    
78
        Array<Slot> processes;
79
        ArrayMap<String, Group> groups;
80
        Vector<String> error_keys;
81
        String current_group;
82
        String spooled_output;
83
        int console_lock;
84
        bool wrap_text;
85
        FrameBottom<EditString> input;
86

    
87
        void CheckEndGroup();
88
        void FlushConsole();
89

    
90
public:
91
        Callback WhenSelect;
92
        Callback1<Bar&> WhenBar;
93
        bool console;
94
        bool verbosebuild;
95

    
96
        int  Execute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
97
        int  Execute(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false);
98
        int  GetSlotCount() const { return processes.GetCount(); }
99
        int  AllocSlot();
100
        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);
101
        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);
102
        void BeginGroup(String group);
103
        void EndGroup();
104

    
105
        Console& operator<<(const String& s)      { Append(s); return *this; }
106

    
107
        bool IsRunning();
108
        bool IsRunning(int slot);
109
        int  Flush();
110
        void Kill(int slot);
111
        void Kill();
112
        void ClearError()                         { error_keys.Clear(); }
113
        Vector<String> PickErrors()               { Vector<String> e = pick(error_keys); error_keys.Clear(); return pick(e); }
114
        void Wait(int slot);
115
        bool Wait();
116

    
117
        void WrapText(bool w)                     { wrap_text = w; }
118

    
119
        void SetSlots(int s);
120

    
121
        void Input(bool b);
122

    
123
        Console();
124
};
125

    
126
VectorMap<String, Builder *(*)()>& BuilderMap();
127

    
128
String SelectAnyPackage();
129

    
130
String FindInDirs(const Vector<String>& dir, const String& file);
131
String FindCommand(const Vector<String>& exedir, const String& cmdline);
132

    
133
void DlCharset(DropList& d);
134
void DlCharsetD(DropList& d);
135

    
136
void                      SetupBuildMethods();
137
VectorMap<String, String> GetMethodVars(const String& method);
138
String                    GetDefaultMethod();
139

    
140
bool CheckLicense();
141
bool Install();
142

    
143
#define HELPNAME    "Help Topics"
144
#define METAPACKAGE "<meta>"
145

    
146
class TopicCtrl : public HelpWindow {
147
public:
148
        virtual Topic AcquireTopic(const String& topic);
149
        virtual void  BarEx(Bar& bar);
150
        virtual bool  Key(dword key, int count);
151
        virtual void  FinishText(RichText& text);
152

    
153
private:
154
        EditString search;
155
        DropList   lang;
156
        bool       internal;
157
        bool       showwords, all;
158
        
159
        VectorMap<String, VectorMap<String, Index<String> > > map;
160
        Index<String> lang_list;
161
        Vector<int>   spos;
162
        
163
        static  Index<String> idelink;
164

    
165
        void OpenTopic();
166
        void Search();
167
        void ShowWords();
168
        void All();
169
        void Lang();
170
        void SShow();
171
        void ScanDirForTpp(const char *dir, const String& rel, Index<String>& donepackage,
172
                           Index<String>& lang_list);
173
        void LoadMap();
174
        void FocusSearch();
175
        void Prev();
176
        void Next();
177

    
178
public:
179
        Callback WhenTopic;
180

    
181
        void SyncDocTree();
182
        void SearchWord(const String& s);
183
        void Serialize(Stream& s);
184

    
185
        typedef TopicCtrl CLASSNAME;
186

    
187
        TopicCtrl();
188
};
189

    
190
struct IdeCalc : CodeEditor {
191
        virtual bool Key(dword key, int count);
192
        virtual void LeftDouble(Point p, dword flags);
193

    
194
        ArrayMap<String, EscValue> vars;
195

    
196
        void    Execute();
197

    
198
        IdeCalc();
199
};
200

    
201
void AutoSetup();
202

    
203
extern bool splash_screen;
204
void HideSplash();
205
void ShowSplash();
206
bool IsSplashOpen();
207

    
208
class RightTabs : public FrameCtrl<Ctrl> {
209
public:
210
        virtual void Paint(Draw& w);
211
        virtual void LeftDown(Point p, dword);
212
        virtual void MouseMove(Point p, dword);
213
        virtual void MouseLeave();
214
        virtual void CancelMode();
215
        virtual void FramePaint(Draw& w, const Rect& r);
216
        virtual void FrameLayout(Rect& r);
217
        virtual void FrameAddSize(Size& sz);
218

    
219
private:
220
        enum       { SPACE = 7 };
221

    
222
        struct Tab {
223
                int    y;
224
                Image  img;
225
                String tip;
226

    
227
                int    GetHeight() const { return img.GetSize().cy + SPACE; }
228
                int    GetRight() const  { return y + GetHeight(); }
229
        };
230

    
231
        Array<Tab> tab;
232
        int        cx;
233
        int        hl;
234
        int        cursor;
235

    
236
        void Repos();
237
        void PaintTab(Draw& w, int x, int y, int cx, int cy, Color paper, const Image& img, Color hl);
238
        int  GetPos(Point p);
239

    
240
public:
241
        void Clear();
242
        void Add(const Image& img, const String& tip);
243
        void SetCursor(int i);
244
        int  GetCursor() const                                       { return cursor; }
245

    
246
        RightTabs();
247
};
248

    
249
class EditorTabBar : public FileTabs
250
{
251
public:
252
        EditorTabBar();
253
        String GetFile(int n) const;
254
        bool FindSetFile(const String& fn);
255
        void SetAddFile(const String& fn);
256
        void RenameFile(const String& fn, const String& nn);
257
        void SetSplitColor(const String& fn, const Color& c);
258
        void ClearSplitColor();
259

    
260
        typedef EditorTabBar CLASSNAME;
261
};
262

    
263
int    memcmp_i(const char *s, const char *t, int n);
264
String ParseTemplatedType(const String& type, Vector<String>& tparam);
265
String ResolveTParam(const String& type, const Vector<String>& tparam);
266
void   ResolveTParam(Vector<String>& type, const Vector<String>& tparam);
267
String Qualify(const String& scope, const String& type);
268
int    CharFilterMacro(int c);
269
int    CharFilterFileName(int c);
270

    
271
bool isincludefnchar(int c);
272

    
273
struct AssistEditor : CodeEditor {
274
        virtual bool Key(dword key, int count);
275
        virtual void LostFocus();
276
        virtual void MouseWheel(Point p, int zdelta, dword keyflags);
277
        virtual void LeftDown(Point p, dword keyflags);
278
        virtual void SelectionChanged();
279
        virtual void DirtyFrom(int line);
280
        virtual void State(int reason);
281

    
282
        struct IndexItem : Moveable<IndexItem> {
283
                String text;
284
                Color  ink;
285
                int    line;
286
        };
287
        byte              navigator;
288
        SplitterFrame     navigatorframe;
289
        StaticRect        navigatorpane;
290

    
291
        CodeBrowser       browser;
292
        ParentCtrl        scopepane;
293
        ParentCtrl        itempane;
294
        Splitter          scope_item;
295

    
296
        Splitter       popup;
297
        ArrayCtrl      assist;
298
        ArrayCtrl      type;
299
        Index<String>                 assist_type;
300
        ArrayMap<String, CppItemInfo> assist_item;
301
        RichTextCtrl   annotation_popup;
302
        
303
        int            assist_cursor;
304
        bool           auto_assist;
305
        bool           assist_active;
306
        bool           commentdp;
307
        bool           inbody;
308
        bool           thisback, thisbackn;
309
        bool           include_assist;
310
        Ide           *theide;
311
        WString        cachedline;
312
        int            cachedpos;
313
        int            cachedln;
314
        bool           include_local;
315
        int            include_back;
316
        String         include_path;
317
        int            scan_counter;
318
        
319
        RichTextCtrl   param_info;
320
        String         param_qtf;
321
        struct ParamInfo {
322
                int            line;
323
                int            pos;
324
                WString        test;
325
                CppItem        item;
326
                String         editfile;
327
                
328
                ParamInfo()    { line = -1; }
329
        };
330
        enum { PARAMN = 16 };
331
        ParamInfo param[PARAMN];
332
        int       parami;
333
        
334
        void           PopUpAssist(bool auto_insert = false);
335
        void           CloseAssist();
336
        void           Assist();
337
        bool           IncludeAssist();
338
        String         ReadIdBack(int q, bool include = false);
339
        void           SyncAssist();
340
        void           AssistInsert();
341
        bool           InCode();
342
        
343
        void           SyncParamInfo();
344
        void           StartParamInfo(const CppItem& m, int pos);
345

    
346
        Vector<String> GetFileIds();
347
        void           Complete();
348
        void           Complete2();
349
        void           Abbr();
350

    
351
        void           Context(Parser& parser, int pos);
352
        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
353
                                      Index<String>& typeset, bool variable,
354
                                      bool can_shortcut_operator, Index<String>& visited_bases,
355
                                      int lvl);
356
        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
357
                                      Index<String>& typeset, bool variable, int lvl);
358
//        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
359
//                                      Index<String>& typeset);
360
        Index<String>  ExpressionType(const Parser& parser, const Vector<String>& xp);
361

    
362
        Index<String>  EvaluateExpressionType(const Parser& parser, const Vector<String>& xp);
363

    
364
        String         RemoveDefPar(const char *s);
365
        String         MakeDefinition(const String& cls, const String& _n);
366
        void           DCopy();
367
        void           Virtuals();
368
        void           Thisbacks();
369
        void           GatherItems(const String& type, bool only_public, Index<String>& in_types,
370
                                   bool types);
371

    
372
        void           SelParam();
373
        int            Ch(int q);
374
        int            ParsBack(int q);
375
        Vector<String> ReadBack(int q);
376
        void           SkipSpcBack(int& q);
377
        String         IdBack(int& qq);
378
        String         CompleteIdBack(int& q);
379

    
380
        void           SwapSContext(Parser& p);
381
        
382
        void           SyncCursor();
383

    
384
        void           SyncNavigator();
385
        void           GotoBrowserScope();
386
        void           BrowserGoto();
387
        void           BrowserGotoNF();
388

    
389
        bool           IsNavigator() const                             { return navigator; }
390
        void           Navigator(bool navigator);
391

    
392
        bool           GetAnnotationRefs(Vector<String>& tl, String& coderef, int q = -1);
393
        bool           GetAnnotationRef(String& t, String& coderef, int q = -1);
394
        void           SyncAnnotationPopup();
395
        void           EditAnnotation(bool fastedit);
396
        void           Annotate(const String& filename);
397
        void           OpenTopic(String topic, String create, bool before);
398
        void           NewTopic(String group, String coderef);
399
        
400
        bool           Esc();
401
        
402
        void           SerializeNavigator(Stream& s);
403
        
404
        Callback1<int> WhenFontScroll;
405

    
406
        typedef AssistEditor CLASSNAME;
407

    
408
        AssistEditor();
409
};
410

    
411
void DirSel(EditField& f, FrameRight<Button>& b);
412
bool CopyFolder(const char *dst, const char *src, Progress *pi);
413
void SvnSyncDirs(const Vector<String>& working);
414

    
415
struct FindInFilesDlg : WithFindInFilesLayout<TopWindow> {
416
        WString itext;
417

    
418
        virtual bool Key(dword key, int count);
419
        
420
        void Setup(bool replace);
421
        void Sync();
422

    
423
        typedef FindInFilesDlg CLASSNAME;
424
        
425
        FindInFilesDlg();
426
};
427

    
428
struct Ide : public TopWindow, public WorkspaceWork, public IdeContext, public MakeBuild {
429
public:
430
        virtual   void   Paint(Draw& w);
431
        virtual   bool   Key(dword key, int count);
432
        virtual   bool   HotKey(dword key);
433
        virtual   void   FileCursor();
434
        virtual   void   PackageCursor();
435
        virtual   void   SyncWorkspace();
436
        virtual   void   BuildFileMenu(Bar& menu);
437
        virtual   void   ProjectSvn(Bar& bar);
438
        virtual   void   FilePropertiesMenu(Bar& menu);
439
        virtual   String GetOutputDir();
440
        virtual   String GetConfigDir();
441
        virtual   void   FileSelected();
442
        virtual   void   Serialize(Stream& s);
443
        virtual   void   FileRename(const String& nm);
444
        virtual   bool   FileRemove();
445
        virtual   void   DragAndDrop(Point p, PasteClip& d);
446
        virtual   void   Deactivate();
447

    
448
        virtual   void      PutConsole(const char *s);
449
        virtual   void      PutVerbose(const char *s);
450

    
451
        virtual   const Workspace& IdeWorkspace() const;
452
        virtual   bool             IdeIsBuilding() const;
453
        virtual   String           IdeGetOneFile() const;
454
        virtual   int              IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
455
        virtual   int              IdeConsoleExecute(One<AProcess> pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false);
456
        virtual   int              IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet);
457
        virtual   int              IdeConsoleAllocSlot();
458
        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);
459
        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);
460
        virtual   void             IdeConsoleFlush();
461
        virtual   void             IdeConsoleBeginGroup(String group);
462
        virtual   void             IdeConsoleEndGroup();
463
        virtual   bool             IdeConsoleWait();
464

    
465
        virtual   bool      IdeIsDebug() const;
466
        virtual   void      IdeEndDebug();
467
        virtual   void      IdeSetBottom(Ctrl& ctrl);
468
        virtual   void      IdeActivateBottom();
469
        virtual   void      IdeRemoveBottom(Ctrl& ctrl);
470
        virtual   void      IdeSetRight(Ctrl& ctrl);
471
        virtual   void      IdeRemoveRight(Ctrl& ctrl);
472

    
473
        virtual   String    IdeGetFileName() const;
474
        virtual   int       IdeGetFileLine();
475
        virtual   String    IdeGetLine(int i) const;
476

    
477
        virtual   void      IdeSetDebugPos(const String& fn, int line, const Image& img, int i);
478
        virtual   void      IdeHidePtr();
479
        virtual   bool      IdeDebugLock();
480
        virtual   bool      IdeDebugUnLock();
481
        virtual   bool      IdeIsDebugLock() const;
482

    
483
        virtual   void      IdeSetBar();
484
        virtual   void      IdeGotoCodeRef(String coderef);
485
        virtual   void      IdeOpenTopicFile(const String& file);
486
        virtual   void      IdeFlushFile();
487

    
488
        virtual   String    IdeGetFileName();
489
        virtual   String    IdeGetNestFolder();
490

    
491
        virtual   bool      IsPersistentFindReplace();
492

    
493
        virtual void   ConsoleShow();
494
        virtual void   ConsoleSync();
495
        virtual void   ConsoleClear();
496
        virtual void   SetupDefaultMethod();
497
        virtual Vector<String> PickErrors();
498
        virtual void   BeginBuilding(bool sync_files, bool clear_console);
499
        virtual void   EndBuilding(bool ok);
500
        virtual void   ClearErrorEditor();
501
        virtual void   DoProcessEvents();
502
        virtual void   ReQualifyCodeBase();
503
        virtual void   SetErrorEditor();
504
        virtual String GetMain();
505

    
506
        enum {
507
                EDITING, BUILDING, RUNNING, DEBUGGING,
508
        };
509

    
510
        String     pocfg;
511

    
512
        MenuBar    menubar;
513
        ToolBar    toolbar;
514
        StatusBar  statusbar;
515
        StaticRect editpane;
516

    
517
        int        idestate;
518
        int        debuglock;
519
        int        hydra1_threads;
520
        
521
        int        gdbSelector;
522

    
523
        int        chstyle;
524

    
525
        One<IdeDesigner> designer;
526
        AssistEditor     editor;
527
        CodeEditor       editor2;
528
        EditorTabBar     tabs;
529
        EscValue         macro_api;
530
#ifdef PLATFORM_POSIX
531
        SourceUpdater    su;
532
#endif
533

    
534
        RightTabs   btabs;
535
        StaticRect  bottom;
536
        Splitter    editor_bottom;
537
        Console     console, console2;
538
        IdeCalc     calc;
539
        Ptr<Ctrl>   bottomctrl;
540

    
541
        enum Bottoms { BCLOSE, BCONSOLE, BCONSOLE2, BCALC, BDEBUG };
542

    
543
        FileOut    stdout_fout;
544

    
545
        Splitter   editorsplit;
546
        Splitter   pfsplit;
547
        Splitter   wesplit;
548

    
549
        Splitter   right_split;
550
        StaticRect right;
551

    
552
        String    editfile;
553
        FileTime  edittime;
554
        int       editfile_line_endings;
555

    
556
        String    editfile2;
557

    
558
        Vector<String> tablru;
559
        int            tabi;
560
        bool           blocktabs;
561

    
562
        struct Bookmark : Moveable<Bookmark> {
563
                String            file;
564
                LineEdit::EditPos pos;
565

    
566
                void Serialize(Stream& s)        { s % file % pos; }
567
        }
568
        bookmark[10];
569

    
570
        struct FileData {
571
                Time               filetime;
572
                LineEdit::EditPos  editpos;
573
                Point              columnline;
574
                LineEdit::UndoData undodata;
575
                LineInfo           lineinfo;
576
                LineInfoRem        lineinforem;
577

    
578
                void Clear()  {
579
                        filetime = Null; editpos.Clear(); undodata.Clear();
580
                        columnline = Null; lineinfo.Clear(); lineinforem.Clear();
581
                }
582
                void ClearP() {
583
                        lineinforem.Clear();
584
                        undodata.Clear();
585
                }
586
        };
587

    
588
        String posfile[2];
589
        int    posline[2];
590
        Image  posimg[2];
591

    
592
        Vector<Bookmark> history;
593
        int              histi;
594

    
595
        ArrayMap<String, FileData> filedata;
596
        Index<String> editastext;
597

    
598
        DropList   mainconfiglist;
599
        String     mainconfigname;
600

    
601
        int          build_time;
602

    
603
        MultiButton               buildmode;
604
        PopUpTable                methodlist;
605
        PopUpTable                modelist;
606
        VectorMap<String, String> recent_buildmode;
607

    
608
        Vector<String> recentoutput;
609
        Vector<String> recentflags;
610

    
611
        String    runarg;
612
        String    recent_runarg;
613
        String    rundir;
614
        enum      { RUN_WINDOW, RUN_CONSOLE, RUN_FILE, RUN_FILE_CONSOLE };
615
        int       runmode;
616
        bool      runexternal;
617
        bool      forceconsole;
618
        String    stdout_file;
619
        String    recent_stdout_file;
620

    
621
// ------------------------------------
622
        enum { LF, CRLF, DETECT_LF, DETECT_CRLF };
623

    
624
        One<Debugger> debugger;
625

    
626
        Time      start_time;
627
        Time      build_start_time;
628
        int       stat_build_time;
629

    
630
        Font      editorfont;
631
        Font      veditorfont;
632
        Font      consolefont;
633
        Font      font1;
634
        Font      font2;
635
        Font      tfont;
636
        int       editortabsize;
637
        int       indent_amount;
638
        byte      default_charset;
639
        bool      indent_spaces;
640
        bool      show_status_bar;
641
        bool      toolbar_in_row;
642
        bool      show_tabs;
643
        int       line_endings;
644
        bool      tabs_icons;
645
        int       tabs_crosses;
646
        bool      tabs_grouping;
647
        bool      tabs_stacking;
648
        bool      tabs_serialize;
649
        bool      no_parenthesis_indent;
650
        bool      hilite_if_endif;
651
        bool      thousands_separator;
652
        bool      wrap_console_text;
653
        bool      mute_sounds;
654
        bool      line_numbers;
655
        bool      header_guards;
656
        int       filetabs;
657
        bool      auto_enclose;
658
        bool      mark_lines;
659
        bool      find_pick_sel;
660
        bool      find_pick_text;
661
        bool      deactivate_save;
662
        int       insert_include;
663
        int       bordercolumn;
664
        Color     bordercolor;
665
        bool      persistent_find_replace;
666
        bool      debug_console_apps_in_console;
667

    
668
        /*
669
                astyle code formatter control vars
670
                added 2008.01.27 by Massimo Del Fedele
671
        */
672
        bool        astyle_BracketIndent;
673
        bool        astyle_NamespaceIndent;
674
        bool        astyle_BlockIndent;
675
        bool        astyle_CaseIndent;
676
        bool        astyle_ClassIndent;
677
        bool        astyle_LabelIndent;
678
        bool        astyle_SwitchIndent;
679
        bool        astyle_PreprocessorIndent;
680
        int                astyle_MinInStatementIndentLength;
681
        int                astyle_MaxInStatementIndentLength;
682
        bool        astyle_BreakClosingHeaderBracketsMode;
683
        bool        astyle_BreakElseIfsMode;
684
        bool        astyle_BreakOneLineBlocksMode;
685
        bool        astyle_SingleStatementsMode;
686
        bool        astyle_BreakBlocksMode;
687
        bool        astyle_BreakClosingHeaderBlocksMode;
688
        int                astyle_BracketFormatMode;
689
        int                astyle_ParensPaddingMode;
690
        bool        astyle_ParensUnPaddingMode;
691
        bool        astyle_OperatorPaddingMode;
692
        bool        astyle_EmptyLineFill;
693
        bool        astyle_TabSpaceConversionMode;
694
        WString        astyle_TestBox;
695

    
696
        // Formats a string of code with a given formatter
697
        WString FormatCodeString(WString const &Src, astyle::ASFormatter &Formatter);
698

    
699
        // Formats editor's code with Ide format parameters
700
        void FormatCode();
701

    
702
        bool      browser_closeesc;
703
        bool      bookmark_pos;
704

    
705
        FrameTop<StaticBarArea> bararea;
706
        Label                   display;
707

    
708

    
709
        byte      hilite_scope;
710
        int       hilite_bracket;
711
        int       hilite_ifdef;
712
        bool      barline;
713
        bool      qtfsel;
714

    
715
        enum { STYLE_NO_REPLACE, STYLE_CONFIRM_REPLACE, STYLE_AUTO_REPLACE };
716

    
717
        String                        find_file_search_string;
718

    
719
        FindInFilesDlg ff;
720
        int            iwc;
721

    
722
        int           doc_serial;
723
        TopicCtrl     doc;
724

    
725
        int           state_icon;
726
        
727
        String        export_dir;
728
        VectorMap<String, String> abbr;
729
        
730
        int           issaving;
731
        int           isscanning;
732

    
733
// ------------------------------------
734

    
735
        Time      config_time;
736
        Time      ConfigTime();
737
        void      LoadConfig();
738
        void      SaveConfig();
739
        void      FinishConfig();
740
        void      SaveConfigOnTime();
741

    
742
        int       GetPackageIndex();
743

    
744
        void      BeepMuteExclamation() { if(!mute_sounds) BeepExclamation(); }
745
        void      BeepMuteInformation() { if(!mute_sounds) BeepInformation(); }
746

    
747
        void      BookKey(int key);
748
        void      AddHistory();
749
        void      GotoBookmark(const Bookmark& b);
750
        void      HistoryFw();
751
        void      HistoryBk();
752
        bool      IsHistDiff(int i);
753

    
754
        bool      HasFileData(const String& file);
755
        FileData& Filedata(const String& file);
756

    
757
        void      BTabs();
758
        void      SyncBottom();
759
        void      HideBottom();
760
        void      SetBottom(int i);
761
        void      ToggleBottom(int i);
762
        void      ShowBottom(int i);
763
        void      ShowConsole()                      { ShowBottom(1); }
764
        void      ShowConsole2()                     { ShowBottom(2); }
765
        void      ToggleConsole()                    { ToggleBottom(1); }
766
        void      SwapBottom();
767
        bool      IsBottomShown() const;
768

    
769
        void      EditorFontScroll(int d);
770

    
771
        void      MakeTitle();
772
        void      MakeIcon();
773
        void      AdjustMainConfig();
774
        String    GetFirstFile();
775
        void      SetMain(const String& package);
776
        void      ChangeFileCharset(const String& name, Package& p, byte charset);
777
        void      ChangeCharset();
778
        void      FlushFile();
779
        void      EditFile0(const String& path, byte charset = CHARSET_DEFAULT, bool astext = false,
780
                            const String& header = Null);
781
        void      EditFile(const String& path);
782
        void      AddEditFile(const String& path);
783
        void      ReloadFile();
784
        void      AddLru();
785
        bool      CanToggleReadOnly();
786
        void      ToggleReadOnly();
787
        void      PosSync();
788

    
789
        void      PackageMenu(Bar& menu);
790

    
791
        void      UscFile(const String& file);
792
        void      UscProcessDir(const String& dir);
793
        void      SyncUsc();
794

    
795
        void      RefreshBrowser();
796

    
797
        void      SetupOutputMode();
798
        void      SyncBuildMode();
799
        void      SetupBuildMethods();
800
        void      DropMethodList();
801
        void      SelectMethod();
802
        void      DropModeList();
803
        void      SelectMode();
804
        void      SerializeOutputMode(Stream& s);
805

    
806
        void      GotoPos(String path, int line);
807
        void      GotoCpp(const CppItem& pos);
808
        
809
        void      LoadAbbr();
810
        void      SaveAbbr();
811

    
812
        Vector<String> SvnDirs(bool actual = false);
813

    
814
        void      File(Bar& menu);
815
                void   EditWorkspace();
816
                void   EditAnyFile();
817
                bool   IsProjectFile(const String& f) const;
818
                void   SaveEditorFile(Stream& out);
819
                void   SaveFile0(bool always);
820
                void   SaveFile(bool always = false);
821
                void   DoSaveFile()    { SaveFile(); }
822
                void   FileBookmark        (Bar& menu);
823
                void   SwapPackagesFiles();
824
                void   Times();
825
                void   Statistics();
826
                void   Exit();
827
                String GetOpposite();
828
                void   GoOpposite();
829
                void   Print();
830
                void   Diff();
831
                void   Patch();
832
                void   SvnHistory();
833

    
834
        void      Edit(Bar& menu);
835
                void  EditAsText();
836
                void  EditUsingDesigner();
837
                void  EditMakeTabs()     { editor.MakeTabsOrSpaces(true); }
838
                void  EditMakeSpaces()   { editor.MakeTabsOrSpaces(false); }
839
                void  EditMakeLineEnds() { editor.MakeLineEnds(); }
840

    
841
                void  FindInFiles(bool replace);
842
                void  FindFileName();
843
                void  FindString(bool back);
844
                void  ClearEditedFile();
845
                void  ClearEditedAll();
846
        
847
                void  InsertColor();
848
                void  InsertLay(const String& fn);
849
                void  InsertIml(const String& fn, String classname);
850
                void  InsertText(const String& text);
851
                void  InsertCString();
852
                void  InsertFilePath(bool c);
853
                void  InsertMenu(Bar& bar);
854
                void  InsertAdvanced(Bar& bar);
855
                void  EditorMenu(Bar& bar);
856

    
857
        void SearchMenu(Bar& bar);
858
                void  EditFind()                { editor.FindReplace(find_pick_sel, find_pick_text, false); }
859
                void  EditReplace()             { editor.FindReplace(find_pick_sel, find_pick_text, true); }
860
                void  EditFindReplacePickText() { editor.FindReplace(true, true, false); }
861
                void  EditFindNext()            { editor.Find(false); }
862
                void  EditFindPrevious()        { editor.Find(true); }
863
                void  EditPaste()               { editor.Paste(); }
864
                void  FindNextError();
865
                void  FindPrevError();
866
        
867
        void      EditSpecial(Bar& menu);
868
                void  TranslateString();
869
                void  SwapChars()               { editor.SwapChars(); }
870
                void  CopyWord()                { editor.CopyWord(); }
871
                void  AlterText(WString (*op)(const WString& in));
872
                void  TextToUpper();
873
                void  TextToLower();
874
                void  TextToAscii();
875
                void  TextInitCaps();
876
                void  SwapCase();
877
                void  ToCString();
878
                void  ToComment();
879
                void  CommentLines();
880
                void  UnComment();
881

    
882
        void      MacroMenu(Bar& menu);
883
                bool  HasMacros();
884
                void  EditMacroMenu(Bar& menu, ValueArray items);
885
                void  EditMacro(int i);
886

    
887
        void      Project(Bar& menu);
888
                void  SyncT(int kind);
889
                void  ConvertST();
890
                void  ExportMakefile(const String& ep);
891
                void  ExportProject(const String& ep, bool all, bool gui, bool deletedir = true);
892
                void  SyncSvnDirs(const Vector<String>& working);
893
                void  SyncSvnDir(const String& working);
894
                void  SyncSvn();
895

    
896
        void      BuildMenu(Bar& menu);
897
                void BuildPackageMenu(Bar& menu);
898

    
899
                void  DoBuild();
900
                void  PackageBuild();
901
                void  StopBuild();
902
                void  PackageClean();
903
                void  CreateMakefile();
904
                void  CleanUppOut();
905
                void  SwitchHeader();
906
                void  FileCompile();
907
                void  Preprocess(bool asmout);
908
                void  ToggleStopOnErrors();
909
                One<Host> CreateHostRunDir();
910
                void  OpenOutputFolder();
911

    
912
        void      DebugMenu(Bar& menu);
913
                void  RunArgs();
914
                void  BuildAndExecute();
915
                void  BuildAndDebug0(const String& srcfile);
916
                void  BuildAndDebug(bool runto);
917
                void  BuildAndExtDebug();
918
                void  BuildAndExtDebugFile();
919
                bool  IsValgrind();
920
                void  Valgrind();
921

    
922
                void  StartDebug();
923
                void  StopDebug();
924
                void  DebugToggleBreak();
925
                void  ConditionalBreak();
926
                void  DebugClearBreakpoints();
927
                void  OnBreakpoint(int i);
928

    
929
                String GetLogPath();
930
                void  OpenLog();
931
                bool  EditorTip(CodeEditor::MouseTip& mt);
932

    
933
        void      Setup(Bar& menu);
934
                void  SetupFormat();
935
                void  ToggleVerboseBuild();
936
                void  AutoSetup();
937
                void  CheckUpdates(bool verbose);
938
                void  CheckUpdatesManual();
939
                void  SetUpdateTimer(int period);
940
                void  Abbreviations();
941

    
942
        void      BrowseMenu(Bar& menu);
943
                void  RescanCode();
944
                void  QueryId();
945
                void  About();
946
                void  OpenTopic(const String& topic, const String& createafter, bool before);
947
                void  OpenTopic(const String& topic);
948
                void  OpenATopic();
949
                void  ToggleNavigator();
950
                void  SearchCode();
951
                void  Goto();
952
                void  GotoGlobal();
953
                void  ScanFile();
954
                bool  SwapSIf(const char *cref);
955
                void  SwapS();
956
                void  ContextGoto0(int pos);
957
                void  ContextGoto();
958
                void  CtrlClick(int pos);
959
                void  Qtf();
960
                void  Xml();
961
                void  Json();
962
                void  DoDirDiff();
963

    
964

    
965
        void      ConsoleMenu(Bar& menu);
966
                void  ConsoleCopy();
967
                void  ConsolePaste();
968

    
969
        void      MainMenu(Bar& menu);
970
        void      MainTool(Bar& bar);
971

    
972
        void      SaveWorkspace();
973
        String    WorkspaceFile();
974
        void      SerializeWorkspace(Stream& s);
975

    
976
        void      SerializeLastMain(Stream& s);
977
        void      SaveLastMain();
978
        void      LoadLastMain();
979

    
980
//        void      PrintTime(dword time);
981
        void      SetIdeState(int newstate);
982

    
983
        void      MainConfig();
984
        void      SyncMainConfigList();
985
        void      OnMainConfigList();
986
        void      SetMainConfigList();
987

    
988
        void      FileProperties();
989

    
990
        void      CustomSteps();
991

    
992
        void      CycleFiles();
993

    
994
        void      Renumber();
995

    
996
        Console&  GetConsole();
997

    
998
        bool      FindLineError(int l, Host& host);
999
        
1000
        struct FindLineErrorCache {
1001
                VectorMap<String, bool> ff;
1002
                Vector<String>          wspc_paths;
1003
        };
1004
        
1005
        bool      FindLineError(String ln, Host& host, String& file, int& lineno, int& error,
1006
                                FindLineErrorCache& cache, int& linepos);
1007
        void      FindError();
1008
        void          ClearErrorEditor(String file);
1009

    
1010
        void      FindWildcard();
1011
        void      FindFolder();
1012
        void      FindSetStdDir(String n);
1013
        void      FindStdDir();
1014
        void      InsertWildcard(int c);
1015
        void      SerializeFf(Stream& s);
1016
        bool      SearchInFile(const String& fn, const String& pattern,
1017
                                   bool wholeword, bool ignorecase, int& n);
1018
        void      SyncFindInFiles();
1019
        void      ConstructFindInFiles();
1020
        void      SerializeFindInFiles(Stream& s);
1021

    
1022
        void      SetupEditor(int font, String highlight, String fn);
1023
        void      SetupEditor();
1024

    
1025
        void      Display();
1026

    
1027
        void      SetIcon();
1028
        bool      IsCppBaseFile();
1029
        void      CheckFileUpdate();
1030
        void      Periodic();
1031

    
1032
        void      PassEditor();
1033
        void      SyncEditorSplit();
1034
        void      SplitEditor(bool horz);
1035
        void      CloseSplit();
1036
        void      KeySplit(bool horz);
1037
        void      SwapEditors();
1038
        void      TabFile();
1039
        void      ClearTab();
1040
        void      ClearTabs();
1041
        void      CloseRest(EditorTabBar *tabs);
1042
        void      TabsLR(int d);
1043

    
1044
        void      RefreshFrame(bool auto_disasm);
1045
        void      RefreshLine(int frame, bool auto_disasm);
1046

    
1047
        void      ResolveUvsConflict();
1048

    
1049
        void      SetBar();
1050
        void      SetMenuBar();
1051
        void      SetToolBar();
1052
        
1053
        void      UpdateFormat(CodeEditor& editor);
1054
        void      UpdateFormat();
1055
        void      ReadHlStyles(ArrayCtrl& hlstyle);
1056

    
1057
        bool      OpenMainPackage();
1058
        void      NewMainPackage();
1059

    
1060
        void      JumpToDefinition(const Array<CppItem>& n, int q, const String& scope);
1061
        void      SearchTopics();
1062
        void      ShowTopics();
1063

    
1064
        void      TopicBack();
1065

    
1066
        void      SetupBars();
1067

    
1068
        void      SyncCh();
1069

    
1070
        EscValue  MacroEditor();
1071
                void  MacroGetLength(EscEscape& e);
1072
                void  MacroGetLineCount(EscEscape& e);
1073
                void  MacroGetLinePos(EscEscape& e);
1074
                void  MacroGetCursor(EscEscape& e);
1075
                void  MacroGetLine(EscEscape& e);
1076
                void  MacroGetColumn(EscEscape& e);
1077
                void  MacroGetSelBegin(EscEscape& e);
1078
                void  MacroGetSelEnd(EscEscape& e);
1079
                void  MacroGetSelCount(EscEscape& e);
1080
                void  MacroSetCursor(EscEscape& e);
1081
                void  MacroSetSelection(EscEscape& e);
1082
                void  MacroClearSelection(EscEscape& e);
1083
                void  MacroGet(EscEscape& e);
1084
                void  MacroRemove(EscEscape& e);
1085
                void  MacroInsert(EscEscape& e);
1086
                void  MacroFind(EscEscape& e);
1087
                void  MacroReplace(EscEscape& e);
1088
                void  MacroFindMatchingBrace(EscEscape& e);
1089
                void  MacroFindClosingBrace(EscEscape& e);
1090
                void  MacroFindOpeningBrace(EscEscape& e);
1091
                void  MacroMoveLeft(EscEscape& e);
1092
                void  MacroMoveRight(EscEscape& e);
1093
                void  MacroMoveWordLeft(EscEscape& e);
1094
                void  MacroMoveWordRight(EscEscape& e);
1095
                void  MacroMoveUp(EscEscape& e);
1096
                void  MacroMoveDown(EscEscape& e);
1097
                void  MacroMoveHome(EscEscape& e);
1098
                void  MacroMoveEnd(EscEscape& e);
1099
                void  MacroMovePageUp(EscEscape& e);
1100
                void  MacroMovePageDown(EscEscape& e);
1101
                void  MacroMoveTextBegin(EscEscape& e);
1102
                void  MacroMoveTextEnd(EscEscape& e);
1103
                void  MacroInput(EscEscape& e);
1104
                void  MacroBuild(EscEscape& e);
1105
                void  MacroBuildProject(EscEscape& e);
1106
                void  MacroExecute(EscEscape& e);
1107
                void  MacroLaunch(EscEscape& e);
1108
                void  MacroClearConsole(EscEscape& e);
1109
                void  MacroEditFile(EscEscape& e);
1110
                void  MacroSaveCurrentFile(EscEscape& e);
1111
                void  MacroFileName(EscEscape& e);
1112
                void  MacroMainPackage(EscEscape& e);
1113
                void  MacroActivePackage(EscEscape& e);
1114
                void  MacroPackageDir(EscEscape& e);
1115
                void  MacroAssembly(EscEscape& e);
1116
                void  MacroBuildMethod(EscEscape& e);
1117
                void  MacroBuildMode(EscEscape& e);
1118
                void  MacroFlags(EscEscape& e);
1119
                void  MacroEcho(EscEscape& e);
1120
                void  MacroCloseFile(EscEscape& e);
1121
                void  MacroPackageFiles(EscEscape& e);
1122
                void  MacroAllPackages(EscEscape& e);
1123

    
1124
        typedef   Ide CLASSNAME;
1125

    
1126
        enum {
1127
                TIMEID_PERIODIC = TopWindow::TIMEID_COUNT,
1128
                TIMEID_COUNT,
1129
        };
1130

    
1131
        Ide();
1132
        ~Ide();
1133
};
1134

    
1135
#endif