Or, one could add a flag into the global user variable manager which marks a certain variable as "undefined, don't ask again", but then it won't do its work for compilation any more :(What about resetting this flag in EndWorkspaceLoaded all the time? It seems the most convenient way to me to do it that way. Because most likely the user won't / can't work with the workspace / project(s) loaded anyways. So the next logical step would be to close the workspace (and not compiling it / modifying it).
All in all, I am not sure if this would make things better or worse, to be honest.I take that as a vote against doing the proposed change in uservarmanager/macrosmanager and prefer to change projectmanager and CC instead.
I don't know, whether it makes sense or can be done easily.The problem here is: You mostly don't know that a project you want to open to inspect will contain user vars. So you wouldn't use the "read-only" option in the first place. The annoyance remains...
if (Manager::Get()->GetProjectManager()->IsLoading())
{
// a project/workspace is being loaded.
// no need to bug the user now about global vars.
// just preempt it; ProjectManager will call Arrogate() when it's done.
Preempt(variable);
return variable;
}
else
{
wxString msg;
msg.Printf(_("In the currently active Set, Code::Blocks does not know\nthe global compiler variable \"%s\".\n\nPlease define it."), package.c_str());
InfoWindow::Display(_("Global Compiler Variables"), msg , 8000, 1000);
UsrGlblMgrEditDialog d;
d.AddVar(package);
PlaceWindow(&d);
d.ShowModal();
}
...so glorious Thomas thought about that issue, but it seems not to work (anymore?!).Hmmm actually I had forgotten about having implemented that already :) Yes, this was indeed supposed to work that way, no idea why it does not now.
What about doing some kind of open "readonly"That's actually a good idea too. One could add a readonly flag which in this context means "return the value if it's there, and return an empty string if it's not there, but don't do anything else".