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 = activeBorder;
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 = activeBorder, 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 = activeBorder;
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 = activeBorder;
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 = activeBorder, 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 activeCompiler = compiler;
508 environmentTab.Load();
511 deleteCompiler.disabled = compiler.readOnly;
514 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
516 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
517 LoadCompiler((CompilerConfig)clickedButton.id);
522 class CompilerDirectoriesTab : CompilersSubTab
524 background = activeBorder;
525 text = $"Directories";
527 Button dirTypeTglBtn[DirTypes];
528 DirectoriesBox dirs[DirTypes], currentDirs;
530 ~CompilerDirectoriesTab()
533 for(c = 0; c < DirTypes::enumSize; c++)
536 delete dirTypeTglBtn[c];
539 CompilerDirectoriesTab()
542 for(c = 0; c < DirTypes::enumSize; c++)
544 dirs[c] = DirectoriesBox
546 this;//, alwaysHighLight = true
547 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
550 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
551 settingsFileDialog.filePath = directory;
552 if(settingsFileDialog.Modal())
553 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
556 bool NotifyModified(DirectoriesBox dirsBox)
558 CompilerConfig compiler = loadedCompiler;
561 DirTypes dirType = (DirTypes)dirsBox.id;
562 if(dirType == includes)
563 compiler.includeDirs = dirsBox.strings;
564 else if(dirType == libraries)
565 compiler.libraryDirs = dirsBox.strings;
566 else if(dirType == executables)
567 compiler.executableDirs = dirsBox.strings;
569 compilersTab.modifiedDocument = true;
577 dirs[c].visible = false;
579 // (width) Should be 324 for text...
580 //field[c] = { dataType = class(char *), editable = true };
581 //dirs[c].AddField(field[c]);
584 int v = (int)c * 100 + 8;
585 dirTypeTglBtn[c] = Button
587 this, inactive = true, text = settingsDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
591 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
593 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
595 DirTypes dirType = (DirTypes)button.id;
596 currentDirs.visible = false;
597 dirs[dirType].visible = true;
598 currentDirs = dirs[dirType];
602 incref dirTypeTglBtn[c];
605 dirTypeTglBtn[c].hotKey = altI;
606 else if(c == libraries)
607 dirTypeTglBtn[c].hotKey = altL;
608 else if(c == executables)
609 dirTypeTglBtn[c].hotKey = altE;
612 currentDirs = dirs[includes];
613 dirTypeTglBtn[includes].checked = true;
621 CompilerConfig compiler = loadedCompiler;
622 dirs[includes].strings = compiler.includeDirs;
623 dirs[libraries].strings = compiler.libraryDirs;
624 dirs[executables].strings = compiler.executableDirs;
625 dirs[includes].list.scroll = { 0, 0 };
626 dirs[libraries].list.scroll = { 0, 0 };
627 dirs[executables].list.scroll = { 0, 0 };
632 class CompilerToolchainTab : CompilersSubTab
634 background = activeBorder;
637 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
640 this, anchor = { left = 120, top = 8, right = 8 };
641 text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
643 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
646 this, anchor = { left = 120, top = 34, right = 8 };
647 text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
649 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
652 this, anchor = { left = 120, top = 60, right = 8 };
653 text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
655 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
658 this, anchor = { left = 120, top = 86, right = 8 };
659 text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
661 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
664 this, anchor = { left = 120, top = 112, right = 8 };
665 text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
667 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
670 this, anchor = { left = 120, top = 138, right = 8 };
671 text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
673 Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
676 this, anchor = { left = 120, top = 164, right = 8 };
677 text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
679 Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
682 this, anchor = { left = 120, top = 190, right = 8 };
683 text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
686 bool NotifyModifiedDocument(PathBox pathBox)
690 CompilerConfig compiler = loadedCompiler;
692 compiler.ecpCommand = pathBox.slashPath;
693 else if(pathBox == ecc)
694 compiler.eccCommand = pathBox.slashPath;
695 else if(pathBox == ecs)
696 compiler.ecsCommand = pathBox.slashPath;
697 else if(pathBox == ear)
698 compiler.earCommand = pathBox.slashPath;
699 else if(pathBox == cpp)
700 compiler.cppCommand = pathBox.slashPath;
701 else if(pathBox == cc)
702 compiler.ccCommand = pathBox.slashPath;
703 else if(pathBox == make)
704 compiler.makeCommand = pathBox.slashPath;
705 else if(pathBox == execPrefix)
706 compiler.execPrefixCommand = pathBox.slashPath;
707 modifiedDocument = true;
708 compilersTab.modifiedDocument = true;
717 CompilerConfig compiler = loadedCompiler;
718 bool disabled = compiler.readOnly;
719 bool isVC = compiler.type.isVC;
720 ecp.path = compiler.ecpCommand;
721 ecc.path = compiler.eccCommand;
722 ecs.path = compiler.ecsCommand;
723 ear.path = compiler.earCommand;
724 cpp.path = compiler.cppCommand;
725 cc.path = compiler.ccCommand;
726 make.path = compiler.makeCommand;
727 execPrefix.path = compiler.execPrefixCommand;
729 ecpLabel.disabled = ecp.disabled = disabled;
730 eccLabel.disabled = ecc.disabled = disabled;
731 ecsLabel.disabled = ecs.disabled = disabled;
732 earLabel.disabled = ear.disabled = disabled;
733 cppLabel.disabled = cpp.disabled = isVC || disabled;
734 ccLabel.disabled = cc.disabled = isVC || disabled;
735 makeLabel.disabled = make.disabled = disabled;
736 execPrefixLabel.disabled = execPrefix.disabled = disabled;
738 modifiedDocument = false;
742 class CompilerEnvironmentTab : CompilersSubTab
744 background = activeBorder;
745 text = $"Environment";
747 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
748 NamedStringsBox envVars
750 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
751 text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
753 bool NotifyModified(NamedStringsBox stringsBox)
755 loadedCompiler.environmentVars = stringsBox.namedStrings;
756 modifiedDocument = true;
761 CompilerEnvironmentTab()
769 CompilerConfig compiler = loadedCompiler;
770 envVars.namedStrings = compiler.environmentVars;
772 // Was these meant to be false?
773 modifiedDocument = false;//true;
774 compilersTab.modifiedDocument = false;//true;
779 class CompilerOptionsTab : CompilersSubTab
781 background = activeBorder;
784 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
785 DropBox targetPlatform
787 this, position = { 110, 8 }, size = { 160 };
788 text = $"Target Platform", hotKey = altT;
789 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
791 CompilerConfig compiler = loadedCompiler;
794 compiler.targetPlatform = (Platform)row.tag;
795 modifiedDocument = true;
796 compilersTab.modifiedDocument = true;
803 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
806 this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
807 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
809 bool OnKeyDown(Key key, unichar ch)
811 if((SmartKey)key == enter)
813 DataBox::OnKeyDown(key, ch);
817 return DataBox::OnKeyDown(key, ch);
820 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
830 bool NotifyChanged(bool closingDropDown)
832 CompilerConfig compiler = loadedCompiler;
835 compiler.numJobs = numJobs;
836 modifiedDocument = true;
837 compilersTab.modifiedDocument = true;
845 this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
848 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
850 CompilerConfig compiler = loadedCompiler;
853 compiler.ccacheEnabled = button.checked;
854 modifiedDocument = true;
855 compilersTab.modifiedDocument = true;
863 this, text = $"Use distcc", hotKey = altD, position = { 8, 96 };
866 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
868 CompilerConfig compiler = loadedCompiler;
871 distccHosts.disabled = !button.checked;
872 compiler.distccEnabled = button.checked;
873 modifiedDocument = true;
874 compilersTab.modifiedDocument = true;
880 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
883 this, text = $"distcc hosts", hotKey = altH;
884 position = { 88, 120 }, size = { 300 };
886 bool NotifyModified(EditBox editBox)
890 CompilerConfig compiler = loadedCompiler;
891 compiler.distccHosts = editBox.contents;
892 modifiedDocument = true;
893 compilersTab.modifiedDocument = true;
903 for(p = (Platform)1; p < Platform::enumSize; p++)
905 row = targetPlatform.AddRow();
915 CompilerConfig compiler = loadedCompiler;
916 bool disabled = compiler.readOnly;
917 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
918 numJobs = compiler.numJobs;
919 numJobsBox.Refresh();
920 ccacheEnabled.checked = compiler.ccacheEnabled;
921 distccEnabled.checked = compiler.distccEnabled;
922 distccHosts.disabled = !compiler.distccEnabled;
923 distccHosts.contents = compiler.distccHosts;
925 labelTargetPlatform.disabled = disabled;
926 targetPlatform.disabled = disabled;
929 modifiedDocument = false;
933 class CompilersSubTab : Tab
935 property CompilersTab compilersTab
939 CompilersTab tab = (CompilersTab)master;
940 while(tab && tab._class != class(CompilersTab))
941 tab = (CompilersTab)tab.master;
946 property CompilerConfig loadedCompiler
950 CompilersTab tab = compilersTab;
951 return tab ? tab.activeCompiler : null;
956 class ProjectOptionsTab : GlobalSettingsSubTab
958 background = activeBorder;
961 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
962 PathBox defaultTargetDir
964 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
965 text = $"Default Target Directory", hotKey = altT;
967 bool NotifyModified(PathBox editBox)
969 modifiedDocument = true;
974 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
975 PathBox defaultIntermediateObjDir
977 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
978 text = $"Default Intermediate Objects Directory", hotKey = altI;
980 bool NotifyModified(PathBox editBox)
982 modifiedDocument = true;
988 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
989 // of WorkspaceOptionsTab will *not* be called!
990 class GlobalSettingsSubTab : Tab
992 property GlobalSettingsDialog dialog
996 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
997 while(dialog && dialog._class != class(GlobalSettingsDialog))
998 dialog = (GlobalSettingsDialog)dialog.master;
1004 class WorkspaceOptionsTab : GlobalSettingsSubTab
1006 background = activeBorder;
1007 text = $"Workspace";
1009 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1010 DropBox defaultCompilerDropBox
1012 this, position = { 140, 8 }, size = { 220 };
1013 text = $"Default Compiler", hotKey = altA;
1015 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1017 modifiedDocument = true;
1024 GlobalSettingsDialog dialog = this.dialog;
1025 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1028 for(compiler : dialog.ideSettings.compilerConfigs)
1030 row = defaultCompilerDropBox.AddString(compiler.name);
1031 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1032 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1033 defaultCompilerDropBox.currentRow = row;
1035 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1036 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1043 defaultCompilerDropBox.Clear();
1044 modifiedDocument = false;
1048 //static define app = ((GuiApplication)__thisModule);