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 OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
558 // DirectoriesBox's NotifyModified isn't working! Or it's not called before this?
559 if(!active && (modifiedDocument || list.modifiedDocument))
561 CompilerDirectoriesTab dirsTab = (CompilerDirectoriesTab)parent;
562 CompilerConfig compiler = dirsTab.loadedCompiler;
565 DirTypes dirType = (DirTypes)id;
566 // TODO ? I think not, see DirectoriesBox.ec: CopyUnixPath() must be called when copying these dirs
568 if(dirType == includes)
569 compiler.includeDirs = strings;
570 else if(dirType == libraries)
571 compiler.libraryDirs = strings;
572 else if(dirType == executables)
573 compiler.executableDirs = strings;
575 //modifiedDocument = true;
576 dirsTab.compilersTab.modifiedDocument = true;
585 dirs[c].visible = false;
587 // (width) Should be 324 for text...
588 //field[c] = { dataType = class(char *), editable = true };
589 //dirs[c].AddField(field[c]);
592 int v = (int)c * 100 + 8;
593 dirTypeTglBtn[c] = Button
595 this, inactive = true, text = settingsDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
599 anchor = { left = v, top = 8 }; // ((int)c) * 100 + 8
601 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
603 DirTypes dirType = (DirTypes)button.id;
604 currentDirs.visible = false;
605 dirs[dirType].visible = true;
606 currentDirs = dirs[dirType];
610 incref dirTypeTglBtn[c];
613 dirTypeTglBtn[c].hotKey = altI;
614 else if(c == libraries)
615 dirTypeTglBtn[c].hotKey = altL;
616 else if(c == executables)
617 dirTypeTglBtn[c].hotKey = altE;
620 currentDirs = dirs[includes];
621 dirTypeTglBtn[includes].checked = true;
629 CompilerConfig compiler = loadedCompiler;
630 dirs[includes].strings = compiler.includeDirs;
631 dirs[libraries].strings = compiler.libraryDirs;
632 dirs[executables].strings = compiler.executableDirs;
637 class CompilerToolchainTab : CompilersSubTab
639 background = activeBorder;
642 Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
645 this, anchor = { left = 120, top = 8, right = 8 };
646 text = "eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
648 Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
651 this, anchor = { left = 120, top = 34, right = 8 };
652 text = "eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
654 Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
657 this, anchor = { left = 120, top = 60, right = 8 };
658 text = "eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
660 Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
663 this, anchor = { left = 120, top = 86, right = 8 };
664 text = "Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
666 Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
669 this, anchor = { left = 120, top = 112, right = 8 };
670 text = "C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
672 Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
675 this, anchor = { left = 120, top = 138, right = 8 };
676 text = "C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
678 Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
681 this, anchor = { left = 120, top = 164, right = 8 };
682 text = "GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
684 Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
687 this, anchor = { left = 120, top = 190, right = 8 };
688 text = "Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
691 bool NotifyModifiedDocument(PathBox pathBox)
695 CompilerConfig compiler = loadedCompiler;
697 compiler.ecpCommand = pathBox.slashPath;
698 else if(pathBox == ecc)
699 compiler.eccCommand = pathBox.slashPath;
700 else if(pathBox == ecs)
701 compiler.ecsCommand = pathBox.slashPath;
702 else if(pathBox == ear)
703 compiler.earCommand = pathBox.slashPath;
704 else if(pathBox == cpp)
705 compiler.cppCommand = pathBox.slashPath;
706 else if(pathBox == cc)
707 compiler.ccCommand = pathBox.slashPath;
708 else if(pathBox == make)
709 compiler.makeCommand = pathBox.slashPath;
710 else if(pathBox == execPrefix)
711 compiler.execPrefixCommand = pathBox.slashPath;
712 modifiedDocument = true;
713 compilersTab.modifiedDocument = true;
722 CompilerConfig compiler = loadedCompiler;
723 bool disabled = compiler.readOnly;
724 bool isVC = compiler.type.isVC;
725 ecp.path = compiler.ecpCommand;
726 ecc.path = compiler.eccCommand;
727 ecs.path = compiler.ecsCommand;
728 ear.path = compiler.earCommand;
729 cpp.path = compiler.cppCommand;
730 cc.path = compiler.ccCommand;
731 make.path = compiler.makeCommand;
732 execPrefix.path = compiler.execPrefixCommand;
734 ecpLabel.disabled = ecp.disabled = disabled;
735 eccLabel.disabled = ecc.disabled = disabled;
736 ecsLabel.disabled = ecs.disabled = disabled;
737 earLabel.disabled = ear.disabled = disabled;
738 cppLabel.disabled = cpp.disabled = isVC || disabled;
739 ccLabel.disabled = cc.disabled = isVC || disabled;
740 makeLabel.disabled = make.disabled = disabled;
741 execPrefixLabel.disabled = execPrefix.disabled = disabled;
743 modifiedDocument = false;
747 class CompilerEnvironmentTab : CompilersSubTab
749 background = activeBorder;
750 text = "Environment";
752 Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
753 NamedStringsBox envVars
755 this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
756 text = "Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
758 bool NotifyModified(NamedStringsBox stringsBox)
760 loadedCompiler.environmentVars = stringsBox.namedStrings;
761 modifiedDocument = true;
766 CompilerEnvironmentTab()
774 CompilerConfig compiler = loadedCompiler;
775 envVars.namedStrings = compiler.environmentVars;
777 // Was these meant to be false?
778 modifiedDocument = false;//true;
779 compilersTab.modifiedDocument = false;//true;
784 class CompilerOptionsTab : CompilersSubTab
786 background = activeBorder;
789 Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
790 DropBox targetPlatform
792 this, position = { 110, 8 }, size = { 160 };
793 text = "Target Platform", hotKey = altT;
794 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
796 CompilerConfig compiler = loadedCompiler;
799 compiler.targetPlatform = (Platform)row.tag;
800 modifiedDocument = true;
801 compilersTab.modifiedDocument = true;
808 Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
811 this, text = "Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
812 position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
814 bool OnKeyDown(Key key, unichar ch)
816 if((SmartKey)key == enter)
818 DataBox::OnKeyDown(key, ch);
822 return DataBox::OnKeyDown(key, ch);
825 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
835 bool NotifyChanged(bool closingDropDown)
837 CompilerConfig compiler = loadedCompiler;
840 compiler.numJobs = numJobs;
841 modifiedDocument = true;
842 compilersTab.modifiedDocument = true;
850 this, text = "Use ccache", hotKey = altC, position = { 8, 68 };
853 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
855 CompilerConfig compiler = loadedCompiler;
858 compiler.ccacheEnabled = button.checked;
859 modifiedDocument = true;
860 compilersTab.modifiedDocument = true;
868 this, text = "Use distcc", hotKey = altD, position = { 8, 96 };
871 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
873 CompilerConfig compiler = loadedCompiler;
876 distccHosts.disabled = !button.checked;
877 compiler.distccEnabled = button.checked;
878 modifiedDocument = true;
879 compilersTab.modifiedDocument = true;
885 Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
888 this, text = "distcc hosts", hotKey = altH;
889 position = { 88, 120 }, size = { 300 };
891 bool NotifyModified(EditBox editBox)
895 CompilerConfig compiler = loadedCompiler;
896 compiler.distccHosts = editBox.contents;
897 modifiedDocument = true;
898 compilersTab.modifiedDocument = true;
908 for(p = (Platform)1; p < Platform::enumSize; p++)
910 row = targetPlatform.AddRow();
920 CompilerConfig compiler = loadedCompiler;
921 bool disabled = compiler.readOnly;
922 targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
923 numJobs = compiler.numJobs;
924 numJobsBox.Refresh();
925 ccacheEnabled.checked = compiler.ccacheEnabled;
926 distccEnabled.checked = compiler.distccEnabled;
927 distccHosts.disabled = !compiler.distccEnabled;
928 distccHosts.contents = compiler.distccHosts;
930 labelTargetPlatform.disabled = disabled;
931 targetPlatform.disabled = disabled;
934 modifiedDocument = false;
938 class CompilersSubTab : Tab
940 property CompilersTab compilersTab
944 CompilersTab tab = (CompilersTab)master;
945 while(tab && tab._class != class(CompilersTab))
946 tab = (CompilersTab)tab.master;
951 property CompilerConfig loadedCompiler
955 CompilersTab tab = compilersTab;
956 return tab ? tab.activeCompiler : null;
961 class ProjectOptionsTab : GlobalSettingsSubTab
963 background = activeBorder;
966 Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
967 PathBox defaultTargetDir
969 this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
970 text = "Default Target Directory", hotKey = altT;
972 bool NotifyModified(PathBox editBox)
974 modifiedDocument = true;
979 Label defaultIntermediateObjDirLabel { this, position = { 8, 78 }, labeledWindow = defaultIntermediateObjDir };
980 PathBox defaultIntermediateObjDir
982 this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
983 text = "Default Intermediate Objects Directory", hotKey = altI;
985 bool NotifyModified(PathBox editBox)
987 modifiedDocument = true;
993 // COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
994 // of WorkspaceOptionsTab will *not* be called!
995 class GlobalSettingsSubTab : Tab
997 property GlobalSettingsDialog dialog
1001 GlobalSettingsDialog dialog = (GlobalSettingsDialog)master;
1002 while(dialog && dialog._class != class(GlobalSettingsDialog))
1003 dialog = (GlobalSettingsDialog)dialog.master;
1009 class WorkspaceOptionsTab : GlobalSettingsSubTab
1011 background = activeBorder;
1014 Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
1015 DropBox defaultCompilerDropBox
1017 this, position = { 140, 8 }, size = { 220 };
1018 text = "Default Compiler", hotKey = altA;
1020 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1022 modifiedDocument = true;
1029 GlobalSettingsDialog dialog = this.dialog;
1030 if(dialog && dialog.compilersTab.compilerConfigs && dialog.ideSettings)
1033 for(compiler : dialog.ideSettings.compilerConfigs)
1035 row = defaultCompilerDropBox.AddString(compiler.name);
1036 if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
1037 !strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
1038 defaultCompilerDropBox.currentRow = row;
1040 if(!defaultCompilerDropBox.currentRow && defaultCompilerDropBox)
1041 defaultCompilerDropBox.currentRow = defaultCompilerDropBox.firstRow;
1048 defaultCompilerDropBox.Clear();
1049 modifiedDocument = false;
1053 //static define app = ((GuiApplication)__thisModule);