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 ideSettings.compilerConfigs.Free();
91 for(compiler : compilersTab.compilerConfigs)
92 ideSettings.compilerConfigs.Add(compiler.Copy());
93 compilerSettingsChanged = true;
96 if(projectOptionsTab.modifiedDocument)
98 if(strcmp(projectOptionsTab.defaultTargetDir.path, ideSettings.projectDefaultTargetDir)
99 || strcmp(projectOptionsTab.defaultIntermediateObjDir.path, ideSettings.projectDefaultIntermediateObjDir))
101 ideSettings.projectDefaultTargetDir = projectOptionsTab.defaultTargetDir.path;
102 ideSettings.projectDefaultIntermediateObjDir = projectOptionsTab.defaultIntermediateObjDir.path;
103 projectOptionsChanged = true;
107 if(workspaceOptionsTab.modifiedDocument)
109 DataRow row = workspaceOptionsTab.defaultCompilerDropBox.currentRow;
110 if(row && row.string)
112 if(!ideSettings.defaultCompiler || strcmp(row.string, ideSettings.defaultCompiler))
114 ideSettings.defaultCompiler = row.string;
115 workspaceOptionsChanged = true;
120 settingsContainer.Save();
122 if(compilerSettingsChanged)
123 OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
124 if(editorSettingsChanged)
125 OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
126 if(projectOptionsChanged)
127 OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
130 Destroy(DialogResult::ok);
139 for(c = 0; c < DirTypes::enumSize; c++)
141 CompilerDir compilerDir;
143 for(systemDir : ideSettings.systemDirs[c])
145 compilerDir = CompilerDir { type = c; compilerConfig = null; path = CopyString(systemDir) };
146 dirs.Add(compilerDir);
149 row = compilersTab.dirs[c].AddRow();
150 row.SetData(null, "");
151 compilersTab.dirs[c].currentRow = compilersTab.dirs[c].firstRow;
152 compilersTab.dirs[c].modifiedDocument = false;
159 CompilerConfig activateCompiler = null;
160 CompilerConfig readonlyCompiler = null;
163 editorTab.useFreeCaret.checked = ideSettings.useFreeCaret;
164 editorTab.showLineNumbers.checked = ideSettings.showLineNumbers;
165 editorTab.caretFollowsScrolling.checked = ideSettings.caretFollowsScrolling;
168 if(workspaceActiveCompiler)
170 for(compiler : ideSettings.compilerConfigs)
172 if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
173 activateCompiler = compiler;
174 if(!readonlyCompiler && compiler.readOnly)
175 readonlyCompiler = compiler;
176 if(activateCompiler && readonlyCompiler)
180 if(!activateCompiler && readonlyCompiler)
181 activateCompiler = readonlyCompiler;
182 if(!activateCompiler && ideSettings.compilerConfigs.count)
183 activateCompiler = ideSettings.compilerConfigs[0];
185 for(compiler : ideSettings.compilerConfigs)
186 compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
189 projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
190 projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
197 editorTab.modifiedDocument = false;
198 compilersTab.modifiedDocument = false;
199 compilersTab.dirsTab.modifiedDocument = false;
200 compilersTab.toolchainTab.modifiedDocument = false;
201 compilersTab.optionsTab.modifiedDocument = false;
202 compilersTab.activeCompiler = null;
203 compilersTab.compilerConfigs.Free();
204 compilersTab.compilerSelector.Clear();
205 projectOptionsTab.modifiedDocument = false;
206 workspaceOptionsTab.modifiedDocument = false;
209 virtual void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange);
212 class EditorTab : GlobalSettingsSubTab
214 background = formColor;
219 this, text = $"Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
220 NotifyClicked = NotifyClickedModifiedDocument;
223 Button caretFollowsScrolling
225 this, text = $"Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
226 NotifyClicked = NotifyClickedModifiedDocument;
229 Button showLineNumbers
231 this, text = $"Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
232 NotifyClicked = NotifyClickedModifiedDocument;
235 bool NotifyClickedModifiedDocument(Button button, int x, int y, Modifiers mods)
237 modifiedDocument = true;
242 static void DrawStipple(Surface surface, Size clientSize)
246 int x2 = clientSize.w - 1;
247 int y2 = clientSize.h - 1;
248 if((x2 - x1) & 1) x2--;
249 if((y2 - y1) & 1) y2--;
251 surface.LineStipple(0x5555);
252 surface.Rectangle(x1, y1, x2, y2);
253 surface.LineStipple(0);
256 class CompilersTab : GlobalSettingsSubTab
258 background = formColor;
261 SelectorBar compilerSelector
263 this, text = $"Compiler Configurations:", anchor = { left = 148, top = 8, right = 99 }; size = { 0, 26 };
265 direction = horizontal, scrollable = true;
267 bool OnKeyDown(Key key, unichar ch)
271 ((CompilersTab)parent).createCompiler.NotifyClicked(parent, ((CompilersTab)parent).createCompiler, 0, 0, 0);
276 ((CompilersTab)parent).deleteCompiler.NotifyClicked(parent, ((CompilersTab)parent).deleteCompiler, 0, 0, 0);
279 return SelectorBar::OnKeyDown(key, ch);
282 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
284 ((CompilersTab)master).labelCompilers.Update(null);
290 SelectorBar::OnPostCreate();
291 if(((CompilersTab)parent).selectedButton)
293 ((CompilersTab)parent).selectedButton.Activate();
294 ((CompilersTab)parent).selectedButton.checked = true;
295 ((CompilersTab)parent).selectedButton = null;
301 TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 38, right = 8, bottom = 8 } };
303 CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
304 CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
305 CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
306 CompilerOptionsTab optionsTab { this, tabControl = tabControl };
308 List<CompilerConfig> compilerConfigs { };
309 CompilerConfig activeCompiler;
313 this, anchor = { left = 8, top = 14 }, labeledWindow = compilerSelector;
315 void OnRedraw(Surface surface)
317 Label::OnRedraw(surface);
318 if(labeledWindow.active)
319 DrawStipple(surface, clientSize);
323 void FindUniqueCompilerName(char * baseName, CompilerConfig compiler/*, bool startWithNumber*/, char * output)
326 char tmp[MAX_F_STRING];
327 /*if(startWithNumber)
328 sprintf(tmp, "%s%d", baseName, num);
330 strcpy(tmp, baseName);
333 CompilerConfig matchingCompiler = null;
334 for(c : compilerConfigs)
335 { // TOFIX: Error when omitting these brackets, c not found
336 if((!compiler || c != compiler) && c.name && !strcmp(c.name, tmp))
338 matchingCompiler = c;
345 sprintf(tmp, "%s%d", baseName, num);
353 Button createCompiler
355 parent = this, bevelOver = true, inactive = true;
357 anchor = { top = 10, right = 77 };
358 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
360 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
362 char compilerName[MAX_F_STRING];
363 CompilerConfig newCompiler;
364 FindUniqueCompilerName("New Compiler", null, compilerName);
365 newCompiler = MakeDefaultCompiler(compilerName, false);
366 AddCompiler(newCompiler, true);
367 modifiedDocument = true;
371 Button detectCompiler
373 parent = this, bevelOver = true, inactive = true;
375 anchor = { top = 10, right = 54 };
376 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
378 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
380 CompilersDetectionDialog compilersDetectionDialog
385 if(compilersDetectionDialog.Modal())
387 if(compilersDetectionDialog.selectedCompilerType)
389 char uniqueName[MAX_F_STRING];
390 CompilerConfig newCompiler = compilersDetectionDialog.compilerConfig;
391 FindUniqueCompilerName(newCompiler.name, null, uniqueName);
392 newCompiler.name = uniqueName;
393 AddCompiler(newCompiler, true);
394 modifiedDocument = true;
400 Button duplicateCompiler
402 parent = this, bevelOver = true, inactive = true;
404 anchor = { top = 10, right = 31 };
405 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
407 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
409 char copyName[MAX_F_STRING];
410 CompilerConfig copyCompiler = activeCompiler.Copy();
411 FindUniqueCompilerName(copyCompiler.name, null, copyName);
412 copyCompiler.readOnly = false;
413 copyCompiler.name = copyName;
414 AddCompiler(copyCompiler, true);
415 modifiedDocument = true;
419 Button deleteCompiler
421 parent = this, bevelOver = true, inactive = true;
423 anchor = { top = 10, right = 8 };
424 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
426 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
430 CompilerConfig compilerToDelete = activeCompiler;
431 String title = PrintString($"Delete ", compilerToDelete.name, $" Compiler Configuration");
432 String msg = PrintString($"Are you sure you wish to delete the ", compilerToDelete.name, $" compiler configuration?");
433 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
435 SelectorButton button = compilerSelector.FindButtonByID((int)compilerToDelete);
437 compilerSelector.RemoveButton(button);
438 //DeleteCompiler(compilerToDelete);
440 Iterator<CompilerConfig> it { compilerConfigs };
441 if(it.Find(compilerToDelete))
442 compilerConfigs.Delete(it.pointer);
444 modifiedDocument = true;
453 void AddCompiler(CompilerConfig compiler, bool load)
455 SelectorButton selectButton;
456 if(compiler.readOnly)
458 SelectorButton button
460 compilerSelector, master = this, text = compiler.name, id = (int)compiler;
461 NotifyClicked = CompilerClicked;
463 selectButton = button;
467 EditableSelectorButton button
469 compilerSelector, master = this, renameable = true, text = compiler.name, id = (int)compiler;
470 NotifyClicked = CompilerClicked;
472 bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
474 if(*newName && (*newName)[0])
476 char compilerName[MAX_F_STRING];
477 FindUniqueCompilerName(*newName, activeCompiler, compilerName);
478 if(strcmp(*newName, compilerName))
481 *newName = CopyString(compilerName);
483 activeCompiler.name = compilerName;
484 modifiedDocument = true;
490 selectButton = (SelectorButton)button;
492 compilerConfigs.Add(compiler);
495 LoadCompiler(compiler);
496 selectedButton = selectButton;
497 compilerSelector.Select(selectedButton);
500 SelectorButton selectedButton;
502 void LoadCompiler(CompilerConfig compiler)
504 bool modified = modifiedDocument;
505 activeCompiler = compiler;
509 environmentTab.Load();
512 // Restore original modifiedDocument
513 modifiedDocument = modified;
515 deleteCompiler.disabled = compiler.readOnly;
518 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
520 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
521 LoadCompiler((CompilerConfig)clickedButton.id);
526 Array<String> displayDirectoryNames
533 class CompilerDirectoriesTab : CompilersSubTab
535 background = formColor;
536 text = $"Directories";
538 Button dirTypeTglBtn[DirTypes];
539 DirectoriesBox dirs[DirTypes], currentDirs;
541 ~CompilerDirectoriesTab()
544 for(c = 0; c < DirTypes::enumSize; c++)
547 delete dirTypeTglBtn[c];
550 CompilerDirectoriesTab()
553 for(c = 0; c < DirTypes::enumSize; c++)
555 dirs[c] = DirectoriesBox
557 this;//, alwaysHighLight = true
558 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
561 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
562 settingsFileDialog.filePath = directory;
563 if(settingsFileDialog.Modal())
564 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
567 bool NotifyModified(DirectoriesBox dirsBox)
569 CompilerConfig compiler = loadedCompiler;
572 DirTypes dirType = (DirTypes)dirsBox.id;
573 if(dirType == includes)
574 compiler.includeDirs = dirsBox.strings;
575 else if(dirType == libraries)
576 compiler.libraryDirs = dirsBox.strings;
577 else if(dirType == executables)
578 compiler.executableDirs = dirsBox.strings;
580 compilersTab.modifiedDocument = true;
588 dirs[c].visible = false;
590 // (width) Should be 324 for text...
591 //field[c] = { dataType = class(char *), editable = true };
592 //dirs[c].AddField(field[c]);
595 int v = (int)c * 100 + 8;
596 dirTypeTglBtn[c] = Button
598 this, inactive = true, text = displayDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
602 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
604 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
606 DirTypes dirType = (DirTypes)button.id;
607 currentDirs.visible = false;
608 dirs[dirType].visible = true;
609 currentDirs = dirs[dirType];
613 incref dirTypeTglBtn[c];
616 dirTypeTglBtn[c].hotKey = altI;
617 else if(c == libraries)
618 dirTypeTglBtn[c].hotKey = altL;
619 else if(c == executables)
620 dirTypeTglBtn[c].hotKey = altE;
623 currentDirs = dirs[includes];
624 dirTypeTglBtn[includes].checked = true;
632 CompilerConfig compiler = loadedCompiler;
633 dirs[includes].strings = compiler.includeDirs;
634 dirs[libraries].strings = compiler.libraryDirs;
635 dirs[executables].strings = compiler.executableDirs;
636 dirs[includes].list.scroll = { 0, 0 };
637 dirs[libraries].list.scroll = { 0, 0 };
638 dirs[executables].list.scroll = { 0, 0 };
643 class CompilerToolchainTab : CompilersSubTab
645 background = formColor;
648 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
651 this, anchor = { left = 120, top = 8, right = 8 };
652 text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
654 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
657 this, anchor = { left = 120, top = 34, right = 8 };
658 text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
660 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
663 this, anchor = { left = 120, top = 60, right = 8 };
664 text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
666 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
669 this, anchor = { left = 120, top = 86, right = 8 };
670 text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
672 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
675 this, anchor = { left = 120, top = 112, right = 8 };
676 text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
678 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
681 this, anchor = { left = 120, top = 138, right = 8 };
682 text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
684 Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
687 this, anchor = { left = 120, top = 164, right = 8 };
688 text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
690 Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
693 this, anchor = { left = 120, top = 190, right = 8 };
694 text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
697 bool NotifyModifiedDocument(PathBox pathBox)
701 CompilerConfig compiler = loadedCompiler;
703 compiler.ecpCommand = pathBox.slashPath;
704 else if(pathBox == ecc)
705 compiler.eccCommand = pathBox.slashPath;
706 else if(pathBox == ecs)
707 compiler.ecsCommand = pathBox.slashPath;
708 else if(pathBox == ear)
709 compiler.earCommand = pathBox.slashPath;
710 else if(pathBox == cpp)
711 compiler.cppCommand = pathBox.slashPath;
712 else if(pathBox == cc)
713 compiler.ccCommand = pathBox.slashPath;
714 else if(pathBox == make)
715 compiler.makeCommand = pathBox.slashPath;
716 else if(pathBox == execPrefix)
717 compiler.execPrefixCommand = pathBox.slashPath;
718 modifiedDocument = true;
719 compilersTab.modifiedDocument = true;
728 CompilerConfig compiler = loadedCompiler;
729 bool disabled = compiler.readOnly;
730 bool isVC = compiler.type.isVC;
731 ecp.path = compiler.ecpCommand;
732 ecc.path = compiler.eccCommand;
733 ecs.path = compiler.ecsCommand;
734 ear.path = compiler.earCommand;
735 cpp.path = compiler.cppCommand;
736 cc.path = compiler.ccCommand;
737 make.path = compiler.makeCommand;
738 execPrefix.path = compiler.execPrefixCommand;
740 ecpLabel.disabled = ecp.disabled = disabled;
741 eccLabel.disabled = ecc.disabled = disabled;
742 ecsLabel.disabled = ecs.disabled = disabled;
743 earLabel.disabled = ear.disabled = disabled;
744 cppLabel.disabled = cpp.disabled = isVC || disabled;
745 ccLabel.disabled = cc.disabled = isVC || disabled;
746 makeLabel.disabled = make.disabled = disabled;
747 execPrefixLabel.disabled = execPrefix.disabled = disabled;
749 modifiedDocument = false;
753 class CompilerEnvironmentTab : CompilersSubTab
755 background = formColor;
756 text = $"Environment";
758 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
759 NamedStringsBox envVars
761 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
762 text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
764 bool NotifyModified(NamedStringsBox stringsBox)
766 loadedCompiler.environmentVars = stringsBox.namedStrings;
767 modifiedDocument = true;
768 compilersTab.modifiedDocument = true;
773 CompilerEnvironmentTab()
781 CompilerConfig compiler = loadedCompiler;
782 envVars.namedStrings = compiler.environmentVars;
784 modifiedDocument = false;
789 class CompilerOptionsTab : CompilersSubTab
791 background = formColor;
794 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
795 DropBox targetPlatform
797 this, position = { 110, 8 }, size = { 160 };
798 text = $"Target Platform", hotKey = altT;
799 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
801 CompilerConfig compiler = loadedCompiler;
804 compiler.targetPlatform = (Platform)row.tag;
805 modifiedDocument = true;
806 compilersTab.modifiedDocument = true;
813 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
816 this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
817 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
819 bool OnKeyDown(Key key, unichar ch)
821 if((SmartKey)key == enter)
823 DataBox::OnKeyDown(key, ch);
827 return DataBox::OnKeyDown(key, ch);
830 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
840 bool NotifyChanged(bool closingDropDown)
842 CompilerConfig compiler = loadedCompiler;
845 compiler.numJobs = numJobs;
846 modifiedDocument = true;
847 compilersTab.modifiedDocument = true;
855 this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
858 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
860 CompilerConfig compiler = loadedCompiler;
863 compiler.ccacheEnabled = button.checked;
864 modifiedDocument = true;
865 compilersTab.modifiedDocument = true;
873 this, text = $"Use distcc", hotKey = altD, position = { 8, 96 };
876 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
878 CompilerConfig compiler = loadedCompiler;
881 distccHosts.disabled = !button.checked;
882 compiler.distccEnabled = button.checked;
883 modifiedDocument = true;
884 compilersTab.modifiedDocument = true;
890 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
893 this, text = $"distcc hosts", hotKey = altH;
894 position = { 88, 120 }, size = { 300 };
896 bool NotifyModified(EditBox editBox)
900 CompilerConfig compiler = loadedCompiler;
901 compiler.distccHosts = editBox.contents;
902 modifiedDocument = true;
903 compilersTab.modifiedDocument = true;
913 for(p = (Platform)1; p < Platform::enumSize; p++)
915 row = targetPlatform.AddRow();
925 CompilerConfig compiler = loadedCompiler;
926 bool disabled = compiler.readOnly;
927 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
928 numJobs = compiler.numJobs;
929 numJobsBox.Refresh();
930 ccacheEnabled.checked = compiler.ccacheEnabled;
931 distccEnabled.checked = compiler.distccEnabled;
932 distccHosts.disabled = !compiler.distccEnabled;
933 distccHosts.contents = compiler.distccHosts;
935 labelTargetPlatform.disabled = disabled;
936 targetPlatform.disabled = disabled;
939 modifiedDocument = false;
943 class CompilersSubTab : Tab
945 property CompilersTab compilersTab
949 CompilersTab tab = (CompilersTab)master;
950 while(tab && tab._class != class(CompilersTab))
951 tab = (CompilersTab)tab.master;
956 property CompilerConfig loadedCompiler
960 CompilersTab tab = compilersTab;
961 return tab ? tab.activeCompiler : null;
966 class ProjectOptionsTab : GlobalSettingsSubTab
968 background = formColor;
971 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
972 PathBox defaultTargetDir
974 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
975 text = $"Default Target Directory", hotKey = altT;
977 bool NotifyModified(PathBox editBox)
979 modifiedDocument = true;
984 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
985 PathBox defaultIntermediateObjDir
987 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
988 text = $"Default Intermediate Objects Directory", hotKey = altI;
990 bool NotifyModified(PathBox editBox)
992 modifiedDocument = true;
998 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
999 // of WorkspaceOptionsTab will *not* be called!
1000 class GlobalSettingsSubTab : Tab
1002 property GlobalSettingsDialog dialog
1006 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
1007 while(dialog && dialog._class != class(GlobalSettingsDialog))
1008 dialog = (GlobalSettingsDialog)dialog.master;
1014 class WorkspaceOptionsTab : GlobalSettingsSubTab
1016 background = formColor;
1017 text = $"Workspace";
1019 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1020 DropBox defaultCompilerDropBox
1022 this, position = { 140, 8 }, size = { 220 };
1023 text = $"Default Compiler", hotKey = altA;
1025 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1027 modifiedDocument = true;
1034 GlobalSettingsDialog dialog = this.dialog;
1035 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1038 for(compiler : dialog.ideSettings.compilerConfigs)
1040 row = defaultCompilerDropBox.AddString(compiler.name);
1041 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1042 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1043 defaultCompilerDropBox.currentRow = row;
1045 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1046 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1053 // TOFIX: The selection will be lost upon changing tab...
1054 // Should either warn, or leave it modified and put in place
1055 // checks to save/find the compiler by name
1056 defaultCompilerDropBox.Clear();
1057 modifiedDocument = false;
1061 //static define app = ((GuiApplication)__thisModule);