3 // import "SelectorBar"
4 import "CompilersDetectionDialog"
7 FileDialog settingsFileDialog { type = selectDir, text = $"Select directory" };
9 FileDialog toolchainFileDialog { type = open, text = $"Open"; mayNotExist = true; };
11 class GlobalSettingsDialog : Window
15 background = formColor;
17 borderStyle = sizable;
18 text = $"Global Settings";
19 minClientSize = { 560, 542 };
20 nativeDecorations = true;
22 String workspaceActiveCompiler;
24 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
26 EditorTab editorTab { this, tabControl = tabControl };
27 CompilersTab compilersTab { this, tabControl = tabControl };
28 ProjectOptionsTab projectOptionsTab { this, tabControl = tabControl };
29 WorkspaceOptionsTab workspaceOptionsTab { this, tabControl = tabControl };
31 property bool settingsModified
35 return editorTab.modifiedDocument || compilersTab.modifiedDocument ||
36 projectOptionsTab.modifiedDocument || workspaceOptionsTab.modifiedDocument;
40 bool OnClose(bool parentClosing)
42 if(!settingsModified || MessageBox {
43 type = okCancel, master = ide,
44 text = $"Lose Changes?",
45 contents = $"Are you sure you wish to discard changes?"
53 parent = this, hotKey = escape, text = $"Cancel", id = DialogResult::cancel;
54 position = { 290, 290 }, size = { 80 };
55 anchor = { right = 8, bottom = 8 };
56 NotifyClicked = ButtonCloseDialog;
61 parent = this, isDefault = true, text = $"OK";
62 position = { 200, 290 }, size = { 90 };
63 anchor = { right = 96, bottom = 8 };
65 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
69 bool editorSettingsChanged = false;
70 bool compilerSettingsChanged = false;
71 bool projectOptionsChanged = false;
72 AVLTree<String> cfgsToWrite = null;
73 if(editorTab.modifiedDocument)
75 if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
76 editorTab.showLineNumbers.checked != ideSettings.showLineNumbers ||
77 editorTab.caretFollowsScrolling.checked != ideSettings.caretFollowsScrolling ||
78 editorTab.fontPicker.fontSize != ideSettings.codeEditorFontSize ||
79 editorTab.fontPicker.faceName.OnCompare(ideSettings.codeEditorFont)
82 ideSettings.useFreeCaret = editorTab.useFreeCaret.checked;
83 ideSettings.showLineNumbers = editorTab.showLineNumbers.checked;
84 ideSettings.caretFollowsScrolling = editorTab.caretFollowsScrolling.checked;
85 ideSettings.codeEditorFont = editorTab.fontPicker.faceName;
86 ideSettings.codeEditorFontSize = editorTab.fontPicker.fontSize;
88 ide.ApplyFont(ideSettings.codeEditorFont, ideSettings.codeEditorFontSize);
90 editorSettingsChanged = true;
94 if(compilersTab.modifiedDocument)
96 if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
97 ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
98 if(compilersTab.compilerConfigs.OnCompare(ideConfig.compilers))
100 cfgsToWrite = compilersTab.compilerConfigs.getWriteRequiredList(ideConfig.compilers);
101 ideConfig.compilers.Free();
102 for(compiler : compilersTab.compilerConfigs)
104 ideConfig.compilers.Add(compiler.Copy());
106 compilerSettingsChanged = true;
110 if(projectOptionsTab.modifiedDocument)
112 if(strcmp(projectOptionsTab.defaultTargetDir.path, ideSettings.projectDefaultTargetDir)
113 || strcmp(projectOptionsTab.defaultIntermediateObjDir.path, ideSettings.projectDefaultIntermediateObjDir))
115 ideSettings.projectDefaultTargetDir = projectOptionsTab.defaultTargetDir.path;
116 ideSettings.projectDefaultIntermediateObjDir = projectOptionsTab.defaultIntermediateObjDir.path;
117 projectOptionsChanged = true;
121 if(workspaceOptionsTab.modifiedDocument)
123 DataRow row = workspaceOptionsTab.defaultCompilerDropBox.currentRow;
124 if(row && row.string)
126 if(!ideSettings.defaultCompiler || strcmp(row.string, ideSettings.defaultCompiler))
128 ideSettings.defaultCompiler = row.string;
133 if(editorSettingsChanged || projectOptionsChanged)
134 settingsContainer.Save();
136 if(compilerSettingsChanged)
138 ideConfig.compilers.write(settingsContainer, cfgsToWrite);
139 OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
143 if(editorSettingsChanged)
144 OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
145 if(projectOptionsChanged)
146 OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
148 editorTab.modifiedDocument = false;
149 compilersTab.modifiedDocument = false;
150 projectOptionsTab.modifiedDocument = false;
151 workspaceOptionsTab.modifiedDocument = false;
154 Destroy(DialogResult::ok);
163 for(c = 0; c < DirTypes::enumSize; c++)
165 CompilerDir compilerDir;
167 for(systemDir : ideSettings.systemDirs[c])
169 compilerDir = CompilerDir { type = c; compilerConfig = null; path = CopyString(systemDir) };
170 dirs.Add(compilerDir);
173 row = compilersTab.dirs[c].AddRow();
174 row.SetData(null, "");
175 compilersTab.dirs[c].currentRow = compilersTab.dirs[c].firstRow;
176 compilersTab.dirs[c].modifiedDocument = false;
183 CompilerConfig activateCompiler = null;
184 CompilerConfig readonlyCompiler = null;
187 editorTab.useFreeCaret.checked = ideSettings.useFreeCaret;
188 editorTab.showLineNumbers.checked = ideSettings.showLineNumbers;
189 editorTab.caretFollowsScrolling.checked = ideSettings.caretFollowsScrolling;
192 if(workspaceActiveCompiler)
194 for(compiler : ideConfig.compilers)
196 if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
197 activateCompiler = compiler;
198 if(!readonlyCompiler && compiler.readOnly)
199 readonlyCompiler = compiler;
200 if(activateCompiler && readonlyCompiler)
204 if(!activateCompiler && readonlyCompiler)
205 activateCompiler = readonlyCompiler;
206 if(!activateCompiler && ideConfig.compilers.count)
207 activateCompiler = ideConfig.compilers[0];
209 for(compiler : ideConfig.compilers)
210 compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
211 compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
214 projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
215 projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
222 editorTab.modifiedDocument = false;
223 compilersTab.modifiedDocument = false;
224 compilersTab.dirsTab.modifiedDocument = false;
225 compilersTab.toolchainTab.modifiedDocument = false;
226 compilersTab.optionsTab.modifiedDocument = false;
227 compilersTab.activeCompiler = null;
228 compilersTab.compilerConfigs.Free();
229 compilersTab.compilerSelector.Clear();
230 projectOptionsTab.modifiedDocument = false;
231 workspaceOptionsTab.modifiedDocument = false;
234 virtual void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange);
239 class EditorTab : GlobalSettingsSubTab
241 background = formColor;
246 this, text = $"Move code editor caret freely past end of line", position = { 16, 58 }, isCheckbox = true;
247 NotifyClicked = NotifyClickedModifiedDocument;
250 Button caretFollowsScrolling
252 this, text = $"Keep caret visible (move along) when scrolling", position = { 16, 78 }, isCheckbox = true;
253 NotifyClicked = NotifyClickedModifiedDocument;
256 Button showLineNumbers
258 this, text = $"Show line numbers in code editor", position = { 16, 98 }, isCheckbox = true;
259 NotifyClicked = NotifyClickedModifiedDocument;
262 bool NotifyClickedModifiedDocument(Button button, int x, int y, Modifiers mods)
264 modifiedDocument = true;
268 FontPicker fontPicker
270 this, anchor = { left = 8, right = 8, top = 120, bottom = 8 };
274 modifiedDocument = true;
280 static void DrawStipple(Surface surface, Size clientSize)
284 int x2 = clientSize.w - 1;
285 int y2 = clientSize.h - 1;
286 if((x2 - x1) & 1) x2--;
287 if((y2 - y1) & 1) y2--;
289 surface.LineStipple(0x5555);
290 surface.Rectangle(x1, y1, x2, y2);
291 surface.LineStipple(0);
294 class CompilersTab : GlobalSettingsSubTab
296 background = formColor;
299 Label compilerConfigsDirLabel { this, position = { 8, 12 }, labeledWindow = compilerConfigsDir, tabCycle = false, inactive = true };
300 PathBox compilerConfigsDir
302 this, anchor = { left = 230, top = 8, right = 8 };
303 text = $"Compiler Configurations Directory", browseDialog = settingsFileDialog, NotifyModified = NotifyModifiedDocument;
306 SelectorBar compilerSelector
308 this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
310 direction = horizontal;
315 bool OnKeyDown(Key key, unichar ch)
319 ((CompilersTab)parent).createCompiler.NotifyClicked(parent, ((CompilersTab)parent).createCompiler, 0, 0, 0);
324 ((CompilersTab)parent).deleteCompiler.NotifyClicked(parent, ((CompilersTab)parent).deleteCompiler, 0, 0, 0);
327 return SelectorBar::OnKeyDown(key, ch);
330 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
332 ((CompilersTab)master).labelCompilers.Update(null);
338 CompilersTab compilers = (CompilersTab)parent;
339 SelectorBar::OnPostCreate();
340 if(compilers.selectedButton)
342 Button sb = compilers.selectedButton;
345 // Why was this being set to null? On going back to compilers the 2nd time, the selectedButton was lost and so was not made visible...
346 // compilers.selectedButton = null;
352 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
354 CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
355 CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
356 CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
357 CompilerOptionsTab optionsTab { this, tabControl = tabControl };
359 CompilerConfigs compilerConfigs { };
360 CompilerConfig activeCompiler;
364 this, anchor = { left = 8, top = 44 }, labeledWindow = compilerSelector;
366 void OnRedraw(Surface surface)
368 Label::OnRedraw(surface);
369 if(labeledWindow.active)
370 DrawStipple(surface, clientSize);
374 void FindUniqueCompilerName(const char * baseName, CompilerConfig compiler/*, bool startWithNumber*/, char * output)
377 char tmp[MAX_F_STRING];
378 /*if(startWithNumber)
379 sprintf(tmp, "%s%d", baseName, num);
381 strcpy(tmp, baseName);
384 CompilerConfig matchingCompiler = null;
385 for(c : compilerConfigs)
386 { // TOFIX: Error when omitting these brackets, c not found
387 if((!compiler || c != compiler) && c.name && !strcmp(c.name, tmp))
389 matchingCompiler = c;
396 sprintf(tmp, "%s%d", baseName, num);
404 Button createCompiler
406 parent = this, bevelOver = true, inactive = true;
408 anchor = { top = 40, right = 77 };
409 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
411 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
413 char compilerName[MAX_F_STRING];
414 CompilerConfig newCompiler;
415 FindUniqueCompilerName("New Compiler", null, compilerName);
416 newCompiler = MakeDefaultCompiler(compilerName, false);
417 AddCompiler(newCompiler, true);
418 modifiedDocument = true;
422 Button detectCompiler
424 parent = this, bevelOver = true, inactive = true;
426 anchor = { top = 40, right = 54 };
427 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
429 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
431 CompilersDetectionDialog compilersDetectionDialog
436 if(compilersDetectionDialog.Modal())
438 if(compilersDetectionDialog.selectedCompilerType)
440 char uniqueName[MAX_F_STRING];
441 CompilerConfig newCompiler = compilersDetectionDialog.compilerConfig;
442 FindUniqueCompilerName(newCompiler.name, null, uniqueName);
443 newCompiler.name = uniqueName;
444 AddCompiler(newCompiler, true);
445 modifiedDocument = true;
451 Button duplicateCompiler
453 parent = this, bevelOver = true, inactive = true;
455 anchor = { top = 40, right = 31 };
456 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
458 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
460 char copyName[MAX_F_STRING];
461 CompilerConfig copyCompiler = activeCompiler.Copy();
462 FindUniqueCompilerName(copyCompiler.name, null, copyName);
463 copyCompiler.readOnly = false;
464 copyCompiler.name = copyName;
465 AddCompiler(copyCompiler, true);
466 modifiedDocument = true;
470 Button deleteCompiler
472 parent = this, bevelOver = true, inactive = true;
474 anchor = { top = 40, right = 8 };
475 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
477 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
481 CompilerConfig compilerToDelete = activeCompiler;
482 String title = PrintString($"Delete ", compilerToDelete.name, $" Compiler Configuration");
483 String msg = PrintString($"Are you sure you wish to delete the ", compilerToDelete.name, $" compiler configuration?");
484 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
486 SelectorButton button = compilerSelector.FindButtonByID((int64)(intptr)compilerToDelete);
488 compilerSelector.RemoveButton(button);
489 //DeleteCompiler(compilerToDelete);
491 Iterator<CompilerConfig> it { compilerConfigs };
492 if(it.Find(compilerToDelete))
493 compilerConfigs.Delete(it.pointer);
495 modifiedDocument = true;
504 void AddCompiler(CompilerConfig compiler, bool load)
506 SelectorButton selectButton;
507 if(compiler.readOnly)
509 SelectorButton button
511 compilerSelector, master = this, text = compiler.name, id = (int64)(intptr)compiler;
512 NotifyClicked = CompilerClicked;
514 selectButton = button;
518 EditableSelectorButton button
520 compilerSelector, master = this, renameable = true, text = compiler.name, id = (int64)(intptr)compiler;
521 NotifyClicked = CompilerClicked;
523 bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
525 if(*newName && (*newName)[0])
527 char compilerName[MAX_F_STRING];
528 FindUniqueCompilerName(*newName, activeCompiler, compilerName);
529 if(strcmp(*newName, compilerName))
532 *newName = CopyString(compilerName);
534 activeCompiler.name = compilerName;
535 modifiedDocument = true;
541 selectButton = (SelectorButton)button;
543 compilerConfigs.Add(compiler);
546 LoadCompiler(compiler);
547 selectedButton = selectButton;
548 compilerSelector.Select(selectedButton);
551 SelectorButton selectedButton;
553 void LoadCompiler(CompilerConfig compiler)
555 bool modified = modifiedDocument;
556 activeCompiler = compiler;
560 environmentTab.Load();
563 // Restore original modifiedDocument
564 modifiedDocument = modified;
566 deleteCompiler.disabled = compiler.readOnly;
569 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
571 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
573 LoadCompiler((CompilerConfig)(intptr)clickedButton.id);
574 selectedButton = (SelectorButton)clickedButton;
579 bool NotifyModifiedDocument(PathBox pathBox)
581 BasicValidatePathBoxPath(pathBox);
582 modifiedDocument = true;
587 Array<const String> displayDirectoryNames
594 class CompilerDirectoriesTab : CompilersSubTab
596 background = formColor;
597 text = $"Directories";
599 Button dirTypeTglBtn[DirTypes];
600 DirectoriesBox dirs[DirTypes], currentDirs;
602 ~CompilerDirectoriesTab()
605 for(c = 0; c < DirTypes::enumSize; c++)
608 delete dirTypeTglBtn[c];
611 CompilerDirectoriesTab()
615 for(c = 0; c < DirTypes::enumSize; c++)
617 dirs[c] = DirectoriesBox
619 this;//, alwaysHighLight = true
620 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
623 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
624 settingsFileDialog.filePath = directory;
625 if(settingsFileDialog.Modal())
626 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
629 bool NotifyModified(DirectoriesBox dirsBox)
631 CompilerConfig compiler = loadedCompiler;
634 DirTypes dirType = (DirTypes)dirsBox.id;
635 if(dirType == includes)
636 compiler.includeDirs = dirsBox.strings;
637 else if(dirType == libraries)
638 compiler.libraryDirs = dirsBox.strings;
639 else if(dirType == executables)
640 compiler.executableDirs = dirsBox.strings;
642 compilersTab.modifiedDocument = true;
646 bool NotifyPathBoxModified(DirectoriesBox dirsBox, PathBox pathBox)
648 BasicValidatePathBoxPath(pathBox);
655 dirs[c].visible = false;
657 // (width) Should be 324 for text...
658 //field[c] = { dataType = class(char *), editable = true };
659 //dirs[c].AddField(field[c]);
661 dirTypeTglBtn[c] = Button
663 this, inactive = true, text = displayDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
666 minClientSize = { 99, 20 };
667 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
669 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
671 DirTypes dirType = (DirTypes)button.id;
672 currentDirs.visible = false;
673 dirs[dirType].visible = true;
674 currentDirs = dirs[dirType];
678 v += dirTypeTglBtn[c].size.w + 1;
679 incref dirTypeTglBtn[c];
682 dirTypeTglBtn[c].hotKey = altI;
683 else if(c == libraries)
684 dirTypeTglBtn[c].hotKey = altL;
685 else if(c == executables)
686 dirTypeTglBtn[c].hotKey = altE;
688 currentDirs = dirs[includes];
689 dirTypeTglBtn[includes].checked = true;
693 bool OnLoadGraphics()
697 for(c = 0; c < DirTypes::enumSize; c++)
699 dirTypeTglBtn[c].anchor.left = v;
700 v += dirTypeTglBtn[c].size.w + 1;
702 return CompilersSubTab::OnLoadGraphics();
707 CompilerConfig compiler = loadedCompiler;
710 dirs[includes].strings = compiler.includeDirs;
711 dirs[libraries].strings = compiler.libraryDirs;
712 dirs[executables].strings = compiler.executableDirs;
713 dirs[includes].list.scroll = { 0, 0 };
714 dirs[libraries].list.scroll = { 0, 0 };
715 dirs[executables].list.scroll = { 0, 0 };
720 class CompilerToolchainTab : CompilersSubTab
722 background = formColor;
728 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
731 this, anchor = { left = margin, top = 8, right = 8 };
732 text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
734 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
737 this, anchor = { left = margin, top = 34, right = 8 };
738 text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
740 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
743 this, anchor = { left = margin, top = 60, right = 8 };
744 text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
746 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
749 this, anchor = { left = margin, top = 86, right = 8 };
750 text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
752 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
755 this, anchor = { left = margin, top = 112, right = 8 };
756 //text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
757 text = $"C Preprocessor";//, NotifyModified = NotifyModifiedDocument;
758 bool NotifyModified(EditBox editBox)
760 CompilerConfig compiler = loadedCompiler;
763 compiler.cppCommand = editBox.contents;
764 modifiedDocument = true;
765 compilersTab.modifiedDocument = true;
770 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
773 this, anchor = { left = margin, top = 138, right = 8 };
774 text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
776 Label cxxLabel { this, position = { 8, 168 }, labeledWindow = cxx, tabCycle = false, inactive = true };
779 this, anchor = { left = margin, top = 164, right = 8 };
780 text = $"C++ Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
782 Label arLabel { this, position = { 8, 194 }, labeledWindow = ar, tabCycle = false, inactive = true };
785 this, anchor = { left = margin, top = 190, right = 8 };
786 text = $"AR", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
788 Label ldLabel { this, position = { 8, 220 }, labeledWindow = ld, tabCycle = false, inactive = true };
791 this, anchor = { left = margin, top = 216, right = 8 };
792 text = $"Linker", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
794 Label makeLabel { this, position = { 8, 246 }, labeledWindow = make, tabCycle = false, inactive = true };
797 this, anchor = { left = margin, top = 242, right = 8 };
798 text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
800 Label gnuToolchainPrefixLabel { this, position = { 8, 272 }, labeledWindow = gnuToolchainPrefix, tabCycle = false, inactive = true };
801 PathBox gnuToolchainPrefix
803 this, anchor = { left = margin, top = 268, right = 8 };
804 text = $"GNU Toolchain Prefix", typeExpected = directory, browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
806 Label sysrootLabel { this, position = { 8, 298 }, labeledWindow = sysroot, tabCycle = false, inactive = true };
809 this, anchor = { left = margin, top = 294, right = 8 };
810 text = $"SYSROOT", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
812 Label executableLauncherLabel { this, position = { 8, 324 }, labeledWindow = executableLauncher, tabCycle = false, inactive = true };
813 PathBox executableLauncher
815 this, anchor = { left = margin, top = 320, right = 8 };
816 text = $"Executable Launcher", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
819 bool NotifyModifiedDocument(PathBox pathBox)
821 CompilerConfig compiler = loadedCompiler;
824 BasicValidatePathBoxPath(pathBox);
826 compiler.ecpCommand = pathBox.slashPath;
827 else if(pathBox == ecc)
828 compiler.eccCommand = pathBox.slashPath;
829 else if(pathBox == ecs)
830 compiler.ecsCommand = pathBox.slashPath;
831 else if(pathBox == ear)
832 compiler.earCommand = pathBox.slashPath;
833 /*else if(pathBox == cpp)
834 compiler.cppCommand = pathBox.slashPath;*/
835 else if(pathBox == cc)
836 compiler.ccCommand = pathBox.slashPath;
837 else if(pathBox == cxx)
838 compiler.cxxCommand = pathBox.slashPath;
839 else if(pathBox == ld)
840 compiler.ldCommand = pathBox.slashPath;
841 else if(pathBox == ar)
842 compiler.arCommand = pathBox.slashPath;
843 else if(pathBox == make)
844 compiler.makeCommand = pathBox.slashPath;
845 else if(pathBox == executableLauncher)
846 compiler.executableLauncher = pathBox.slashPath;
847 else if(pathBox == gnuToolchainPrefix)
848 compiler.gccPrefix = pathBox.slashPath;
849 else if(pathBox == sysroot)
850 compiler.sysroot = pathBox.slashPath;
851 modifiedDocument = true;
852 compilersTab.modifiedDocument = true;
859 CompilerConfig compiler = loadedCompiler;
862 bool disabled = compiler.readOnly;
863 bool isVC = compiler.type.isVC;
864 ecp.path = compiler.ecpCommand;
865 ecc.path = compiler.eccCommand;
866 ecs.path = compiler.ecsCommand;
867 ear.path = compiler.earCommand;
868 //cpp.path = compiler.cppCommand;
869 cpp.contents = compiler.cppCommand;
870 cc.path = compiler.ccCommand;
871 cxx.path = compiler.cxxCommand;
872 ld.path = compiler.ldCommand;
873 ar.path = compiler.arCommand;
874 make.path = compiler.makeCommand;
875 executableLauncher.path = compiler.executableLauncher;
876 gnuToolchainPrefix.path = compiler.gnuToolchainPrefix;
877 sysroot.path = compiler.sysroot;
879 ecpLabel.disabled = ecp.disabled = disabled;
880 eccLabel.disabled = ecc.disabled = disabled;
881 ecsLabel.disabled = ecs.disabled = disabled;
882 earLabel.disabled = ear.disabled = disabled;
883 cppLabel.disabled = cpp.disabled = isVC || disabled;
884 cxxLabel.disabled = cxx.disabled = isVC || disabled;
885 ccLabel.disabled = cc.disabled = isVC || disabled;
886 ldLabel.disabled = ld.disabled = isVC || disabled;
887 arLabel.disabled = ar.disabled = isVC || disabled;
888 makeLabel.disabled = make.disabled = disabled;
889 executableLauncherLabel.disabled = executableLauncher.disabled = disabled;
890 gnuToolchainPrefixLabel.disabled = gnuToolchainPrefix.disabled = disabled;
891 sysrootLabel.disabled = sysroot.disabled = disabled;
893 modifiedDocument = false;
897 class CompilerEnvironmentTab : CompilersSubTab
899 background = formColor;
900 text = $"Environment";
902 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
903 NamedStringsBox envVars
905 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
906 text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
908 bool NotifyModified(NamedStringsBox stringsBox)
910 CompilerConfig compiler = loadedCompiler;
913 compiler.environmentVars = stringsBox.namedStrings;
914 modifiedDocument = true;
915 compilersTab.modifiedDocument = true;
921 CompilerEnvironmentTab()
927 CompilerConfig compiler = loadedCompiler;
930 envVars.namedStrings = compiler.environmentVars;
932 modifiedDocument = false;
937 class CompilerOptionsTab : CompilersSubTab
939 background = formColor;
942 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
943 DropBox targetPlatform
945 this, position = { 110, 8 }, size = { 160 };
946 text = $"Target Platform", hotKey = altT;
947 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
949 CompilerConfig compiler = loadedCompiler;
952 compiler.targetPlatform = (Platform)row.tag;
953 modifiedDocument = true;
954 compilersTab.modifiedDocument = true;
961 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
964 this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
965 position = { 244, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
967 bool OnKeyDown(Key key, unichar ch)
969 if((SmartKey)key == enter)
971 DataBox::OnKeyDown(key, ch);
975 return DataBox::OnKeyDown(key, ch);
978 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
988 bool NotifyChanged(DataBox dataBox, bool closingDropDown)
990 CompilerConfig compiler = loadedCompiler;
993 compiler.numJobs = numJobs;
994 modifiedDocument = true;
995 compilersTab.modifiedDocument = true;
1001 Button ccacheEnabled
1003 this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
1006 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1008 CompilerConfig compiler = loadedCompiler;
1011 compiler.ccacheEnabled = button.checked;
1012 modifiedDocument = true;
1013 compilersTab.modifiedDocument = true;
1019 Button distccEnabled
1021 this, text = $"Use distcc", position = { 158, 68 };
1024 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1026 CompilerConfig compiler = loadedCompiler;
1029 distccHostsLabel.disabled = distccHosts.disabled = !button.checked;
1030 compiler.distccEnabled = button.checked;
1031 modifiedDocument = true;
1032 compilersTab.modifiedDocument = true;
1038 Label distccHostsLabel { this, position = { 240, 68 }, labeledWindow = distccHosts };
1041 this, text = $"distcc hosts", hotKey = altH;
1042 position = { 320, 64 }, size = { 160, 22 };
1044 bool NotifyModified(EditBox editBox)
1046 CompilerConfig compiler = loadedCompiler;
1049 compiler.distccHosts = editBox.contents;
1050 modifiedDocument = true;
1051 compilersTab.modifiedDocument = true;
1057 Label lblPrepDefs { this, position = { 8, 96 }, labeledWindow = prepDefs };
1058 StringListBox prepDefs
1060 this, text = $"Preprocessor directives", hotKey = altP;
1061 position = { 168, 94 }, size = { 280, 22 }, anchor = { left = 168, top = 94, right = 8 };
1063 bool NotifyModified(EditBox editBox)
1067 CompilerConfig compiler = loadedCompiler;
1068 compiler.prepDirectives = ((StringListBox)editBox).strings;
1069 modifiedDocument = true;
1070 compilersTab.modifiedDocument = true;
1076 Label leCcompilerFlags { this, position = { 8, 126 }, labeledWindow = eCcompilerFlags };
1077 StringListBox eCcompilerFlags
1079 this, text = $"Additional eC compiler flags", hotKey = altG;
1080 position = { 168, 124 }, size = { 280, 22 }, anchor = { left = 168, top = 124, right = 8 };
1082 bool NotifyModified(EditBox editBox)
1086 CompilerConfig compiler = loadedCompiler;
1087 compiler.eCcompilerFlags = ((StringListBox)editBox).strings;
1088 modifiedDocument = true;
1089 compilersTab.modifiedDocument = true;
1095 Label lblCompilerFlags { this, position = { 8, 156 }, labeledWindow = compilerFlags };
1096 StringListBox compilerFlags
1098 this, text = $"Additional C compiler flags", hotKey = altR;
1099 position = { 168, 154 }, size = { 280, 22 }, anchor = { left = 168, top = 154, right = 8 };
1101 bool NotifyModified(EditBox editBox)
1105 CompilerConfig compiler = loadedCompiler;
1106 compiler.compilerFlags = ((StringListBox)editBox).strings;
1107 modifiedDocument = true;
1108 compilersTab.modifiedDocument = true;
1114 Label lblcxxFlags { this, position = { 8, 186 }, labeledWindow = cxxFlags };
1115 StringListBox cxxFlags
1117 this, text = $"Additional C++ compiler flags", hotKey = altD;
1118 position = { 168, 184 }, size = { 280, 22 }, anchor = { left = 168, top = 184, right = 8 };
1120 bool NotifyModified(EditBox editBox)
1124 CompilerConfig compiler = loadedCompiler;
1125 compiler.cxxFlags = ((StringListBox)editBox).strings;
1126 modifiedDocument = true;
1127 compilersTab.modifiedDocument = true;
1133 Label lblLinkerFlags { this, position = { 8, 216 }, labeledWindow = linkerFlags };
1134 StringListBox linkerFlags
1136 this, text = $"Additional linker flags", hotKey = altL;
1137 position = { 168, 214 }, size = { 280, 22 }, anchor = { left = 168, top = 214, right = 8 };
1139 bool NotifyModified(EditBox editBox)
1143 CompilerConfig compiler = loadedCompiler;
1144 compiler.linkerFlags = ((StringListBox)editBox).strings;
1145 modifiedDocument = true;
1146 compilersTab.modifiedDocument = true;
1152 Label lblExcludedLibraries { this, position = { 8, 246 }, labeledWindow = excludedLibraries };
1153 StringListBox excludedLibraries
1155 this, text = $"Libraries to exclude", hotKey = altX;
1156 position = { 168, 244 }, size = { 280, 22 }, anchor = { left = 168, top = 244, right = 8 };
1158 bool NotifyModified(EditBox editBox)
1162 CompilerConfig compiler = loadedCompiler;
1163 compiler.excludeLibs = ((StringListBox)editBox).strings;
1164 modifiedDocument = true;
1165 compilersTab.modifiedDocument = true;
1171 Label objectFileExtLabel { this, position = { 8, 276 }, labeledWindow = objectFileExt };
1172 EditBox objectFileExt
1174 this, text = $"Object file extension";//, hotKey = altH;
1175 position = { 168, 274 }, size = { 80, 22 };
1177 bool NotifyModified(EditBox editBox)
1179 CompilerConfig compiler = loadedCompiler;
1182 compiler.objectFileExt = editBox.contents;
1183 modifiedDocument = true;
1184 compilersTab.modifiedDocument = true;
1190 Label staticLibFileExtLabel { this, position = { 8, 306 }, labeledWindow = staticLibFileExt };
1191 EditBox staticLibFileExt
1193 this, text = $"Target extensions (a, so, exe)";//, hotKey = altH;
1194 position = { 168, 304 }, size = { 80, 22 };
1196 bool NotifyModified(EditBox editBox)
1198 CompilerConfig compiler = loadedCompiler;
1201 compiler.staticLibFileExt = editBox.contents;
1202 modifiedDocument = true;
1203 compilersTab.modifiedDocument = true;
1208 EditBox sharedLibFileExt
1211 position = { 256, 304 }, size = { 80, 22 };
1213 bool NotifyModified(EditBox editBox)
1215 CompilerConfig compiler = loadedCompiler;
1218 compiler.sharedLibFileExt = editBox.contents;
1219 modifiedDocument = true;
1220 compilersTab.modifiedDocument = true;
1225 EditBox executableFileExt
1228 position = { 344, 304 }, size = { 80, 22 };
1230 bool NotifyModified(EditBox editBox)
1232 CompilerConfig compiler = loadedCompiler;
1235 compiler.executableFileExt = editBox.contents;
1236 modifiedDocument = true;
1237 compilersTab.modifiedDocument = true;
1245 this, text = $"Strip target", hotKey = altC, position = { 168, 332 };
1248 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1250 CompilerConfig compiler = loadedCompiler;
1253 compiler.noStripTarget = !button.checked;
1254 modifiedDocument = true;
1255 compilersTab.modifiedDocument = true;
1261 Button resourcesDotEar
1263 this, text = $"Use resources.ear", position = { 308, 332 };
1266 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1268 CompilerConfig compiler = loadedCompiler;
1271 compiler.resourcesDotEar = button.checked;
1272 modifiedDocument = true;
1273 compilersTab.modifiedDocument = true;
1279 CompilerOptionsTab()
1283 for(p = (Platform)1; p < Platform::enumSize; p++)
1285 row = targetPlatform.AddRow();
1293 CompilerConfig compiler = loadedCompiler;
1296 bool disabled = compiler.readOnly;
1297 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
1298 numJobs = compiler.numJobs;
1299 numJobsBox.Refresh();
1300 ccacheEnabled.checked = compiler.ccacheEnabled;
1301 distccEnabled.checked = compiler.distccEnabled;
1302 distccHostsLabel.disabled = distccHosts.disabled = !compiler.distccEnabled;
1303 distccHosts.contents = compiler.distccHosts;
1304 prepDefs.strings = compiler.prepDirectives;
1305 excludedLibraries.strings = compiler.excludeLibs;
1306 eCcompilerFlags.strings = compiler.eCcompilerFlags;
1307 compilerFlags.strings = compiler.compilerFlags;
1308 cxxFlags.strings = compiler.cxxFlags;
1309 linkerFlags.strings = compiler.linkerFlags;
1310 objectFileExt.contents = compiler.objectFileExt;
1311 staticLibFileExt.contents = compiler.staticLibFileExt;
1312 sharedLibFileExt.contents = compiler.sharedLibFileExt;
1313 executableFileExt.contents = compiler.executableFileExt;
1314 stripTarget.checked = !compiler.noStripTarget;
1315 resourcesDotEar.checked = compiler.resourcesDotEar;
1317 labelTargetPlatform.disabled = disabled;
1318 targetPlatform.disabled = disabled;
1321 modifiedDocument = false;
1325 class CompilersSubTab : Tab
1327 property CompilersTab compilersTab
1331 CompilersTab tab = (CompilersTab)master;
1332 while(tab && tab._class != class(CompilersTab))
1333 tab = (CompilersTab)tab.master;
1338 property CompilerConfig loadedCompiler
1342 CompilersTab tab = compilersTab;
1343 return tab ? tab.activeCompiler : null;
1348 class ProjectOptionsTab : GlobalSettingsSubTab
1350 background = formColor;
1353 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
1354 PathBox defaultTargetDir
1356 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
1357 text = $"Default Target Directory", hotKey = altT;
1359 bool NotifyModified(PathBox pathBox)
1361 BasicValidatePathBoxPath(pathBox);
1362 modifiedDocument = true;
1367 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
1368 PathBox defaultIntermediateObjDir
1370 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
1371 text = $"Default Intermediate Objects Directory", hotKey = altI;
1373 bool NotifyModified(PathBox pathBox)
1375 BasicValidatePathBoxPath(pathBox);
1376 modifiedDocument = true;
1382 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
1383 // of WorkspaceOptionsTab will *not* be called!
1384 class GlobalSettingsSubTab : Tab
1386 property GlobalSettingsDialog dialog
1390 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
1391 while(dialog && dialog._class != class(GlobalSettingsDialog))
1392 dialog = (GlobalSettingsDialog)dialog.master;
1398 class WorkspaceOptionsTab : GlobalSettingsSubTab
1400 background = formColor;
1401 text = $"Workspace";
1403 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1404 DropBox defaultCompilerDropBox
1406 this, position = { 140, 8 }, size = { 220 };
1407 text = $"Default Compiler", hotKey = altA;
1409 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1411 modifiedDocument = true;
1418 GlobalSettingsDialog dialog = this.dialog;
1419 if(dialog && dialog.compilersTab.compilerConfigs && ideSettings)
1422 for(compiler : ideConfig.compilers)
1424 row = defaultCompilerDropBox.AddString(compiler.name);
1425 if(ideSettings.defaultCompiler && ideSettings.defaultCompiler[0] &&
1426 !strcmp(compiler.name, ideSettings.defaultCompiler))
1427 defaultCompilerDropBox.currentRow = row;
1429 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1430 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1437 // TOFIX: The selection will be lost upon changing tab...
1438 // Should either warn, or leave it modified and put in place
1439 // checks to save/find the compiler by name
1440 defaultCompilerDropBox.Clear();
1441 modifiedDocument = false;
1445 //static define app = ((GuiApplication)__thisModule);