3 class WorkspaceTab : Tab
8 background = formColor;
11 Label labelDebugDirectory { this, position = { 8, 8 }, labeledWindow = debugDirectory };
12 PathBox debugDirectory
14 this, size = { 290, 22 }, position = { 8, 24 }, anchor = { left = 8, top = 24, right = 8 };
15 text = $"Debug Working Directory", hotKey = altU;
16 typeExpected = directory;
19 bool NotifyModified(PathBox pathBox)
21 char path[MAX_LOCATION];
22 String debugDir = pathBox.path;
23 strcpy(path, ide.workspace.projectDir);
25 PathCat(path, debugDir);
26 if(strcmp(path, debugDir))
27 debugDirectory.path = path;
29 modifiedDocument = true;
34 Label labelCommandLineArgs { this, position = { 8, 50 }, labeledWindow = commandLineArgs };
35 EditBox commandLineArgs
37 this, size = { 290, 22 }, position = { 8, 66 }, anchor = { left = 8, top = 66, right = 8 };
38 text = $"Command Line Arguments", hotKey = altA;
39 NotifyModified = WorkspaceControlModified;
41 Label labelEnvironmentVars { environmentVars, this, position = { 0, 6 }, labeledWindow = environmentVars };
42 NamedStringsBox environmentVars
44 this, size = { 290, 100 }, anchor = { left = 8, top = 96, right = 8 };
45 text = $"Environment Variables", hotKey = altV;
46 NotifyModified = WorkspaceControlModified;
49 Label labelSourceDirs { sourceDirs, this, position = { 0, 6 }, labeledWindow = sourceDirs };
50 DirectoriesBox sourceDirs
52 this, size = { 290, 100 }, anchor = { left = 8, top = 204, right = 8 };
53 text = $"Source Files Directories", hotKey = altI;
54 NotifyModified = WorkspaceControlModified;
61 // This is required to be here because the label is labeling its parent, which otherwise has issues
62 labelSourceDirs.labeledWindow = sourceDirs;
66 Array<String> strings { };
67 char path[MAX_LOCATION];
68 String debugDir = ide.workspace.debugDir;
69 for(dir : ide.workspace.sourceDirs)
71 sourceDirs.strings = strings;
73 strcpy(path, ide.workspace.projectDir);
75 PathCat(path, debugDir);
76 debugDirectory.path = path;
77 commandLineArgs.contents = ide.workspace.commandLineArgs;
78 environmentVars.namedStrings = ide.workspace.environmentVars;
82 firstCreation = false;
87 bool WorkspaceControlModified(CommonControl control)
89 modifiedDocument = true;
95 if(debugDirectory.modifiedDocument)
97 char path[MAX_LOCATION];
98 strcpy(path, debugDirectory.slashPath);
99 if(!fstrcmp(path, ide.workspace.projectDir))
101 ide.workspace.debugDir = path;
103 if(commandLineArgs.modifiedDocument)
104 ide.workspace.commandLineArgs = commandLineArgs.line.text;
105 if(environmentVars.modifiedDocument)
107 ide.workspace.environmentVars.Free();
108 delete ide.workspace.environmentVars;
109 ide.workspace.environmentVars = environmentVars.namedStrings;
111 if(sourceDirs.modifiedDocument)
112 ide.workspace.UpdateSourceDirsArray(sourceDirs.strings);
114 if(debugDirectory.modifiedDocument || sourceDirs.modifiedDocument || commandLineArgs.modifiedDocument)
115 ide.workspace.modified = true;
118 bool OnClose(bool parentClosing)
122 DialogResult diagRes = MessageBox
124 type = yesNoCancel, master = rootWindow,
125 text = $"Save changes to workspace options?",
126 contents = $"Would you like to save changes made to the workspace options?"
128 if(diagRes == cancel)
132 modifiedDocument = false;