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, 446 };
20 nativeDecorations = true;
22 IDESettings ideSettings;
23 IDESettingsContainer settingsContainer;
24 String workspaceActiveCompiler;
26 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
28 EditorTab editorTab { this, tabControl = tabControl };
29 CompilersTab compilersTab { this, tabControl = tabControl };
30 ProjectOptionsTab projectOptionsTab { this, tabControl = tabControl };
31 WorkspaceOptionsTab workspaceOptionsTab { this, tabControl = tabControl };
33 property bool settingsModified
37 return editorTab.modifiedDocument || compilersTab.modifiedDocument ||
38 projectOptionsTab.modifiedDocument || workspaceOptionsTab.modifiedDocument;
42 bool OnClose(bool parentClosing)
44 if(!settingsModified || MessageBox {
45 type = okCancel, master = ide,
46 text = $"Lose Changes?",
47 contents = $"Are you sure you wish to discard changes?"
55 parent = this, hotKey = escape, text = $"Cancel", id = DialogResult::cancel;
56 position = { 290, 290 }, size = { 80 };
57 anchor = { right = 8, bottom = 8 };
58 NotifyClicked = ButtonCloseDialog;
63 parent = this, isDefault = true, text = $"OK";
64 position = { 200, 290 }, size = { 90 };
65 anchor = { right = 96, bottom = 8 };
67 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
71 bool editorSettingsChanged = false;
72 bool compilerSettingsChanged = false;
73 bool projectOptionsChanged = false;
74 bool workspaceOptionsChanged = false;
76 if(editorTab.modifiedDocument)
78 if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
79 editorTab.showLineNumbers.checked != ideSettings.showLineNumbers ||
80 editorTab.caretFollowsScrolling.checked != ideSettings.caretFollowsScrolling)
82 ideSettings.useFreeCaret = editorTab.useFreeCaret.checked;
83 ideSettings.showLineNumbers = editorTab.showLineNumbers.checked;
84 ideSettings.caretFollowsScrolling = editorTab.caretFollowsScrolling.checked;
85 editorSettingsChanged = true;
89 if(compilersTab.modifiedDocument)
91 if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
92 ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
93 ideSettings.compilerConfigs.Free();
94 for(compiler : compilersTab.compilerConfigs)
95 ideSettings.compilerConfigs.Add(compiler.Copy());
96 compilerSettingsChanged = true;
99 if(projectOptionsTab.modifiedDocument)
101 if(strcmp(projectOptionsTab.defaultTargetDir.path, ideSettings.projectDefaultTargetDir)
102 || strcmp(projectOptionsTab.defaultIntermediateObjDir.path, ideSettings.projectDefaultIntermediateObjDir))
104 ideSettings.projectDefaultTargetDir = projectOptionsTab.defaultTargetDir.path;
105 ideSettings.projectDefaultIntermediateObjDir = projectOptionsTab.defaultIntermediateObjDir.path;
106 projectOptionsChanged = true;
110 if(workspaceOptionsTab.modifiedDocument)
112 DataRow row = workspaceOptionsTab.defaultCompilerDropBox.currentRow;
113 if(row && row.string)
115 if(!ideSettings.defaultCompiler || strcmp(row.string, ideSettings.defaultCompiler))
117 ideSettings.defaultCompiler = row.string;
118 workspaceOptionsChanged = true;
123 settingsContainer.Save();
125 if(compilerSettingsChanged)
126 OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
127 if(editorSettingsChanged)
128 OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
129 if(projectOptionsChanged)
130 OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
132 editorTab.modifiedDocument = false;
133 compilersTab.modifiedDocument = false;
134 projectOptionsTab.modifiedDocument = false;
135 workspaceOptionsTab.modifiedDocument = false;
138 Destroy(DialogResult::ok);
147 for(c = 0; c < DirTypes::enumSize; c++)
149 CompilerDir compilerDir;
151 for(systemDir : ideSettings.systemDirs[c])
153 compilerDir = CompilerDir { type = c; compilerConfig = null; path = CopyString(systemDir) };
154 dirs.Add(compilerDir);
157 row = compilersTab.dirs[c].AddRow();
158 row.SetData(null, "");
159 compilersTab.dirs[c].currentRow = compilersTab.dirs[c].firstRow;
160 compilersTab.dirs[c].modifiedDocument = false;
167 CompilerConfig activateCompiler = null;
168 CompilerConfig readonlyCompiler = null;
171 editorTab.useFreeCaret.checked = ideSettings.useFreeCaret;
172 editorTab.showLineNumbers.checked = ideSettings.showLineNumbers;
173 editorTab.caretFollowsScrolling.checked = ideSettings.caretFollowsScrolling;
176 if(workspaceActiveCompiler)
178 for(compiler : ideSettings.compilerConfigs)
180 if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
181 activateCompiler = compiler;
182 if(!readonlyCompiler && compiler.readOnly)
183 readonlyCompiler = compiler;
184 if(activateCompiler && readonlyCompiler)
188 if(!activateCompiler && readonlyCompiler)
189 activateCompiler = readonlyCompiler;
190 if(!activateCompiler && ideSettings.compilerConfigs.count)
191 activateCompiler = ideSettings.compilerConfigs[0];
193 for(compiler : ideSettings.compilerConfigs)
194 compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
195 compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
198 projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
199 projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
206 editorTab.modifiedDocument = false;
207 compilersTab.modifiedDocument = false;
208 compilersTab.dirsTab.modifiedDocument = false;
209 compilersTab.toolchainTab.modifiedDocument = false;
210 compilersTab.optionsTab.modifiedDocument = false;
211 compilersTab.activeCompiler = null;
212 compilersTab.compilerConfigs.Free();
213 compilersTab.compilerSelector.Clear();
214 projectOptionsTab.modifiedDocument = false;
215 workspaceOptionsTab.modifiedDocument = false;
218 virtual void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange);
221 class EditorTab : GlobalSettingsSubTab
223 background = formColor;
228 this, text = $"Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
229 NotifyClicked = NotifyClickedModifiedDocument;
232 Button caretFollowsScrolling
234 this, text = $"Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
235 NotifyClicked = NotifyClickedModifiedDocument;
238 Button showLineNumbers
240 this, text = $"Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
241 NotifyClicked = NotifyClickedModifiedDocument;
244 bool NotifyClickedModifiedDocument(Button button, int x, int y, Modifiers mods)
246 modifiedDocument = true;
251 static void DrawStipple(Surface surface, Size clientSize)
255 int x2 = clientSize.w - 1;
256 int y2 = clientSize.h - 1;
257 if((x2 - x1) & 1) x2--;
258 if((y2 - y1) & 1) y2--;
260 surface.LineStipple(0x5555);
261 surface.Rectangle(x1, y1, x2, y2);
262 surface.LineStipple(0);
265 class CompilersTab : GlobalSettingsSubTab
267 background = formColor;
270 Label compilerConfigsDirLabel { this, position = { 8, 12 }, labeledWindow = compilerConfigsDir, tabCycle = false, inactive = true };
271 PathBox compilerConfigsDir
273 this, anchor = { left = 210, top = 8, right = 8 };
274 text = $"Compiler Configurations Directory", browseDialog = settingsFileDialog, NotifyModified = NotifyModifiedDocument;
277 SelectorBar compilerSelector
279 this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
281 direction = horizontal, scrollable = true;
283 bool OnKeyDown(Key key, unichar ch)
287 ((CompilersTab)parent).createCompiler.NotifyClicked(parent, ((CompilersTab)parent).createCompiler, 0, 0, 0);
292 ((CompilersTab)parent).deleteCompiler.NotifyClicked(parent, ((CompilersTab)parent).deleteCompiler, 0, 0, 0);
295 return SelectorBar::OnKeyDown(key, ch);
298 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
300 ((CompilersTab)master).labelCompilers.Update(null);
306 CompilersTab compilers = (CompilersTab)parent;
307 SelectorBar::OnPostCreate();
308 if(compilers.selectedButton)
310 Button sb = compilers.selectedButton;
313 // 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...
314 // compilers.selectedButton = null;
320 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
322 CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
323 CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
324 CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
325 CompilerOptionsTab optionsTab { this, tabControl = tabControl };
327 List<CompilerConfig> compilerConfigs { };
328 CompilerConfig activeCompiler;
332 this, anchor = { left = 8, top = 44 }, labeledWindow = compilerSelector;
334 void OnRedraw(Surface surface)
336 Label::OnRedraw(surface);
337 if(labeledWindow.active)
338 DrawStipple(surface, clientSize);
342 void FindUniqueCompilerName(char * baseName, CompilerConfig compiler/*, bool startWithNumber*/, char * output)
345 char tmp[MAX_F_STRING];
346 /*if(startWithNumber)
347 sprintf(tmp, "%s%d", baseName, num);
349 strcpy(tmp, baseName);
352 CompilerConfig matchingCompiler = null;
353 for(c : compilerConfigs)
354 { // TOFIX: Error when omitting these brackets, c not found
355 if((!compiler || c != compiler) && c.name && !strcmp(c.name, tmp))
357 matchingCompiler = c;
364 sprintf(tmp, "%s%d", baseName, num);
372 Button createCompiler
374 parent = this, bevelOver = true, inactive = true;
376 anchor = { top = 40, right = 77 };
377 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
379 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
381 char compilerName[MAX_F_STRING];
382 CompilerConfig newCompiler;
383 FindUniqueCompilerName("New Compiler", null, compilerName);
384 newCompiler = MakeDefaultCompiler(compilerName, false);
385 AddCompiler(newCompiler, true);
386 modifiedDocument = true;
390 Button detectCompiler
392 parent = this, bevelOver = true, inactive = true;
394 anchor = { top = 40, right = 54 };
395 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
397 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
399 CompilersDetectionDialog compilersDetectionDialog
404 if(compilersDetectionDialog.Modal())
406 if(compilersDetectionDialog.selectedCompilerType)
408 char uniqueName[MAX_F_STRING];
409 CompilerConfig newCompiler = compilersDetectionDialog.compilerConfig;
410 FindUniqueCompilerName(newCompiler.name, null, uniqueName);
411 newCompiler.name = uniqueName;
412 AddCompiler(newCompiler, true);
413 modifiedDocument = true;
419 Button duplicateCompiler
421 parent = this, bevelOver = true, inactive = true;
423 anchor = { top = 40, right = 31 };
424 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
426 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
428 char copyName[MAX_F_STRING];
429 CompilerConfig copyCompiler = activeCompiler.Copy();
430 FindUniqueCompilerName(copyCompiler.name, null, copyName);
431 copyCompiler.readOnly = false;
432 copyCompiler.name = copyName;
433 AddCompiler(copyCompiler, true);
434 modifiedDocument = true;
438 Button deleteCompiler
440 parent = this, bevelOver = true, inactive = true;
442 anchor = { top = 40, right = 8 };
443 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
445 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
449 CompilerConfig compilerToDelete = activeCompiler;
450 String title = PrintString($"Delete ", compilerToDelete.name, $" Compiler Configuration");
451 String msg = PrintString($"Are you sure you wish to delete the ", compilerToDelete.name, $" compiler configuration?");
452 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
454 SelectorButton button = compilerSelector.FindButtonByID((int)compilerToDelete);
456 compilerSelector.RemoveButton(button);
457 //DeleteCompiler(compilerToDelete);
459 Iterator<CompilerConfig> it { compilerConfigs };
460 if(it.Find(compilerToDelete))
461 compilerConfigs.Delete(it.pointer);
463 modifiedDocument = true;
472 void AddCompiler(CompilerConfig compiler, bool load)
474 SelectorButton selectButton;
475 if(compiler.readOnly)
477 SelectorButton button
479 compilerSelector, master = this, text = compiler.name, id = (int)compiler;
480 NotifyClicked = CompilerClicked;
482 selectButton = button;
486 EditableSelectorButton button
488 compilerSelector, master = this, renameable = true, text = compiler.name, id = (int)compiler;
489 NotifyClicked = CompilerClicked;
491 bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
493 if(*newName && (*newName)[0])
495 char compilerName[MAX_F_STRING];
496 FindUniqueCompilerName(*newName, activeCompiler, compilerName);
497 if(strcmp(*newName, compilerName))
500 *newName = CopyString(compilerName);
502 activeCompiler.name = compilerName;
503 modifiedDocument = true;
509 selectButton = (SelectorButton)button;
511 compilerConfigs.Add(compiler);
514 LoadCompiler(compiler);
515 selectedButton = selectButton;
516 compilerSelector.Select(selectedButton);
519 SelectorButton selectedButton;
521 void LoadCompiler(CompilerConfig compiler)
523 bool modified = modifiedDocument;
524 activeCompiler = compiler;
528 environmentTab.Load();
531 // Restore original modifiedDocument
532 modifiedDocument = modified;
534 deleteCompiler.disabled = compiler.readOnly;
537 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
539 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
541 LoadCompiler((CompilerConfig)clickedButton.id);
542 selectedButton = (SelectorButton)clickedButton;
547 bool NotifyModifiedDocument(PathBox pathBox)
549 modifiedDocument = true;
554 Array<String> displayDirectoryNames
561 class CompilerDirectoriesTab : CompilersSubTab
563 background = formColor;
564 text = $"Directories";
566 Button dirTypeTglBtn[DirTypes];
567 DirectoriesBox dirs[DirTypes], currentDirs;
569 ~CompilerDirectoriesTab()
572 for(c = 0; c < DirTypes::enumSize; c++)
575 delete dirTypeTglBtn[c];
578 CompilerDirectoriesTab()
581 for(c = 0; c < DirTypes::enumSize; c++)
583 dirs[c] = DirectoriesBox
585 this;//, alwaysHighLight = true
586 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
589 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
590 settingsFileDialog.filePath = directory;
591 if(settingsFileDialog.Modal())
592 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
595 bool NotifyModified(DirectoriesBox dirsBox)
597 CompilerConfig compiler = loadedCompiler;
600 DirTypes dirType = (DirTypes)dirsBox.id;
601 if(dirType == includes)
602 compiler.includeDirs = dirsBox.strings;
603 else if(dirType == libraries)
604 compiler.libraryDirs = dirsBox.strings;
605 else if(dirType == executables)
606 compiler.executableDirs = dirsBox.strings;
608 compilersTab.modifiedDocument = true;
616 dirs[c].visible = false;
618 // (width) Should be 324 for text...
619 //field[c] = { dataType = class(char *), editable = true };
620 //dirs[c].AddField(field[c]);
623 int v = (int)c * 100 + 8;
624 dirTypeTglBtn[c] = Button
626 this, inactive = true, text = displayDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
630 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
632 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
634 DirTypes dirType = (DirTypes)button.id;
635 currentDirs.visible = false;
636 dirs[dirType].visible = true;
637 currentDirs = dirs[dirType];
641 incref dirTypeTglBtn[c];
644 dirTypeTglBtn[c].hotKey = altI;
645 else if(c == libraries)
646 dirTypeTglBtn[c].hotKey = altL;
647 else if(c == executables)
648 dirTypeTglBtn[c].hotKey = altE;
651 currentDirs = dirs[includes];
652 dirTypeTglBtn[includes].checked = true;
660 CompilerConfig compiler = loadedCompiler;
661 dirs[includes].strings = compiler.includeDirs;
662 dirs[libraries].strings = compiler.libraryDirs;
663 dirs[executables].strings = compiler.executableDirs;
664 dirs[includes].list.scroll = { 0, 0 };
665 dirs[libraries].list.scroll = { 0, 0 };
666 dirs[executables].list.scroll = { 0, 0 };
671 class CompilerToolchainTab : CompilersSubTab
673 background = formColor;
676 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
679 this, anchor = { left = 120, top = 8, right = 8 };
680 text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
682 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
685 this, anchor = { left = 120, top = 34, right = 8 };
686 text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
688 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
691 this, anchor = { left = 120, top = 60, right = 8 };
692 text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
694 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
697 this, anchor = { left = 120, top = 86, right = 8 };
698 text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
700 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
703 this, anchor = { left = 120, top = 112, right = 8 };
704 text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
706 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
709 this, anchor = { left = 120, top = 138, right = 8 };
710 text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
712 Label cxxLabel { this, position = { 8, 168 }, labeledWindow = cxx, tabCycle = false, inactive = true };
715 this, anchor = { left = 120, top = 164, right = 8 };
716 text = $"C++ Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
718 Label makeLabel { this, position = { 8, 194 }, labeledWindow = make, tabCycle = false, inactive = true };
721 this, anchor = { left = 120, top = 190, right = 8 };
722 text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
724 Label execPrefixLabel { this, position = { 8, 220 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
727 this, anchor = { left = 120, top = 216, right = 8 };
728 text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
731 bool NotifyModifiedDocument(PathBox pathBox)
735 CompilerConfig compiler = loadedCompiler;
737 compiler.ecpCommand = pathBox.slashPath;
738 else if(pathBox == ecc)
739 compiler.eccCommand = pathBox.slashPath;
740 else if(pathBox == ecs)
741 compiler.ecsCommand = pathBox.slashPath;
742 else if(pathBox == ear)
743 compiler.earCommand = pathBox.slashPath;
744 else if(pathBox == cpp)
745 compiler.cppCommand = pathBox.slashPath;
746 else if(pathBox == cc)
747 compiler.ccCommand = pathBox.slashPath;
748 else if(pathBox == cxx)
749 compiler.cxxCommand = pathBox.slashPath;
750 else if(pathBox == make)
751 compiler.makeCommand = pathBox.slashPath;
752 else if(pathBox == execPrefix)
753 compiler.execPrefixCommand = pathBox.slashPath;
754 modifiedDocument = true;
755 compilersTab.modifiedDocument = true;
764 CompilerConfig compiler = loadedCompiler;
765 bool disabled = compiler.readOnly;
766 bool isVC = compiler.type.isVC;
767 ecp.path = compiler.ecpCommand;
768 ecc.path = compiler.eccCommand;
769 ecs.path = compiler.ecsCommand;
770 ear.path = compiler.earCommand;
771 cpp.path = compiler.cppCommand;
772 cc.path = compiler.ccCommand;
773 cxx.path = compiler.cxxCommand;
774 make.path = compiler.makeCommand;
775 execPrefix.path = compiler.execPrefixCommand;
777 ecpLabel.disabled = ecp.disabled = disabled;
778 eccLabel.disabled = ecc.disabled = disabled;
779 ecsLabel.disabled = ecs.disabled = disabled;
780 earLabel.disabled = ear.disabled = disabled;
781 cppLabel.disabled = cpp.disabled = isVC || disabled;
782 ccLabel.disabled = cc.disabled = isVC || disabled;
783 makeLabel.disabled = make.disabled = disabled;
784 execPrefixLabel.disabled = execPrefix.disabled = disabled;
786 modifiedDocument = false;
790 class CompilerEnvironmentTab : CompilersSubTab
792 background = formColor;
793 text = $"Environment";
795 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
796 NamedStringsBox envVars
798 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
799 text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
801 bool NotifyModified(NamedStringsBox stringsBox)
803 loadedCompiler.environmentVars = stringsBox.namedStrings;
804 modifiedDocument = true;
805 compilersTab.modifiedDocument = true;
810 CompilerEnvironmentTab()
818 CompilerConfig compiler = loadedCompiler;
819 envVars.namedStrings = compiler.environmentVars;
821 modifiedDocument = false;
826 class CompilerOptionsTab : CompilersSubTab
828 background = formColor;
831 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
832 DropBox targetPlatform
834 this, position = { 110, 8 }, size = { 160 };
835 text = $"Target Platform", hotKey = altT;
836 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
838 CompilerConfig compiler = loadedCompiler;
841 compiler.targetPlatform = (Platform)row.tag;
842 modifiedDocument = true;
843 compilersTab.modifiedDocument = true;
850 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
853 this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
854 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
856 bool OnKeyDown(Key key, unichar ch)
858 if((SmartKey)key == enter)
860 DataBox::OnKeyDown(key, ch);
864 return DataBox::OnKeyDown(key, ch);
867 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
877 bool NotifyChanged(bool closingDropDown)
879 CompilerConfig compiler = loadedCompiler;
882 compiler.numJobs = numJobs;
883 modifiedDocument = true;
884 compilersTab.modifiedDocument = true;
892 this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
895 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
897 CompilerConfig compiler = loadedCompiler;
900 compiler.ccacheEnabled = button.checked;
901 modifiedDocument = true;
902 compilersTab.modifiedDocument = true;
910 this, text = $"Use distcc", hotKey = altD, position = { 8, 96 };
913 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
915 CompilerConfig compiler = loadedCompiler;
918 distccHosts.disabled = !button.checked;
919 compiler.distccEnabled = button.checked;
920 modifiedDocument = true;
921 compilersTab.modifiedDocument = true;
927 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
930 this, text = $"distcc hosts", hotKey = altH;
931 position = { 88, 120 }, size = { 300 };
933 bool NotifyModified(EditBox editBox)
937 CompilerConfig compiler = loadedCompiler;
938 compiler.distccHosts = editBox.contents;
939 modifiedDocument = true;
940 compilersTab.modifiedDocument = true;
950 for(p = (Platform)1; p < Platform::enumSize; p++)
952 row = targetPlatform.AddRow();
962 CompilerConfig compiler = loadedCompiler;
963 bool disabled = compiler.readOnly;
964 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
965 numJobs = compiler.numJobs;
966 numJobsBox.Refresh();
967 ccacheEnabled.checked = compiler.ccacheEnabled;
968 distccEnabled.checked = compiler.distccEnabled;
969 distccHosts.disabled = !compiler.distccEnabled;
970 distccHosts.contents = compiler.distccHosts;
972 labelTargetPlatform.disabled = disabled;
973 targetPlatform.disabled = disabled;
976 modifiedDocument = false;
980 class CompilersSubTab : Tab
982 property CompilersTab compilersTab
986 CompilersTab tab = (CompilersTab)master;
987 while(tab && tab._class != class(CompilersTab))
988 tab = (CompilersTab)tab.master;
993 property CompilerConfig loadedCompiler
997 CompilersTab tab = compilersTab;
998 return tab ? tab.activeCompiler : null;
1003 class ProjectOptionsTab : GlobalSettingsSubTab
1005 background = formColor;
1008 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
1009 PathBox defaultTargetDir
1011 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
1012 text = $"Default Target Directory", hotKey = altT;
1014 bool NotifyModified(PathBox editBox)
1016 modifiedDocument = true;
1021 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
1022 PathBox defaultIntermediateObjDir
1024 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
1025 text = $"Default Intermediate Objects Directory", hotKey = altI;
1027 bool NotifyModified(PathBox editBox)
1029 modifiedDocument = true;
1035 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
1036 // of WorkspaceOptionsTab will *not* be called!
1037 class GlobalSettingsSubTab : Tab
1039 property GlobalSettingsDialog dialog
1043 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
1044 while(dialog && dialog._class != class(GlobalSettingsDialog))
1045 dialog = (GlobalSettingsDialog)dialog.master;
1051 class WorkspaceOptionsTab : GlobalSettingsSubTab
1053 background = formColor;
1054 text = $"Workspace";
1056 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1057 DropBox defaultCompilerDropBox
1059 this, position = { 140, 8 }, size = { 220 };
1060 text = $"Default Compiler", hotKey = altA;
1062 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1064 modifiedDocument = true;
1071 GlobalSettingsDialog dialog = this.dialog;
1072 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1075 for(compiler : dialog.ideSettings.compilerConfigs)
1077 row = defaultCompilerDropBox.AddString(compiler.name);
1078 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1079 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1080 defaultCompilerDropBox.currentRow = row;
1082 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1083 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1090 // TOFIX: The selection will be lost upon changing tab...
1091 // Should either warn, or leave it modified and put in place
1092 // checks to save/find the compiler by name
1093 defaultCompilerDropBox.Clear();
1094 modifiedDocument = false;
1098 //static define app = ((GuiApplication)__thisModule);