5 import "DirectoriesBox"
6 import "CompilersDetectionDialog"
8 FileDialog settingsFileDialog { type = selectDir, text = "Select directory" };
10 FileDialog toolchainFileDialog { type = open, text = "Open"; mayNotExist = true; };
12 class GlobalSettingsDialog : Window
16 background = activeBorder;
18 borderStyle = sizable;
19 text = "Global Settings";
20 minClientSize = { 560, 420 };
21 nativeDecorations = true;
23 IDESettings ideSettings;
24 IDESettingsContainer settingsContainer;
25 String workspaceActiveCompiler;
27 TabControl tabControl { this, background = activeBorder, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
29 EditorTab editorTab { this, tabControl = tabControl };
30 CompilersTab compilersTab { this, tabControl = tabControl };
31 ProjectOptionsTab projectOptionsTab { this, tabControl = tabControl };
32 WorkspaceOptionsTab workspaceOptionsTab { this, tabControl = tabControl };
34 property bool settingsModified
38 return editorTab.modifiedDocument || compilersTab.modifiedDocument ||
39 projectOptionsTab.modifiedDocument || workspaceOptionsTab.modifiedDocument;
45 parent = this, hotKey = escape, text = "Cancel", id = DialogResult::cancel;
46 position = { 290, 290 }, size = { 80 };
47 anchor = { right = 8, bottom = 8 };
48 NotifyClicked = ButtonCloseDialog;
53 parent = this, isDefault = true, text = "OK";
54 position = { 200, 290 }, size = { 90 };
55 anchor = { right = 96, bottom = 8 };
57 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
61 bool editorSettingsChanged = false;
62 bool compilerSettingsChanged = false;
63 bool projectOptionsChanged = false;
64 bool workspaceOptionsChanged = false;
66 if(editorTab.modifiedDocument)
68 if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
69 editorTab.showLineNumbers.checked != ideSettings.showLineNumbers ||
70 editorTab.caretFollowsScrolling.checked != ideSettings.caretFollowsScrolling)
72 ideSettings.useFreeCaret = editorTab.useFreeCaret.checked;
73 ideSettings.showLineNumbers = editorTab.showLineNumbers.checked;
74 ideSettings.caretFollowsScrolling = editorTab.caretFollowsScrolling.checked;
75 editorSettingsChanged = true;
79 if(compilersTab.modifiedDocument)
81 ideSettings.compilerConfigs.Free();
82 for(compiler : compilersTab.compilerConfigs)
83 ideSettings.compilerConfigs.Add(compiler.Copy());
84 compilerSettingsChanged = true;
87 if(projectOptionsTab.modifiedDocument)
89 if(strcmp(projectOptionsTab.defaultTargetDir.path, ideSettings.projectDefaultTargetDir)
90 || strcmp(projectOptionsTab.defaultIntermediateObjDir.path, ideSettings.projectDefaultIntermediateObjDir))
92 ideSettings.projectDefaultTargetDir = projectOptionsTab.defaultTargetDir.path;
93 ideSettings.projectDefaultIntermediateObjDir = projectOptionsTab.defaultIntermediateObjDir.path;
94 projectOptionsChanged = true;
98 if(workspaceOptionsTab.modifiedDocument)
100 DataRow row = workspaceOptionsTab.defaultCompilerDropBox.currentRow;
101 if(row && row.string)
103 if(!ideSettings.defaultCompiler || strcmp(row.string, ideSettings.defaultCompiler))
105 ideSettings.defaultCompiler = row.string;
106 workspaceOptionsChanged = true;
111 settingsContainer.Save();
113 if(compilerSettingsChanged)
114 OnGlobalSettingChange(GlobalSettingsChange::compilerSettings);
115 if(editorSettingsChanged)
116 OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
117 if(projectOptionsChanged)
118 OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
121 Destroy(DialogResult::ok);
130 for(c = 0; c < DirTypes::enumSize; c++)
132 CompilerDir compilerDir;
134 for(systemDir : ideSettings.systemDirs[c])
136 compilerDir = CompilerDir { type = c; compilerConfig = null; path = CopyString(systemDir) };
137 dirs.Add(compilerDir);
140 row = compilersTab.dirs[c].AddRow();
141 row.SetData(null, "");
142 compilersTab.dirs[c].currentRow = compilersTab.dirs[c].firstRow;
143 compilersTab.dirs[c].modifiedDocument = false;
150 CompilerConfig activateCompiler = null;
151 CompilerConfig readonlyCompiler = null;
154 editorTab.useFreeCaret.checked = ideSettings.useFreeCaret;
155 editorTab.showLineNumbers.checked = ideSettings.showLineNumbers;
156 editorTab.caretFollowsScrolling.checked = ideSettings.caretFollowsScrolling;
159 if(workspaceActiveCompiler)
161 for(compiler : ideSettings.compilerConfigs)
163 if(!activateCompiler && !strcmp(workspaceActiveCompiler, compiler.name))
164 activateCompiler = compiler;
165 if(!readonlyCompiler && compiler.readOnly)
166 readonlyCompiler = compiler;
167 if(activateCompiler && readonlyCompiler)
171 if(!activateCompiler && readonlyCompiler)
172 activateCompiler = readonlyCompiler;
173 if(!activateCompiler && ideSettings.compilerConfigs.count)
174 activateCompiler = ideSettings.compilerConfigs[0];
176 for(compiler : ideSettings.compilerConfigs)
177 compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
180 projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
181 projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
188 editorTab.modifiedDocument = false;
189 compilersTab.modifiedDocument = false;
190 compilersTab.dirsTab.modifiedDocument = false;
191 compilersTab.toolchainTab.modifiedDocument = false;
192 compilersTab.optionsTab.modifiedDocument = false;
193 compilersTab.activeCompiler = null;
194 compilersTab.compilerConfigs.Free();
195 compilersTab.compilerSelector.Clear();
196 projectOptionsTab.modifiedDocument = false;
197 workspaceOptionsTab.modifiedDocument = false;
200 virtual void OnGlobalSettingChange(GlobalSettingsChange globalSettingsChange);
203 class EditorTab : GlobalSettingsSubTab
205 background = activeBorder;
210 this, text = "Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
211 NotifyClicked = NotifyClickedModifiedDocument;
214 Button caretFollowsScrolling
216 this, text = "Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
217 NotifyClicked = NotifyClickedModifiedDocument;
220 Button showLineNumbers
222 this, text = "Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
223 NotifyClicked = NotifyClickedModifiedDocument;
226 bool NotifyClickedModifiedDocument(Button button, int x, int y, Modifiers mods)
228 modifiedDocument = true;
233 static void DrawStipple(Surface surface, Size clientSize)
237 int x2 = clientSize.w - 1;
238 int y2 = clientSize.h - 1;
239 if((x2 - x1) & 1) x2--;
240 if((y2 - y1) & 1) y2--;
242 surface.LineStipple(0x5555);
243 surface.Rectangle(x1, y1, x2, y2);
244 surface.LineStipple(0);
247 class CompilersTab : GlobalSettingsSubTab
249 background = activeBorder;
252 SelectorBar compilerSelector
254 this, text = "Compiler Configurations:", anchor = { left = 148, top = 8, right = 99 }; size = { 0, 26 };
256 direction = horizontal, scrollable = true;
258 bool OnKeyDown(Key key, unichar ch)
262 ((CompilersTab)parent).createCompiler.NotifyClicked(parent, ((CompilersTab)parent).createCompiler, 0, 0, 0);
267 ((CompilersTab)parent).deleteCompiler.NotifyClicked(parent, ((CompilersTab)parent).deleteCompiler, 0, 0, 0);
270 return SelectorBar::OnKeyDown(key, ch);
273 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
275 ((CompilersTab)master).labelCompilers.Update(null);
281 SelectorBar::OnPostCreate();
282 if(((CompilersTab)parent).selectedButton)
284 ((CompilersTab)parent).selectedButton.Activate();
285 ((CompilersTab)parent).selectedButton.checked = true;
286 ((CompilersTab)parent).selectedButton = null;
292 TabControl tabControl { this, background = activeBorder, anchor = { left = 8, top = 38, right = 8, bottom = 8 } };
294 CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
295 CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
296 CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
297 CompilerOptionsTab optionsTab { this, tabControl = tabControl };
299 List<CompilerConfig> compilerConfigs { };
300 CompilerConfig activeCompiler;
304 this, anchor = { left = 8, top = 14 }, labeledWindow = compilerSelector;
306 void OnRedraw(Surface surface)
308 Label::OnRedraw(surface);
309 if(labeledWindow.active)
310 DrawStipple(surface, clientSize);
314 void FindUniqueCompilerName(char * baseName, CompilerConfig compiler/*, bool startWithNumber*/, char * output)
317 char tmp[MAX_F_STRING];
318 /*if(startWithNumber)
319 sprintf(tmp, "%s%d", baseName, num);
321 strcpy(tmp, baseName);
324 CompilerConfig matchingCompiler = null;
325 for(c : compilerConfigs)
326 { // TOFIX: Error when omitting these brackets, c not found
327 if((!compiler || c != compiler) && c.name && !strcmp(c.name, tmp))
329 matchingCompiler = c;
336 sprintf(tmp, "%s%d", baseName, num);
344 Button createCompiler
346 parent = this, bevelOver = true, inactive = true;
348 anchor = { top = 10, right = 77 };
349 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
351 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
353 char compilerName[MAX_F_STRING];
354 CompilerConfig newCompiler;
355 FindUniqueCompilerName("New Compiler", null, compilerName);
356 newCompiler = MakeDefaultCompiler(compilerName, false);
357 AddCompiler(newCompiler, true);
358 modifiedDocument = true;
362 Button detectCompiler
364 parent = this, bevelOver = true, inactive = true;
366 anchor = { top = 10, right = 54 };
367 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
369 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
371 CompilersDetectionDialog compilersDetectionDialog
376 if(compilersDetectionDialog.Modal())
378 if(compilersDetectionDialog.selectedCompilerType)
380 char uniqueName[MAX_F_STRING];
381 CompilerConfig newCompiler = compilersDetectionDialog.compilerConfig;
382 FindUniqueCompilerName(newCompiler.name, null, uniqueName);
383 newCompiler.name = uniqueName;
384 AddCompiler(newCompiler, true);
385 modifiedDocument = true;
391 Button duplicateCompiler
393 parent = this, bevelOver = true, inactive = true;
395 anchor = { top = 10, right = 31 };
396 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
398 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
400 char copyName[MAX_F_STRING];
401 CompilerConfig copyCompiler = activeCompiler.Copy();
402 FindUniqueCompilerName(copyCompiler.name, null, copyName);
403 copyCompiler.readOnly = false;
404 copyCompiler.name = copyName;
405 AddCompiler(copyCompiler, true);
406 modifiedDocument = true;
410 Button deleteCompiler
412 parent = this, bevelOver = true, inactive = true;
414 anchor = { top = 10, right = 8 };
415 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
417 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
421 CompilerConfig compilerToDelete = activeCompiler;
422 String title = PrintString("Delete ", compilerToDelete.name, " Compiler Configuration");
423 String msg = PrintString("Are you sure you wish to delete the ", compilerToDelete.name, " compiler configuration?");
424 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
426 SelectorButton button = compilerSelector.FindButtonByID((int)compilerToDelete);
428 compilerSelector.RemoveButton(button);
429 //DeleteCompiler(compilerToDelete);
431 Iterator<CompilerConfig> it { compilerConfigs };
432 if(it.Find(compilerToDelete))
433 compilerConfigs.Delete(it.pointer);
435 modifiedDocument = true;
444 void AddCompiler(CompilerConfig compiler, bool load)
446 SelectorButton selectButton;
447 if(compiler.readOnly)
449 SelectorButton button
451 compilerSelector, master = this, text = compiler.name, id = (int)compiler;
452 NotifyClicked = CompilerClicked;
454 selectButton = button;
458 EditableSelectorButton button
460 compilerSelector, master = this, renameable = true, text = compiler.name, id = (int)compiler;
461 NotifyClicked = CompilerClicked;
463 bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
465 if(*newName && (*newName)[0])
467 char compilerName[MAX_F_STRING];
468 FindUniqueCompilerName(*newName, activeCompiler, compilerName);
469 if(strcmp(*newName, compilerName))
472 *newName = CopyString(compilerName);
474 activeCompiler.name = compilerName;
475 modifiedDocument = true;
481 selectButton = (SelectorButton)button;
483 compilerConfigs.Add(compiler);
486 LoadCompiler(compiler);
487 selectedButton = selectButton;
488 compilerSelector.Select(selectedButton);
491 SelectorButton selectedButton;
493 void LoadCompiler(CompilerConfig compiler)
495 activeCompiler = compiler;
499 environmentTab.Load();
502 deleteCompiler.disabled = compiler.readOnly;
505 bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
507 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
508 LoadCompiler((CompilerConfig)clickedButton.id);
513 class CompilerDirectoriesTab : CompilersSubTab
515 background = activeBorder;
516 text = "Directories";
518 Button dirTypeTglBtn[DirTypes];
519 DirectoriesBox dirs[DirTypes], currentDirs;
521 ~CompilerDirectoriesTab()
524 for(c = 0; c < DirTypes::enumSize; c++)
527 delete dirTypeTglBtn[c];
530 CompilerDirectoriesTab()
533 for(c = 0; c < DirTypes::enumSize; c++)
535 dirs[c] = DirectoriesBox
537 this;//, alwaysHighLight = true
538 anchor = { left = 8, top = 8, right = 8, bottom = 8 };
541 /* MAKE SURE THINGS ARE DONE PROPERLY IN THE NEW DIRECTORIES BOX WHEN BROWSING FOR A DIR?
542 settingsFileDialog.filePath = directory;
543 if(settingsFileDialog.Modal())
544 row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
547 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
549 // DirectoriesBox's NotifyModified isn't working! Or it's not called before this?
550 if(!active && (modifiedDocument || list.modifiedDocument))
552 CompilerDirectoriesTab dirsTab = (CompilerDirectoriesTab)parent;
553 CompilerConfig compiler = dirsTab.loadedCompiler;
556 DirTypes dirType = (DirTypes)id;
557 // TODO ? I think not, see DirectoriesBox.ec: CopyUnixPath() must be called when copying these dirs
559 if(dirType == includes)
560 compiler.includeDirs = strings;
561 else if(dirType == libraries)
562 compiler.libraryDirs = strings;
563 else if(dirType == executables)
564 compiler.executableDirs = strings;
566 //modifiedDocument = true;
567 dirsTab.compilersTab.modifiedDocument = true;
576 dirs[c].visible = false;
578 // (width) Should be 324 for text...
579 //field[c] = { dataType = class(char *), editable = true };
580 //dirs[c].AddField(field[c]);
583 int v = (int)c * 100 + 8;
584 dirTypeTglBtn[c] = Button
586 this, inactive = true, text = settingsDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
590 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
592 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
594 DirTypes dirType = (DirTypes)button.id;
595 currentDirs.visible = false;
596 dirs[dirType].visible = true;
597 currentDirs = dirs[dirType];
601 incref dirTypeTglBtn[c];
604 dirTypeTglBtn[c].hotKey = altI;
605 else if(c == libraries)
606 dirTypeTglBtn[c].hotKey = altL;
607 else if(c == executables)
608 dirTypeTglBtn[c].hotKey = altE;
611 currentDirs = dirs[includes];
612 dirTypeTglBtn[includes].checked = true;
620 CompilerConfig compiler = loadedCompiler;
621 dirs[includes].strings = compiler.includeDirs;
622 dirs[libraries].strings = compiler.libraryDirs;
623 dirs[executables].strings = compiler.executableDirs;
628 class CompilerToolchainTab : CompilersSubTab
630 background = activeBorder;
633 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
636 this, anchor = { left = 120, top = 8, right = 8 };
637 text = "eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
639 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
642 this, anchor = { left = 120, top = 34, right = 8 };
643 text = "eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
645 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
648 this, anchor = { left = 120, top = 60, right = 8 };
649 text = "eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
651 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
654 this, anchor = { left = 120, top = 86, right = 8 };
655 text = "Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
657 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
660 this, anchor = { left = 120, top = 112, right = 8 };
661 text = "C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
663 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
666 this, anchor = { left = 120, top = 138, right = 8 };
667 text = "C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
669 Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
672 this, anchor = { left = 120, top = 164, right = 8 };
673 text = "GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
675 Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
678 this, anchor = { left = 120, top = 190, right = 8 };
679 text = "Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
682 bool NotifyModifiedDocument(PathBox pathBox)
686 CompilerConfig compiler = loadedCompiler;
688 compiler.ecpCommand = pathBox.slashPath;
689 else if(pathBox == ecc)
690 compiler.eccCommand = pathBox.slashPath;
691 else if(pathBox == ecs)
692 compiler.ecsCommand = pathBox.slashPath;
693 else if(pathBox == ear)
694 compiler.earCommand = pathBox.slashPath;
695 else if(pathBox == cpp)
696 compiler.cppCommand = pathBox.slashPath;
697 else if(pathBox == cc)
698 compiler.ccCommand = pathBox.slashPath;
699 else if(pathBox == make)
700 compiler.makeCommand = pathBox.slashPath;
701 else if(pathBox == execPrefix)
702 compiler.execPrefixCommand = pathBox.slashPath;
703 modifiedDocument = true;
704 compilersTab.modifiedDocument = true;
713 CompilerConfig compiler = loadedCompiler;
714 bool disabled = compiler.readOnly;
715 bool isVC = compiler.type.isVC;
716 ecp.path = compiler.ecpCommand;
717 ecc.path = compiler.eccCommand;
718 ecs.path = compiler.ecsCommand;
719 ear.path = compiler.earCommand;
720 cpp.path = compiler.cppCommand;
721 cc.path = compiler.ccCommand;
722 make.path = compiler.makeCommand;
723 execPrefix.path = compiler.execPrefixCommand;
725 ecpLabel.disabled = ecp.disabled = disabled;
726 eccLabel.disabled = ecc.disabled = disabled;
727 ecsLabel.disabled = ecs.disabled = disabled;
728 earLabel.disabled = ear.disabled = disabled;
729 cppLabel.disabled = cpp.disabled = isVC || disabled;
730 ccLabel.disabled = cc.disabled = isVC || disabled;
731 makeLabel.disabled = make.disabled = disabled;
732 execPrefixLabel.disabled = execPrefix.disabled = disabled;
734 modifiedDocument = false;
738 class CompilerEnvironmentTab : CompilersSubTab
740 background = activeBorder;
741 text = "Environment";
743 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
744 NamedStringsBox envVars
746 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
747 text = "Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
749 bool NotifyModified(NamedStringsBox stringsBox)
751 loadedCompiler.environmentVars = stringsBox.namedStrings;
752 modifiedDocument = true;
757 CompilerEnvironmentTab()
765 CompilerConfig compiler = loadedCompiler;
766 envVars.namedStrings = compiler.environmentVars;
767 modifiedDocument = true;
768 compilersTab.modifiedDocument = true;
773 class CompilerOptionsTab : CompilersSubTab
775 background = activeBorder;
778 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
779 DropBox targetPlatform
781 this, position = { 110, 8 }, size = { 160 };
782 text = "Target Platform", hotKey = altT;
783 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
785 CompilerConfig compiler = loadedCompiler;
788 compiler.targetPlatform = (Platform)row.tag;
789 modifiedDocument = true;
790 compilersTab.modifiedDocument = true;
797 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
800 this, text = "Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
801 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
803 bool OnKeyDown(Key key, unichar ch)
805 if((SmartKey)key == enter)
807 DataBox::OnKeyDown(key, ch);
811 return DataBox::OnKeyDown(key, ch);
814 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
824 bool NotifyChanged(bool closingDropDown)
826 CompilerConfig compiler = loadedCompiler;
829 compiler.numJobs = numJobs;
830 modifiedDocument = true;
831 compilersTab.modifiedDocument = true;
839 this, text = "Use ccache", hotKey = altC, position = { 8, 68 };
842 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
844 CompilerConfig compiler = loadedCompiler;
847 compiler.ccacheEnabled = button.checked;
848 modifiedDocument = true;
849 compilersTab.modifiedDocument = true;
857 this, text = "Use distcc", hotKey = altD, position = { 8, 96 };
860 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
862 CompilerConfig compiler = loadedCompiler;
865 distccHosts.disabled = !button.checked;
866 compiler.distccEnabled = button.checked;
867 modifiedDocument = true;
868 compilersTab.modifiedDocument = true;
874 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
877 this, text = "distcc hosts", hotKey = altH;
878 position = { 88, 120 }, size = { 300 };
880 bool NotifyModified(EditBox editBox)
884 CompilerConfig compiler = loadedCompiler;
885 compiler.distccHosts = editBox.contents;
886 modifiedDocument = true;
887 compilersTab.modifiedDocument = true;
897 for(p = (Platform)1; p < Platform::enumSize; p++)
899 row = targetPlatform.AddRow();
909 CompilerConfig compiler = loadedCompiler;
910 bool disabled = compiler.readOnly;
911 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
912 numJobs = compiler.numJobs;
913 numJobsBox.Refresh();
914 ccacheEnabled.checked = compiler.ccacheEnabled;
915 distccEnabled.checked = compiler.distccEnabled;
916 distccHosts.disabled = !compiler.distccEnabled;
917 distccHosts.contents = compiler.distccHosts;
919 labelTargetPlatform.disabled = disabled;
920 targetPlatform.disabled = disabled;
923 modifiedDocument = false;
927 class CompilersSubTab : Tab
929 property CompilersTab compilersTab
933 CompilersTab tab = (CompilersTab)master;
934 while(tab && tab._class != class(CompilersTab))
935 tab = (CompilersTab)tab.master;
940 property CompilerConfig loadedCompiler
944 CompilersTab tab = compilersTab;
945 return tab ? tab.activeCompiler : null;
950 class ProjectOptionsTab : GlobalSettingsSubTab
952 background = activeBorder;
955 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
956 PathBox defaultTargetDir
958 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
959 text = "Default Target Directory", hotKey = altT;
961 bool NotifyModified(PathBox editBox)
963 modifiedDocument = true;
968 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
969 PathBox defaultIntermediateObjDir
971 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
972 text = "Default Intermediate Objects Directory", hotKey = altI;
974 bool NotifyModified(PathBox editBox)
976 modifiedDocument = true;
982 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
983 // of WorkspaceOptionsTab will *not* be called!
984 class GlobalSettingsSubTab : Tab
986 property GlobalSettingsDialog dialog
990 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
991 while(dialog && dialog._class != class(GlobalSettingsDialog))
992 dialog = (GlobalSettingsDialog)dialog.master;
998 class WorkspaceOptionsTab : GlobalSettingsSubTab
1000 background = activeBorder;
1003 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1004 DropBox defaultCompilerDropBox
1006 this, position = { 140, 8 }, size = { 220 };
1007 text = "Default Compiler", hotKey = altA;
1009 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1011 modifiedDocument = true;
1018 GlobalSettingsDialog dialog = this.dialog;
1019 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1022 for(compiler : dialog.ideSettings.compilerConfigs)
1024 row = defaultCompilerDropBox.AddString(compiler.name);
1025 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1026 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1027 defaultCompilerDropBox.currentRow = row;
1029 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1030 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1037 defaultCompilerDropBox.Clear();
1041 //static define app = ((GuiApplication)__thisModule);