Allow removing active group.
This is an artificial restriction that serves no useful purpose. Just switch to the previous group if asked to delete the current one. The ClearSuper() calls are reshuffled, since TW.ClearSuper() calls TW.Show() and so has to be called while the sketch is still valid, whereas GW.ClearSuper() also recreates the default group and thus it should be called after the first RemoveById+GenerateAll pair, or it'll recreate the default group before the entities on it have a chance to be pruned.pull/4/head
parent
27d0dedbd1
commit
b3fa8dca37
|
@ -605,6 +605,9 @@ void GraphicsWindow::EnsureValidActives(void) {
|
|||
// drawing group and activate that. They should never be able
|
||||
// to delete the references, though.
|
||||
activeGroup = SS.CreateDefaultDrawingGroup();
|
||||
// We've created the default group, but not the workplane entity;
|
||||
// do it now so that drawing mode isn't switched to "Free in 3d".
|
||||
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
|
||||
} else {
|
||||
activeGroup = SK.groupOrder.elem[i];
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ void TextWindow::ScreenShowGroupsSpecial(int link, uint32_t v) {
|
|||
}
|
||||
}
|
||||
void TextWindow::ScreenActivateGroup(int link, uint32_t v) {
|
||||
hGroup hg = { v };
|
||||
SS.GW.activeGroup.v = v;
|
||||
SK.GetGroup(SS.GW.activeGroup)->Activate();
|
||||
SS.GW.ClearSuper();
|
||||
|
@ -251,15 +250,20 @@ void TextWindow::ScreenDeleteGroup(int link, uint32_t v) {
|
|||
|
||||
hGroup hg = SS.TW.shown.group;
|
||||
if(hg.v == SS.GW.activeGroup.v) {
|
||||
Error("This group is currently active; activate a different group "
|
||||
"before proceeding.");
|
||||
return;
|
||||
SS.GW.activeGroup = SK.GetGroup(SS.GW.activeGroup)->PreviousGroup()->h;
|
||||
}
|
||||
SK.group.RemoveById(hg);
|
||||
// This is a major change, so let's re-solve everything.
|
||||
|
||||
// Reset the text window, since we're displaying information about
|
||||
// the group that's about to get deleted.
|
||||
SS.TW.ClearSuper();
|
||||
SS.GW.ClearSuper();
|
||||
|
||||
// This is a major change, so let's re-solve everything.
|
||||
SK.group.RemoveById(hg);
|
||||
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
|
||||
|
||||
// Reset the graphics window. This will also recreate the default
|
||||
// group if it was removed.
|
||||
SS.GW.ClearSuper();
|
||||
}
|
||||
void TextWindow::ShowGroupInfo(void) {
|
||||
Group *g = SK.GetGroup(shown.group);
|
||||
|
|
Loading…
Reference in New Issue