ide.h

Zbigniew Rebacz, 01/05/2014 01:36 AM

Download (31.3 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
class FileSelButton : public FileSel
43
{
44
public:
45
        typedef FileSelButton CLASSNAME;
46
        enum MODE { MODE_OPEN, MODE_SAVE, MODE_DIR };
47
        FileSelButton(MODE mode = MODE_OPEN, const char *title = NULL);
48

    
49
        void               Attach(Ctrl& parent) { parent.AddFrame(button); }
50
        void               Title(String t)      { title = t; }
51
        String             GetTitle() const     { return title; }
52

    
53
private:
54
        void               OnAction();
55

    
56
private:
57
        FrameRight<Button> button;
58
        String             title;
59
        MODE               mode;
60
};
61

    
62
struct OpenFileButton  : FileSelButton { OpenFileButton(const char *title = NULL) : FileSelButton(MODE_OPEN, title) {} };
63
struct SaveFileButton  : FileSelButton { SaveFileButton(const char *title = NULL) : FileSelButton(MODE_SAVE, title) {} };
64
struct SelectDirButton : FileSelButton { SelectDirButton(const char *title = NULL) : FileSelButton(MODE_DIR,  title) {} };
65

    
66
#include "UppDlg.h"
67

    
68
void Puts(const char *s);
69

    
70
class Console : public LineEdit {
71
public:
72
        virtual bool Key(dword key, int count);
73
        virtual void LeftDouble(Point p, dword);
74
        virtual void RightDown(Point p, dword);
75
        virtual void Append(const String& s);
76

    
77
protected:
78
        struct Slot {
79
                Slot() : outfile(NULL), quiet(true), exitcode(Null) {}
80

    
81
                One<AProcess>     process;
82
                String            cmdline;
83
                String            output;
84
                String            key;
85
                String            group;
86
                Stream            *outfile;
87
                bool              quiet;
88
                int               exitcode;
89
                int               last_msecs;
90
        };
91

    
92
        struct Group {
93
                Group() : count(0), start_time(::msecs()), finished(false), msecs(0), raw_msecs(0) {}
94

    
95
                int               count;
96
                int               start_time;
97
                bool              finished;
98
                int               msecs;
99
                int               raw_msecs;
100
        };
101

    
102
        Array<Slot> processes;
103
        ArrayMap<String, Group> groups;
104
        Vector<String> error_keys;
105
        String current_group;
106
        String spooled_output;
107
        int console_lock;
108
        bool wrap_text;
109
        FrameBottom<EditString> input;
110

    
111
        void CheckEndGroup();
112
        void FlushConsole();
113

    
114
public:
115
        Callback WhenSelect;
116
        Callback1<Bar&> WhenBar;
117
        bool console;
118
        bool verbosebuild;
119

    
120
        int  Execute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
121
        int  Execute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
122
        int  GetSlotCount() const { return processes.GetCount(); }
123
        int  AllocSlot();
124
        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);
125
        bool Run(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
126
        void BeginGroup(String group);
127
        void EndGroup();
128

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

    
131
        bool IsRunning();
132
        bool IsRunning(int slot);
133
        int  Flush();
134
        void Kill(int slot);
135
        void Kill();
136
        void ClearError()                         { error_keys.Clear(); }
137
        Vector<String> PickErrors()               { Vector<String> e = error_keys; error_keys.Clear(); return e; }
138
        void Wait(int slot);
139
        bool Wait();
140

    
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();
166

    
167
#define HELPNAME    "Help Topics"
168
#define METAPACKAGE "<meta>"
169

    
170
class TopicCtrl : public HelpWindow {
171
public:
172
        virtual Topic AcquireTopic(const String& topic);
173
        virtual void  BarEx(Bar& bar);
174
        virtual bool  Key(dword key, int count);
175
        virtual void  FinishText(RichText& text);
176

    
177
private:
178
        EditString search;
179
        DropList   lang;
180
        bool       internal;
181
        bool       showwords, all;
182
        
183
        VectorMap<String, VectorMap<String, Index<String> > > map;
184
        Index<String> lang_list;
185
        Vector<int>   spos;
186
        
187
        static  Index<String> idelink;
188

    
189
        void OpenTopic();
190
        void Search();
191
        void ShowWords();
192
        void All();
193
        void Lang();
194
        void SShow();
195
        void ScanDirForTpp(const char *dir, const String& rel, Index<String>& donepackage,
196
                           Index<String>& lang_list);
197
        void LoadMap();
198
        void FocusSearch();
199
        void Prev();
200
        void Next();
201

    
202
public:
203
        Callback WhenTopic;
204

    
205
        void SyncDocTree();
206
        void SearchWord(const String& s);
207
        void Serialize(Stream& s);
208

    
209
        typedef TopicCtrl CLASSNAME;
210

    
211
        TopicCtrl();
212
};
213

    
214
struct IdeCalc : CodeEditor {
215
        virtual bool Key(dword key, int count);
216
        virtual void LeftDouble(Point p, dword flags);
217

    
218
        ArrayMap<String, EscValue> vars;
219

    
220
        void    Execute();
221

    
222
        IdeCalc();
223
};
224

    
225
void AutoSetup();
226

    
227
extern bool splash_screen;
228
void HideSplash();
229
void ShowSplash();
230
bool IsSplashOpen();
231

    
232
class RightTabs : public FrameCtrl<Ctrl> {
233
public:
234
        virtual void Paint(Draw& w);
235
        virtual void LeftDown(Point p, dword);
236
        virtual void MouseMove(Point p, dword);
237
        virtual void MouseLeave();
238
        virtual void CancelMode();
239
        virtual void FramePaint(Draw& w, const Rect& r);
240
        virtual void FrameLayout(Rect& r);
241
        virtual void FrameAddSize(Size& sz);
242

    
243
private:
244
        enum       { SPACE = 7 };
245

    
246
        struct Tab {
247
                int    y;
248
                Image  img;
249
                String tip;
250

    
251
                int    GetHeight() const { return img.GetSize().cy + SPACE; }
252
                int    GetRight() const  { return y + GetHeight(); }
253
        };
254

    
255
        Array<Tab> tab;
256
        int        cx;
257
        int        hl;
258
        int        cursor;
259

    
260
        void Repos();
261
        void PaintTab(Draw& w, int x, int y, int cx, int cy, Color paper, const Image& img, Color hl);
262
        int  GetPos(Point p);
263

    
264
public:
265
        void Clear();
266
        void Add(const Image& img, const String& tip);
267
        void SetCursor(int i);
268
        int  GetCursor() const                                       { return cursor; }
269

    
270
        RightTabs();
271
};
272

    
273
class EditorTabBar : public FileTabs
274
{
275
public:
276
        EditorTabBar();
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

    
284
        typedef EditorTabBar CLASSNAME;
285
};
286

    
287
int    memcmp_i(const char *s, const char *t, int n);
288
String ParseTemplatedType(const String& type, Vector<String>& tparam);
289
String ResolveTParam(const String& type, const Vector<String>& tparam);
290
void   ResolveTParam(Vector<String>& type, const Vector<String>& tparam);
291
String Qualify(const String& scope, const String& type);
292
int    CharFilterMacro(int c);
293
int    CharFilterFileName(int c);
294

    
295
bool isincludefnchar(int c);
296

    
297
struct AssistEditor : CodeEditor {
298
        virtual bool Key(dword key, int count);
299
        virtual void LostFocus();
300
        virtual void MouseWheel(Point p, int zdelta, dword keyflags);
301
        virtual void LeftDown(Point p, dword keyflags);
302
        virtual void SelectionChanged();
303
        virtual void DirtyFrom(int line);
304
        virtual void State(int reason);
305

    
306
        struct IndexItem : Moveable<IndexItem> {
307
                String text;
308
                Color  ink;
309
                int    line;
310
        };
311
        byte              navigator;
312
        SplitterFrame     navigatorframe;
313
        StaticRect        navigatorpane;
314

    
315
        CodeBrowser       browser;
316
        ParentCtrl        scopepane;
317
        ParentCtrl        itempane;
318
        Splitter          scope_item;
319

    
320
        Splitter       popup;
321
        ArrayCtrl      assist;
322
        ArrayCtrl      type;
323
        Index<String>                 assist_type;
324
        ArrayMap<String, CppItemInfo> assist_item;
325
        RichTextCtrl   annotation_popup;
326
        
327
        int            assist_cursor;
328
        bool           auto_assist;
329
        bool           assist_active;
330
        bool           commentdp;
331
        bool           inbody;
332
        bool           thisback, thisbackn;
333
        bool           include_assist;
334
        Ide           *theide;
335
        WString        cachedline;
336
        int            cachedpos;
337
        int            cachedln;
338
        bool           include_local;
339
        int            include_back;
340
        String         include_path;
341
        int            scan_counter;
342
        
343
        RichTextCtrl   param_info;
344
        String         param_qtf;
345
        struct ParamInfo {
346
                int            line;
347
                int            pos;
348
                WString        test;
349
                CppItem        item;
350
                String         editfile;
351
                
352
                ParamInfo()    { line = -1; }
353
        };
354
        enum { PARAMN = 16 };
355
        ParamInfo param[PARAMN];
356
        int       parami;
357
        
358
        void           PopUpAssist(bool auto_insert = false);
359
        void           CloseAssist();
360
        void           Assist();
361
        bool           IncludeAssist();
362
        String         ReadIdBack(int q, bool include = false);
363
        void           SyncAssist();
364
        void           AssistInsert();
365
        bool           InCode();
366
        
367
        void           SyncParamInfo();
368
        void           StartParamInfo(const CppItem& m, int pos);
369

    
370
        Vector<String> GetFileIds();
371
        void           Complete();
372
        void           Complete2();
373
        void           Abbr();
374

    
375
        void           Context(Parser& parser, int pos);
376
        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
377
                                      Index<String>& typeset, bool variable,
378
                                      bool can_shortcut_operator, Index<String>& visited_bases,
379
                                      int lvl);
380
        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
381
                                      Index<String>& typeset, bool variable, int lvl);
382
//        void           ExpressionType(const String& type, const Vector<String>& xp, int ii,
383
//                                      Index<String>& typeset);
384
        Index<String>  ExpressionType(const Parser& parser, const Vector<String>& xp);
385

    
386
        Index<String>  EvaluateExpressionType(const Parser& parser, const Vector<String>& xp);
387

    
388
        String         RemoveDefPar(const char *s);
389
        String         MakeDefinition(const String& cls, const String& _n);
390
        void           DCopy();
391
        void           Virtuals();
392
        void           Thisbacks();
393
        void           GatherItems(const String& type, bool only_public, Index<String>& in_types,
394
                                   bool types);
395

    
396
        void           SelParam();
397
        int            Ch(int q);
398
        int            ParsBack(int q);
399
        Vector<String> ReadBack(int q);
400
        void           SkipSpcBack(int& q);
401
        String         IdBack(int& qq);
402
        String         CompleteIdBack(int& q);
403

    
404
        void           SwapSContext(Parser& p);
405
        
406
        void           SyncCursor();
407

    
408
        void           SyncNavigator();
409
        void           GotoBrowserScope();
410
        void           BrowserGoto();
411
        void           BrowserGotoNF();
412

    
413
        bool           IsNavigator() const                             { return navigator; }
414
        void           Navigator(bool navigator);
415

    
416
        bool           GetAnnotationRefs(Vector<String>& tl, String& coderef, int q = -1);
417
        bool           GetAnnotationRef(String& t, String& coderef, int q = -1);
418
        void           SyncAnnotationPopup();
419
        void           EditAnnotation(bool fastedit);
420
        void           Annotate(const String& filename);
421
        void           OpenTopic(String topic, String create, bool before);
422
        void           NewTopic(String group, String coderef);
423
        
424
        bool           Esc();
425
        
426
        void           SerializeNavigator(Stream& s);
427
        
428
        Callback1<int> WhenFontScroll;
429

    
430
        typedef AssistEditor CLASSNAME;
431

    
432
        AssistEditor();
433
};
434

    
435
void DirSel(EditField& f, FrameRight<Button>& b);
436
bool CopyFolder(const char *dst, const char *src, Progress *pi);
437
void SvnSyncDirs(const Vector<String>& working);
438

    
439
struct FindInFilesDlg : WithFindInFilesLayout<TopWindow> {
440
        WString itext;
441

    
442
        virtual bool Key(dword key, int count);
443
        
444
        void Setup(bool replace);
445
        void Sync();
446

    
447
        typedef FindInFilesDlg CLASSNAME;
448
        
449
        FindInFilesDlg();
450
};
451

    
452
struct Ide : public TopWindow, public WorkspaceWork, public IdeContext, public MakeBuild {
453
public:
454
        virtual   void   Paint(Draw& w);
455
        virtual   bool   Key(dword key, int count);
456
        virtual   bool   HotKey(dword key);
457
        virtual   void   FileCursor();
458
        virtual   void   PackageCursor();
459
        virtual   void   SyncWorkspace();
460
        virtual   void   BuildFileMenu(Bar& menu);
461
        virtual   void   ProjectSvn(Bar& bar);
462
        virtual   void   FilePropertiesMenu(Bar& menu);
463
        virtual   String GetOutputDir();
464
        virtual   String GetConfigDir();
465
        virtual   void   FileSelected();
466
        virtual   void   Serialize(Stream& s);
467
        virtual   void   FileRename(const String& nm);
468
        virtual   bool   FileRemove();
469
        virtual   void   DragAndDrop(Point p, PasteClip& d);
470
        virtual   void   Deactivate();
471

    
472
        virtual   void      PutConsole(const char *s);
473
        virtual   void      PutVerbose(const char *s);
474

    
475
        virtual   const Workspace& IdeWorkspace() const;
476
        virtual   bool             IdeIsBuilding() const;
477
        virtual   String           IdeGetOneFile() const;
478
        virtual   int              IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
479
        virtual   int              IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
480
        virtual   int              IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet);
481
        virtual   int              IdeConsoleAllocSlot();
482
        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);
483
        virtual   bool             IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
484
        virtual   void             IdeConsoleFlush();
485
        virtual   void             IdeConsoleBeginGroup(String group);
486
        virtual   void             IdeConsoleEndGroup();
487
        virtual   bool             IdeConsoleWait();
488

    
489
        virtual   bool      IdeIsDebug() const;
490
        virtual   void      IdeEndDebug();
491
        virtual   void      IdeSetBottom(Ctrl& ctrl);
492
        virtual   void      IdeActivateBottom();
493
        virtual   void      IdeRemoveBottom(Ctrl& ctrl);
494
        virtual   void      IdeSetRight(Ctrl& ctrl);
495
        virtual   void      IdeRemoveRight(Ctrl& ctrl);
496

    
497
        virtual   String    IdeGetFileName() const;
498
        virtual   int       IdeGetFileLine();
499
        virtual   String    IdeGetLine(int i) const;
500

    
501
        virtual   void      IdeSetDebugPos(const String& fn, int line, const Image& img, int i);
502
        virtual   void      IdeHidePtr();
503
        virtual   bool      IdeDebugLock();
504
        virtual   bool      IdeDebugUnLock();
505
        virtual   bool      IdeIsDebugLock() const;
506

    
507
        virtual   void      IdeSetBar();
508
        virtual   void      IdeGotoCodeRef(String coderef);
509
        virtual   void      IdeOpenTopicFile(const String& file);
510
        virtual   void      IdeFlushFile();
511

    
512
        virtual   String    IdeGetFileName();
513
        virtual   String    IdeGetNestFolder();
514

    
515
        virtual   bool      IsPersistentFindReplace();
516

    
517
        virtual void   ConsoleShow();
518
        virtual void   ConsoleSync();
519
        virtual void   ConsoleClear();
520
        virtual void   SetupDefaultMethod();
521
        virtual Vector<String> PickErrors();
522
        virtual void   BeginBuilding(bool sync_files, bool clear_console);
523
        virtual void   EndBuilding(bool ok);
524
        virtual void   ClearErrorEditor();
525
        virtual void   DoProcessEvents();
526
        virtual void   ReQualifyCodeBase();
527
        virtual void   SetErrorEditor();
528
        virtual String GetMain();
529

    
530
        enum {
531
                EDITING, BUILDING, RUNNING, DEBUGGING,
532
        };
533

    
534
        String     pocfg;
535

    
536
        MenuBar    menubar;
537
        ToolBar    toolbar;
538
        StatusBar  statusbar;
539
        StaticRect editpane;
540

    
541
        int        idestate;
542
        int        debuglock;
543
        int        hydra1_threads;
544
        
545
        int        gdbSelector;
546

    
547
        int        chstyle;
548

    
549
        One<IdeDesigner> designer;
550
        AssistEditor     editor;
551
        CodeEditor       editor2;
552
        EditorTabBar     tabs;
553
        EscValue         macro_api;
554
#ifdef PLATFORM_POSIX
555
        SourceUpdater    su;
556
#endif
557

    
558
        RightTabs   btabs;
559
        StaticRect  bottom;
560
        Splitter    editor_bottom;
561
        Console     console, console2;
562
        IdeCalc     calc;
563
        Ptr<Ctrl>   bottomctrl;
564

    
565
        enum Bottoms { BCLOSE, BCONSOLE, BCONSOLE2, BCALC, BDEBUG };
566

    
567
        FileOut    stdout_fout;
568

    
569
        Splitter   editorsplit;
570
        Splitter   pfsplit;
571
        Splitter   wesplit;
572

    
573
        Splitter   right_split;
574
        StaticRect right;
575

    
576
        String    editfile;
577
        FileTime  edittime;
578
        int       editfile_line_endings;
579

    
580
        String    editfile2;
581

    
582
        Vector<String> tablru;
583
        int            tabi;
584
        bool           blocktabs;
585

    
586
        struct Bookmark : Moveable<Bookmark> {
587
                String            file;
588
                LineEdit::EditPos pos;
589

    
590
                void Serialize(Stream& s)        { s % file % pos; }
591
        }
592
        bookmark[10];
593

    
594
        struct FileData {
595
                Time               filetime;
596
                LineEdit::EditPos  editpos;
597
                Point              columnline;
598
                LineEdit::UndoData undodata;
599
                LineInfo           lineinfo;
600
                LineInfoRem        lineinforem;
601

    
602
                void Clear()  {
603
                        filetime = Null; editpos.Clear(); undodata.Clear();
604
                        columnline = Null; lineinfo.Clear(); lineinforem.Clear();
605
                }
606
        };
607

    
608
        String posfile[2];
609
        int    posline[2];
610
        Image  posimg[2];
611

    
612
        Vector<Bookmark> history;
613
        int              histi;
614

    
615
        ArrayMap<String, FileData> filedata;
616
        Index<String> editastext;
617

    
618
        DropList   mainconfiglist;
619
        String     mainconfigname;
620

    
621
        int          build_time;
622

    
623
        MultiButton               buildmode;
624
        PopUpTable                methodlist;
625
        PopUpTable                modelist;
626
        VectorMap<String, String> recent_buildmode;
627

    
628
        Vector<String> recentoutput;
629
        Vector<String> recentflags;
630

    
631
        String    runarg;
632
        String    recent_runarg;
633
        String    rundir;
634
        enum      { RUN_WINDOW, RUN_CONSOLE, RUN_FILE, RUN_FILE_CONSOLE };
635
        int       runmode;
636
        bool      runexternal;
637
        bool      forceconsole;
638
        String    stdout_file;
639
        String    recent_stdout_file;
640

    
641
// ------------------------------------
642
        enum { LF, CRLF, DETECT_LF, DETECT_CRLF };
643

    
644
        One<Debugger> debugger;
645

    
646
        Time      start_time;
647
        Time      build_start_time;
648
        int       stat_build_time;
649

    
650
        Font      editorfont;
651
        Font      veditorfont;
652
        Font      consolefont;
653
        Font      font1;
654
        Font      font2;
655
        Font      tfont;
656
        int       editortabsize;
657
        int       indent_amount;
658
        byte      default_charset;
659
        bool      indent_spaces;
660
        bool      show_status_bar;
661
        bool      toolbar_in_row;
662
        bool      show_tabs;
663
        int       line_endings;
664
        bool      tabs_icons;
665
        int       tabs_crosses;
666
        bool      tabs_grouping;
667
        bool      tabs_stacking;
668
        bool      tabs_serialize;
669
        bool      no_parenthesis_indent;
670
        bool      hilite_if_endif;
671
        bool      thousands_separator;
672
        bool      wrap_console_text;
673
        bool      mute_sounds;
674
        bool      line_numbers;
675
        bool      header_guards;
676
        int       filetabs;
677
        bool      auto_enclose;
678
        bool      mark_lines;
679
        bool      find_pick_sel;
680
        bool      find_pick_text;
681
        bool      deactivate_save;
682
        int       insert_include;
683
        int       bordercolumn;
684
        Color     bordercolor;
685
        bool      persistent_find_replace;
686

    
687
        /*
688
                astyle code formatter control vars
689
                added 2008.01.27 by Massimo Del Fedele
690
        */
691
        bool        astyle_BracketIndent;
692
        bool        astyle_NamespaceIndent;
693
        bool        astyle_BlockIndent;
694
        bool        astyle_CaseIndent;
695
        bool        astyle_ClassIndent;
696
        bool        astyle_LabelIndent;
697
        bool        astyle_SwitchIndent;
698
        bool        astyle_PreprocessorIndent;
699
        int                astyle_MinInStatementIndentLength;
700
        int                astyle_MaxInStatementIndentLength;
701
        bool        astyle_BreakClosingHeaderBracketsMode;
702
        bool        astyle_BreakElseIfsMode;
703
        bool        astyle_BreakOneLineBlocksMode;
704
        bool        astyle_SingleStatementsMode;
705
        bool        astyle_BreakBlocksMode;
706
        bool        astyle_BreakClosingHeaderBlocksMode;
707
        int                astyle_BracketFormatMode;
708
        int                astyle_ParensPaddingMode;
709
        bool        astyle_ParensUnPaddingMode;
710
        bool        astyle_OperatorPaddingMode;
711
        bool        astyle_EmptyLineFill;
712
        bool        astyle_TabSpaceConversionMode;
713
        WString        astyle_TestBox;
714

    
715
        // Formats a string of code with a given formatter
716
        WString FormatCodeString(WString const &Src, astyle::ASFormatter &Formatter);
717

    
718
        // Formats editor's code with Ide format parameters
719
        void FormatCode();
720

    
721
        bool      browser_closeesc;
722
        bool      bookmark_pos;
723

    
724
        FrameTop<StaticBarArea> bararea;
725
        Label                   display;
726

    
727

    
728
        byte      hilite_scope;
729
        int       hilite_bracket;
730
        int       hilite_ifdef;
731
        bool      barline;
732
        bool      qtfsel;
733

    
734
        enum { STYLE_NO_REPLACE, STYLE_CONFIRM_REPLACE, STYLE_AUTO_REPLACE };
735

    
736
        String                        find_file_search_string;
737

    
738
        FindInFilesDlg ff;
739
        int            iwc;
740

    
741
        int           doc_serial;
742
        TopicCtrl     doc;
743

    
744
        int           state_icon;
745
        
746
        String        export_dir;
747
        VectorMap<String, String> abbr;
748
        
749
        int           issaving;
750
        int           isscanning;
751

    
752
// ------------------------------------
753

    
754
        Time      config_time;
755
        Time      ConfigTime();
756
        void      LoadConfig();
757
        void      SaveConfig();
758
        void      FinishConfig();
759
        void      SaveConfigOnTime();
760

    
761
        int       GetPackageIndex();
762

    
763
        void      BeepMuteExclamation() { if(!mute_sounds) BeepExclamation(); }
764
        void      BeepMuteInformation() { if(!mute_sounds) BeepInformation(); }
765

    
766
        void      BookKey(int key);
767
        void      AddHistory();
768
        void      GotoBookmark(const Bookmark& b);
769
        void      HistoryFw();
770
        void      HistoryBk();
771
        bool      IsHistDiff(int i);
772

    
773
        bool      HasFileData(const String& file);
774
        FileData& Filedata(const String& file);
775

    
776
        void      BTabs();
777
        void      SyncBottom();
778
        void      HideBottom();
779
        void      SetBottom(int i);
780
        void      ToggleBottom(int i);
781
        void      ShowBottom(int i);
782
        void      ShowConsole()                      { ShowBottom(1); }
783
        void      ShowConsole2()                     { ShowBottom(2); }
784
        void      ToggleConsole()                    { ToggleBottom(1); }
785
        void      SwapBottom();
786
        bool      IsBottomShown() const;
787

    
788
        void      EditorFontScroll(int d);
789

    
790
        void      MakeTitle();
791
        void      MakeIcon();
792
        void      AdjustMainConfig();
793
        String    GetFirstFile();
794
        void      SetMain(const String& package);
795
        void      ChangeFileCharset(const String& name, Package& p, byte charset);
796
        void      ChangeCharset();
797
        void      FlushFile();
798
        void      EditFile0(const String& path, byte charset = CHARSET_DEFAULT, bool astext = false,
799
                            const String& header = Null);
800
        void      EditFile(const String& path);
801
        void      AddEditFile(const String& path);
802
        void      ReloadFile();
803
        void      AddLru();
804
        bool      CanToggleReadOnly();
805
        void      ToggleReadOnly();
806
        void      PosSync();
807

    
808
        void      PackageMenu(Bar& menu);
809

    
810
        void      UscFile(const String& file);
811
        void      UscProcessDir(const String& dir);
812
        void      SyncUsc();
813

    
814
        void      RefreshBrowser();
815

    
816
        void      SetupOutputMode();
817
        void      SyncBuildMode();
818
        void      SetupBuildMethods();
819
        void      DropMethodList();
820
        void      SelectMethod();
821
        void      DropModeList();
822
        void      SelectMode();
823
        void      SerializeOutputMode(Stream& s);
824

    
825
        void      GotoPos(String path, int line);
826
        void      GotoCpp(const CppItem& pos);
827
        
828
        void      LoadAbbr();
829
        void      SaveAbbr();
830

    
831
        Vector<String> SvnDirs(bool actual = false);
832

    
833
        void      File(Bar& menu);
834
                void   EditWorkspace();
835
                void   EditAnyFile();
836
                bool   IsProjectFile(const String& f) const;
837
                void   SaveFile0(bool always);
838
                void   SaveFile(bool always = false);
839
                void   DoSaveFile()    { SaveFile(); }
840
                void   FileBookmark        (Bar& menu);
841
                void   SwapPackagesFiles();
842
                void   Times();
843
                void   Statistics();
844
                void   Exit();
845
                String GetOpposite();
846
                void   GoOpposite();
847
                void   Print();
848
                void   Diff();
849
                void   Patch();
850
                void   SvnHistory();
851

    
852
        void      Edit(Bar& menu);
853
                void  EditAsText();
854
                void  EditUsingDesigner();
855
                void  EditMakeTabs()     { editor.MakeTabsOrSpaces(true); }
856
                void  EditMakeSpaces()   { editor.MakeTabsOrSpaces(false); }
857
                void  EditMakeLineEnds() { editor.MakeLineEnds(); }
858

    
859
                void  FindInFiles(bool replace);
860
                void  FindFileName();
861
                void  FindString(bool back);
862
                void  ClearEditedFile();
863
                void  ClearEditedAll();
864
        
865
                void  InsertColor();
866
                void  InsertLay(const String& fn);
867
                void  InsertIml(const String& fn, String classname);
868
                void  InsertText(const String& text);
869
                void  InsertCString();
870
                void  InsertFilePath();
871
                void  InsertMenu(Bar& bar);
872
                void  InsertAdvanced(Bar& bar);
873
                void  EditorMenu(Bar& bar);
874

    
875
        void SearchMenu(Bar& bar);
876
                void  EditFind()                { editor.FindReplace(find_pick_sel, find_pick_text, false); }
877
                void  EditReplace()             { editor.FindReplace(find_pick_sel, find_pick_text, true); }
878
                void  EditFindReplacePickText() { editor.FindReplace(true, true, false); }
879
                void  EditFindNext()            { editor.Find(false); }
880
                void  EditFindPrevious()        { editor.Find(true); }
881
                void  EditPaste()               { editor.Paste(); }
882
                void  FindNextError();
883
                void  FindPrevError();
884
        
885
        void      EditSpecial(Bar& menu);
886
                void  TranslateString();
887
                void  SwapChars()               { editor.SwapChars(); }
888
                void  CopyWord()                { editor.CopyWord(); }
889
                void  AlterText(WString (*op)(const WString& in));
890
                void  TextToUpper();
891
                void  TextToLower();
892
                void  TextToAscii();
893
                void  TextInitCaps();
894
                void  SwapCase();
895
                void  ToCString();
896

    
897
        void      MacroMenu(Bar& menu);
898
                bool  HasMacros();
899
                void  EditMacroMenu(Bar& menu, const Vector<int>& items);
900
                void  EditMacro(int i);
901

    
902
        void      Project(Bar& menu);
903
                void  SyncT(int kind);
904
                void  ConvertST();
905
                void  ExportMakefile(const String& ep);
906
                void  ExportProject(const String& ep, bool all, bool gui, bool deletedir = true);
907
                void  SyncSvnDirs(const Vector<String>& working);
908
                void  SyncSvnDir(const String& working);
909
                void  SyncSvn();
910

    
911
        void      BuildMenu(Bar& menu);
912
                void BuildPackageMenu(Bar& menu);
913

    
914
                void  DoBuild();
915
                void  PackageBuild();
916
                void  StopBuild();
917
                void  PackageClean();
918
                void  CreateMakefile();
919
                void  CleanUppOut();
920
                void  SwitchHeader();
921
                void  FileCompile();
922
                void  Preprocess(bool asmout);
923
                void  ToggleStopOnErrors();
924
                One<Host> CreateHostRunDir();
925
                void  OpenOutputFolder();
926

    
927
        void      DebugMenu(Bar& menu);
928
                void  RunArgs();
929
                void  BuildAndExecute();
930
                void  BuildAndDebug0(const String& srcfile);
931
                void  BuildAndDebug(bool runto);
932
                void  BuildAndExtDebug();
933
                void  BuildAndExtDebugFile();
934
                bool  IsValgrind();
935
                void  Valgrind();
936

    
937
                void  StartDebug();
938
                void  StopDebug();
939
                void  DebugToggleBreak();
940
                void  ConditionalBreak();
941
                void  DebugClearBreakpoints();
942
                void  OnBreakpoint(int i);
943

    
944
                String GetLogPath();
945
                void  OpenLog();
946
                bool  EditorTip(CodeEditor::MouseTip& mt);
947

    
948
        void      Setup(Bar& menu);
949
                void  SetupFormat();
950
                void  ToggleVerboseBuild();
951
                void  AutoSetup();
952
                void  CheckUpdates(bool verbose);
953
                void  CheckUpdatesManual();
954
                void  SetUpdateTimer(int period);
955
                void  Abbreviations();
956

    
957
        void      BrowseMenu(Bar& menu);
958
                void  RescanCode();
959
                void  QueryId();
960
                void  About();
961
                void  OpenTopic(const String& topic, const String& createafter, bool before);
962
                void  OpenTopic(const String& topic);
963
                void  OpenATopic();
964
                void  ToggleNavigator();
965
                void  SearchCode();
966
                void  Goto();
967
                void  GotoGlobal();
968
                void  ScanFile();
969
                bool  SwapSIf(const char *cref);
970
                void  SwapS();
971
                void  ContextGoto0(int pos);
972
                void  ContextGoto();
973
                void  CtrlClick(int pos);
974
                void  Qtf();
975
                void  Xml();
976
                void  Json();
977

    
978

    
979
        void      ConsoleMenu(Bar& menu);
980
                void  ConsoleCopy();
981
                void  ConsolePaste();
982

    
983
        void      MainMenu(Bar& menu);
984
        void      MainTool(Bar& bar);
985

    
986
        void      SaveWorkspace();
987
        String    WorkspaceFile();
988
        void      SerializeWorkspace(Stream& s);
989

    
990
        void      SerializeLastMain(Stream& s);
991
        void      SaveLastMain();
992
        void      LoadLastMain();
993

    
994
//        void      PrintTime(dword time);
995
        void      SetIdeState(int newstate);
996

    
997
        void      MainConfig();
998
        void      SyncMainConfigList();
999
        void      OnMainConfigList();
1000
        void      SetMainConfigList();
1001

    
1002
        void      FileProperties();
1003

    
1004
        void      CustomSteps();
1005

    
1006
        void      CycleFiles();
1007

    
1008
        void      Renumber();
1009

    
1010
        Console&  GetConsole();
1011

    
1012
        bool      FindLineError(int l, Host& host);
1013
        
1014
        struct FindLineErrorCache {
1015
                VectorMap<String, bool> ff;
1016
                Vector<String>          wspc_paths;
1017
        };
1018
        
1019
        bool      FindLineError(String ln, Host& host, String& file, int& lineno, int& error,
1020
                                FindLineErrorCache& cache);
1021
        void      FindError();
1022
        void          ClearErrorEditor(String file);
1023

    
1024
        void      FindWildcard();
1025
        void      FindFolder();
1026
        void      FindSetStdDir(String n);
1027
        void      FindStdDir();
1028
        void      InsertWildcard(int c);
1029
        void      SerializeFf(Stream& s);
1030
        bool      SearchInFile(const String& fn, const String& pattern,
1031
                                   bool wholeword, bool ignorecase, int& n);
1032
        void      SyncFindInFiles();
1033
        void      ConstructFindInFiles();
1034
        void      SerializeFindInFiles(Stream& s);
1035

    
1036
        void      SetupEditor(int font, String highlight, String fn);
1037
        void      SetupEditor();
1038

    
1039
        void      Display();
1040

    
1041
        void      SetIcon();
1042
        bool      IsCppBaseFile();
1043
        void      CheckFileUpdate();
1044
        void      Periodic();
1045

    
1046
        void      PassEditor();
1047
        void      SyncEditorSplit();
1048
        void      SplitEditor(bool horz);
1049
        void      CloseSplit();
1050
        void      KeySplit(bool horz);
1051
        void      SwapEditors();
1052
        void      TabFile();
1053
        void      ClearTab();
1054
        void      ClearTabs();
1055
        void      CloseRest(EditorTabBar *tabs);
1056
        void      TabsLR(int d);
1057

    
1058
        void      RefreshFrame(bool auto_disasm);
1059
        void      RefreshLine(int frame, bool auto_disasm);
1060

    
1061
        void      ResolveUvsConflict();
1062

    
1063
        void      SetBar();
1064
        void      SetMenuBar();
1065
        void      SetToolBar();
1066
        
1067
        void      UpdateFormat(CodeEditor& editor);
1068
        void      UpdateFormat();
1069
        void      ReadHlStyles(ArrayCtrl& hlstyle);
1070

    
1071
        bool      OpenMainPackage();
1072
        void      NewMainPackage();
1073

    
1074
        void      JumpToDefinition(const Array<CppItem>& n, int q, const String& scope);
1075
        void      SearchTopics();
1076
        void      ShowTopics();
1077

    
1078
        void      TopicBack();
1079

    
1080
        void      SetupBars();
1081

    
1082
        void      SyncCh();
1083

    
1084
        EscValue  MacroEditor();
1085
                void  MacroGetLength(EscEscape& e);
1086
                void  MacroGetLineCount(EscEscape& e);
1087
                void  MacroGetLinePos(EscEscape& e);
1088
                void  MacroGetCursor(EscEscape& e);
1089
                void  MacroGetLine(EscEscape& e);
1090
                void  MacroGetColumn(EscEscape& e);
1091
                void  MacroGetSelBegin(EscEscape& e);
1092
                void  MacroGetSelEnd(EscEscape& e);
1093
                void  MacroGetSelCount(EscEscape& e);
1094
                void  MacroSetCursor(EscEscape& e);
1095
                void  MacroSetSelection(EscEscape& e);
1096
                void  MacroClearSelection(EscEscape& e);
1097
                void  MacroGet(EscEscape& e);
1098
                void  MacroRemove(EscEscape& e);
1099
                void  MacroInsert(EscEscape& e);
1100
                void  MacroFind(EscEscape& e);
1101
                void  MacroReplace(EscEscape& e);
1102
                void  MacroFindMatchingBrace(EscEscape& e);
1103
                void  MacroFindClosingBrace(EscEscape& e);
1104
                void  MacroFindOpeningBrace(EscEscape& e);
1105
                void  MacroMoveLeft(EscEscape& e);
1106
                void  MacroMoveRight(EscEscape& e);
1107
                void  MacroMoveWordLeft(EscEscape& e);
1108
                void  MacroMoveWordRight(EscEscape& e);
1109
                void  MacroMoveUp(EscEscape& e);
1110
                void  MacroMoveDown(EscEscape& e);
1111
                void  MacroMoveHome(EscEscape& e);
1112
                void  MacroMoveEnd(EscEscape& e);
1113
                void  MacroMovePageUp(EscEscape& e);
1114
                void  MacroMovePageDown(EscEscape& e);
1115
                void  MacroMoveTextBegin(EscEscape& e);
1116
                void  MacroMoveTextEnd(EscEscape& e);
1117
                void  MacroInput(EscEscape& e);
1118
                void  MacroBuild(EscEscape& e);
1119
                void  MacroBuildProject(EscEscape& e);
1120
                void  MacroExecute(EscEscape& e);
1121
                void  MacroLaunch(EscEscape& e);
1122
                void  MacroClearConsole(EscEscape& e);
1123
                void  MacroEditFile(EscEscape& e);
1124
                void  MacroSaveCurrentFile(EscEscape& e);
1125
                void  MacroFileName(EscEscape& e);
1126
                void  MacroMainPackage(EscEscape& e);
1127
                void  MacroActivePackage(EscEscape& e);
1128
                void  MacroPackageDir(EscEscape& e);
1129
                void  MacroAssembly(EscEscape& e);
1130
                void  MacroBuildMethod(EscEscape& e);
1131
                void  MacroBuildMode(EscEscape& e);
1132
                void  MacroFlags(EscEscape& e);
1133
                void  MacroEcho(EscEscape& e);
1134
                void  MacroCloseFile(EscEscape& e);
1135
                void  MacroPackageFiles(EscEscape& e);
1136
                void  MacroAllPackages(EscEscape& e);
1137

    
1138
        typedef   Ide CLASSNAME;
1139

    
1140
        enum {
1141
                TIMEID_PERIODIC = TopWindow::TIMEID_COUNT,
1142
                TIMEID_COUNT,
1143
        };
1144

    
1145
        Ide();
1146
        ~Ide();
1147
};
1148

    
1149
#endif