My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
#include "ide.h"

void Ide::SetupEditor(int f, String hl, String fn)
{
String ext = ToLower(GetFileExt(fn));
switch(f) {
case 1: editor.SetFont(font1); break;
case 2: editor.SetFont(font2); break;
case 3: editor.SetFont(consolefont); break;
default: editor.SetFont(editorsplit.GetZoom() < 0 && editorsplit.IsHorz() ? veditorfont :
ext == ".t" ? tfont : editorfont); break;
}
if(IsNull(hl)) {
if(ext == ".c" || ext == ".cpp" || ext == ".cc" || ext == ".cxx" ||
ext == ".h" || ext == ".hpp" || ext == ".hh" || ext == ".hxx" ||
ext == ".m" || ext == ".mm" || ext == ".icpp")
editor.Highlight(CodeEditor::HIGHLIGHT_CPP);
else
if(ext == ".usc")
editor.Highlight(CodeEditor::HIGHLIGHT_USC);
else
if(ext == ".java")
editor.Highlight(CodeEditor::HIGHLIGHT_JAVA);
else
if(ext == ".t" || ext == ".jt")
editor.Highlight(CodeEditor::HIGHLIGHT_T);
else
if(ext == ".lay")
editor.Highlight(CodeEditor::HIGHLIGHT_LAY);
else
if(ext == ".sch")
editor.Highlight(CodeEditor::HIGHLIGHT_SCH);
else
if(ext == ".sql")
editor.Highlight(CodeEditor::HIGHLIGHT_SQL);
else
editor.Highlight(CodeEditor::HIGHLIGHT_NONE);
}
else {
if(hl == "cpp")
editor.Highlight(CodeEditor::HIGHLIGHT_CPP);
else
if(hl == "esc")
editor.Highlight(CodeEditor::HIGHLIGHT_USC);
else
if(hl == "java")
editor.Highlight(CodeEditor::HIGHLIGHT_JAVA);
else
editor.Highlight(CodeEditor::HIGHLIGHT_NONE);
}
}

void Ide::SetupEditor()
{
if(!IsActiveFile())
return;
Package::File& f = ActiveFile();
SetupEditor(f.font, f.highlight, GetFileExt(GetActiveFileName()));
}

void Ide::FileCursor()
{
WorkspaceWork::FileCursor();
if(IsActiveFile() && !filelist[filelist.GetCursor()].isdir) {
const Package::File& f = ActiveFile();
editor.SetEditable(!f.readonly);
editor.TabSize(f.tabsize > 0 ? f.tabsize : editortabsize);
SetupEditor();
String headername;
if(insert_include)
for(int i = insert_include == 1 ? 0 : filelist.GetCursor();
i >= 0 && i < filelist.GetCount();
i += insert_include == 1 ? 1 : -1) {
String nm = FileName(i);
if(!IsSeparator(i) && GetFileExt(nm) == ".h") {
headername = nm;
break;
}
}
String p = GetActiveFileName();
if(p != HELPNAME)
p = GetActiveFilePath();
EditFile0(p, f.charset ? f.charset : actual.charset ? actual.charset : default_charset,
false, headername);
}
}

bool Ide::HasFileData(const String& file)
{
return filedata.Find(NormalizePath(file)) >= 0;
}

Ide::FileData& Ide::Filedata(const String& file) {
return filedata.GetAdd(NormalizePath(file));
}

void DlCharsetD(DropList& d)
{
d.Add(0, "Default");
DlCharset(d);
}

void Ide::ChangeFileCharset(const String& name, Package& p, byte charset)
{
if(IsNull(name))
return;
bool sv = false;
for(int i = 0; i < p.file.GetCount(); i++)
if(SourcePath(name, p.file[i]) == editfile && p.file[i].charset != charset) {
p.file[i].charset = charset;
sv = true;
}
if(sv) {
String pp = PackagePathA(name);
RealizePath(pp);
p.Save(pp);
}
}

void Ide::FileProperties()
{
if(!IsActiveFile()) return;
WithFileFormatLayout<TopWindow> d;
CtrlLayoutOKCancel(d, "File properties");
Package::File& f = ActiveFile();
DlCharsetD(d.charset);
d.font.Add(0, "Normal");
d.font.Add(1, "Small");
d.font.Add(2, "Special");
d.font.Add(3, "Console");
d.highlight.Add(Null, "Default");
d.highlight.Add("cpp", "C++");
d.highlight.Add("java", "Java");
d.highlight.Add("esc", "Esc");
d.tabsize <<= f.tabsize > 0 ? f.tabsize : Null;
d.tabsize <<= d.Breaker(111);
d.tabsize.MinMax(1, 100);
d.charset <<= (int)f.charset;
d.font <<= f.font;
d.font <<= d.Breaker(111);
d.highlight <<= f.highlight;
d.highlight <<= d.Breaker(111);
for(;;) {
switch(d.Run()) {
case IDCANCEL:
FlushFile();
FileCursor();
return;
case IDOK:
int c = filelist.GetCursor();
FlushFile();
f.charset = (byte)(int)~d.charset;
f.tabsize = Nvl((int)~d.tabsize);
f.font = Nvl((int)~d.font);
f.highlight = ~d.highlight;
SavePackage();
PackageCursor();
filelist.SetCursor(c);
editor.ClearUndo();
return;
}
if(!IsNull(editfile)) {
int ts = Nvl((int)~d.tabsize);
editor.TabSize(ts ? ts : editortabsize);
SetupEditor(Nvl((int)~d.font), ~d.highlight, editfile);
}
}
}

void Ide::ChangeCharset()
{
if(!IsActiveFile()) return;
Package::File& f = ActiveFile();
SaveFile();
WithCharsetLayout<TopWindow> dlg;
CtrlLayoutOKCancel(dlg, "Save file with enconding");
DlCharsetD(dlg.charset);
dlg.charset <<= editor.GetCharset();
dlg.ActiveFocus(dlg.charset);
byte cs;
for(;;) {
if(dlg.Run() != IDOK)
return;
cs = (byte)(int)~dlg.charset;
int q = editor.GetInvalidCharPos(cs);
if(q >= 0) {
if(PromptYesNo("File contains characters that cannot be saved using selected encoding.&"
"Save anyway? (If you choose Yes, they will be replaced with question marks.)"))
break;
editor.SetCursor(q);
return;
}
else
break;
}
f.charset = cs;
SavePackage();
editor.SetCharset(f.charset);
SaveFile(true);
FlushFile();
FileCursor();
editor.ClearUndo();
}

void Ide::PosSync()
{
if(designer || editfile.IsEmpty())
return;
for(int i = 0; i < 2; i++)
if(PathIsEqual(posfile[i], editfile))
editor.SetPtr(posline[i], posimg[i], i);
else
editor.SetPtr(-1, Image(), i);
editor.SyncTip();
}

bool Ide::IsProjectFile(const String& f) const
{
const Workspace& wspc = IdeWorkspace();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& pk = wspc.GetPackage(i);
String n = wspc[i];
for(int i = 0; i < pk.file.GetCount(); i++) {
String fn = pk.file[i];
String path = SourcePath(n, fn);
if(f == path)
return true;
}
}
return false;
}

void Ide::ScanFile()
{
if(IsCppBaseFile()) {
String s = ~editor;
StringStream ss(s);
CodeBaseScan(ss, editfile);
}
}

String ConvertTLine(const String& line, int flag)
{
String r;
const char *s = line;

while(*s) {
if(*s == '\"') {
CParser p(s);
p.NoSkipSpaces();
try {
r.Cat(AsCString(p.ReadOneString(), INT_MAX, NULL, flag));
}
catch(CParser::Error) {
return line;
}
s = p.GetPtr();
}
else
r.Cat(*s++);
}
return r;
}

void Ide::SaveFile(bool always)
{
if(designer) {
String fn = designer->GetFileName();
Time tm = FileGetTime(fn);
designer->Save();
if(tm != FileGetTime(fn))
TouchFile(fn);
if(IsProjectFile(fn) && ToUpper(GetFileExt(fn)) == ".LAY")
CodeBaseScanLay(fn);
return;
}

if(editfile.IsEmpty())
return;

FileData& fd = Filedata(editfile);
fd.lineinfo = editor.GetLineInfo();
fd.lineinforem = editor.GetLineInfoRem();
fd.editpos = editor.GetEditPos();
fd.columnline = editor.GetColumnLine(fd.editpos.cursor);
fd.filetime = edittime;
if(!editor.IsDirty() && !always)
return;
#ifdef PLATFORM_POSIX
struct stat statbuf;
int statcode = stat(editfile, &statbuf);
#endif
TouchFile(editfile);
String tmpfile = editfile + ".$tmp", outfile = editfile;
{
FileOut out(tmpfile);
if(!out.IsOpen()) {
Exclamation(NFormat("Error creating temporary file [* \1%s\1].", tmpfile));
return;
}
if(designer)
designer->Save();
else
if(GetFileExt(editfile) == ".t") {
for(int i = 0; i < editor.GetLineCount(); i++) {
if(i) out.PutCrLf();
out.Put(ConvertTLine(editor.GetUtf8Line(i), ASCSTRING_OCTALHI));
}
}
else
editor.Save(out, editor.GetCharset(), force_crlf);
out.Close();
if(out.IsError()) {
Exclamation(NFormat("Error writing temporary file [* \1%s\1].", tmpfile));
return;
}
}

Progress progress;
int time = msecs();
for(;;) {
progress.SetTotal(10000);
progress.SetText(NFormat("Saving '%s'", GetFileName(outfile)));
if(editfile != outfile || !FileExists(tmpfile))
return;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
break;
console.Flush();
Sleep(200);
if(progress.SetPosCanceled(msecs(time) % progress.GetTotal()))
{
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
break;
if(art && AnySourceFs().ExecuteSaveAs()) {
outfile = editfile = AnySourceFs();
MakeTitle();
PosSync();
break;
}
progress.Reset();
}
}

#ifdef PLATFORM_POSIX
if(statcode == 0)
chmod(editfile, statbuf.st_mode);
#endif

if(!designer) {
FindFile ff(editfile);
fd.filetime = edittime = ff.GetLastWriteTime();
}

if(editor.IsDirty())
ScanFile();

editor.ClearDirty();

if(ToLower(GetFileExt(editfile)) == ".usc")
SyncUsc();

MakeTitle();
}

void Ide::FlushFile() {
editor.CloseAssist();
SaveFile();
editor.assist_active = false;
if(designer) {
designer->SaveEditPos();
designer->DesignerCtrl().SetFrame(NullFrame());
if(dynamic_cast<TopicEditor *>(&designer->DesignerCtrl()))
RefreshBrowser();
}
else
if(!editfile.IsEmpty())
Filedata(editfile).undodata = editor.PickUndoData();
editfile.Clear();
editor.Clear();
editor.Disable();
editorsplit.Ctrl::Remove();
editor.SetFrame(NullFrame());
designer.Clear();
SetBar();
}

int CharFilterMacro(int c)
{
return iscid(c) ? c : '_';
}

void Ide::FileRename(const String& nm)
{
tabs.RenameFile(editfile, nm);
}

bool Ide::FileRemove()
{
int q = FindIndex(tablru, editfile);
if(q >= 0)
tablru.Remove(q);
q = tabs.GetCursor();
if(q >= 0) {
tabs.CloseForce(q, false);
if(filelist.GetCount())
return true;
if(tabs.GetCount())
TabFile();
else {
tabs.Refresh();
FlushFile();
}
return false;
}
return true;
}

void Ide::EditFile0(const String& path, byte charset, bool astext, const String& headername) {
editor.CheckEdited(false);
editor.CloseAssist();
if(path.IsEmpty()) return;
FlushFile();

editfile = path;
editor.SetCharset(charset);
AddLru();

if(!astext && !(debugger && (PathIsEqual(path, posfile[0]) || PathIsEqual(path, posfile[0])))
&& editastext.Find(path) < 0 && !IsNestReadOnly(editfile)) {
for(int i = 0; i < GetIdeModuleCount() && !designer; i++)
designer = GetIdeModule(i).CreateDesigner(this, path, charset);
if(designer) {
editpane.Add(designer->DesignerCtrl().SizePos());
designer->SetFocus();
if(filetabs)
tabs.SetAddFile(editfile);
MakeTitle();
SetBar();
return;
}
}

tabs.SetAddFile(editfile);
tabs.SetSplitColor(editfile2, Yellow);
editor.Enable();
editpane.Add(editorsplit);
editor.HiliteScope(hilite_scope);
editor.OverWriteMode(false);
ActiveFocus(editor);
FileData& fd = Filedata(editfile);
FindFile ff(editfile);
bool tfile = GetFileExt(editfile) == ".t";
if(ff) {
edittime = ff.GetLastWriteTime();
if(edittime != fd.filetime || IsNull(fd.filetime))
fd.undodata.Clear();
FileIn in(editfile);
if(in)
if(tfile && editastext.Find(editfile) < 0) {
String f;
String ln;
for(;;) {
int c = in.Get();
if(c < 0) {
f.Cat(ConvertTLine(ln, 0));
break;
}
if(c != '\r') {
ln.Cat(c);
if(c == '\n') {
f.Cat(ConvertTLine(ln, 0));
ln.Clear();
}
}
}
editor.Set(f);
editor.SetCharset(CHARSET_UTF8);
}
else
editor.Load(in, charset);
editor.SetEditPos(fd.editpos);
if(!IsNull(fd.columnline) && fd.columnline.y >= 0 && fd.columnline.y < editor.GetLineCount())
editor.SetCursor(editor.GetColumnLinePos(fd.columnline));
editor.SetPickUndoData(fd.undodata);
editor.SetLineInfo(fd.lineinfo);
editor.SetLineInfoRem(fd.lineinforem);
if(ff.IsReadOnly() || IsNestReadOnly(editfile))
editor.SetReadOnly();
fd.undodata.Clear();
PosSync();
}
else {
RealizePath(editfile);
if(GetFileExt(editfile) == ".h") {
String n = '_' + Filter(String().Cat() << GetActivePackage() << '_' << GetFileTitle(editfile) << "_h_",
CharFilterMacro);
String s;
s << "#ifndef " << n << "\r\n";
s << "#define " << n << "\r\n";
s << "\r\n";
s << "#endif\r\n";
editor <<= s;
editor.SetCursor(editor.GetPos(2));
}
if(IsCSourceFile(editfile) && !IsNull(headername)) {
editor <<= "#include \"" + headername + "\"\r\n";
editor.SetCursor(editor.GetPos(1));
}
editor.SetCharset(tfile ? CHARSET_UTF8 : charset);
}
editor.SetFocus();
MakeTitle();
SetBar();
editor.assist_active = IsProjectFile(editfile) && IsCppBaseFile();
editor.CheckEdited(true);
editor.Annotate(editfile);
editor.SyncNavigator();
}

void Ide::EditAsText()
{
String path = editfile;
editastext.FindPut(editfile);
byte cs = editor.GetCharset();
FlushFile();
EditFile0(path, cs);
}

void Ide::EditUsingDesigner()
{
String path = editfile;
editastext.RemoveKey(editfile);
byte cs = editor.GetCharset();
FlushFile();
EditFile0(path, cs);
}

void Ide::AddEditFile(const String& path)
{
actual.file.Add(path);
if(IsAux())
SaveLoadPackageNS(false);
else
SaveLoadPackage(false);
ShowFile(package.GetCount() - 1);
filelist.SetCursor(filelist.GetCount() - 1);
}

void Ide::EditFile(const String& p)
{
if(p.IsEmpty()) {
FlushFile();
return;
}
if(p == HELPNAME) {
if(designer && designer->GetFileName() == p)
return;
package.FindSetCursor(METAPACKAGE);
filelist.FindSetCursor(HELPNAME);
return;
}

String path = NormalizePath(p);
if(designer ? path == designer->GetFileName() : path == editfile)
return;

FlushFile();
if(path.IsEmpty())
return;

for(int i = 0; i < package.GetCount(); i++) {
String pkg = package[i].name;
Package p;
p.Load(PackagePathA(pkg));
for(int j = 0; j < p.file.GetCount(); j++)
if(PathIsEqual(SourcePath(pkg, p.file[j]), path)) {
package.FindSetCursor(pkg);
ShowFile(j);
filelist.FindSetCursor(p.file[j]);
return;
}
if(GetFileExt(path) == ".tpp" && PathIsEqual(SourcePath(pkg, GetFileName(path)), path)) {
filelist.KillCursor();
package.KillCursor();
package.SetCursor(i);
AddEditFile(GetFileName(path));
return;
}
}
filelist.KillCursor();
package.KillCursor();
package.SetCursor(package.GetCount() - 2);
AddEditFile(path);
}

bool Ide::IsCppBaseFile()
{
return IsProjectFile(editfile) && (IsCSourceFile(editfile) || IsCHeaderFile(editfile) ||
ToUpper(GetFileExt(editfile)) == ".SCH");
}

void Ide::CheckFileUpdate()
{
if(editfile.IsEmpty() || !IsForeground() || designer) return;
FindFile ff(editfile);
if(!ff) return;
FileTime tm = ff.GetLastWriteTime();
if(tm == edittime) return;
edittime = tm;
if(editor.IsDirty() && !Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Current file was changed outside the IDE, but was also edited inside it.&"
"Would you like to reload the file or to keep changes made in the IDE ?",
"Reload", "Keep")) return;

if(IsCppBaseFile()) {
FileIn in(editfile);
CodeBaseScan(in, editfile);
}
ReloadFile();
}


void Ide::ReloadFile()
{
if(editfile.IsEmpty())
return;
String fn = editfile;
String data = ~editor;
int ln = editor.GetCursorLine();
editfile.Clear();
int sc = filelist.GetSbPos();
EditFile0(fn, editor.GetCharset());
filelist.SetSbPos(sc);
int l = LocateLine(data, ln, ~editor);
editor.SetCursor(editor.GetPos(l));
}

void Ide::EditAnyFile() {
FileSel& fs = AnySourceFs();
fs.Multi(false);
if(!fs.ExecuteOpen()) return;
EditFile(fs);
FileSelected();
}

void Ide::DragAndDrop(Point, PasteClip& d)
{
if(AcceptFiles(d)) {
Vector<String> f = GetFiles(d);
for(int i = 0; i < f.GetCount(); i++)
if(FileExists(f[i])) {
EditFile(f[i]);
FileSelected();
editor.SetFocus();
}
}
}

void Ide::AddLru()
{
if(editfile.IsEmpty() || tabi) return;
LruAdd(tablru, editfile, 200);
}

static String sExFiles(const char *fn, const char **ext, int cnt)
{
for(int i = 0; i < cnt; i++) {
String f = ForceExt(fn, ext[i]);
if(FileExists(f))
return f;
}
return Null;
}

String Ide::GetOpposite()
{
static const char *cpp[] = { ".c", ".cpp", ".cc", ".cxx" };
static const char *hdr[] = { ".h", ".hpp", ".hh", ".hxx" };
if(IsNull(editfile) || designer)
return Null;
String ext = GetFileExt(editfile);
for(int i = 0; i < __countof(cpp); i++)
if(ext == cpp[i])
return sExFiles(editfile, hdr, __countof(hdr));
for(int i = 0; i < __countof(hdr); i++)
if(ext == hdr[i])
return sExFiles(editfile, cpp, __countof(cpp));
return Null;
}

void Ide::GoOpposite()
{
String fn = GetOpposite();
if(!IsNull(fn))
EditFile(fn);
}

void Ide::PassEditor()
{
editorsplit.NoZoom();
SyncEditorSplit();
SetupEditor();
editfile2 = editfile;
editor2.SetFont(editor.GetFont());
editor2.Highlight(editor.GetHighlight());
editor2.LoadHlStyles(editor.StoreHlStyles());
byte charset = editor.GetCharset();
editor2.CheckEdited(false);
editor2.Set(editor.Get(charset), charset);
editor2.SetEditPosSb(editor.GetEditPos());
editor2.CheckEdited();
editor.SetFocus();
editor.ScrollIntoCursor();
}

void Ide::ClearEditedFile()
{
editor.ClearEdited();
}

void Ide::ClearEditedAll()
{
ClearEditedFile();
for(int i = 0; i < filedata.GetCount(); i++) {
LineInfo li = editor.GetLineInfo();
LineInfoRem lir = editor.GetLineInfoRem();
FileData& fd = Filedata(filedata.GetKey(i));
editor.SetLineInfo(fd.lineinfo);
editor.SetLineInfoRem(fd.lineinforem);
ClearEditedFile();
fd.lineinfo = editor.GetLineInfo();
fd.lineinforem = editor.GetLineInfoRem();
editor.SetLineInfo(li);
}
}

void Ide::SplitEditor(bool horz)
{
if(editorsplit.GetZoom() < 0)
CloseSplit();

if(horz)
editorsplit.Horz(editor2, editor);
else
editorsplit.Vert(editor2, editor);

tabs.SetSplitColor(editfile, Yellow);
PassEditor();
}

void Ide::SwapEditors()
{
String f = editfile2;
CodeEditor::EditPos p = editor2.GetEditPos();
if(editorsplit.GetFirstChild() == &editor)
if(editorsplit.IsVert())
editorsplit.Vert(editor2, editor);
else
editorsplit.Horz(editor2, editor);
else
if(editorsplit.IsVert())
editorsplit.Vert(editor, editor2);
else
editorsplit.Horz(editor, editor2);
PassEditor();
EditFile(f);
editor.SetEditPos(p);
}

void Ide::CloseSplit()
{
editorsplit.Vert(editor, editor2);
editorsplit.Zoom(0);
editfile2.Clear();
tabs.ClearSplitColor();
SyncEditorSplit();
editor.SetFocus();
SetupEditor();
}

void Ide::KeySplit(bool horz)
{
if(editorsplit.GetZoom() >= 0)
SplitEditor(horz);
else
CloseSplit();
}

void Ide::SyncEditorSplit()
{
editor.topsbbutton.ScrollStyle().SetMonoImage(IdeImg::split()).Tip("Split (Ctrl+[-])");
editor.topsbbutton <<= THISBACK1(SplitEditor, false);
editor.topsbbutton1.ScrollStyle().SetMonoImage(IdeImg::vsplit()).Tip("Split (Ctrl+[\\])");
editor.topsbbutton1 <<= THISBACK1(SplitEditor, true);
editor2.topsbbutton.ScrollStyle().SetMonoImage(IdeImg::split()).Tip("Split (Ctrl+[-])");
editor2.topsbbutton <<= THISBACK1(SplitEditor, false);
editor2.topsbbutton1.ScrollStyle().SetMonoImage(IdeImg::vsplit()).Tip("Split (Ctrl+[\\])");
editor2.topsbbutton1 <<= THISBACK1(SplitEditor, true);
if(editorsplit.GetZoom() >= 0)
return;
if(editorsplit.IsVert()) {
editor.topsbbutton.ScrollStyle().SetMonoImage(IdeImg::closesplit()).Tip("Close (Ctrl+[-])");
editor.topsbbutton <<= THISBACK(CloseSplit);
editor2.topsbbutton.ScrollStyle().SetMonoImage(IdeImg::closesplit()).Tip("Close (Ctrl+[-])");
editor2.topsbbutton <<= THISBACK(CloseSplit);
}
else {
editor.topsbbutton1.ScrollStyle().SetMonoImage(IdeImg::closesplit()).Tip("Close (Ctrl+[\\])");
editor.topsbbutton1 <<= THISBACK(CloseSplit);
editor2.topsbbutton1.ScrollStyle().SetMonoImage(IdeImg::closesplit()).Tip("Close (Ctrl+[\\])");
editor2.topsbbutton1 <<= THISBACK(CloseSplit);
}
}

bool Ide::HotKey(dword key)
{
if(designer && designer->DesignerCtrl().HotKey(key))
return true;
return TopWindow::HotKey(key);
}

String Ide::IdeGetFileName()
{
return editfile;
}

String Ide::IdeGetNestFolder()
{
Vector<String> w = GetUppDirs();
for(int i = 0; i < w.GetCount(); i++)
if(editfile.StartsWith(w[i]))
return w[i];
return Null;
}

Change log

r4337 by cxl on Dec 22, 2011   Diff
.ide: Minor optimization in package
organizer (RM #212)
Go to: 
Project members, sign in to write a code review

Older revisions

r4170 by cxl on Nov 13, 2011   Diff
*ide: fixed wrong refresh of block
highligting
r4163 by cxl on Nov 12, 2011   Diff
ide: Layout files are now syntax
highlighted, Assist++ now knows
correct line postition info (thanks
Sender Ghost) (RM #166, #168)
r4148 by cxl on Nov 7, 2011   Diff
ide: resolved problems with deleting
files (RM #139)
All revisions of this file

File info

Size: 19976 bytes, 839 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting