import "WorkspaceSettings"
import "ProjectTabSettings"
import "StringsBox"
-import "SelectorBar"
+// import "SelectorBar"
static ProjectConfig config;
static Platform platform;
static ProjectNode currentNode;
static Project project;
-static String MakeString(char * s, int len)
+static String MakeString(char * s, int len, char * switchToKeep, int lenSwitchToKeep)
{
String string = new char[len+1];
- memcpy(string, s, len);
- string[len] = 0;
+ if(s[0] == '-' && switchToKeep && switchToKeep[0])
+ {
+ if(strstr(s+1, switchToKeep) == s+1)
+ {
+ memcpy(string, s+lenSwitchToKeep+1, len-lenSwitchToKeep-1);
+ string[len-lenSwitchToKeep-1] = '\0';
+ }
+ else
+ delete string;
+ }
+ else
+ {
+ memcpy(string, s, len);
+ string[len] = '\0';
+ }
return string;
}
class StringListBox : EditBox
{
+ char * switchToKeep;
+ int lenSwitchToKeep;
+
textHorzScroll = true;
property Array<String> strings
bool first = true;
for(item : value)
{
- bool quoted = strchr(item, ' ') != null;
- if(!first)
- AddS(" ");
- if(quoted)
- AddS("\"");
- AddS(item);
- if(quoted)
- AddS("\"");
- first = false;
+ if(item)
+ {
+ if(!first)
+ AddS(" ");
+ AddS(item);
+ first = false;
+ }
}
}
}
Array<String> array { };
int c, start = 0;
char * contents = property::contents;
+ char * s;
char ch;
bool quoted = false;
if(ch == ' ' && !quoted)
{
if(c - start)
- array.Add(MakeString(contents + start, c - start));
+ {
+ if((s = MakeString(contents + start, c - start, switchToKeep, lenSwitchToKeep)))
+ array.Add(s);
+ }
start = c + 1;
}
else if(ch == '\"')
{
if(quoted)
- {
- if(c - start)
- array.Add(MakeString(contents + start, c - start));
quoted = false;
- start = c + 1;
- }
else
- {
quoted = true;
- start = c + 1;
- }
}
}
if(c - start)
- array.Add(MakeString(contents + start, c - start));
+ {
+ if((s = MakeString(contents + start, c - start, switchToKeep, lenSwitchToKeep)))
+ array.Add(s);
+ }
return array;
}
}
}
-define dialogTitle = "Project Settings";
+define dialogTitle = $"Project Settings";
static Color unfocusedSelectorColor { 70, 96, 166 };
class ProjectSettings : Window
{
text = dialogTitle;
- background = activeBorder;
+ background = formColor;
borderStyle = sizable;
- minClientSize = { 650, 490 };
+ minClientSize = { 650, 520 };
hasClose = true;
tabCycle = true;
- size = { 650, 490 };
+ size = { 650, 520 };
property Project project
{
char * nodeName = currentNode && currentNode != project.topNode ? currentNode.name : "";
char * config = buildTab.selectedConfigName;
char * platform = buildTab.selectedPlatformName;
- char * label = new char[strlen(dialogTitle) + 3 + strlen(project.topNode.name) + 3 +
+ char * label = new char[strlen(dialogTitle) + 3 + strlen(project.topNode.name) + 3 +
strlen(nodeName) + 2 + strlen(config) + 1 + strlen(platform) + 1 + 1];
strcpy(label, dialogTitle);
strcat(label, " - ");
TabControl prjTabControl
{
- this, background = activeBorder, anchor = { left = 8, top = 4, right = 8, bottom = 38 };
+ this, background = formColor, anchor = { left = 8, top = 4, right = 8, bottom = 38 };
};
ProjectTab projectTab { this, tabControl = prjTabControl };
BuildTab buildTab { this, tabControl = prjTabControl };
{
this, size = { 80, 22 };
anchor = { right = 8, bottom = 8 };
- text = "Cancel", hotKey = escape, id = DialogResult::cancel;
+ text = $"Cancel", hotKey = escape, id = DialogResult::cancel;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
DialogResult diagRes = MessageBox
{
type = okCancel, master = ide,
- text = "Lose Changes?",
- contents = "Are you sure you wish to discard changes made to the build options?"
+ text = $"Lose Changes?",
+ contents = $"Are you sure you wish to discard changes made to the build options?"
}.Modal();
if(diagRes == ok)
{
{
this, size = { 80, 22 };
anchor = { right = 96, bottom = 8 };
- text = "OK", isDefault = true;
+ text = $"OK", isDefault = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
{
UpdateDialogTitle();
prjTabControl.curTab = buildTab;
+
+ ((DirectoriesBox)buildTab.compilerTab.includeDirs.editor).baseBrowsePath = project.topNode.path;
+ ((DirectoriesBox)buildTab.linkerTab.libraryDirs.editor).baseBrowsePath = project.topNode.path;
+
return true;
}
}
// TOFIX: USING T INSTEAD OF Z HERE CAUSED US SOME CONFLICTS WITH T IN Array TEMPLATES
+// the BlendFileConfigPlatformProjectOptions function and the GenericOptionTools class
+// contain code that is closely matched to the following code
+// output changing modification should be mirrored in both implementations
class OptionBox<class Z> : CommonControl
{
bool mergeValues, configReplaces;
}
property bool visible { set { editor.visible = value; } get { return editor.visible; } }
- property Window parent { set { editor.parent = value; Window::parent = value; master = value; editor.id = (int)this; } }
+ property Window parent { set { editor.parent = value; Window::parent = value; master = value; editor.id = (int64)this; } }
property Point position { set { editor.position = value; } }
property Size size { set { editor.size = value; } }
property Anchor anchor { set { editor.anchor = value; } }
Menu clearMenu { };
MenuItem clearItem
{
- clearMenu, "Clear";
+ clearMenu, $"Clear";
bool NotifySelect(MenuItem selection, Modifiers mods)
{
OptionBox ob = (OptionBox)id;
- ob.Unset();
+ if(eClass_IsDerived(ob._class, class(CheckBoxForEnumOptionBox)))
+ {
+ Window slave;
+ for(slave = ob.master.firstSlave; slave; slave = slave.nextSlave)
+ {
+ if(eClass_IsDerived(slave._class, class(CheckBoxForEnumOptionBox)) &&
+ ((OptionBox)slave).option == ob.option)
+ ((OptionBox)slave).Unset();
+ }
+ }
+ else
+ ob.Unset();
return true;
}
};
-
+
bool Window::OptionBox_OnRightButtonDown(int x, int y, Modifiers mods)
{
OptionBox ob = (OptionBox)id;
return (((bool(*)(Window, Key, unichar)) ob.chainKeyDown)(this, key, ch);
}
+ // code: 0 = not set anywhere, 1 = overridden here, 2 = inherited
void SetAttribs(int code)
{
Window c;
break;
}
}
-
+
if(!c)
{
label = null;
virtual void FinalizeLoading();
virtual void LoadOption(ProjectOptions options);
- virtual void RetrieveOption(ProjectOptions options);
+ virtual void RetrieveOption(ProjectOptions options, bool isCfgOrPlt);
virtual void UnsetOption(ProjectOptions options)
{
Z value = (Z)0;
{
return OptionSet(options);
}
-
+
void MarkBuildTabModified()
{
BuildTab buildTab = (BuildTab)master;
buildTab = (BuildTab)buildTab.master;
if(buildTab) buildTab.modifiedDocument = true;
}
-
+
void Unset()
{
char * platformName = platform ? platform.OnGetString(0,0,0) : null;
Iterator<PlatformOptions> it { c.platforms };
if(it.Find(p))
{
- it.Remove(p);
+ it.Remove();
delete p;
}
}
if(currentNode.options && OptionSet(currentNode.options))
UnsetOption(currentNode.options);
if(currentNode.options && currentNode.options.isEmpty)
- delete currentNode.options;
+ {
+ // delete currentNode.options;
+ // Property will free:
+ currentNode.options = null;
+ }
Load();
}
bool skipped = false;
for(node = currentNode; node; node = node.parent)
{
+ bool configXplatformSet = false;
if(config && node.configurations)
{
for(c : node.configurations; !strcmpi(c.name, config.name))
{
for(p : c.platforms; !strcmpi(p.name, platformName))
{
- if(skipped && p.options && OptionSet(p.options))
- LoadOption(p.options);
+ if(p.options && OptionSet(p.options))
+ {
+ if(skipped)
+ LoadOption(p.options);
+ }
+ configXplatformSet = true;
skipped = true;
break;
}
- }
+ }
if(skipped && c.options && OptionSet(c.options))
{
break;
}
}
- if(platform && node.platforms)
+ if((!configXplatformSet || !configReplaces) && platform && node.platforms)
{
for(p : node.platforms; !strcmpi(p.name, platformName))
{
c.platforms.Add(p = PlatformOptions { CopyString(platformName) });
if(!p.options) p.options = { };
- RetrieveOption(p.options);
+ RetrieveOption(p.options, true);
if(!mergeValues) SetAttribs(1);
return;
}
if(!c.options) c.options = { };
- RetrieveOption(c.options);
+ RetrieveOption(c.options, true);
if(!mergeValues) SetAttribs(1);
return;
}
currentNode.platforms.Add(p = PlatformOptions { CopyString(platformName) });
if(!p.options) p.options = { };
- RetrieveOption(p.options);
+ RetrieveOption(p.options, true);
if(!mergeValues) SetAttribs(1);
return;
}
if(!currentNode.options) currentNode.options = { };
- RetrieveOption(currentNode.options);
+ RetrieveOption(currentNode.options, false);
if(!mergeValues) SetAttribs((currentNode.parent || OptionCheck(currentNode.options)) ? 1 : 0);
}
bool setAttribs = false;
for(node = currentNode; node; node = node.parent)
{
+ bool configXplatformSet = false;
ProjectConfig nodeConfig = null;
if(config && node.configurations)
{
LoadOption(p.options);
if(!setAttribs) { setAttribs = true; SetAttribs((node == currentNode) ? 1 : 2); }
if(!mergeValues) { FinalizeLoading(); return; }
+ configXplatformSet = true;
}
break;
}
- }
+ }
nodeConfig = c;
break;
}
}
- if(platform && node.platforms)
+ if(platform && node.platforms && (!configXplatformSet || !configReplaces))
{
for(p : node.platforms; !strcmpi(p.name, platformName))
{
textHorzScroll = true;
};
- void RetrieveOption(ProjectOptions options)
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
String * string = (String*)((byte *)options + option);
if(*string) delete *string;
bool NotifyModified(PathBox pathBox)
{
+ FixPathOnPathBoxNotifyModified(pathBox);
((OptionBox)pathBox.id).Retrieve();
return true;
}
};
- void RetrieveOption(ProjectOptions options)
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
String * string = (String*)((byte *)options + option);
String slashPath = ((PathBox)editor).slashPath;
Array<String> tempStrings;
- void RetrieveOption(ProjectOptions options)
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
Array<String> newStrings = GetStrings();
Array<String> * strings = (Array<String>*)((byte *)options + option);
{
String s = it.data;
bool found = false;
- for(i : tempStrings; !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
+ for(i : tempStrings; i && s && !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
if(found && (!configReplaces || platform)) // ADDED || platform here...
{
delete s;
delete tempStrings;
}
- *strings = newStrings;
+ if(!mergeValues || (configReplaces && isCfgOrPlt && !platform))
+ *strings = newStrings;
+ else
+ {
+ *strings = (newStrings && newStrings.count) ? newStrings : null;
+ if(newStrings && !newStrings.count) delete newStrings;
+ }
Load();
}
for(s : strings)
{
bool found = false;
- for(i : tempStrings; !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
+ for(i : tempStrings; i && s && !(caseSensitive ? strcmp : strcmpi)(i, s)) { found = true; break; }
if(!found) tempStrings.Add(s);
}
}
- }
+ }
else
{
SetStrings(options ? *(Array<String>*)((byte *)options + option) : null);
// NO VIRTUAL PROPERTIES YET...
Array<String> GetStrings() { return ((StringListBox)editor).strings; }
void SetStrings(Array<String> value) { ((StringListBox)editor).strings = value; }
+
+ property char * switchToKeep { set { ((StringListBox)editor).switchToKeep = value; ((StringListBox)editor).lenSwitchToKeep = strlen(value); } };
}
class StringsArrayOptionBox : MultiStringOptionBox
void SetStrings(Array<String> value) { ((StringsBox)editor).strings = value; }
}
-class DirsArrayOptionBox : MultiStringOptionBox
+bool eString_IsPathRelatedTo(char * path, char * to)
{
- editor = DirectoriesBox
+ if(path[0] && to[0])
{
- bool NotifyModified(DirectoriesBox dirsBox)
+ char rest[MAX_FILENAME];
+ char pathPart[MAX_FILENAME], pathRest[MAX_LOCATION] = "";
+ char toPart[MAX_FILENAME], toRest[MAX_LOCATION] = "";
+ SplitDirectory(path, pathPart, pathRest);
+ SplitDirectory(to, toPart, toRest);
+ if(!fstrcmp(pathPart, toPart))
{
- ((OptionBox)dirsBox.id).Retrieve();
- return true;
- }
-
- bool OnChangedDir(char * * directory)
- {
- char fixedDirectory[MAX_LOCATION] = "";
- if(PathCat(fixedDirectory, *directory))
+ if(pathRest[0] && toRest[0])
{
- char cwdBackup[MAX_LOCATION];
- if(project)
- {
- GetWorkingDir(cwdBackup, sizeof(cwdBackup));
- ChangeWorkingDir(project.topNode.path);
- }
- FileFixCase(fixedDirectory);
- if(project)
- ChangeWorkingDir(cwdBackup);
- delete *directory;
- *directory = CopyString(fixedDirectory);
- return true;
+ SplitDirectory(pathRest, pathPart, pathRest);
+ SplitDirectory(toRest, toPart, toRest);
+ if(!fstrcmp(pathPart, toPart))
+ return true;
}
- return false;
}
+ }
+ return false;
+}
+
+static void FixPathOnPathBoxNotifyModified(PathBox pathBox)
+{
+ int len;
+ char path[MAX_LOCATION];
+ ValidPathBufCopy(path, pathBox.path);
+ len = strlen(path);
+ if(len && !(path[0] == '.' && (len == 1 || (len == 2 && path[1] == DIR_SEP) || (len > 1 && path[1] == '.'))))
+ {
+ char cwdBackup[MAX_LOCATION];
+ if(project)
+ {
+ GetWorkingDir(cwdBackup, sizeof(cwdBackup));
+ ChangeWorkingDir(project.topNode.path);
+ }
+ FileFixCase(path);
+ if(project)
+ ChangeWorkingDir(cwdBackup);
+ if(eString_IsPathRelatedTo(path, project.topNode.path))
+ MakePathRelative(path, project.topNode.path, path);
+ if(!path[0])
+ strcpy(path, ".");
+ len = strlen(path);
+ }
+ if(len>1 && path[len-1] == DIR_SEP)
+ path[--len] = '\0';
+ pathBox.path = path;
+}
+
+class DirsArrayOptionBox : MultiStringOptionBox
+{
+public:
+ property char * switchToKeep { set { switchToKeep = value; lenSwitchToKeep = strlen(value); } };
+private:
+ char * switchToKeep;
+ int lenSwitchToKeep;
- bool OnPrepareBrowseDir(char * * directory)
+ editor = DirectoriesBox
+ {
+ browseDialog = { };
+ bool NotifyModified(DirectoriesBox dirsBox)
{
- char dir[MAX_LOCATION];
- if(project)
+ char * switchToKeep = ((DirsArrayOptionBox)dirsBox.id).switchToKeep;
+ if(switchToKeep && switchToKeep[0])
{
- GetSystemPathBuffer(dir, project.topNode.path);
- if(*directory)
- PathCat(dir, *directory);
+ bool change = false;
+ int lenSwitchToKeep = ((DirsArrayOptionBox)dirsBox.id).lenSwitchToKeep;
+ Array<String> dirs { };
+ Array<String> previousDirs = dirsBox.strings;
+ for(d : previousDirs)
+ {
+ int c;
+ char * buffer = new char[strlen(d)+64];
+ char * tokens[1024];
+ uint count;
+ strcpy(buffer, d);
+ count = Tokenize(buffer, sizeof(tokens)/sizeof(tokens[0]), tokens, (BackSlashEscaping)false);
+ for(c=0; c<count; c++)
+ {
+ if(tokens[c][0] == '-')
+ {
+ if(strstr(tokens[c]+1, switchToKeep) == tokens[c]+1)
+ tokens[c] += lenSwitchToKeep+1;
+ else
+ tokens[c][0] = '\0';
+ change = true;
+ }
+ dirs.Add(CopyString(tokens[c]));
+ }
+ delete buffer;
+ }
+ if(change)
+ dirsBox.strings = dirs;
+ dirs.Free();
+ delete dirs;
+ previousDirs.Free();
+ delete previousDirs;
}
- else if(*directory)
- strcpy(dir, *directory);
- else
- dir[0] = '\0';
-
- delete *directory;
- *directory = CopyString(dir);
-
- // GCC 4.4 bug: ----- path becomes *directory
- //strcpy(dir, path ? path : "");
+ ((OptionBox)dirsBox.id).Retrieve();
return true;
}
- bool OnBrowsedDir(char * * directory)
+ bool NotifyPathBoxModified(DirectoriesBox dirsBox, PathBox pathBox)
{
- if(project)
- {
- char path[MAX_LOCATION];
- MakePathRelative(*directory, project.topNode.path, path);
- delete *directory;
- *directory = CopyString(path);
- }
+ FixPathOnPathBoxNotifyModified(pathBox);
return true;
}
};
return *(SetBool*)((byte *)options + option) == true;
}
- void RetrieveOption(ProjectOptions options)
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
bool checked = ((Button)editor).checked;
- *(SetBool*)((byte *)options + option) = checked ? true : (currentNode.parent ? false : unset);
+ *(SetBool*)((byte *)options + option) = checked ? true :
+ ((currentNode.parent || isCfgOrPlt) ? false : unset);
}
void LoadOption(ProjectOptions options)
}
}
+class CheckBoxForEnumOptionBox : OptionBox
+{
+ editor = Button
+ {
+ isCheckbox = true;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ ((OptionBox)button.id).Retrieve();
+ {
+ Window slave;
+ for(slave = master.firstSlave; slave; slave = slave.nextSlave)
+ {
+ if(eClass_IsDerived(slave._class, class(CheckBoxForEnumOptionBox)) &&
+ slave != (Window)button.id &&
+ ((OptionBox)slave).option == ((OptionBox)button.id).option)
+ ((OptionBox)slave).Load();
+ }
+ }
+ return true;
+ }
+ };
+
+ Z enumValue;
+ void LoadOption(ProjectOptions options)
+ {
+ Z value = options ? *(Z*)((byte *)options + option) : (Z)0;
+ ((Button)editor).checked = value == enumValue;
+ }
+
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
+ {
+ Button checkBox = (Button)editor;
+ if(checkBox.checked)
+ *(Z*)((byte *)options + option) = enumValue;
+ }
+}
+
+class BuildBitDepthOptionBox : CheckBoxForEnumOptionBox<BuildBitDepth> { }
+
class DropOptionBox : OptionBox
{
editor = DropBox
((OptionBox)dropBox.id).Retrieve();
return true;
}
- };
+ };
void LoadOption(ProjectOptions options)
{
DropBox dropBox = (DropBox)editor;
Z value = options ? *(Z*)((byte *)options + option) : (Z)0;
- dropBox.currentRow = value ? dropBox.FindRow((int)value) : dropBox.firstRow;
+ dropBox.currentRow = value ? dropBox.FindRow((int64)value) : dropBox.firstRow;
}
- void RetrieveOption(ProjectOptions options)
+ void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
DropBox dropBox = (DropBox)editor;
DataRow row = dropBox.currentRow;
row = ((DropBox)editor).AddRow();
row.tag = TargetTypes::executable;
- row.SetData(null, "Executable");
+ row.SetData(null, $"Executable");
row = ((DropBox)editor).AddRow();
row.tag = TargetTypes::sharedLibrary;
- row.SetData(null, "Shared Library");
+ row.SetData(null, $"Shared Library");
row = ((DropBox)editor).AddRow();
row.tag = TargetTypes::staticLibrary;
- row.SetData(null, "Static Library");
+ row.SetData(null, $"Static Library");
}
bool OptionCheck(ProjectOptions options)
DataRow row;
row = ((DropBox)editor).AddRow();
row.tag = OptimizationStrategy::none;
- row.SetData(null, "None");
+ row.SetData(null, $"None");
row = ((DropBox)editor).AddRow();
row.tag = OptimizationStrategy::speed;
- row.SetData(null, "For Speed (-O2)");
+ row.SetData(null, $"For Speed (-O2)");
row = ((DropBox)editor).AddRow();
row.tag = OptimizationStrategy::size;
- row.SetData(null, "For Size (-Os)");
+ row.SetData(null, $"For Size (-Os)");
}
bool OptionCheck(ProjectOptions options)
DataRow row;
row = ((DropBox)editor).AddRow();
row.tag = WarningsOption::normal;
- row.SetData(null, "Normal");
+ row.SetData(null, $"Normal");
row = ((DropBox)editor).AddRow();
row.tag = WarningsOption::none;
- row.SetData(null, "None");
+ row.SetData(null, $"None");
row = ((DropBox)editor).AddRow();
row.tag = WarningsOption::all;
- row.SetData(null, "All");
+ row.SetData(null, $"All");
}
bool OptionCheck(ProjectOptions options)
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
class BuildTab : Tab
{
- text = "Build";
- background = activeBorder;
+ text = $"Build";
+ background = formColor;
tabCycle = true;
ProjectNode backupNode;
if(button && button.id)
{
Platform platform = (Platform)button.id;
- char * platformName = platform ? platform.OnGetString(0,0,0) : null; // all these platformName are leaking, no?
+ char * platformName = platform ? platform.OnGetString(0,0,0) : null; // all these platformName are leaking, no?
return platformName;
}
}
};
SelectorBar configSelector
{
- this, text = "Configurations: ", anchor = { left = 98, top = 8, right = 54 }; size = { 0, 26 };
+ this, text = $"Configurations: ", anchor = { left = 98, top = 8, right = 54 }; size = { 0, 26 };
opacity = 0;
direction = horizontal, scrollable = true;
}
return SelectorBar::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
((BuildTab)master).labelConfigurations.Update(null);
name = CopyString(tmp);
options =
{
- // objectsDirectory = CopyString(defaultObjDirExpression);
+ // objectsDirectory = /*CopyString(*/defaultObjDirExpression/*)*/;
};
};
if(!project.topNode.configurations) project.topNode.configurations = { };
/*
targetType = project.config.options.targetType;
config.options.
- config.options.targetFileName = CopyString(project.moduleName);
- config.targetDir.dir = "";
- config.objectsDirectory = CopyString(defaultObjDirExpression);
+ config.options.targetFileName = project.moduleName;
+ config.options.targetDir.dir = "";
+ config.options.objectsDirectory = defaultObjDirExpression);
config.options.debug = true;
config.options.optimization = none;
config.options.warnings = all;
- */
+ */
button =
{
- configSelector, renameable = true, master = this, text = config.name, id = (int)config;
+ configSelector, renameable = true, master = this, text = config.name, id = (int64)config;
NotifyClicked = ConfigClicked, OnRename = ConfigOnRename;
};
{
if(config)
{
- String title = PrintString("Delete ", config.name, " Configuration");
- String msg = PrintString("Are you sure you wish to delete the ", config.name, " configuration?");
+ String title = PrintString($"Delete ", config.name, $" Configuration");
+ String msg = PrintString($"Are you sure you wish to delete the ", config.name, $" configuration?");
if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
{
Iterator<Window> it { configSelector.controls };
ProjectConfig configToDelete = config;
-
+ /*
while(it.Next())
{
SelectorButton button = (SelectorButton)it.data;
if((ProjectConfig)button.id == config)
- {
+ {
button.visible = false;
button.Destroy(0);
- delete button;
if(it.Prev())
{
break;
}
}
+ */
+ SelectorButton button = configSelector.FindButtonByID((int64)configToDelete);
+ if(button)
+ configSelector.RemoveButton(button);
+
project.topNode.DeleteConfig(configToDelete);
modifiedDocument = true;
return true;
}
};
-
+
Label labelPlatforms
{
this, anchor = { left = 8, top = 44 }, labeledWindow = platformSelector;
};
SelectorBar platformSelector
{
- this, text = "Platforms: ", anchor = { left = 64, top = 38, right = 54 }; size = { 0, 26 };
+ this, text = $"Platforms: ", anchor = { left = 64, top = 38, right = 54 }; size = { 0, 26 };
opacity = 0;
direction = horizontal, scrollable = true;
TabControl buildTabControl
{
- this, background = activeBorder, anchor = { left = 8, top = 64, right = 8, bottom = 8 };
+ this, background = formColor, anchor = { left = 8, top = 64, right = 8, bottom = 8 };
curTab = compilerTab;
};
CompilerTab compilerTab { this, tabControl = buildTabControl };
Label rightClick
{
this, font = { font.faceName, font.size, italic = true }, stayOnTop = true,
- text = "(Right click or press Ctrl-Del to revert an option to inherited value)", anchor = { top = 72, right = 16 }
+ text = $"(Right click or press Ctrl-Del to revert an option to inherited value)", anchor = { top = 72, right = 16 }
};
void FindUniqueConfigName(char * baseName, bool startWithNumber, char * output)
}
project.topNode.RenameConfig(config.name, *newName);
-
+
modifiedDocument = true;
return true;
}
if(!mods)
buildTabControl.Activate();
+ compilerTab.fileList.Update(null);
if(compilerTab.rightPaneHeader.visible)
compilerTab.rightPaneHeader.Update(null);
((ProjectSettings)master).UpdateDialogTitle();
if(!node) node = project.topNode;
newNodeRes = node.isInResources;
-
+
currentNode = node;
if(!ignoreAsLastSelection)
lastSelectedNode = node;
}
else
{
- compilerTab.rightPaneHeader.id = (int)node;
+ compilerTab.rightPaneHeader.id = (int64)node;
compilerTab.rightPaneHeader.Update(null);
compilerTab.rightPaneHeader.visible = true;
}
{
- DataRow row = compilerTab.fileList.FindSubRow((int)currentNode);
+ DataRow row = compilerTab.fileList.FindSubRow((int64)currentNode);
if(row)
{
compilerTab.fileList.currentRow = row;
compilerTab.profiling.visible = !newNodeRes;
compilerTab.labelOptimization.visible = !newNodeRes;
compilerTab.optimization.visible = !newNodeRes;
+ compilerTab.fastMath.visible = !newNodeRes;
compilerTab.labelIncludeDirs.visible = !newNodeRes;
compilerTab.includeDirs.visible = !newNodeRes;
}
-
+
if(node == project.topNode)
{
compilerTab.objDir.visible = true;
// Create Config Buttons
commonButton = SelectorButton
{
- configSelector, master = this, text = "Common", id = (int)null; font = { font.faceName, font.size, true };
+ configSelector, master = this, text = $"Common", id = (int64)null; font = { font.faceName, font.size, true };
checked = true;
NotifyClicked = ConfigClicked;
};
-
+
config = null;
if(project.topNode.configurations)
{
EditableSelectorButton button
{
- configSelector, master = this, renameable = true, text = c.name, id = (int)c;
+ configSelector, master = this, renameable = true, text = c.name, id = (int64)c;
NotifyClicked = ConfigClicked, OnRename = ConfigOnRename;
};
}
}
}
-
+
void Init()
{
Platform p;
SelectorButton button;
activeConfigName = project.config ? CopyString(project.config.name) : null;
-
+
compilerTab.AddNode(project.topNode, null);
CreateConfigButtons();
platformButton = button =
{
- platformSelector, master = this, text = "Common", id = 0; font = { font.faceName, font.size, true };
+ platformSelector, master = this, text = $"Common", id = 0; font = { font.faceName, font.size, true };
NotifyClicked = PlatformClicked; checked = true;
};
{
SelectorButton button
{
- platformSelector, master = this, text = p.OnGetString(0,0,0), id = (int)p;
+ platformSelector, master = this, text = p.OnGetString(0,0,0), id = (int64)p;
NotifyClicked = PlatformClicked;
};
}
}
}
}
+ if(!project.config)
+ {
+ List<ProjectConfig> configs = project.topNode.configurations;
+ if(configs && configs.count)
+ project.config = configs[0];
+ }
+
+ ide.UpdateToolBarActiveConfigs(false);
}
void RevertChanges()
DialogResult diagRes = MessageBox
{
type = yesNoCancel, master = ide,
- text = "Save changes to project settings?",
- contents = "Would you like to save changes made to the build options?"
+ text = $"Save changes to project settings?",
+ contents = $"Would you like to save changes made to the build options?"
}.Modal();
if(diagRes == no)
RevertChanges();
project.MarkChanges(backupNode);
project.topNode.modified = true;
ide.projectView.modifiedDocument = true;
+ ide.UpdateToolBarActiveConfigs(false);
ide.projectView.Update(null);
}
modifiedDocument = false;
class CompilerTab : Tab
{
- background = activeBorder;
- text = "Compiler";
+ background = formColor;
+ text = $"Compiler";
- Window leftPane { this, size = { 180 }, anchor = { left = 0, top = 0, bottom = 0 }, background = activeBorder };
+ Window leftPane { this, size = { 180 }, anchor = { left = 0, top = 0, bottom = 0 }, background = formColor };
Label labelFileList { leftPane, this, position = { 8, 8 }, labeledWindow = fileList };
ListBox fileList
selectionColor = unfocusedSelectorColor;
size = { 180 };
anchor = Anchor { left = 8, top = 24, right = 4, bottom = 8 };
- text = "Files";
+ text = $"Files";
bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
{
}
};
- Window rightPane
+ Window rightPane
{
- this, anchor = { left = 196, top = 0, right = 0, bottom = 0 }, background = activeBorder, tabCycle = true;
+ this, anchor = { left = 196, top = 0, right = 0, bottom = 0 }, background = formColor, tabCycle = true;
};
Window rightPaneHeader
if(id)
{
ide.projectView.drawingInProjectSettingsDialogHeader = true;
- class(ProjectNode)._vTbl[__ecereVMethodID_class_OnDisplay](class(ProjectNode),
- id, surface, 8, 2, clientSize.w, ide.projectView, Alignment::left, DataDisplayFlags { selected = true });
+ ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)class(ProjectNode)._vTbl[__ecereVMethodID_class_OnDisplay])(class(ProjectNode),
+ (void *)id, surface, 8, 2, clientSize.w, ide.projectView, Alignment::left, DataDisplayFlags { selected = true });
ide.projectView.drawingInProjectSettingsDialogHeader = false;
}
}
PathOptionBox objDir
{
rightPane, this, size = { 250, 22 }, anchor = { left = 8, top = 24, right = 8 };
- text = "Intermediate Objects Directory", hotKey = altJ, option = OPTION(objectsDirectory);
+ text = $"Intermediate Objects Directory", hotKey = altJ, option = OPTION(objectsDirectory);
};
BoolOptionBox excludeFromBuild
{
rightPane, this, position = { 8, 28 },
- text = "Exclude from Build", visible = false, option = OPTION(excludeFromBuild);
+ text = $"Exclude from Build", visible = false, option = OPTION(excludeFromBuild);
};
Label labelPreprocessorDefs { rightPane, this, position = { 8, 50 }, labeledWindow = preprocessorDefs };
StringArrayOptionBox preprocessorDefs
{
rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 66, right = 8 };
- text = "Preprocessor Definitions", hotKey = altD, option = OPTION(preprocessorDefinitions);
+ text = $"Preprocessor Definitions", hotKey = altD, option = OPTION(preprocessorDefinitions);
};
Label labelDefaultNameSpace { rightPane, this, position = { 8, 92 }, labeledWindow = defaultNameSpace };
StringOptionBox defaultNameSpace
{
rightPane, this, size = { 160, 22 }, position = { 8, 108 };
- text = "Default Name Space", option = OPTION(defaultNameSpace);
+ text = $"Default Name Space", option = OPTION(defaultNameSpace);
};
BoolOptionBox strictNameSpaces
{
- rightPane, this, position = { 172, 112 },
- text = "Strict Name Spaces", option = OPTION(strictNameSpaces);
+ rightPane, this, position = { 172, 112 },
+ text = $"Strict Name Spaces", option = OPTION(strictNameSpaces);
+ };
+
+ BoolOptionBox fastMath
+ {
+ rightPane, this, position = { 316, 112 },
+ text = $"Fast Math", option = OPTION(fastMath);
};
BoolOptionBox memoryGuard
{
rightPane, this, position = { 8, 154 };
- text = "MemoryGuard", hotKey = altM, option = OPTION(memoryGuard);
+ text = $"MemoryGuard", hotKey = altM, option = OPTION(memoryGuard);
};
Label labelWarnings { rightPane, position = { 116, 138 }, labeledWindow = warnings };
WarningsDB warnings
{
rightPane, this, position = { 116, 154 };
- text = "Warnings", hotKey = altW, option = OPTION(warnings);
+ text = $"Warnings", hotKey = altW, option = OPTION(warnings);
};
- Label labelOptimization { rightPane, position = { 244, 138 }, labeledWindow = optimization };
+ Label labelOptimization { rightPane, position = { 220, 138 }, labeledWindow = optimization };
OptimizationDB optimization
{
- rightPane, this, position = { 244, 154 }, size = { 120, 22 };
- text = "Optimization", hotKey = altO, option = OPTION(optimization);
+ rightPane, this, position = { 220, 154 }, size = { 120, 22 };
+ text = $"Optimization", hotKey = altO, option = OPTION(optimization);
};
BoolOptionBox debug
{
rightPane, this, position = { 8, 188 };
- text = "Debuggable", hotKey = altG, option = OPTION(debug);
+ text = $"Debuggable", hotKey = altG, option = OPTION(debug);
};
BoolOptionBox profiling
{
rightPane, this, position = { 116, 188 };
- text = "Profiling Data", hotKey = altP, option = OPTION(profile);
+ text = $"Profiling Data", hotKey = altP, option = OPTION(profile);
};
BoolOptionBox noLineNumbers
{
- rightPane, this, position = { 244, 188 };
- text = "No Line Numbers", hotKey = altN, option = OPTION(noLineNumbers);
+ rightPane, this, position = { 220, 188 };
+ text = $"No Line Numbers", hotKey = altN, option = OPTION(noLineNumbers);
+ };
+
+ Label labelCompilerOptions { rightPane, this, position = { 8, 208 }, labeledWindow = compilerOptions };
+ StringArrayOptionBox compilerOptions
+ {
+ rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 224, right = 8 };
+ text = $"Compiler Options", hotKey = altO, option = OPTION(compilerOptions);
+ configReplaces = true;
};
Label labelIncludeDirs { includeDirs.editor, labeledWindow = includeDirs, position = { 0, 6 }; };
DirsArrayOptionBox includeDirs
{
- rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 208, right = 8, bottom = 8 };
- text = "Additional Include Directories", hotKey = altI, option = OPTION(includeDirs);
+ rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 250, right = 8, bottom = 8 };
+ text = $"Additional Include Directories", hotKey = altI, option = OPTION(includeDirs), switchToKeep = "I";
};
CompilerTab()
{
DataRow row = addTo ? addTo.AddRow() : fileList.AddRow();
- row.tag = (int)node;
+ row.tag = (int64)node;
row.SetData(null, node);
- if(node.files && node.files.first && node.parent &&
- !(!node.parent.parent &&
- (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
+ if(node.files && node.files.first && node.parent &&
+ !(!node.parent.parent &&
+ (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
!strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
row.collapsed = true;
else if(node.type == folder)
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
class LinkerTab : Tab
{
- background = activeBorder;
- text = "Linker";
+ background = formColor;
+ text = $"Linker";
Label labelTargetName { this, position = { 8, 8 }, labeledWindow = targetName };
StringOptionBox targetName
{
this, position = { 8, 24 }, size = { 200, 22 };
- text = "Target Name", hotKey = altN, option = OPTION(targetFileName);
+ text = $"Target Name", hotKey = altN, option = OPTION(targetFileName);
};
-
+
Label labelTargetType { this, position = { 216, 8 }, labeledWindow = targetType };
TargetTypeDB targetType
{
this, position = { 216, 24 }, size = { 120, 22 };
- text = "Target Type", hotKey = altT, option = OPTION(targetType);
+ text = $"Target Type", hotKey = altT, option = OPTION(targetType);
};
-
+
Label labelTargetDirectory { this, position = { 344, 8 }, labeledWindow = targetDirectory };
PathOptionBox targetDirectory
{
this, size = { 270, 22 }, anchor = { left = 344, top = 24, right = 8 };
- hotKey = altR, text = "Target Directory", option = OPTION(targetDirectory);
+ hotKey = altR, text = $"Target Directory", option = OPTION(targetDirectory);
};
Label labelLibraries { this, position = { 8, 50 }, labeledWindow = libraries };
StringArrayOptionBox libraries
{
this, size = { 290, 22 }, anchor = { left = 8, top = 66, right = 8 };
- text = "Additional Libraries", hotKey = altL, option = OPTION(libraries);
+ text = $"Additional Libraries", hotKey = altL, option = OPTION(libraries), switchToKeep = "l";
configReplaces = true;
};
StringArrayOptionBox linkerOptions
{
this, size = { 290, 22 }, anchor = { left = 8, top = 108, right = 8 };
- text = "Linker Options", hotKey = altO, option = OPTION(linkerOptions);
+ text = $"Linker Options", hotKey = altO, option = OPTION(linkerOptions);
configReplaces = true;
};
BoolOptionBox console
{
this, position = { 8, 138 };
- text = "Console Application", hotKey = altC, option = OPTION(console);
+ text = $"Console Application", hotKey = altC, option = OPTION(console);
};
BoolOptionBox compress
{
this, position = { 8, 162 };
- text = "Compress", hotKey = altW, option = OPTION(compress);
+ text = $"Compress", hotKey = altW, option = OPTION(compress);
};
Label labelLibraryDirs { libraryDirs.editor, labeledWindow = libraryDirs, position = { 0, 6 }; };
DirsArrayOptionBox libraryDirs
{
this, size = { 290, 22 }, anchor = { left = 8, top = 182, right = 8, bottom = 8 };
- text = "Additional Library Directories", hotKey = altY, option = OPTION(libraryDirs);
+ text = $"Additional Library Directories", hotKey = altY, option = OPTION(libraryDirs), switchToKeep = "L";
};
bool OnCreate()
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
class BuilderTab : Tab
{
- background = activeBorder;
- text = "Builder";
+ background = formColor;
+ text = $"Builder";
Label labelPrebuildCommands { prebuildCommands.editor, labeledWindow = prebuildCommands, position = { 0, 6 }; };
StringsArrayOptionBox prebuildCommands
{
- this, size = { 290, 100 }, anchor = { left = 8, top = 52, right = 8 };
- text = "Pre-build Commands", hotKey = altE, option = OPTION(prebuildCommands);
+ this, size = { 290, 92 }, anchor = { left = 8, top = 8, right = 8, bottom = 200 };
+ text = $"Pre-build Commands", hotKey = altE, option = OPTION(prebuildCommands);
};
Label labelPostbuildCommands { postbuildCommands.editor, labeledWindow = postbuildCommands, position = { 0, 6 }; };
StringsArrayOptionBox postbuildCommands
{
- this, size = { 290, 100 }, anchor = { left = 8, top = 160, right = 8 };
- text = "Post-build Commands", hotKey = altT, option = OPTION(postbuildCommands);
+ this, size = { 290, 92 }, anchor = { left = 8, top = 100, right = 8, bottom = 100 };
+ text = $"Post-build Commands", hotKey = altT, option = OPTION(postbuildCommands);
+ };
+
+ Label labelInstallCommands { installCommands.editor, labeledWindow = installCommands, position = { 0, 6 }; };
+ StringsArrayOptionBox installCommands
+ {
+ this, size = { 290, 92 }, anchor = { left = 8, top = 200, right = 8, bottom = 8 };
+ text = $"Install Commands", hotKey = altT, option = OPTION(installCommands);
};
void LoadSettings()
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
+
+ void OnResize(int width, int height)
+ {
+ int h = (height - 8 * 4) / 3;
+ prebuildCommands.anchor = { left = 8, top = 8, right = 8, bottom = h * 2 + 8 * 3 };
+ postbuildCommands.anchor = { left = 8, top = h + 8 * 2, right = 8, bottom = h + 8 * 2 };
+ installCommands.anchor = { left = 8, top = h * 2 + 8 * 3, right = 8, bottom = 8 };
+ }
}