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, 420 };
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;
44 parent = this, hotKey = escape, text = $"Cancel", id = DialogResult::cancel;
45 position = { 290, 290 }, size = { 80 };
46 anchor = { right = 8, bottom = 8 };
48 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
50 if(!settingsModified || MessageBox {
51 type = okCancel, master = ide,
52 text = $"Lose Changes?",
53 contents = $"Are you sure you wish to discard changes?"
62 parent = this, isDefault = true, text = $"OK";
63 position = { 200, 290 }, size = { 90 };
64 anchor = { right = 96, bottom = 8 };
66 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
70 bool editorSettingsChanged = false;
71 bool compilerSettingsChanged = false;
72 bool projectOptionsChanged = false;
73 bool workspaceOptionsChanged = false;
75 if(editorTab.modifiedDocument)
77 if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
78 editorTab.showLineNumbers.checked != ideSettings.showLineNumbers ||
79 editorTab.caretFollowsScrolling.checked != ideSettings.caretFollowsScrolling)
81 ideSettings.useFreeCaret = editorTab.useFreeCaret.checked;
82 ideSettings.showLineNumbers = editorTab.showLineNumbers.checked;
83 ideSettings.caretFollowsScrolling = editorTab.caretFollowsScrolling.checked;
84 editorSettingsChanged = true;
88 if(compilersTab.modifiedDocument)
90 if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
91 ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
92 ideSettings.compilerConfigs.Free();
93 for(compiler : compilersTab.compilerConfigs)
94 ideSettings.compilerConfigs.Add(compiler.Copy());
95 compilerSettingsChanged = true;
98 if(projectOptionsTab.modifiedDocument)
100 if(strcmp(projectOptionsTab.defaultTargetDir.path, ideSettings.projectDefaultTargetDir)
101 || strcmp(projectOptionsTab.defaultIntermediateObjDir.path, ideSettings.projectDefaultIntermediateObjDir))
103 ideSettings.projectDefaultTargetDir = projectOptionsTab.defaultTargetDir.path;
104 ideSettings.projectDefaultIntermediateObjDir = projectOptionsTab.defaultIntermediateObjDir.path;
105 projectOptionsChanged = true;
109 if(workspaceOptionsTab.modifiedDocument)
111 DataRow row = workspaceOptionsTab.defaultCompilerDropBox.currentRow;
112 if(row && row.string)
114 if(!ideSettings.defaultCompiler || strcmp(row.string, ideSettings.defaultCompiler))
116 ideSettings.defaultCompiler = row.string;
117 workspaceOptionsChanged = true;
122 settingsContainer.Save();
124 if(compilerSettingsChanged)
125 OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
126 if(editorSettingsChanged)
127 OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
128 if(projectOptionsChanged)
129 OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
132 Destroy(DialogResult::ok);
141 for(c = 0; c < DirTypes::enumSize; c++)
143 CompilerDir compilerDir;
145 for(systemDir : ideSettings.systemDirs[c])
147 compilerDir = CompilerDir { type = c; compilerConfig = null; path = CopyString(systemDir) };
148 dirs.Add(compilerDir);
151 row = compilersTab.dirs[c].AddRow();
152 row.SetData(null, "");
153 compilersTab.dirs[c].currentRow = compilersTab.dirs[c].firstRow;
154 compilersTab.dirs[c].modifiedDocument = false;
161 CompilerConfig activateCompiler = null;
162 CompilerConfig readonlyCompiler = null;
165 editorTab.useFreeCaret.checked = ideSettings.useFreeCaret;
166 editorTab.showLineNumbers.checked = ideSettings.showLineNumbers;
167 editorTab.caretFollowsScrolling.checked = ideSettings.caretFollowsScrolling;
170 if(workspaceActiveCompiler)
172 for(compiler : ideSettings.compilerConfigs)
174 if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
175 activateCompiler = compiler;
176 if(!readonlyCompiler && compiler.readOnly)
177 readonlyCompiler = compiler;
178 if(activateCompiler && readonlyCompiler)
182 if(!activateCompiler && readonlyCompiler)
183 activateCompiler = readonlyCompiler;
184 if(!activateCompiler && ideSettings.compilerConfigs.count)
185 activateCompiler = ideSettings.compilerConfigs[0];
187 for(compiler : ideSettings.compilerConfigs)
188 compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
189 compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
192 projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
193 projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
200 editorTab.modifiedDocument = false;
201 compilersTab.modifiedDocument = false;
202 compilersTab.dirsTab.modifiedDocument = false;
203 compilersTab.toolchainTab.modifiedDocument = false;
204 compilersTab.optionsTab.modifiedDocument = false;
205 compilersTab.activeCompiler = null;
206 compilersTab.compilerConfigs.Free();
207 compilersTab.compilerSelector.Clear();
208 projectOptionsTab.modifiedDocument = false;
209 workspaceOptionsTab.modifiedDocument = false;
212 virtual void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange);
215 class EditorTab : GlobalSettingsSubTab
217 background = formColor;
222 this, text = $"Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
223 NotifyClicked = NotifyClickedModifiedDocument;
226 Button caretFollowsScrolling
228 this, text = $"Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
229 NotifyClicked = NotifyClickedModifiedDocument;
232 Button showLineNumbers
234 this, text = $"Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
235 NotifyClicked = NotifyClickedModifiedDocument;
238 bool NotifyClickedModifiedDocument(Button button, int x, int y, Modifiers mods)
240 modifiedDocument = true;
245 static void DrawStipple(Surface surface, Size clientSize)
249 int x2 = clientSize.w - 1;
250 int y2 = clientSize.h - 1;
251 if((x2 - x1) & 1) x2--;
252 if((y2 - y1) & 1) y2--;
254 surface.LineStipple(0x5555);
255 surface.Rectangle(x1, y1, x2, y2);
256 surface.LineStipple(0);
259 class CompilersTab : GlobalSettingsSubTab
261 background = formColor;
264 Label compilerConfigsDirLabel { this, position = { 8, 12 }, labeledWindow = compilerConfigsDir, tabCycle = false, inactive = true };
265 PathBox compilerConfigsDir
267 this, anchor = { left = 210, top = 8, right = 8 };
268 text = $"Compiler Configurations Directory:", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
271 SelectorBar compilerSelector
273 this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
275 direction = horizontal, scrollable = true;
277 bool OnKeyDown(Key key, unichar ch)
281 ((CompilersTab)parent).createCompiler.NotifyClicked(parent, ((CompilersTab)parent).createCompiler, 0, 0, 0);
286 ((CompilersTab)parent).deleteCompiler.NotifyClicked(parent, ((CompilersTab)parent).deleteCompiler, 0, 0, 0);
289 return SelectorBar::OnKeyDown(key, ch);
292 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
294 ((CompilersTab)master).labelCompilers.Update(null);
300 SelectorBar::OnPostCreate();
301 if(((CompilersTab)parent).selectedButton)
303 ((CompilersTab)parent).selectedButton.Activate();
304 ((CompilersTab)parent).selectedButton.checked = true;
305 ((CompilersTab)parent).selectedButton = null;
311 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
313 CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
314 CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
315 CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
316 CompilerOptionsTab optionsTab { this, tabControl = tabControl };
318 List<CompilerConfig> compilerConfigs { };
319 CompilerConfig activeCompiler;
323 this, anchor = { left = 8, top = 44 }, labeledWindow = compilerSelector;
325 void OnRedraw(Surface surface)
327 Label::OnRedraw(surface);
328 if(labeledWindow.active)
329 DrawStipple(surface, clientSize);
333 void FindUniqueCompilerName(char * baseName, CompilerConfig compiler/*, bool startWithNumber*/, char * output)
336 char tmp[MAX_F_STRING];
337 /*if(startWithNumber)
338 sprintf(tmp, "%s%d", baseName, num);
340 strcpy(tmp, baseName);
343 CompilerConfig matchingCompiler = null;
344 for(c : compilerConfigs)
345 { // TOFIX: Error when omitting these brackets, c not found
346 if((!compiler || c != compiler) && c.name && !strcmp(c.name, tmp))
348 matchingCompiler = c;
355 sprintf(tmp, "%s%d", baseName, num);
363 Button createCompiler
365 parent = this, bevelOver = true, inactive = true;
367 anchor = { top = 40, right = 77 };
368 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
370 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
372 char compilerName[MAX_F_STRING];
373 CompilerConfig newCompiler;
374 FindUniqueCompilerName("New Compiler", null, compilerName);
375 newCompiler = MakeDefaultCompiler(compilerName, false);
376 AddCompiler(newCompiler, true);
377 modifiedDocument = true;
381 Button detectCompiler
383 parent = this, bevelOver = true, inactive = true;
385 anchor = { top = 40, right = 54 };
386 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
388 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
390 CompilersDetectionDialog compilersDetectionDialog
395 if(compilersDetectionDialog.Modal())
397 if(compilersDetectionDialog.selectedCompilerType)
399 char uniqueName[MAX_F_STRING];
400 CompilerConfig newCompiler = compilersDetectionDialog.compilerConfig;
401 FindUniqueCompilerName(newCompiler.name, null, uniqueName);
402 newCompiler.name = uniqueName;
403 AddCompiler(newCompiler, true);
404 modifiedDocument = true;
410 Button duplicateCompiler
412 parent = this, bevelOver = true, inactive = true;
414 anchor = { top = 40, right = 31 };
415 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
417 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
419 char copyName[MAX_F_STRING];
420 CompilerConfig copyCompiler = activeCompiler.Copy();
421 FindUniqueCompilerName(copyCompiler.name, null, copyName);
422 copyCompiler.readOnly = false;
423 copyCompiler.name = copyName;
424 AddCompiler(copyCompiler, true);
425 modifiedDocument = true;
429 Button deleteCompiler
431 parent = this, bevelOver = true, inactive = true;
433 anchor = { top = 40, right = 8 };
434 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
436 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
440 CompilerConfig compilerToDelete = activeCompiler;
441 String title = PrintString($"Delete ", compilerToDelete.name, $" Compiler Configuration");
442 String msg = PrintString($"Are you sure you wish to delete the ", compilerToDelete.name, $" compiler configuration?");
443 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
445 SelectorButton button = compilerSelector.FindButtonByID((int)compilerToDelete);
447 compilerSelector.RemoveButton(button);
448 //DeleteCompiler(compilerToDelete);
450 Iterator<CompilerConfig> it { compilerConfigs };
451 if(it.Find(compilerToDelete))
452 compilerConfigs.Delete(it.pointer);
454 modifiedDocument = true;
463 void AddCompiler(CompilerConfig compiler, bool load)
465 SelectorButton selectButton;
466 if(compiler.readOnly)
468 SelectorButton button
470 compilerSelector, master = this, text = compiler.name, id = (int)compiler;
471 NotifyClicked = CompilerClicked;
473 selectButton = button;
477 EditableSelectorButton button
479 compilerSelector, master = this, renameable = true, text = compiler.name, id = (int)compiler;
480 NotifyClicked = CompilerClicked;
482 bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
484 if(*newName && (*newName)[0])
486 char compilerName[MAX_F_STRING];
487 FindUniqueCompilerName(*newName, activeCompiler, compilerName);
488 if(strcmp(*newName, compilerName))
491 *newName = CopyString(compilerName);
493 activeCompiler.name = compilerName;
494 modifiedDocument = true;
500 selectButton = (SelectorButton)button;
502 compilerConfigs.Add(compiler);
505 LoadCompiler(compiler);
506 selectedButton = selectButton;
507 compilerSelector.Select(selectedButton);
510 SelectorButton selectedButton;
512 void LoadCompiler(CompilerConfig compiler)
514 bool modified = modifiedDocument;
515 activeCompiler = compiler;
519 environmentTab.Load();
522 // Restore original modifiedDocument
523 modifiedDocument = modified;
525 deleteCompiler.disabled = compiler.readOnly;
528 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
530 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
531 LoadCompiler((CompilerConfig)clickedButton.id);
535 bool NotifyModifiedDocument(PathBox pathBox)
537 modifiedDocument = true;
542 Array<String> displayDirectoryNames
549 class CompilerDirectoriesTab : CompilersSubTab
551 background = formColor;
552 text = $"Directories";
554 Button dirTypeTglBtn[DirTypes];
555 DirectoriesBox dirs[DirTypes], currentDirs;
557 ~CompilerDirectoriesTab()
560 for(c = 0; c < DirTypes::enumSize; c++)
563 delete dirTypeTglBtn[c];
566 CompilerDirectoriesTab()
569 for(c = 0; c < DirTypes::enumSize; c++)
571 dirs[c] = DirectoriesBox
573 this;//, alwaysHighLight = true
574 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
577 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
578 settingsFileDialog.filePath = directory;
579 if(settingsFileDialog.Modal())
580 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
583 bool NotifyModified(DirectoriesBox dirsBox)
585 CompilerConfig compiler = loadedCompiler;
588 DirTypes dirType = (DirTypes)dirsBox.id;
589 if(dirType == includes)
590 compiler.includeDirs = dirsBox.strings;
591 else if(dirType == libraries)
592 compiler.libraryDirs = dirsBox.strings;
593 else if(dirType == executables)
594 compiler.executableDirs = dirsBox.strings;
596 compilersTab.modifiedDocument = true;
604 dirs[c].visible = false;
606 // (width) Should be 324 for text...
607 //field[c] = { dataType = class(char *), editable = true };
608 //dirs[c].AddField(field[c]);
611 int v = (int)c * 100 + 8;
612 dirTypeTglBtn[c] = Button
614 this, inactive = true, text = displayDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
618 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
620 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
622 DirTypes dirType = (DirTypes)button.id;
623 currentDirs.visible = false;
624 dirs[dirType].visible = true;
625 currentDirs = dirs[dirType];
629 incref dirTypeTglBtn[c];
632 dirTypeTglBtn[c].hotKey = altI;
633 else if(c == libraries)
634 dirTypeTglBtn[c].hotKey = altL;
635 else if(c == executables)
636 dirTypeTglBtn[c].hotKey = altE;
639 currentDirs = dirs[includes];
640 dirTypeTglBtn[includes].checked = true;
648 CompilerConfig compiler = loadedCompiler;
649 dirs[includes].strings = compiler.includeDirs;
650 dirs[libraries].strings = compiler.libraryDirs;
651 dirs[executables].strings = compiler.executableDirs;
652 dirs[includes].list.scroll = { 0, 0 };
653 dirs[libraries].list.scroll = { 0, 0 };
654 dirs[executables].list.scroll = { 0, 0 };
659 class CompilerToolchainTab : CompilersSubTab
661 background = formColor;
664 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
667 this, anchor = { left = 120, top = 8, right = 8 };
668 text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
670 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
673 this, anchor = { left = 120, top = 34, right = 8 };
674 text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
676 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
679 this, anchor = { left = 120, top = 60, right = 8 };
680 text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
682 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
685 this, anchor = { left = 120, top = 86, right = 8 };
686 text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
688 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
691 this, anchor = { left = 120, top = 112, right = 8 };
692 text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
694 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
697 this, anchor = { left = 120, top = 138, right = 8 };
698 text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
700 Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
703 this, anchor = { left = 120, top = 164, right = 8 };
704 text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
706 Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
709 this, anchor = { left = 120, top = 190, right = 8 };
710 text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
713 bool NotifyModifiedDocument(PathBox pathBox)
717 CompilerConfig compiler = loadedCompiler;
719 compiler.ecpCommand = pathBox.slashPath;
720 else if(pathBox == ecc)
721 compiler.eccCommand = pathBox.slashPath;
722 else if(pathBox == ecs)
723 compiler.ecsCommand = pathBox.slashPath;
724 else if(pathBox == ear)
725 compiler.earCommand = pathBox.slashPath;
726 else if(pathBox == cpp)
727 compiler.cppCommand = pathBox.slashPath;
728 else if(pathBox == cc)
729 compiler.ccCommand = pathBox.slashPath;
730 else if(pathBox == make)
731 compiler.makeCommand = pathBox.slashPath;
732 else if(pathBox == execPrefix)
733 compiler.execPrefixCommand = pathBox.slashPath;
734 modifiedDocument = true;
735 compilersTab.modifiedDocument = true;
744 CompilerConfig compiler = loadedCompiler;
745 bool disabled = compiler.readOnly;
746 bool isVC = compiler.type.isVC;
747 ecp.path = compiler.ecpCommand;
748 ecc.path = compiler.eccCommand;
749 ecs.path = compiler.ecsCommand;
750 ear.path = compiler.earCommand;
751 cpp.path = compiler.cppCommand;
752 cc.path = compiler.ccCommand;
753 make.path = compiler.makeCommand;
754 execPrefix.path = compiler.execPrefixCommand;
756 ecpLabel.disabled = ecp.disabled = disabled;
757 eccLabel.disabled = ecc.disabled = disabled;
758 ecsLabel.disabled = ecs.disabled = disabled;
759 earLabel.disabled = ear.disabled = disabled;
760 cppLabel.disabled = cpp.disabled = isVC || disabled;
761 ccLabel.disabled = cc.disabled = isVC || disabled;
762 makeLabel.disabled = make.disabled = disabled;
763 execPrefixLabel.disabled = execPrefix.disabled = disabled;
765 modifiedDocument = false;
769 class CompilerEnvironmentTab : CompilersSubTab
771 background = formColor;
772 text = $"Environment";
774 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
775 NamedStringsBox envVars
777 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
778 text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
780 bool NotifyModified(NamedStringsBox stringsBox)
782 loadedCompiler.environmentVars = stringsBox.namedStrings;
783 modifiedDocument = true;
784 compilersTab.modifiedDocument = true;
789 CompilerEnvironmentTab()
797 CompilerConfig compiler = loadedCompiler;
798 envVars.namedStrings = compiler.environmentVars;
800 modifiedDocument = false;
805 class CompilerOptionsTab : CompilersSubTab
807 background = formColor;
810 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
811 DropBox targetPlatform
813 this, position = { 110, 8 }, size = { 160 };
814 text = $"Target Platform", hotKey = altT;
815 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
817 CompilerConfig compiler = loadedCompiler;
820 compiler.targetPlatform = (Platform)row.tag;
821 modifiedDocument = true;
822 compilersTab.modifiedDocument = true;
829 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
832 this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
833 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
835 bool OnKeyDown(Key key, unichar ch)
837 if((SmartKey)key == enter)
839 DataBox::OnKeyDown(key, ch);
843 return DataBox::OnKeyDown(key, ch);
846 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
856 bool NotifyChanged(bool closingDropDown)
858 CompilerConfig compiler = loadedCompiler;
861 compiler.numJobs = numJobs;
862 modifiedDocument = true;
863 compilersTab.modifiedDocument = true;
871 this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
874 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
876 CompilerConfig compiler = loadedCompiler;
879 compiler.ccacheEnabled = button.checked;
880 modifiedDocument = true;
881 compilersTab.modifiedDocument = true;
889 this, text = $"Use distcc", hotKey = altD, position = { 8, 96 };
892 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
894 CompilerConfig compiler = loadedCompiler;
897 distccHosts.disabled = !button.checked;
898 compiler.distccEnabled = button.checked;
899 modifiedDocument = true;
900 compilersTab.modifiedDocument = true;
906 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
909 this, text = $"distcc hosts", hotKey = altH;
910 position = { 88, 120 }, size = { 300 };
912 bool NotifyModified(EditBox editBox)
916 CompilerConfig compiler = loadedCompiler;
917 compiler.distccHosts = editBox.contents;
918 modifiedDocument = true;
919 compilersTab.modifiedDocument = true;
929 for(p = (Platform)1; p < Platform::enumSize; p++)
931 row = targetPlatform.AddRow();
941 CompilerConfig compiler = loadedCompiler;
942 bool disabled = compiler.readOnly;
943 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
944 numJobs = compiler.numJobs;
945 numJobsBox.Refresh();
946 ccacheEnabled.checked = compiler.ccacheEnabled;
947 distccEnabled.checked = compiler.distccEnabled;
948 distccHosts.disabled = !compiler.distccEnabled;
949 distccHosts.contents = compiler.distccHosts;
951 labelTargetPlatform.disabled = disabled;
952 targetPlatform.disabled = disabled;
955 modifiedDocument = false;
959 class CompilersSubTab : Tab
961 property CompilersTab compilersTab
965 CompilersTab tab = (CompilersTab)master;
966 while(tab && tab._class != class(CompilersTab))
967 tab = (CompilersTab)tab.master;
972 property CompilerConfig loadedCompiler
976 CompilersTab tab = compilersTab;
977 return tab ? tab.activeCompiler : null;
982 class ProjectOptionsTab : GlobalSettingsSubTab
984 background = formColor;
987 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
988 PathBox defaultTargetDir
990 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
991 text = $"Default Target Directory", hotKey = altT;
993 bool NotifyModified(PathBox editBox)
995 modifiedDocument = true;
1000 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
1001 PathBox defaultIntermediateObjDir
1003 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
1004 text = $"Default Intermediate Objects Directory", hotKey = altI;
1006 bool NotifyModified(PathBox editBox)
1008 modifiedDocument = true;
1014 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
1015 // of WorkspaceOptionsTab will *not* be called!
1016 class GlobalSettingsSubTab : Tab
1018 property GlobalSettingsDialog dialog
1022 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
1023 while(dialog && dialog._class != class(GlobalSettingsDialog))
1024 dialog = (GlobalSettingsDialog)dialog.master;
1030 class WorkspaceOptionsTab : GlobalSettingsSubTab
1032 background = formColor;
1033 text = $"Workspace";
1035 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1036 DropBox defaultCompilerDropBox
1038 this, position = { 140, 8 }, size = { 220 };
1039 text = $"Default Compiler", hotKey = altA;
1041 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1043 modifiedDocument = true;
1050 GlobalSettingsDialog dialog = this.dialog;
1051 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1054 for(compiler : dialog.ideSettings.compilerConfigs)
1056 row = defaultCompilerDropBox.AddString(compiler.name);
1057 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1058 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1059 defaultCompilerDropBox.currentRow = row;
1061 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1062 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1069 // TOFIX: The selection will be lost upon changing tab...
1070 // Should either warn, or leave it modified and put in place
1071 // checks to save/find the compiler by name
1072 defaultCompilerDropBox.Clear();
1073 modifiedDocument = false;
1077 //static define app = ((GuiApplication)__thisModule);