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)
{
- if(!first)
- AddS(" ");
- AddS(item);
- 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(c - start)
- array.Add(MakeString(contents + start, c - start));
+ {
+ if((s = MakeString(contents + start, c - start, switchToKeep, lenSwitchToKeep)))
+ array.Add(s);
+ }
return array;
}
}
{
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;
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);
}
}
// 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
{
int len;
char path[MAX_LOCATION];
-#ifdef __WIN32__
- bool volumePath = false;
-#endif
- strcpy(path, pathBox.path);
- TrimLSpaces(path, path);
- TrimRSpaces(path, path);
- MakeSystemPath(path);
-#ifdef __WIN32__
- if(path[0] && path[1] == ':')
- {
- path[1] = '_';
- volumePath = true;
- }
-#endif
- {
- char * chars = "*|:\",<>?";
- char ch, * s = path, * o = path;
- while((ch = *s++)) { if(!strchr(chars, ch)) *o++ = ch; }
- *o = '\0';
- }
-#ifdef __WIN32__
- if(volumePath && path[0])
- path[1] = ':';
-#endif
+ ValidPathBufCopy(path, pathBox.path);
len = strlen(path);
if(len && !(path[0] == '.' && (len == 1 || (len == 2 && path[1] == DIR_SEP) || (len > 1 && path[1] == '.'))))
{
class DirsArrayOptionBox : MultiStringOptionBox
{
+public:
+ property char * switchToKeep { set { switchToKeep = value; lenSwitchToKeep = strlen(value); } };
+private:
+ char * switchToKeep;
+ int lenSwitchToKeep;
+
editor = DirectoriesBox
{
+ browseDialog = { };
bool NotifyModified(DirectoriesBox dirsBox)
{
+ char * switchToKeep = ((DirsArrayOptionBox)dirsBox.id).switchToKeep;
+ if(switchToKeep && switchToKeep[0])
+ {
+ 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;
+ }
((OptionBox)dirsBox.id).Retrieve();
return true;
}
DirsArrayOptionBox includeDirs
{
rightPane, this, size = { 290, 22 }, anchor = { left = 8, top = 250, right = 8, bottom = 8 };
- text = $"Additional Include Directories", hotKey = altI, option = OPTION(includeDirs);
+ text = $"Additional Include Directories", hotKey = altI, option = OPTION(includeDirs), switchToKeep = "I";
};
CompilerTab()
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;
};
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()
Label labelPrebuildCommands { prebuildCommands.editor, labeledWindow = prebuildCommands, position = { 0, 6 }; };
StringsArrayOptionBox prebuildCommands
{
- this, size = { 290, 100 }, anchor = { left = 8, top = 8, right = 8, bottom = 0.5 };
+ this, size = { 290, 100 }, anchor = { left = 8, top = 8, right = 8, bottom = 0.66 };
text = $"Pre-build Commands", hotKey = altE, option = OPTION(prebuildCommands);
};
Label labelPostbuildCommands { postbuildCommands.editor, labeledWindow = postbuildCommands, position = { 0, 6 }; };
StringsArrayOptionBox postbuildCommands
{
- this, size = { 290 }, anchor = { left = 8, top = 0.5, right = 8, bottom = 8 };
+ this, size = { 290 }, anchor = { left = 8, top = 0.33, right = 8, bottom = 0.33 };
text = $"Post-build Commands", hotKey = altT, option = OPTION(postbuildCommands);
};
+ Label labelInstallCommands { installCommands.editor, labeledWindow = installCommands, position = { 0, 6 }; };
+ StringsArrayOptionBox installCommands
+ {
+ this, size = { 290 }, anchor = { left = 8, top = 0.66, right = 8, bottom = 8 };
+ text = $"Install Commands", hotKey = altT, option = OPTION(installCommands);
+ };
+
void LoadSettings()
{
bool disabled = strlen(((BuildTab)master).selectedPlatformName) > 0;