2 import "WorkspaceSettings"
3 import "ProjectTabSettings"
5 // import "SelectorBar"
7 static ProjectConfig config;
8 static Platform platform;
9 static ProjectNode currentNode;
10 static Project project;
12 static String MakeString(const char * s, int len, const char * switchToKeep, int lenSwitchToKeep)
14 String string = new char[len+1];
15 if(s[0] == '-' && switchToKeep && switchToKeep[0])
17 if(strstr(s+1, switchToKeep) == s+1)
19 memcpy(string, s+lenSwitchToKeep+1, len-lenSwitchToKeep-1);
20 string[len-lenSwitchToKeep-1] = '\0';
27 memcpy(string, s, len);
33 class StringListBox : EditBox
35 const char * switchToKeep;
38 textHorzScroll = true;
40 property Array<String> strings
62 Array<String> array { };
64 const char * contents = property::contents;
69 for(c = 0; (ch = contents[c]); c++)
71 if(ch == ' ' && !quoted)
75 if((s = MakeString(contents + start, c - start, switchToKeep, lenSwitchToKeep)))
90 if((s = MakeString(contents + start, c - start, switchToKeep, lenSwitchToKeep)))
98 define dialogTitle = $"Project Settings";
99 static Color unfocusedSelectorColor { 70, 96, 166 };
100 class ProjectSettings : Window
103 background = formColor;
104 borderStyle = sizable;
105 minClientSize = { 650, 520 };
110 property Project project
115 projectTab.project = value;
118 buildTab.SelectNode(project.topNode, false);
120 if(project && project.topNode && project.topNode.name && project.topNode.name[0])
123 get { return ::project; }
126 property ProjectNode projectNode
128 set { buildTab.SelectNode(value, false); }
129 get { return currentNode; }
132 void UpdateDialogTitle()
134 //char * s = PrintString("Project Settings - ", project.topNode.fileName);
136 char * projectName = new char[strlen(project.topNode.name) + 1];
137 const char * nodeName = currentNode && currentNode != project.topNode ? currentNode.name : "";
138 const char * config = buildTab.selectedConfigName;
139 const char * platform = buildTab.selectedPlatformName;
140 char * label = new char[strlen(dialogTitle) + 3 + strlen(project.topNode.name) + 3 +
141 strlen(nodeName) + 2 + strlen(config) + 1 + strlen(platform) + 1 + 1];
142 strcpy(label, dialogTitle);
143 strcat(label, " - ");
144 strcpy(projectName, project.topNode.name);
145 StripExtension(projectName);
146 strcat(label, projectName);
147 if(currentNode && currentNode.type != project)
149 strcat(label, " - ");
150 strcat(label, nodeName);
152 if(strlen(config) || strlen(platform))
156 strcat(label, config);
157 if(strlen(config) && strlen(platform))
160 strcat(label, platform);
173 TabControl prjTabControl
175 this, background = formColor, anchor = { left = 8, top = 4, right = 8, bottom = 38 };
177 ProjectTab projectTab { this, tabControl = prjTabControl };
178 BuildTab buildTab { this, tabControl = prjTabControl };
179 WorkspaceTab workspaceTab { this, tabControl = prjTabControl };
183 this, size = { 80, 22 };
184 anchor = { right = 8, bottom = 8 };
185 text = $"Cancel", hotKey = escape, id = DialogResult::cancel;
187 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
189 if(prjTabControl.curTab.modifiedDocument)
191 DialogResult diagRes = MessageBox
193 type = okCancel, master = ide,
194 text = $"Lose Changes?",
195 contents = $"Are you sure you wish to discard changes made to the build options?"
199 if(prjTabControl.curTab == buildTab)
201 buildTab.RevertChanges();
202 buildTab.modifiedDocument = false;
204 if(prjTabControl.curTab == workspaceTab)
206 workspaceTab.modifiedDocument = false;
208 if(prjTabControl.curTab == projectTab)
210 projectTab.modifiedDocument = false;
212 Destroy(DialogResult::cancel);
216 Destroy(DialogResult::cancel);
222 this, size = { 80, 22 };
223 anchor = { right = 96, bottom = 8 };
224 text = $"OK", isDefault = true;
226 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
228 if(prjTabControl.curTab == buildTab && buildTab.modifiedDocument)
230 buildTab.modifiedDocument = false;
232 project.topNode.modified = true;
233 project.MarkChanges(buildTab.backupNode);
234 ide.projectView.modifiedDocument = true;
235 ide.projectView.Update(null);
237 if(prjTabControl.curTab == workspaceTab && workspaceTab.modifiedDocument)
239 workspaceTab.SaveChanges();
240 workspaceTab.modifiedDocument = false;
242 if(prjTabControl.curTab == projectTab && projectTab.modifiedDocument)
244 projectTab.SaveChanges();
245 projectTab.modifiedDocument = false;
247 Destroy(DialogResult::ok);
255 prjTabControl.curTab = buildTab;
257 ((DirectoriesBox)buildTab.compilerTab.includeDirs.editor).baseBrowsePath = project.topNode.path;
258 ((DirectoriesBox)buildTab.linkerTab.libraryDirs.editor).baseBrowsePath = project.topNode.path;
264 #define OPTION(x) ((uint)(uintptr)(&((ProjectOptions)0).x))
266 // TOFIX: USING T INSTEAD OF Z HERE CAUSED US SOME CONFLICTS WITH T IN Array TEMPLATES
268 // the BlendFileConfigPlatformProjectOptions function and the GenericOptionTools class
269 // contain code that is closely matched to the following code
270 // output changing modification should be mirrored in both implementations
271 class OptionBox<class Z> : CommonControl
273 bool mergeValues, configReplaces;
282 property Window editor
288 editor.OnRightButtonDown = OptionBox_OnRightButtonDown;
289 chainKeyDown = (void *)editor.OnKeyDown;
290 editor.OnKeyDown = OptionBox_OnKeyDown;
294 property bool visible { set { editor.visible = value; } get { return editor.visible; } }
295 property Window parent { set { editor.parent = value; Window::parent = value; master = value; editor.id = (int64)(intptr)this; } }
296 property Point position { set { editor.position = value; } }
297 property Size size { set { editor.size = value; } }
298 property Anchor anchor { set { editor.anchor = value; } }
299 property Key hotKey { set { editor.hotKey = value; } }
300 property const char * text { set { editor.caption = value; Window::caption = value; } }
310 bool NotifySelect(MenuItem selection, Modifiers mods)
312 OptionBox ob = (OptionBox)(intptr)id;
313 if(eClass_IsDerived(ob._class, class(CheckBoxForEnumOptionBox)))
316 for(slave = ob.master.firstSlave; slave; slave = slave.nextSlave)
318 if(eClass_IsDerived(slave._class, class(CheckBoxForEnumOptionBox)) &&
319 ((OptionBox)slave).option == ob.option)
320 ((OptionBox)slave).Unset();
329 bool Window::OptionBox_OnRightButtonDown(int x, int y, Modifiers mods)
331 OptionBox ob = (OptionBox)(intptr)id;
332 GuiApplication app = ((GuiApplication)__thisModule.application);
334 PopupMenu { null, this, menu = ob.clearMenu,
335 position = { absPosition.x + clientStart.x + x - app.desktop.position.x, absPosition.y + clientStart.y + y - app.desktop.position.y } }.Create();
339 bool Window::OptionBox_OnKeyDown(Key key, unichar ch)
341 OptionBox ob = (OptionBox)(intptr)id;
342 if(key == Key { del, ctrl = true } || key == Key { keyPadDelete, ctrl = true })
347 return ob.chainKeyDown ? ((bool(*)(Window, Key, unichar)) ob.chainKeyDown)(this, key, ch) : true;
350 // code: 0 = not set anywhere, 1 = overridden here, 2 = inherited
351 void SetAttribs(int code)
356 for(c = Window::parent.firstChild; c; c = c.next)
358 if(eClass_IsDerived(c._class, class(Label)))
361 if(label.labeledWindow == this)
369 for(c = editor.firstChild; c; c = c.next)
371 if(eClass_IsDerived(c._class, class(Label)))
378 // control.foreground = foreground;
380 if(code == 0 || code == 1)
382 editor.font = { editor.font.faceName, editor.font.size, bold = (code == 1) };
383 editor.background = white;
387 Color foreground = 0x0F3F66;
388 int r = foreground.r, g = foreground.g, b = foreground.b;
392 editor.font = { editor.font.faceName, editor.font.size };
394 r = (int)(alpha * r + src.r * (1 - alpha));
395 g = (int)(alpha * g + src.g * (1 - alpha));
396 b = (int)(alpha * b + src.b * (1 - alpha));
398 r = Max(0,Min(255,r));
399 g = Max(0,Min(255,g));
400 b = Max(0,Min(255,b));
402 editor.background = Color { (byte) r, (byte) g, (byte) b };
407 label.font = { editor.font.faceName, editor.font.size, bold = (code == 1) };
408 //label.foreground = foreground;
412 virtual void FinalizeLoading();
414 virtual void LoadOption(ProjectOptions options);
415 virtual void RetrieveOption(ProjectOptions options, bool isCfgOrPlt);
416 virtual void UnsetOption(ProjectOptions options)
419 *(Z*)((byte *)options + option) = value;
422 virtual bool OptionSet(ProjectOptions options)
424 // TOFIX: If you get a crash here, it might be because JSON.ec must be after ProjectConfig.ec in the project files
425 // JSON.ec must also be before ProjectSettings.ec in the project files
426 if(*(Z*)((byte *)options + option))
430 // BUG: OptionCheck = OptionSet; // Overrides derived classes OptionCheck ?
432 virtual bool OptionCheck(ProjectOptions options)
434 return OptionSet(options);
437 void MarkBuildTabModified()
439 BuildTab buildTab = (BuildTab)master;
440 while(buildTab && buildTab._class != class(BuildTab))
441 buildTab = (BuildTab)buildTab.master;
442 if(buildTab) buildTab.modifiedDocument = true;
447 const char * platformName = platform ? platform.OnGetString(0,0,0) : null;
448 MarkBuildTabModified();
452 ProjectConfig c = null;
453 if(currentNode.configurations)
455 for(i : currentNode.configurations; !strcmpi(i.name, config.name)) { c = i; break; }
460 PlatformOptions p = null;
463 for(i : c.platforms; !strcmpi(i.name, platformName)) { p = i; break; }
466 if(p.options && OptionSet(p.options))
467 UnsetOption(p.options);
468 if(p.options && p.options.isEmpty)
472 Iterator<PlatformOptions> it { c.platforms };
480 if(!c.platforms.count)
486 if(c.options && OptionSet(c.options))
487 UnsetOption(c.options);
488 if(c.options && c.options.isEmpty)
491 // DON'T DELETE PROJECT CONFIGS HERE!
492 if(!c.options && currentNode != project.topNode)
494 Iterator<ProjectConfig> it { currentNode.configurations };
502 if(!currentNode.configurations.count)
503 currentNode.configurations = null;
510 PlatformOptions p = null;
511 if(currentNode.platforms)
513 for(i : currentNode.platforms; !strcmpi(i.name, platformName)) { p = i; break; }
516 if(p.options && OptionSet(p.options))
517 UnsetOption(p.options);
518 if(p.options && p.options.isEmpty)
522 Iterator<PlatformOptions> it { currentNode.platforms };
530 if(!currentNode.platforms.count)
531 currentNode.platforms = null;
537 if(currentNode.options && OptionSet(currentNode.options))
538 UnsetOption(currentNode.options);
539 if(currentNode.options && currentNode.options.isEmpty)
541 // delete currentNode.options;
542 // Property will free:
543 currentNode.options = null;
549 void FigureOutInherited()
552 const char * platformName = platform ? platform.OnGetString(0,0,0) : null;
553 bool skipped = false;
554 for(node = currentNode; node; node = node.parent)
556 bool configXplatformSet = false;
557 if(config && node.configurations)
559 for(c : node.configurations; !strcmpi(c.name, config.name))
561 if(platform && c.platforms)
563 for(p : c.platforms; !strcmpi(p.name, platformName))
565 if(p.options && OptionSet(p.options))
568 LoadOption(p.options);
570 configXplatformSet = true;
576 if(skipped && c.options && OptionSet(c.options))
578 LoadOption(c.options);
579 if(configReplaces) return;
585 if((!configXplatformSet || !configReplaces) && platform && node.platforms)
587 for(p : node.platforms; !strcmpi(p.name, platformName))
589 if(skipped && p.options && OptionSet(p.options))
590 LoadOption(p.options);
595 if(skipped && node.options && OptionSet(node.options))
596 LoadOption(node.options);
597 else if(skipped && !node.parent)
605 const char * platformName = platform ? platform.OnGetString(0,0,0) : null;
606 MarkBuildTabModified();
609 ProjectConfig c = null;
610 if(!currentNode.configurations) currentNode.configurations = { };
611 for(i : currentNode.configurations; !strcmpi(i.name, config.name)) { c = i; break; }
613 currentNode.configurations.Add(c = ProjectConfig { name = CopyString(config.name) });
616 PlatformOptions p = null;
617 if(!c.platforms) c.platforms = { };
619 for(i : c.platforms; !strcmpi(i.name, platformName)) { p = i; break; }
621 c.platforms.Add(p = PlatformOptions { CopyString(platformName) });
623 if(!p.options) p.options = { };
624 RetrieveOption(p.options, true);
625 if(!mergeValues) SetAttribs(1);
628 if(!c.options) c.options = { };
629 RetrieveOption(c.options, true);
630 if(!mergeValues) SetAttribs(1);
635 PlatformOptions p = null;
636 if(!currentNode.platforms) currentNode.platforms = { };
637 for(i : currentNode.platforms; !strcmpi(i.name, platformName)) { p = i; break; }
639 currentNode.platforms.Add(p = PlatformOptions { CopyString(platformName) });
641 if(!p.options) p.options = { };
642 RetrieveOption(p.options, true);
643 if(!mergeValues) SetAttribs(1);
647 if(!currentNode.options) currentNode.options = { };
648 RetrieveOption(currentNode.options, false);
649 if(!mergeValues) SetAttribs((currentNode.parent || OptionCheck(currentNode.options)) ? 1 : 0);
655 const char * platformName = platform ? platform.OnGetString(0,0,0) : null;
656 bool setAttribs = false;
657 for(node = currentNode; node; node = node.parent)
659 bool configXplatformSet = false;
660 ProjectConfig nodeConfig = null;
661 if(config && node.configurations)
663 for(c : node.configurations; !strcmpi(c.name, config.name))
665 if(platform && c.platforms)
667 for(p : c.platforms; !strcmpi(p.name, platformName))
669 if(p.options && (mergeValues ? OptionCheck(p.options) : OptionSet(p.options)))
671 LoadOption(p.options);
672 if(!setAttribs) { setAttribs = true; SetAttribs((node == currentNode) ? 1 : 2); }
673 if(!mergeValues) { FinalizeLoading(); return; }
674 configXplatformSet = true;
684 if(platform && node.platforms && (!configXplatformSet || !configReplaces))
686 for(p : node.platforms; !strcmpi(p.name, platformName))
688 if(p.options && (mergeValues ? OptionCheck(p.options) : OptionSet(p.options)))
690 LoadOption(p.options);
691 if(!setAttribs) { setAttribs = true; SetAttribs((node == currentNode && !config) ? 1 : 2); }
692 if(!mergeValues) { FinalizeLoading(); return; }
698 if(nodeConfig && nodeConfig.options && ((mergeValues && !configReplaces) ? OptionCheck(nodeConfig.options) : OptionSet(nodeConfig.options)))
700 LoadOption(nodeConfig.options);
701 if(!setAttribs) { setAttribs = true; SetAttribs((node == currentNode && !platform) ? 1 : 2); }
702 if(!mergeValues || configReplaces) { FinalizeLoading(); return; }
705 if(node.options && (mergeValues ? OptionCheck(node.options) : OptionSet(node.options)))
707 LoadOption(node.options);
708 if(!node.parent && !OptionCheck(node.options))
710 if(!setAttribs) { setAttribs = true; SetAttribs(0); }
714 if(!setAttribs) { setAttribs = true; SetAttribs((node == currentNode && !config && !platform) ? 1 : 2); }
716 if(!mergeValues) { FinalizeLoading(); return; }
718 else if(!node.parent)
721 if(!setAttribs) { setAttribs = true; SetAttribs(0); }
722 if(!mergeValues) { FinalizeLoading(); return; }
729 class StringOptionBox : OptionBox<String>
733 bool NotifyModified(EditBox editBox)
735 ((OptionBox)(intptr)editBox.id).Retrieve();
739 textHorzScroll = true;
742 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
744 String * string = (String*)((byte *)options + option);
745 if(*string) delete *string;
746 *string = CopyString(((EditBox)editor).contents);
749 void LoadOption(ProjectOptions options)
751 ((EditBox)editor).contents = options ? *(String*)((byte *)options + option) : "";
752 ((EditBox)editor).Deselect();
755 bool OptionCheck(ProjectOptions options)
757 String string = *(String*)((byte *)options + option);
758 return string && string[0];
761 void UnsetOption(ProjectOptions options)
763 delete *(String*)((byte *)options + option);
767 class PathOptionBox : OptionBox<String>
769 bool Window::EditBoxORB(int x, int y, Modifiers mods)
771 Window parent = this.parent;
772 x += clientStart.x + position.x;
773 y += clientStart.y + position.y;
774 return ((OptionBox)this).OptionBox_OnRightButtonDown(parent, x, y, mods);
779 typeExpected = directory, browseDialog = { };
780 editBox.OnRightButtonDown = (void *)EditBoxORB;
782 bool NotifyModified(PathBox pathBox)
784 FixPathOnPathBoxNotifyModified(pathBox);
785 ((OptionBox)(intptr)pathBox.id).Retrieve();
790 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
792 String * string = (String*)((byte *)options + option);
793 String slashPath = ((PathBox)editor).slashPath;
794 if(*string) delete *string;
795 *string = CopyString(slashPath);//(slashPath && slashPath[0]) ? CopyString(slashPath) : null;
798 void LoadOption(ProjectOptions options)
800 ((PathBox)editor).path = options ? *(String*)((byte *)options + option) : "";
801 ((PathBox)editor).Deselect();
804 bool OptionCheck(ProjectOptions options)
806 String string = *(String*)((byte *)options + option);
807 return string && string[0];
810 void UnsetOption(ProjectOptions options)
812 delete *(String*)((byte *)options + option);
816 class MultiStringOptionBox : OptionBox<Array<String>>
821 caseSensitive = true;
823 virtual Array<String> GetStrings();
824 virtual void SetStrings(Array<String> value);
826 Array<String> tempStrings;
828 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
830 Array<String> newStrings = GetStrings();
831 Array<String> * strings = (Array<String>*)((byte *)options + option);
832 if(*strings) { strings->Free(); delete *strings; }
836 Iterator<String> it { newStrings };
838 FigureOutInherited();
846 for(i : tempStrings; i && s && !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
847 if(found && (!configReplaces || platform)) // ADDED || platform here...
857 if(!mergeValues || (configReplaces && isCfgOrPlt && !platform))
858 *strings = newStrings;
861 *strings = (newStrings && newStrings.count) ? newStrings : null;
862 if(newStrings && !newStrings.count) delete newStrings;
868 void LoadOption(ProjectOptions options)
872 Array<String> strings = options ? *(Array<String>*)((byte *)options + option) : null;
880 for(i : tempStrings; i && s && !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
881 if(!found) tempStrings.Add(s);
887 SetStrings(options ? *(Array<String>*)((byte *)options + option) : null);
891 void FinalizeLoading()
895 SetStrings(tempStrings);
900 bool OptionSet(ProjectOptions options)
902 Array<String> strings = *(Array<String>*)((byte *)options + option);
903 if(mergeValues && !configReplaces)
905 return strings && strings.count;
908 return strings != null;
911 bool OptionCheck(ProjectOptions options)
913 Array<String> strings = *(Array<String>*)((byte *)options + option);
914 return strings && strings.count;
917 void UnsetOption(ProjectOptions options)
919 Array<String> * strings = (Array<String>*)((byte *)options + option);
920 if(*strings) { strings->Free(); delete *strings; }
924 class StringArrayOptionBox : MultiStringOptionBox
926 editor = StringListBox
928 bool NotifyModified(EditBox editBox)
930 ((OptionBox)(intptr)editBox.id).Retrieve();
935 // NO VIRTUAL PROPERTIES YET...
936 Array<String> GetStrings() { return ((StringListBox)editor).strings; }
937 void SetStrings(Array<String> value) { ((StringListBox)editor).strings = value; }
939 property const char * switchToKeep { set { ((StringListBox)editor).switchToKeep = value; ((StringListBox)editor).lenSwitchToKeep = strlen(value); } };
942 class StringsArrayOptionBox : MultiStringOptionBox
952 bool NotifyModified(StringsBox stringsBox)
954 ((OptionBox)(intptr)stringsBox.id).Retrieve();
959 Array<String> GetStrings() { return ((StringsBox)editor).strings; }
960 void SetStrings(Array<String> value) { ((StringsBox)editor).strings = value; }
963 bool eString_IsPathRelatedTo(char * path, char * to)
967 char pathPart[MAX_FILENAME], pathRest[MAX_LOCATION] = "";
968 char toPart[MAX_FILENAME], toRest[MAX_LOCATION] = "";
969 SplitDirectory(path, pathPart, pathRest);
970 SplitDirectory(to, toPart, toRest);
971 if(!fstrcmp(pathPart, toPart))
973 if(pathRest[0] && toRest[0])
975 SplitDirectory(pathRest, pathPart, pathRest);
976 SplitDirectory(toRest, toPart, toRest);
977 if(!fstrcmp(pathPart, toPart))
985 static void FixPathOnPathBoxNotifyModified(PathBox pathBox)
988 char path[MAX_LOCATION];
989 ValidPathBufCopy(path, pathBox.path);
991 if(len && !(path[0] == '.' && (len == 1 || (len == 2 && path[1] == DIR_SEP) || (len > 1 && path[1] == '.'))))
993 char cwdBackup[MAX_LOCATION];
996 GetWorkingDir(cwdBackup, sizeof(cwdBackup));
997 ChangeWorkingDir(project.topNode.path);
1001 ChangeWorkingDir(cwdBackup);
1002 if(eString_IsPathRelatedTo(path, project.topNode.path))
1003 MakePathRelative(path, project.topNode.path, path);
1008 if(len>1 && path[len-1] == DIR_SEP)
1010 pathBox.path = path;
1013 class DirsArrayOptionBox : MultiStringOptionBox
1016 property const char * switchToKeep { set { switchToKeep = value; lenSwitchToKeep = strlen(value); } };
1018 const char * switchToKeep;
1019 int lenSwitchToKeep;
1021 editor = DirectoriesBox
1024 bool NotifyModified(DirectoriesBox dirsBox)
1026 const char * switchToKeep = ((DirsArrayOptionBox)(intptr)dirsBox.id).switchToKeep;
1027 if(switchToKeep && switchToKeep[0])
1029 bool change = false;
1030 int lenSwitchToKeep = ((DirsArrayOptionBox)(intptr)dirsBox.id).lenSwitchToKeep;
1031 Array<String> dirs { };
1032 Array<String> previousDirs = dirsBox.strings;
1033 for(d : previousDirs)
1036 char * buffer = new char[strlen(d)+64];
1037 char * tokens[1024];
1040 count = Tokenize(buffer, sizeof(tokens)/sizeof(tokens[0]), tokens, (BackSlashEscaping)false);
1041 for(c=0; c<count; c++)
1043 if(tokens[c][0] == '-')
1045 if(strstr(tokens[c]+1, switchToKeep) == tokens[c]+1)
1046 tokens[c] += lenSwitchToKeep+1;
1048 tokens[c][0] = '\0';
1051 dirs.Add(CopyString(tokens[c]));
1056 dirsBox.strings = dirs;
1059 previousDirs.Free();
1060 delete previousDirs;
1062 ((OptionBox)(intptr)dirsBox.id).Retrieve();
1066 bool NotifyPathBoxModified(DirectoriesBox dirsBox, PathBox pathBox)
1068 FixPathOnPathBoxNotifyModified(pathBox);
1073 Array<String> GetStrings() { return ((DirectoriesBox)editor).strings; }
1074 void SetStrings(Array<String> value) { ((DirectoriesBox)editor).strings = value; }
1077 class BoolOptionBox : OptionBox<SetBool>
1083 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1085 ((OptionBox)(intptr)button.id).Retrieve();
1090 bool OptionCheck(ProjectOptions options)
1092 return *(SetBool*)((byte *)options + option) == true;
1095 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
1097 bool checked = ((Button)editor).checked;
1098 *(SetBool*)((byte *)options + option) = checked ? true :
1099 ((currentNode.parent || isCfgOrPlt) ? false : unset);
1102 void LoadOption(ProjectOptions options)
1104 ((Button)editor).checked = options && (*(SetBool*)((byte *)options + option) == true);
1108 class CheckBoxForEnumOptionBox : OptionBox
1114 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1116 ((OptionBox)(intptr)button.id).Retrieve();
1119 for(slave = master.firstSlave; slave; slave = slave.nextSlave)
1121 if(eClass_IsDerived(slave._class, class(CheckBoxForEnumOptionBox)) &&
1122 slave != (Window)(intptr)button.id &&
1123 ((OptionBox)slave).option == ((OptionBox)(intptr)button.id).option)
1124 ((OptionBox)slave).Load();
1132 void LoadOption(ProjectOptions options)
1134 Z value = options ? *(Z*)((byte *)options + option) : (Z)0;
1135 ((Button)editor).checked = value == enumValue;
1138 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
1140 Button checkBox = (Button)editor;
1141 if(checkBox.checked)
1142 *(Z*)((byte *)options + option) = enumValue;
1146 class BuildBitDepthOptionBox : CheckBoxForEnumOptionBox<BuildBitDepth> { }
1148 class DropOptionBox : OptionBox
1152 bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
1154 ((OptionBox)(intptr)dropBox.id).Retrieve();
1159 void LoadOption(ProjectOptions options)
1161 DropBox dropBox = (DropBox)editor;
1162 Z value = options ? *(Z*)((byte *)options + option) : (Z)0;
1163 dropBox.currentRow = value ? dropBox.FindRow((int64)value) : dropBox.firstRow;
1166 void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
1168 DropBox dropBox = (DropBox)editor;
1169 DataRow row = dropBox.currentRow;
1170 Z value = (Z)(row ? row.tag : 0);
1171 *(Z*)((byte *)options + option) = value;
1175 class TargetTypeDB : DropOptionBox<TargetTypes>
1181 row = ((DropBox)editor).AddRow();
1182 row.tag = TargetTypes::executable;
1183 row.SetData(null, $"Executable");
1185 row = ((DropBox)editor).AddRow();
1186 row.tag = TargetTypes::sharedLibrary;
1187 row.SetData(null, $"Shared Library");
1189 row = ((DropBox)editor).AddRow();
1190 row.tag = TargetTypes::staticLibrary;
1191 row.SetData(null, $"Static Library");
1194 bool OptionCheck(ProjectOptions options)
1196 TargetTypes value = *(TargetTypes*)((byte *)options + option);
1197 return value && value != executable;
1201 class OptimizationDB : DropOptionBox<OptimizationStrategy>
1206 row = ((DropBox)editor).AddRow();
1207 row.tag = OptimizationStrategy::none;
1208 row.SetData(null, $"None");
1210 row = ((DropBox)editor).AddRow();
1211 row.tag = OptimizationStrategy::speed;
1212 row.SetData(null, $"For Speed (-O2)");
1214 row = ((DropBox)editor).AddRow();
1215 row.tag = OptimizationStrategy::size;
1216 row.SetData(null, $"For Size (-Os)");
1219 bool OptionCheck(ProjectOptions options)
1221 OptimizationStrategy value = *(OptimizationStrategy*)((byte *)options + option);
1222 return value && value != none;
1226 class WarningsDB : DropOptionBox<WarningsOption>
1231 row = ((DropBox)editor).AddRow();
1232 row.tag = WarningsOption::normal;
1233 row.SetData(null, $"Normal");
1235 row = ((DropBox)editor).AddRow();
1236 row.tag = WarningsOption::none;
1237 row.SetData(null, $"None");
1239 row = ((DropBox)editor).AddRow();
1240 row.tag = WarningsOption::all;
1241 row.SetData(null, $"All");
1244 bool OptionCheck(ProjectOptions options)
1246 WarningsOption value = *(WarningsOption*)((byte *)options + option);
1247 return value && value != none;
1251 void DrawStipple(Surface surface, Size clientSize)
1255 int x2 = clientSize.w - 1;
1256 int y2 = clientSize.h - 1;
1257 if((x2 - x1) & 1) x2--;
1258 if((y2 - y1) & 1) y2--;
1260 surface.LineStipple(0x5555);
1261 surface.Rectangle(x1, y1, x2, y2);
1262 surface.LineStipple(0);
1265 class BuildTab : Tab
1268 background = formColor;
1271 ProjectNode backupNode;
1272 String activeConfigName;
1274 ProjectNode lastSelectedNode;
1276 property const char * selectedConfigName
1282 SelectorButton button = (SelectorButton)configSelector.selectedButton;
1283 if(button && button.id)
1285 ProjectConfig config = (ProjectConfig)(intptr)button.id;
1293 property const char * selectedPlatformName
1299 SelectorButton button = (SelectorButton)platformSelector.selectedButton;
1300 if(button && button.id)
1302 Platform platform = (Platform)button.id;
1303 const char * platformName = platform ? platform.OnGetString(0,0,0) : null; // all these platformName are leaking, no?
1304 return platformName;
1311 Label labelConfigurations
1313 this, anchor = { left = 8, top = 14 }, labeledWindow = configSelector;
1315 void OnRedraw(Surface surface)
1317 Label::OnRedraw(surface);
1318 if(labeledWindow.active) DrawStipple(surface, clientSize);
1321 SelectorBar configSelector
1323 this, text = $"Configurations: ", anchor = { left = 98, top = 8, right = 54 }; size = { 0, 26 };
1325 direction = horizontal, scrollable = true;
1327 bool OnKeyDown(Key key, unichar ch)
1331 ((BuildTab)parent).createConfig.NotifyClicked(parent, ((BuildTab)parent).createConfig, 0, 0, 0);
1336 ((BuildTab)parent).deleteConfig.NotifyClicked(parent, ((BuildTab)parent).deleteConfig, 0, 0, 0);
1339 return SelectorBar::OnKeyDown(key, ch);
1342 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
1344 ((BuildTab)master).labelConfigurations.Update(null);
1351 parent = this, bevelOver = true, inactive = true;
1353 anchor = { top = 10, right = 31 };
1354 hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
1356 bool NotifyClicked(Button b, int x, int y, Modifiers mods)
1358 char tmp[MAX_F_STRING];
1359 ProjectConfig config;
1360 EditableSelectorButton button;
1362 FindUniqueConfigName("NewConfig", false, tmp);
1366 makingModified = true;
1367 compilingModified = true;
1368 linkingModified = true;
1369 name = CopyString(tmp);
1372 // objectsDirectory = /*CopyString(*/defaultObjDirExpression/*)*/;
1375 if(!project.topNode.configurations) project.topNode.configurations = { };
1376 project.topNode.configurations.Add(config);
1378 targetType = project.config.options.targetType;
1380 config.options.targetFileName = project.moduleName;
1381 config.options.targetDir.dir = "";
1382 config.options.objectsDirectory = defaultObjDirExpression);
1383 config.options.debug = true;
1384 config.options.optimization = none;
1385 config.options.warnings = all;
1390 configSelector, renameable = true, master = this, text = config.name, id = (int64)(intptr)config;
1391 NotifyClicked = ConfigClicked, OnRename = ConfigOnRename;
1394 configSelector.Select(button);
1395 modifiedDocument = true;
1399 /*Button duplicateConfig
1401 parent = this, bevelOver = true, inactive = true;
1403 anchor = { top = 10, right = 31 };
1404 hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
1408 parent = this, bevelOver = true, inactive = true;
1410 anchor = { top = 10, right = 8 };
1411 hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
1413 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
1417 String title = PrintString($"Delete ", config.name, $" Configuration");
1418 String msg = PrintString($"Are you sure you wish to delete the ", config.name, $" configuration?");
1419 if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
1421 //Iterator<Window> it { configSelector.controls };
1422 ProjectConfig configToDelete = config;
1426 SelectorButton button = (SelectorButton)it.data;
1427 if((ProjectConfig)button.id == config)
1429 button.visible = false;
1434 button = (SelectorButton)it.data;
1435 config = (ProjectConfig)button.id;
1436 configSelector.Select(button);
1442 SelectorButton button = configSelector.FindButtonByID((int64)(intptr)configToDelete);
1444 configSelector.RemoveButton(button);
1446 project.topNode.DeleteConfig(configToDelete);
1448 modifiedDocument = true;
1457 Label labelPlatforms
1459 this, anchor = { left = 8, top = 44 }, labeledWindow = platformSelector;
1461 void OnRedraw(Surface surface)
1463 Label::OnRedraw(surface);
1464 if(labeledWindow.active) DrawStipple(surface, clientSize);
1467 SelectorBar platformSelector
1469 this, text = $"Platforms: ", anchor = { left = 64, top = 38, right = 54 }; size = { 0, 26 };
1471 direction = horizontal, scrollable = true;
1473 bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
1475 ((BuildTab)master).labelPlatforms.Update(null);
1480 TabControl buildTabControl
1482 this, background = formColor, anchor = { left = 8, top = 64, right = 8, bottom = 8 };
1483 curTab = compilerTab;
1485 CompilerTab compilerTab { this, tabControl = buildTabControl };
1486 LinkerTab linkerTab { this, tabControl = buildTabControl };
1487 BuilderTab builderTab { this, tabControl = buildTabControl };
1490 this, font = { font.faceName, font.size, italic = true }, stayOnTop = true,
1491 text = $"(Right click or press Ctrl-Del to revert an option to inherited value)", anchor = { top = 72, right = 16 }
1494 void FindUniqueConfigName(const char * baseName, bool startWithNumber, char * output)
1497 char tmp[MAX_F_STRING];
1499 sprintf(tmp, "%s%d", baseName, num);
1501 strcpy(tmp, baseName);
1504 ProjectConfig config = null;
1505 for(c : project.topNode.configurations)
1506 { // TOFIX: Error when omitting these brackets, c not found
1507 if(c.name && !strcmp(c.name, tmp))
1516 sprintf(tmp, "%s%d", baseName, num);
1521 strcpy(output, tmp);
1524 bool PlatformClicked(Button clickedButton, int x, int y, Modifiers mods)
1526 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
1528 platform = (Platform)clickedButton.id;
1530 // Load Settings Into Dialog
1531 compilerTab.LoadSettings();
1532 linkerTab.LoadSettings();
1533 builderTab.LoadSettings();
1536 buildTabControl.Activate();
1538 if(compilerTab.rightPaneHeader.visible)
1539 compilerTab.rightPaneHeader.Update(null);
1540 ((ProjectSettings)master).UpdateDialogTitle();
1547 platformSelector.DestroyChildren();
1548 configSelector.DestroyChildren();
1550 delete activeConfigName;
1553 bool ConfigOnRename(EditableSelectorButton button, char * * oldName, char * * newName)
1558 for(c = 0; (ch = (*newName)[c]); c++)
1560 if(ch == '_' || isalpha(ch) || (isdigit(ch) && d))
1561 (*newName)[d++] = ch;
1567 for(c : project.topNode.configurations; c != config)
1569 if(!strcmpi(c.name, *newName))
1575 if(found || !(*newName)[0])
1577 char tmp[MAX_F_STRING];
1578 char * tmpName = config.name;
1580 FindUniqueConfigName("NewConfig", false, tmp);
1581 config.name = tmpName;
1583 *newName = CopyString(tmp);
1587 if(activeConfigName && !strcmp(activeConfigName, *oldName))
1589 delete activeConfigName;
1590 activeConfigName = CopyString(*newName);
1593 project.topNode.RenameConfig(config.name, *newName);
1595 modifiedDocument = true;
1600 bool ConfigClicked(Button clickedButton, int x, int y, Modifiers mods)
1602 if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
1604 config = (ProjectConfig)(intptr)clickedButton.id;
1606 // Load Settings Into Dialog
1607 compilerTab.LoadSettings();
1608 linkerTab.LoadSettings();
1609 builderTab.LoadSettings();
1611 deleteConfig.disabled = (clickedButton._class == class(SelectorButton));
1614 buildTabControl.Activate();
1616 compilerTab.fileList.Update(null);
1617 if(compilerTab.rightPaneHeader.visible)
1618 compilerTab.rightPaneHeader.Update(null);
1619 ((ProjectSettings)master).UpdateDialogTitle();
1624 void SelectNode(ProjectNode node, bool ignoreAsLastSelection)
1626 if(node != currentNode)
1628 Window ac = compilerTab.rightPane.activeChild;
1629 bool prevNodeRes = currentNode ? currentNode.isInResources : false;
1632 if(!node) node = project.topNode;
1634 newNodeRes = node.isInResources;
1637 if(!ignoreAsLastSelection)
1638 lastSelectedNode = node;
1640 ((ProjectSettings)master).UpdateDialogTitle();
1641 if(node.type == project)
1643 compilerTab.rightPaneHeader.visible = false;
1647 compilerTab.rightPaneHeader.id = (int64)(intptr)node;
1648 compilerTab.rightPaneHeader.Update(null);
1649 compilerTab.rightPaneHeader.visible = true;
1653 DataRow row = compilerTab.fileList.FindSubRow((int64)(intptr)currentNode);
1656 compilerTab.fileList.currentRow = row;
1657 while((row = row.parent))
1658 row.collapsed = false;
1662 if(prevNodeRes != newNodeRes)
1664 compilerTab.labelObjDir.visible = !newNodeRes;
1665 compilerTab.objDir.visible = !newNodeRes;
1666 compilerTab.excludeFromBuild.visible = !newNodeRes;
1667 compilerTab.labelPreprocessorDefs.visible = !newNodeRes;
1668 compilerTab.preprocessorDefs.visible = !newNodeRes;
1669 compilerTab.labelDefaultNameSpace.visible = !newNodeRes;
1670 compilerTab.defaultNameSpace.visible = !newNodeRes;
1671 compilerTab.strictNameSpaces.visible = !newNodeRes;
1672 compilerTab.memoryGuard.visible = !newNodeRes;
1673 compilerTab.noLineNumbers.visible = !newNodeRes;
1674 compilerTab.debug.visible = !newNodeRes;
1675 compilerTab.labelWarnings.visible = !newNodeRes;
1676 compilerTab.warnings.visible = !newNodeRes;
1677 compilerTab.profiling.visible = !newNodeRes;
1678 compilerTab.labelOptimization.visible = !newNodeRes;
1679 compilerTab.optimization.visible = !newNodeRes;
1680 compilerTab.fastMath.visible = !newNodeRes;
1681 compilerTab.labelIncludeDirs.visible = !newNodeRes;
1682 compilerTab.includeDirs.visible = !newNodeRes;
1685 if(node == project.topNode)
1687 compilerTab.objDir.visible = true;
1688 compilerTab.labelObjDir.visible = true;
1690 compilerTab.excludeFromBuild.visible = false;
1694 compilerTab.objDir.visible = false;
1695 compilerTab.labelObjDir.visible = false;
1697 compilerTab.excludeFromBuild.visible = (node != project.resNode);
1700 // Load Settings Into Dialog
1701 compilerTab.LoadSettings();
1702 linkerTab.LoadSettings();
1703 builderTab.LoadSettings();
1709 if(ac == compilerTab.excludeFromBuild.editor)
1710 ac = compilerTab.objDir.editor;
1711 else if(compilerTab.excludeFromBuild.editor.visible)
1712 ac = compilerTab.excludeFromBuild.editor;
1719 void CreateConfigButtons()
1721 // Create Config Buttons
1724 configSelector, master = this, text = $"Common", id = 0; font = { font.faceName, font.size, true };
1726 NotifyClicked = ConfigClicked;
1731 if(project.topNode.configurations)
1733 for(c : project.topNode.configurations)
1735 EditableSelectorButton button
1737 configSelector, master = this, renameable = true, text = c.name, id = (int64)(intptr)c;
1738 NotifyClicked = ConfigClicked, OnRename = ConfigOnRename;
1747 SelectorButton button;
1749 activeConfigName = project.config ? CopyString(project.config.name) : null;
1751 compilerTab.AddNode(project.topNode, null);
1753 CreateConfigButtons();
1755 platformButton = button =
1757 platformSelector, master = this, text = $"Common", id = 0; font = { font.faceName, font.size, true };
1758 NotifyClicked = PlatformClicked; checked = true;
1763 for(p = (Platform)1; p < Platform::enumSize; p++)
1765 SelectorButton button
1767 platformSelector, master = this, text = p.OnGetString(0,0,0), id = (int64)p;
1768 NotifyClicked = PlatformClicked;
1772 SelectorButton platformButton;
1776 // Backup Current Settings
1777 backupNode = project.topNode.Backup();
1779 buildTabControl.Activate();
1782 Iterator<Window> it { configSelector.controls };
1785 SelectorButton configButton = (SelectorButton)it.data;
1786 ProjectConfig buttonConfig = (ProjectConfig)(intptr)configButton.id;
1787 if(buttonConfig == project.config)
1789 configButton.Activate();
1790 configButton.checked = true;
1791 ConfigClicked(configButton, 0, 0, 0);
1798 platformButton.MakeActive();
1799 platformButton = null;
1808 lastSelectedNode = null;
1810 project.config = null;
1812 /* // THIS IS NOW AUTOMATED WITH A project CHECK IN ProjectNode
1813 project.configurations = project.topNode.configurations;
1814 project.platforms = project.topNode.platforms;
1815 project.options = project.topNode.options;
1818 if(project.topNode.configurations)
1820 for(c : project.topNode.configurations)
1822 if(!strcmpi(c.name, activeConfigName))
1831 List<ProjectConfig> configs = project.topNode.configurations;
1832 if(configs && configs.count)
1833 project.config = configs[0];
1836 ide.UpdateToolBarActiveConfigs(false);
1839 void RevertChanges()
1841 String configName = config ? CopyString(config.name) : null;
1843 // Revert to saved project options
1844 project.topNode.Revert(backupNode);
1846 configSelector.DestroyChildren();
1847 CreateConfigButtons();
1849 // Reselect Configuration
1852 Iterator<Window> it { configSelector.controls };
1855 Button button = (Button)it.data;
1856 ProjectConfig c = (ProjectConfig)(intptr)button.id;
1857 if(c && !strcmp(c.name, configName))
1861 button.checked = true;
1862 ConfigClicked(button, 0,0, 0);
1868 SelectNode(project.topNode, false);
1873 bool OnClose(bool parentClosing)
1875 if(modifiedDocument)
1877 DialogResult diagRes = MessageBox
1879 type = yesNoCancel, master = ide,
1880 text = $"Save changes to project settings?",
1881 contents = $"Would you like to save changes made to the build options?"
1885 if(diagRes == cancel)
1889 project.MarkChanges(backupNode);
1890 project.topNode.modified = true;
1891 ide.projectView.modifiedDocument = true;
1892 ide.UpdateToolBarActiveConfigs(false);
1893 ide.projectView.Update(null);
1895 modifiedDocument = false;
1901 class CompilerTab : Tab
1903 background = formColor;
1906 Window leftPane { this, size = { 180 }, anchor = { left = 0, top = 0, bottom = 0 }, background = formColor };
1908 Label labelFileList { leftPane, this, position = { 8, 8 }, labeledWindow = fileList };
1911 leftPane, this, borderStyle = deep, hasVertScroll = true, hasHorzScroll = true;
1912 // THIS WOULD BE EVEN MORE FUN: multiSelect = true,
1913 fullRowSelect = false, collapseControl = true, treeBranches = true;
1914 alwaysHighLight = true;
1915 selectionColor = unfocusedSelectorColor;
1917 anchor = Anchor { left = 8, top = 24, right = 4, bottom = 8 };
1920 bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
1922 BuildTab buildTab = (BuildTab)master;
1923 ProjectNode node = (ProjectNode)(intptr)row.tag;
1924 buildTab.SelectNode(node, false);
1928 void OnRedraw(Surface surface)
1930 ide.projectView.drawingInProjectSettingsDialog = true;
1931 ListBox::OnRedraw(surface);
1932 ide.projectView.drawingInProjectSettingsDialog = false;
1935 bool NotifyActivate(Window window, bool active, Window previous)
1939 //subclass(Skin) skinClass = (subclass(Skin))eSystem_FindClass(app, app.skin);
1940 fileList.selectionColor = Color { 10, 36, 106 }; //skinClass.selectionColor; // darkBlue;
1942 else if(fileList.currentRow)
1944 DataRow currentRow = fileList.currentRow;
1945 //int headerSize = ((fileList.style.header) ? fileList.rowHeight : 0);
1946 int height = fileList.clientSize.h + 1;// - fileList.headerSize;
1947 fileList.selectionColor = unfocusedSelectorColor;
1948 if(currentRow && currentRow.index * fileList.rowHeight > fileList.scroll.y + height - fileList.rowHeight)
1949 fileList.SetScrollPosition(fileList.scroll.x, currentRow.index * fileList.rowHeight - height + fileList.rowHeight);
1950 else if(!currentRow || currentRow.index * fileList.rowHeight < fileList.scroll.y)
1951 fileList.SetScrollPosition(fileList.scroll.x, currentRow ? currentRow.index * fileList.rowHeight : 0);
1961 this, anchor = { left = 196, top = 0, right = 0, bottom = 0 }, background = formColor, tabCycle = true;
1964 Window rightPaneHeader
1966 rightPane, this, size = { h = 21 }, anchor = { left = 0, top = 0, right = 0 }, background = Color { 70, 96, 166 };//0x0F3F66;
1967 foreground = white; visible = false;
1969 void OnRedraw(Surface surface)
1973 void (* onDisplay)(void *, void *, void *, int, int, int, void *, uint, uint) = (void *)class(ProjectNode)._vTbl[__ecereVMethodID_class_OnDisplay];
1975 ide.projectView.drawingInProjectSettingsDialogHeader = true;
1977 onDisplay(class(ProjectNode), (void *)(intptr)id, surface, 8, 2, clientSize.w, ide.projectView, Alignment::left, DataDisplayFlags { selected = true });
1978 ide.projectView.drawingInProjectSettingsDialogHeader = false;
1983 PaneSplitter splitter
1985 this, leftPane = leftPane, rightPane = rightPane, split = 188
1988 Label labelObjDir { rightPane, this, position = { 8, 8 }, labeledWindow = objDir };
1989 PathOptionBox objDir
1991 rightPane, this, size = { 250, 22 }, anchor = { left = 8, top = 24, right = 8 };
1992 text = $"Intermediate Objects Directory", hotKey = altJ, option = OPTION(objectsDirectory);
1995 BoolOptionBox excludeFromBuild
1997 rightPane, this, position = { 8, 28 },
1998 text = $"Exclude from Build", visible = false, option = OPTION(excludeFromBuild);
2001 Label labelPreprocessorDefs { rightPane, this, position = { 8, 50 }, labeledWindow = preprocessorDefs };
2002 StringArrayOptionBox preprocessorDefs
2004 rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 66, right = 8 };
2005 text = $"Preprocessor Definitions", hotKey = altD, option = OPTION(preprocessorDefinitions);
2008 Label labelDefaultNameSpace { rightPane, this, position = { 8, 92 }, labeledWindow = defaultNameSpace };
2009 StringOptionBox defaultNameSpace
2011 rightPane, this, size = { 160, 22 }, position = { 8, 108 };
2012 text = $"Default Name Space", option = OPTION(defaultNameSpace);
2014 BoolOptionBox strictNameSpaces
2016 rightPane, this, position = { 172, 112 },
2017 text = $"Strict Name Spaces", option = OPTION(strictNameSpaces);
2020 BoolOptionBox fastMath
2022 rightPane, this, position = { 316, 112 },
2023 text = $"Fast Math", option = OPTION(fastMath);
2026 BoolOptionBox memoryGuard
2028 rightPane, this, position = { 8, 154 };
2029 text = $"MemoryGuard", hotKey = altM, option = OPTION(memoryGuard);
2032 Label labelWarnings { rightPane, position = { 116, 138 }, labeledWindow = warnings };
2035 rightPane, this, position = { 116, 154 };
2036 text = $"Warnings", hotKey = altW, option = OPTION(warnings);
2039 Label labelOptimization { rightPane, position = { 220, 138 }, labeledWindow = optimization };
2040 OptimizationDB optimization
2042 rightPane, this, position = { 220, 154 }, size = { 120, 22 };
2043 text = $"Optimization", hotKey = altO, option = OPTION(optimization);
2048 rightPane, this, position = { 8, 188 };
2049 text = $"Debuggable", hotKey = altG, option = OPTION(debug);
2052 BoolOptionBox profiling
2054 rightPane, this, position = { 116, 188 };
2055 text = $"Profiling Data", hotKey = altP, option = OPTION(profile);
2058 BoolOptionBox noLineNumbers
2060 rightPane, this, position = { 220, 188 };
2061 text = $"No Line Numbers", hotKey = altN, option = OPTION(noLineNumbers);
2064 Label labelCompilerOptions { rightPane, this, position = { 8, 208 }, labeledWindow = compilerOptions };
2065 StringArrayOptionBox compilerOptions
2067 rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 224, right = 8 };
2068 text = $"Compiler Options", hotKey = altO, option = OPTION(compilerOptions);
2069 configReplaces = true;
2072 Label labelIncludeDirs { includeDirs.editor, labeledWindow = includeDirs, position = { 0, 6 }; };
2073 DirsArrayOptionBox includeDirs
2075 rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 250, right = 8, bottom = 8 };
2076 text = $"Additional Include Directories", hotKey = altI, option = OPTION(includeDirs), switchToKeep = "I";
2081 fileList.AddField(DataField { dataType = class(ProjectNode), freeData = false,
2082 userData = null /* Now set in the ProjectNode directly to know we're in ProjectSettings Dialog -- ide.projectView*/ });
2087 BuildTab buildTab = (BuildTab)master;
2088 buildTab.SelectNode(buildTab.lastSelectedNode, true);
2092 void AddNode(ProjectNode node, DataRow addTo)
2094 DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
2096 row.tag = (int64)(intptr)node;
2098 row.SetData(null, node);
2100 if(node.files && node.files.first && node.parent &&
2101 !(!node.parent.parent &&
2102 (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
2103 !strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
2104 row.collapsed = true;
2105 else if(node.type == folder)
2106 node.icon = openFolder;
2110 for(child : node.files)
2111 AddNode(child, row);
2118 for(ob = (OptionBox)firstSlave; ob; ob = (OptionBox)ob.nextSlave)
2119 if(eClass_IsDerived(ob._class, class(OptionBox)))
2122 if(activeChild && activeChild.active)
2124 Window control = activeChild;
2125 control.Deactivate();
2132 objDir.editor.Activate();
2137 class LinkerTab : Tab
2139 background = formColor;
2142 Label labelTargetName { this, position = { 8, 8 }, labeledWindow = targetName };
2143 StringOptionBox targetName
2145 this, position = { 8, 24 }, size = { 200, 22 };
2146 text = $"Target Name", hotKey = altN, option = OPTION(targetFileName);
2149 Label labelTargetType { this, position = { 216, 8 }, labeledWindow = targetType };
2150 TargetTypeDB targetType
2152 this, position = { 216, 24 }, size = { 120, 22 };
2153 text = $"Target Type", hotKey = altT, option = OPTION(targetType);
2156 Label labelTargetDirectory { this, position = { 344, 8 }, labeledWindow = targetDirectory };
2157 PathOptionBox targetDirectory
2159 this, size = { 270, 22 }, anchor = { left = 344, top = 24, right = 8 };
2160 hotKey = altR, text = $"Target Directory", option = OPTION(targetDirectory);
2163 Label labelLibraries { this, position = { 8, 50 }, labeledWindow = libraries };
2164 StringArrayOptionBox libraries
2166 this, size = { 290, 22 }, anchor = { left = 8, top = 66, right = 8 };
2167 text = $"Additional Libraries", hotKey = altL, option = OPTION(libraries), switchToKeep = "l";
2168 configReplaces = true;
2171 Label labelLinkerOptions { this, position = { 8, 92 }, labeledWindow = linkerOptions };
2172 StringArrayOptionBox linkerOptions
2174 this, size = { 290, 22 }, anchor = { left = 8, top = 108, right = 8 };
2175 text = $"Linker Options", hotKey = altO, option = OPTION(linkerOptions);
2176 configReplaces = true;
2179 BoolOptionBox console
2181 this, position = { 8, 138 };
2182 text = $"Console Application", hotKey = altC, option = OPTION(console);
2185 BoolOptionBox compress
2187 this, position = { 8, 162 };
2188 text = $"Compress", hotKey = altW, option = OPTION(compress);
2191 Label labelLibraryDirs { libraryDirs.editor, labeledWindow = libraryDirs, position = { 0, 6 }; };
2192 DirsArrayOptionBox libraryDirs
2194 this, size = { 290, 22 }, anchor = { left = 8, top = 182, right = 8, bottom = 8 };
2195 text = $"Additional Library Directories", hotKey = altY, option = OPTION(libraryDirs), switchToKeep = "L";
2200 ((BuildTab)master).SelectNode(project.topNode, true);
2207 for(ob = (OptionBox)firstSlave; ob; ob = (OptionBox)ob.nextSlave)
2208 if(eClass_IsDerived(ob._class, class(OptionBox)))
2210 compress.disabled = (config && config.options && config.options.debug == true) || project.topNode.options.debug == true;
2212 if(activeChild && activeChild.active)
2214 Window control = activeChild;
2215 control.Deactivate();
2221 class BuilderTab : Tab
2223 background = formColor;
2226 Label labelPrebuildCommands { prebuildCommands.editor, labeledWindow = prebuildCommands, position = { 0, 6 }; };
2227 StringsArrayOptionBox prebuildCommands
2229 this, size = { 290, 92 }, anchor = { left = 8, top = 8, right = 8, bottom = 200 };
2230 text = $"Pre-build Commands", hotKey = altE, option = OPTION(prebuildCommands);
2233 Label labelPostbuildCommands { postbuildCommands.editor, labeledWindow = postbuildCommands, position = { 0, 6 }; };
2234 StringsArrayOptionBox postbuildCommands
2236 this, size = { 290, 92 }, anchor = { left = 8, top = 100, right = 8, bottom = 100 };
2237 text = $"Post-build Commands", hotKey = altT, option = OPTION(postbuildCommands);
2240 Label labelInstallCommands { installCommands.editor, labeledWindow = installCommands, position = { 0, 6 }; };
2241 StringsArrayOptionBox installCommands
2243 this, size = { 290, 92 }, anchor = { left = 8, top = 200, right = 8, bottom = 8 };
2244 text = $"Install Commands", hotKey = altT, option = OPTION(installCommands);
2250 for(ob = (OptionBox)firstSlave; ob; ob = (OptionBox)ob.nextSlave)
2251 if(eClass_IsDerived(ob._class, class(OptionBox)))
2254 if(activeChild && activeChild.active)
2256 Window control = activeChild;
2257 control.Deactivate();
2262 void OnResize(int width, int height)
2264 int h = (height - 8 * 4) / 3;
2265 prebuildCommands.anchor = { left = 8, top = 8, right = 8, bottom = h * 2 + 8 * 3 };
2266 postbuildCommands.anchor = { left = 8, top = h + 8 * 2, right = 8, bottom = h + 8 * 2 };
2267 installCommands.anchor = { left = 8, top = h * 2 + 8 * 3, right = 8, bottom = 8 };