import "IDESettings"
-import "PathBox"
-import "SelectorBar"
-import "DirectoriesBox"
+// import "SelectorBar"
import "CompilersDetectionDialog"
+import "ide"
-FileDialog settingsFileDialog { type = selectDir, text = "Select directory" };
+FileDialog settingsFileDialog { type = selectDir, text = $"Select directory" };
-FileDialog toolchainFileDialog { type = open, text = "Open"; mayNotExist = true; };
+FileDialog toolchainFileDialog { type = open, text = $"Open"; mayNotExist = true; };
class GlobalSettingsDialog : Window
{
autoCreate = false;
tabCycle = true;
- background = activeBorder;
+ background = formColor;
hasClose = true;
borderStyle = sizable;
- text = "Global Settings";
- minClientSize = { 560, 420 };
+ text = $"Global Settings";
+ minClientSize = { 560, 506 };
+ nativeDecorations = true;
IDESettings ideSettings;
IDESettingsContainer settingsContainer;
String workspaceActiveCompiler;
-
- TabControl tabControl { this, background = activeBorder, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
-
+
+ TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
+
EditorTab editorTab { this, tabControl = tabControl };
CompilersTab compilersTab { this, tabControl = tabControl };
ProjectOptionsTab projectOptionsTab { this, tabControl = tabControl };
WorkspaceOptionsTab workspaceOptionsTab { this, tabControl = tabControl };
-
+
property bool settingsModified
{
get
}
}
+ bool OnClose(bool parentClosing)
+ {
+ if(!settingsModified || MessageBox {
+ type = okCancel, master = ide,
+ text = $"Lose Changes?",
+ contents = $"Are you sure you wish to discard changes?"
+ }.Modal() == ok)
+ return true;
+ return false;
+ }
+
Button cancel
{
- parent = this, hotKey = escape, text = "Cancel", id = DialogResult::cancel;
+ parent = this, hotKey = escape, text = $"Cancel", id = DialogResult::cancel;
position = { 290, 290 }, size = { 80 };
anchor = { right = 8, bottom = 8 };
NotifyClicked = ButtonCloseDialog;
Button ok
{
- parent = this, isDefault = true, text = "OK";
+ parent = this, isDefault = true, text = $"OK";
position = { 200, 290 }, size = { 90 };
anchor = { right = 96, bottom = 8 };
bool compilerSettingsChanged = false;
bool projectOptionsChanged = false;
bool workspaceOptionsChanged = false;
-
+
if(editorTab.modifiedDocument)
{
if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
editorSettingsChanged = true;
}
}
-
+
if(compilersTab.modifiedDocument)
{
+ Workspace workspace = ide.workspace;
+ if(strcmp(compilersTab.compilerConfigsDir.path, ideSettings.compilerConfigsDir))
+ ideSettings.compilerConfigsDir = compilersTab.compilerConfigsDir.path;
ideSettings.compilerConfigs.Free();
for(compiler : compilersTab.compilerConfigs)
+ {
ideSettings.compilerConfigs.Add(compiler.Copy());
+ }
+
compilerSettingsChanged = true;
}
OnGlobalSettingChange(GlobalSettingsChange::editorSettings);
if(projectOptionsChanged)
OnGlobalSettingChange(GlobalSettingsChange::projectOptions);
+
+ editorTab.modifiedDocument = false;
+ compilersTab.modifiedDocument = false;
+ projectOptionsTab.modifiedDocument = false;
+ workspaceOptionsTab.modifiedDocument = false;
}
-
+
Destroy(DialogResult::ok);
return true;
}
activateCompiler = readonlyCompiler;
if(!activateCompiler && ideSettings.compilerConfigs.count)
activateCompiler = ideSettings.compilerConfigs[0];
-
+
for(compiler : ideSettings.compilerConfigs)
compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
+ compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
// ProjectOptionsTab
projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
-
+
return true;
}
class EditorTab : GlobalSettingsSubTab
{
- background = activeBorder;
- text = "Editor";
+ background = formColor;
+ text = $"Editor";
Button useFreeCaret
{
- this, text = "Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
+ this, text = $"Move code editor caret freely past end of line", position = { 16, 68 }, isCheckbox = true;
NotifyClicked = NotifyClickedModifiedDocument;
};
Button caretFollowsScrolling
{
- this, text = "Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
+ this, text = $"Keep caret visible (move along) when scrolling", position = { 16, 88 }, isCheckbox = true;
NotifyClicked = NotifyClickedModifiedDocument;
};
Button showLineNumbers
{
- this, text = "Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
+ this, text = $"Show line numbers in code editor", position = { 16, 108 }, isCheckbox = true;
NotifyClicked = NotifyClickedModifiedDocument;
};
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
class CompilersTab : GlobalSettingsSubTab
{
- background = activeBorder;
- text = "Compilers";
+ background = formColor;
+ text = $"Compilers";
+
+ Label compilerConfigsDirLabel { this, position = { 8, 12 }, labeledWindow = compilerConfigsDir, tabCycle = false, inactive = true };
+ PathBox compilerConfigsDir
+ {
+ this, anchor = { left = 210, top = 8, right = 8 };
+ text = $"Compiler Configurations Directory", browseDialog = settingsFileDialog, NotifyModified = NotifyModifiedDocument;
+ };
SelectorBar compilerSelector
{
- this, text = "Compiler Configurations:", anchor = { left = 148, top = 8, right = 99 }; size = { 0, 26 };
+ this, text = $"Compiler Configurations:", anchor = { left = 148, top = 38, right = 99 }; size = { 0, 26 };
opacity = 0;
direction = horizontal, scrollable = true;
}
return SelectorBar::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
((CompilersTab)master).labelCompilers.Update(null);
bool OnPostCreate()
{
+ CompilersTab compilers = (CompilersTab)parent;
SelectorBar::OnPostCreate();
- if(((CompilersTab)parent).selectedButton)
+ if(compilers.selectedButton)
{
- ((CompilersTab)parent).selectedButton.Activate();
- ((CompilersTab)parent).selectedButton.checked = true;
- ((CompilersTab)parent).selectedButton = null;
+ Button sb = compilers.selectedButton;
+ sb.Activate();
+ sb.checked = true;
+ // Why was this being set to null? On going back to compilers the 2nd time, the selectedButton was lost and so was not made visible...
+ // compilers.selectedButton = null;
}
return true;
}
};
- TabControl tabControl { this, background = activeBorder, anchor = { left = 8, top = 38, right = 8, bottom = 8 } };
-
+ TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
+
CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
Label labelCompilers
{
- this, anchor = { left = 8, top = 14 }, labeledWindow = compilerSelector;
+ this, anchor = { left = 8, top = 44 }, labeledWindow = compilerSelector;
void OnRedraw(Surface surface)
{
{
parent = this, bevelOver = true, inactive = true;
size = { 22, 22 };
- anchor = { top = 10, right = 77 };
+ anchor = { top = 40, right = 77 };
hotKey = altC, bitmap = BitmapResource { fileName = ":actions/docNew.png", alphaBlend = true };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
parent = this, bevelOver = true, inactive = true;
size = { 22, 22 };
- anchor = { top = 10, right = 54 };
+ anchor = { top = 40, right = 54 };
hotKey = altC, bitmap = BitmapResource { fileName = ":actions/attach.png", alphaBlend = true };
bool NotifyClicked(Button b, int x, int y, Modifiers mods)
{
parent = this, bevelOver = true, inactive = true;
size = { 22, 22 };
- anchor = { top = 10, right = 31 };
+ anchor = { top = 40, right = 31 };
hotKey = altU, bitmap = BitmapResource { fileName = ":actions/editCopy.png", alphaBlend = true };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
parent = this, bevelOver = true, inactive = true;
size = { 22, 22 };
- anchor = { top = 10, right = 8 };
+ anchor = { top = 40, right = 8 };
hotKey = altD, bitmap = BitmapResource { fileName = ":actions/delete2.png", alphaBlend = true };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
if(activeCompiler)
{
CompilerConfig compilerToDelete = activeCompiler;
- String title = PrintString("Delete ", compilerToDelete.name, " Compiler Configuration");
- String msg = PrintString("Are you sure you wish to delete the ", compilerToDelete.name, " compiler configuration?");
+ String title = PrintString($"Delete ", compilerToDelete.name, $" Compiler Configuration");
+ String msg = PrintString($"Are you sure you wish to delete the ", compilerToDelete.name, $" compiler configuration?");
if(MessageBox { type = okCancel, text = title, contents = msg }.Modal() == ok)
{
- SelectorButton button = compilerSelector.FindButtonByID((int)compilerToDelete);
+ SelectorButton button = compilerSelector.FindButtonByID((int64)compilerToDelete);
if(button)
compilerSelector.RemoveButton(button);
//DeleteCompiler(compilerToDelete);
{
SelectorButton button
{
- compilerSelector, master = this, text = compiler.name, id = (int)compiler;
+ compilerSelector, master = this, text = compiler.name, id = (int64)compiler;
NotifyClicked = CompilerClicked;
};
selectButton = button;
{
EditableSelectorButton button
{
- compilerSelector, master = this, renameable = true, text = compiler.name, id = (int)compiler;
+ compilerSelector, master = this, renameable = true, text = compiler.name, id = (int64)compiler;
NotifyClicked = CompilerClicked;
bool OnRename(EditableSelectorButton button, char ** oldName, char ** newName)
void LoadCompiler(CompilerConfig compiler)
{
+ bool modified = modifiedDocument;
activeCompiler = compiler;
dirsTab.Load();
environmentTab.Load();
optionsTab.Load();
+ // Restore original modifiedDocument
+ modifiedDocument = modified;
+
deleteCompiler.disabled = compiler.readOnly;
}
bool CompilerClicked(Button clickedButton, int x, int y, Modifiers mods)
{
if(!eClass_IsDerived(clickedButton._class, class(EditableSelectorButton)) || !((EditableSelectorButton)clickedButton).editBox)
+ {
LoadCompiler((CompilerConfig)clickedButton.id);
+ selectedButton = (SelectorButton)clickedButton;
+ }
+ return true;
+ }
+
+ bool NotifyModifiedDocument(PathBox pathBox)
+ {
+ BasicValidatePathBoxPath(pathBox);
+ modifiedDocument = true;
return true;
}
}
+Array<String> displayDirectoryNames
+{ [
+ $"Include Files",
+ $"Library Files",
+ $"Executable Files"
+] };
+
class CompilerDirectoriesTab : CompilersSubTab
{
- background = activeBorder;
- text = "Directories";
+ background = formColor;
+ text = $"Directories";
Button dirTypeTglBtn[DirTypes];
DirectoriesBox dirs[DirTypes], currentDirs;
+ ~CompilerDirectoriesTab()
+ {
+ DirTypes c;
+ for(c = 0; c < DirTypes::enumSize; c++)
+ {
+ delete dirs[c];
+ delete dirTypeTglBtn[c];
+ }
+ }
CompilerDirectoriesTab()
{
DirTypes c;
row.SetData(null, (s = CopyUnixPath(settingsFileDialog.filePath)));
*/
- bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+ bool NotifyModified(DirectoriesBox dirsBox)
{
- // DirectoriesBox's NotifyModified isn't working! Or it's not called before this?
- if(!active && (modifiedDocument || list.modifiedDocument))
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerDirectoriesTab dirsTab = (CompilerDirectoriesTab)parent;
- CompilerConfig compiler = dirsTab.loadedCompiler;
- if(compiler)
- {
- DirTypes dirType = (DirTypes)id;
- // TODO ? I think not, see DirectoriesBox.ec: CopyUnixPath() must be called when copying these dirs
-
- if(dirType == includes)
- compiler.includeDirs = strings;
- else if(dirType == libraries)
- compiler.libraryDirs = strings;
- else if(dirType == executables)
- compiler.executableDirs = strings;
-
- //modifiedDocument = true;
- dirsTab.compilersTab.modifiedDocument = true;
- }
+ DirTypes dirType = (DirTypes)dirsBox.id;
+ if(dirType == includes)
+ compiler.includeDirs = dirsBox.strings;
+ else if(dirType == libraries)
+ compiler.libraryDirs = dirsBox.strings;
+ else if(dirType == executables)
+ compiler.executableDirs = dirsBox.strings;
+
+ compilersTab.modifiedDocument = true;
}
return true;
}
+ bool NotifyPathBoxModified(DirectoriesBox dirsBox, PathBox pathBox)
+ {
+ BasicValidatePathBoxPath(pathBox);
+ return true;
+ }
};
incref dirs[c];
-
+
if(c)
dirs[c].visible = false;
-
+
// (width) Should be 324 for text...
//field[c] = { dataType = class(char *), editable = true };
//dirs[c].AddField(field[c]);
int v = (int)c * 100 + 8;
dirTypeTglBtn[c] = Button
{
- this, inactive = true, text = settingsDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
+ this, inactive = true, text = displayDirectoryNames[c], bevelOver = true, isRadio = true, bitmap = null;
stayOnTop = true;
id = c;
size = { 99, 20 };
else if(c == executables)
dirTypeTglBtn[c].hotKey = altE;
}
- }
+ }
currentDirs = dirs[includes];
dirTypeTglBtn[includes].checked = true;
return true;
void Load()
{
- if(loadedCompiler)
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerConfig compiler = loadedCompiler;
dirs[includes].strings = compiler.includeDirs;
dirs[libraries].strings = compiler.libraryDirs;
dirs[executables].strings = compiler.executableDirs;
+ dirs[includes].list.scroll = { 0, 0 };
+ dirs[libraries].list.scroll = { 0, 0 };
+ dirs[executables].list.scroll = { 0, 0 };
}
}
}
class CompilerToolchainTab : CompilersSubTab
{
- background = activeBorder;
- text = "Toolchain";
+ background = formColor;
+ text = $"Toolchain";
+
+ int margin;
+ margin = 130;
Label ecpLabel { this, position = { 8, 12 }, labeledWindow = ecp, tabCycle = false, inactive = true };
PathBox ecp
{
- this, anchor = { left = 120, top = 8, right = 8 };
- text = "eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 8, right = 8 };
+ text = $"eC Precompiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
Label eccLabel { this, position = { 8, 38 }, labeledWindow = ecc, tabCycle = false, inactive = true };
PathBox ecc
{
- this, anchor = { left = 120, top = 34, right = 8 };
- text = "eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 34, right = 8 };
+ text = $"eC Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
Label ecsLabel { this, position = { 8, 64 }, labeledWindow = ecs, tabCycle = false, inactive = true };
PathBox ecs
{
- this, anchor = { left = 120, top = 60, right = 8 };
- text = "eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 60, right = 8 };
+ text = $"eC Symbol Loader", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
Label earLabel { this, position = { 8, 90 }, labeledWindow = ear, tabCycle = false, inactive = true };
PathBox ear
{
- this, anchor = { left = 120, top = 86, right = 8 };
- text = "Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 86, right = 8 };
+ text = $"Ecere Archiver", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
Label cppLabel { this, position = { 8, 116 }, labeledWindow = cpp, tabCycle = false, inactive = true };
PathBox cpp
{
- this, anchor = { left = 120, top = 112, right = 8 };
- text = "C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 112, right = 8 };
+ text = $"C Preprocessor", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
Label ccLabel { this, position = { 8, 142 }, labeledWindow = cc, tabCycle = false, inactive = true };
PathBox cc
{
- this, anchor = { left = 120, top = 138, right = 8 };
- text = "C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 138, right = 8 };
+ text = $"C Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
- Label makeLabel { this, position = { 8, 168 }, labeledWindow = make, tabCycle = false, inactive = true };
+ Label cxxLabel { this, position = { 8, 168 }, labeledWindow = cxx, tabCycle = false, inactive = true };
+ PathBox cxx
+ {
+ this, anchor = { left = margin, top = 164, right = 8 };
+ text = $"C++ Compiler", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ };
+ Label makeLabel { this, position = { 8, 194 }, labeledWindow = make, tabCycle = false, inactive = true };
PathBox make
{
- this, anchor = { left = 120, top = 164, right = 8 };
- text = "GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 190, right = 8 };
+ text = $"GNU Make", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ };
+ Label gnuToolchainPrefixLabel { this, position = { 8, 220 }, labeledWindow = gnuToolchainPrefix, tabCycle = false, inactive = true };
+ PathBox gnuToolchainPrefix
+ {
+ this, anchor = { left = margin, top = 216, right = 8 };
+ text = $"GNU Toolchain Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ };
+ Label sysrootLabel { this, position = { 8, 246 }, labeledWindow = sysroot, tabCycle = false, inactive = true };
+ PathBox sysroot
+ {
+ this, anchor = { left = margin, top = 242, right = 8 };
+ text = $"SYSROOT", typeExpected = directory, browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
- Label execPrefixLabel { this, position = { 8, 194 }, labeledWindow = execPrefix, tabCycle = false, inactive = true };
- PathBox execPrefix
+ Label executableLauncherLabel { this, position = { 8, 272 }, labeledWindow = executableLauncher, tabCycle = false, inactive = true };
+ PathBox executableLauncher
{
- this, anchor = { left = 120, top = 190, right = 8 };
- text = "Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+ this, anchor = { left = margin, top = 268, right = 8 };
+ text = $"Executable Launcher", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
};
bool NotifyModifiedDocument(PathBox pathBox)
{
- if(loadedCompiler)
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerConfig compiler = loadedCompiler;
+ BasicValidatePathBoxPath(pathBox);
if(pathBox == ecp)
compiler.ecpCommand = pathBox.slashPath;
else if(pathBox == ecc)
compiler.cppCommand = pathBox.slashPath;
else if(pathBox == cc)
compiler.ccCommand = pathBox.slashPath;
+ else if(pathBox == cxx)
+ compiler.cxxCommand = pathBox.slashPath;
else if(pathBox == make)
compiler.makeCommand = pathBox.slashPath;
- else if(pathBox == execPrefix)
+ else if(pathBox == executableLauncher)
compiler.execPrefixCommand = pathBox.slashPath;
+ else if(pathBox == gnuToolchainPrefix)
+ compiler.gccPrefix = pathBox.slashPath;
+ else if(pathBox == sysroot)
+ compiler.sysroot = pathBox.slashPath;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
void Load()
{
- if(loadedCompiler)
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerConfig compiler = loadedCompiler;
bool disabled = compiler.readOnly;
bool isVC = compiler.type.isVC;
ecp.path = compiler.ecpCommand;
ear.path = compiler.earCommand;
cpp.path = compiler.cppCommand;
cc.path = compiler.ccCommand;
+ cxx.path = compiler.cxxCommand;
make.path = compiler.makeCommand;
- execPrefix.path = compiler.execPrefixCommand;
+ executableLauncher.path = compiler.executableLauncher;
+ gnuToolchainPrefix.path = compiler.gnuToolchainPrefix;
+ sysroot.path = compiler.sysroot;
ecpLabel.disabled = ecp.disabled = disabled;
eccLabel.disabled = ecc.disabled = disabled;
ecsLabel.disabled = ecs.disabled = disabled;
earLabel.disabled = ear.disabled = disabled;
cppLabel.disabled = cpp.disabled = isVC || disabled;
+ cxxLabel.disabled = cxx.disabled = isVC || disabled;
ccLabel.disabled = cc.disabled = isVC || disabled;
makeLabel.disabled = make.disabled = disabled;
- execPrefixLabel.disabled = execPrefix.disabled = disabled;
+ executableLauncherLabel.disabled = executableLauncher.disabled = disabled;
+ gnuToolchainPrefixLabel.disabled = gnuToolchainPrefix.disabled = disabled;
+ sysrootLabel.disabled = sysroot.disabled = disabled;
}
modifiedDocument = false;
}
class CompilerEnvironmentTab : CompilersSubTab
{
- background = activeBorder;
- text = "Environment";
+ background = formColor;
+ text = $"Environment";
Label labelEnvVars { envVars, labeledWindow = envVars, position = { 0, 6 }; };
NamedStringsBox envVars
{
this, size = { 290, 22 }, anchor = { left = 8, top = 8, right = 8, bottom = 8 };
- text = "Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
+ text = $"Environment Variables", hotKey = altE; //, option = OPTION(postbuildCommands);
bool NotifyModified(NamedStringsBox stringsBox)
{
- loadedCompiler.environmentVars = stringsBox.namedStrings;
- modifiedDocument = true;
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.environmentVars = stringsBox.namedStrings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
return true;
}
};
void Load()
{
- if(loadedCompiler)
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerConfig compiler = loadedCompiler;
envVars.namedStrings = compiler.environmentVars;
- modifiedDocument = true;
- compilersTab.modifiedDocument = true;
+
+ modifiedDocument = false;
}
}
}
class CompilerOptionsTab : CompilersSubTab
{
- background = activeBorder;
- text = "Options";
+ background = formColor;
+ text = $"Options";
Label labelTargetPlatform { this, position = { 8, 12 }, labeledWindow = targetPlatform }; // TOCHECK: nameless instances dissapear when selecting tabs?
DropBox targetPlatform
{
this, position = { 110, 8 }, size = { 160 };
- text = "Target Platform", hotKey = altT;
+ text = $"Target Platform", hotKey = altT;
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
CompilerConfig compiler = loadedCompiler;
Label numJobsLabel { this, position = { 8, 40 }, labeledWindow = numJobsBox };
DataBox numJobsBox
{
- this, text = "Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
+ this, text = $"Number of parallel build jobs", hotKey = altJ, borderStyle = deep;
position = { 184, 36 }, size = { 80, 20 }, type = class(int), data = &numJobs;
bool OnKeyDown(Key key, unichar ch)
{
if((SmartKey)key == enter)
- {
+ {
DataBox::OnKeyDown(key, ch);
return true;
}
else
return DataBox::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
if(!active)
return true;
}
- bool NotifyChanged(bool closingDropDown)
+ bool NotifyChanged(DataBox dataBox, bool closingDropDown)
{
CompilerConfig compiler = loadedCompiler;
if(compiler)
}
};
+ Button ccacheEnabled
+ {
+ this, text = $"Use ccache", hotKey = altC, position = { 8, 68 };
+ isCheckbox = true;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.ccacheEnabled = button.checked;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ };
+
+ Button distccEnabled
+ {
+ this, text = $"Use distcc", hotKey = altD, position = { 158, 68 };
+ isCheckbox = true;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ distccHosts.disabled = !button.checked;
+ compiler.distccEnabled = button.checked;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ };
+
+ Label distccHostsLabel { this, position = { 8, 96 }, labeledWindow = distccHosts };
+ EditBox distccHosts
+ {
+ this, text = $"distcc hosts", hotKey = altH;
+ position = { 88, 92 }, size = { 300, 22 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.distccHosts = editBox.contents;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
+ Label lblPrepDefs { this, position = { 8, 126 }, labeledWindow = prepDefs };
+ StringListBox prepDefs
+ {
+ this, text = $"Preprocessor directives", hotKey = altP;
+ position = { 148, 124 }, size = { 300, 22 }, anchor = { left = 148, top = 124, right = 8 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ if(loadedCompiler)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ compiler.prepDirectives = ((StringListBox)editBox).strings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
+ Label leCcompilerFlags { this, position = { 8, 156 }, labeledWindow = eCcompilerFlags };
+ StringListBox eCcompilerFlags
+ {
+ this, text = $"Additional eC compiler flags", hotKey = altG;
+ position = { 148, 154 }, size = { 300, 22 }, anchor = { left = 148, top = 154, right = 8 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ if(loadedCompiler)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ compiler.eCcompilerFlags = ((StringListBox)editBox).strings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
+ Label lblCompilerFlags { this, position = { 8, 186 }, labeledWindow = compilerFlags };
+ StringListBox compilerFlags
+ {
+ this, text = $"Additional compiler flags", hotKey = altR;
+ position = { 148, 184 }, size = { 300, 22 }, anchor = { left = 148, top = 184, right = 8 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ if(loadedCompiler)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ compiler.compilerFlags = ((StringListBox)editBox).strings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
+ Label lblLinkerFlags { this, position = { 8, 216 }, labeledWindow = linkerFlags };
+ StringListBox linkerFlags
+ {
+ this, text = $"Additional linker flags", hotKey = altL;
+ position = { 148, 214 }, size = { 300, 22 }, anchor = { left = 148, top = 214, right = 8 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ if(loadedCompiler)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ compiler.linkerFlags = ((StringListBox)editBox).strings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
+ Label lblExcludedLibraries { this, position = { 8, 246 }, labeledWindow = excludedLibraries };
+ StringListBox excludedLibraries
+ {
+ this, text = $"Libraries to exclude", hotKey = altX;
+ position = { 148, 244 }, size = { 300, 22 }, anchor = { left = 148, top = 244, right = 8 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ if(loadedCompiler)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ compiler.excludeLibs = ((StringListBox)editBox).strings;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ }
+
CompilerOptionsTab()
{
Platform p;
void Load()
{
- if(loadedCompiler)
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
{
- CompilerConfig compiler = loadedCompiler;
bool disabled = compiler.readOnly;
targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
numJobs = compiler.numJobs;
numJobsBox.Refresh();
-
+ ccacheEnabled.checked = compiler.ccacheEnabled;
+ distccEnabled.checked = compiler.distccEnabled;
+ distccHosts.disabled = !compiler.distccEnabled;
+ distccHosts.contents = compiler.distccHosts;
+ prepDefs.strings = compiler.prepDirectives;
+ excludedLibraries.strings = compiler.excludeLibs;
+ eCcompilerFlags.strings = compiler.eCcompilerFlags;
+ compilerFlags.strings = compiler.compilerFlags;
+ linkerFlags.strings = compiler.linkerFlags;
+
labelTargetPlatform.disabled = disabled;
targetPlatform.disabled = disabled;
class ProjectOptionsTab : GlobalSettingsSubTab
{
- background = activeBorder;
- text = "Project";
+ background = formColor;
+ text = $"Project";
Label defaultTargetDirLabel { this, position = { 8, 34 }, labeledWindow = defaultTargetDir };
PathBox defaultTargetDir
{
this, size = { 160, 21 }, position = { 8, 52 }, anchor = { left = 8, top = 52, right = 8 };
- text = "Default Target Directory", hotKey = altT;
+ text = $"Default Target Directory", hotKey = altT;
- bool NotifyModified(PathBox editBox)
+ bool NotifyModified(PathBox pathBox)
{
+ BasicValidatePathBoxPath(pathBox);
modifiedDocument = true;
return true;
}
PathBox defaultIntermediateObjDir
{
this, size = { 160, 21 }, position = { 8, 96 }, anchor = { left = 8, top = 96, right = 8 };
- text = "Default Intermediate Objects Directory", hotKey = altI;
+ text = $"Default Intermediate Objects Directory", hotKey = altI;
- bool NotifyModified(PathBox editBox)
+ bool NotifyModified(PathBox pathBox)
{
+ BasicValidatePathBoxPath(pathBox);
modifiedDocument = true;
return true;
}
};
}
-// COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
+// COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
// of WorkspaceOptionsTab will *not* be called!
class GlobalSettingsSubTab : Tab
{
class WorkspaceOptionsTab : GlobalSettingsSubTab
{
- background = activeBorder;
- text = "Workspace";
+ background = formColor;
+ text = $"Workspace";
Label defaultCompilerLabel { this, position = { 8, 14 }, labeledWindow = defaultCompilerDropBox };
DropBox defaultCompilerDropBox
{
this, position = { 140, 8 }, size = { 220 };
- text = "Default Compiler", hotKey = altA;
+ text = $"Default Compiler", hotKey = altA;
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
for(compiler : dialog.ideSettings.compilerConfigs)
{
row = defaultCompilerDropBox.AddString(compiler.name);
- if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
+ if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
!strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
defaultCompilerDropBox.currentRow = row;
}
void OnDestroy()
{
+ // TOFIX: The selection will be lost upon changing tab...
+ // Should either warn, or leave it modified and put in place
+ // checks to save/find the compiler by name
defaultCompilerDropBox.Clear();
+ modifiedDocument = false;
}
}