Do ScheduleGenerateAll in MarkGroupDirty.
This generally simplifies code, and also fixes a bug where adding a datum point would not regenerate the sketch.pull/144/head
parent
9148d0cb91
commit
d99a133982
|
@ -235,8 +235,6 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
|
||||||
MakeSelected(hc);
|
MakeSelected(hc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::MenuClipboard(Command id) {
|
void GraphicsWindow::MenuClipboard(Command id) {
|
||||||
|
|
|
@ -86,7 +86,6 @@ hConstraint Constraint::AddConstraint(Constraint *c, bool rememberForUndo) {
|
||||||
|
|
||||||
SS.MarkGroupDirty(c->group);
|
SS.MarkGroupDirty(c->group);
|
||||||
SK.GetGroup(c->group)->dofCheckOk = false;
|
SK.GetGroup(c->group)->dofCheckOk = false;
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
return c->h;
|
return c->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +539,6 @@ void Constraint::MenuConstrain(Command id) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
c->other = !(c->other);
|
c->other = !(c->other);
|
||||||
SS.MarkGroupDirty(c->group);
|
SS.MarkGroupDirty(c->group);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,8 +550,7 @@ void Constraint::MenuConstrain(Command id) {
|
||||||
Constraint *c = SK.GetConstraint(gs.constraint[0]);
|
Constraint *c = SK.GetConstraint(gs.constraint[0]);
|
||||||
if(c->HasLabel() && c->type != Type::COMMENT) {
|
if(c->HasLabel() && c->type != Type::COMMENT) {
|
||||||
(c->reference) = !(c->reference);
|
(c->reference) = !(c->reference);
|
||||||
SK.GetGroup(c->group)->clean = false;
|
SS.MarkGroupDirty(c->group, /*onlyThis=*/true);
|
||||||
SS.GenerateAll();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ void TextWindow::ScreenSetTtfFont(int link, uint32_t v) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
r->font = SS.fonts.l.elem[i].FontFileBaseName();
|
r->font = SS.fonts.l.elem[i].FontFileBaseName();
|
||||||
SS.MarkGroupDirty(r->group);
|
SS.MarkGroupDirty(r->group);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
SS.ScheduleShowTW();
|
SS.ScheduleShowTW();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ void SolveSpaceUI::MarkGroupDirtyByEntity(hEntity he) {
|
||||||
MarkGroupDirty(e->group);
|
MarkGroupDirty(e->group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolveSpaceUI::MarkGroupDirty(hGroup hg) {
|
void SolveSpaceUI::MarkGroupDirty(hGroup hg, bool onlyThis) {
|
||||||
int i;
|
int i;
|
||||||
bool go = false;
|
bool go = false;
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
|
@ -23,9 +23,11 @@ void SolveSpaceUI::MarkGroupDirty(hGroup hg) {
|
||||||
}
|
}
|
||||||
if(go) {
|
if(go) {
|
||||||
g->clean = false;
|
g->clean = false;
|
||||||
|
if(onlyThis) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsaved = true;
|
unsaved = true;
|
||||||
|
ScheduleGenerateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SolveSpaceUI::PruneOrphans() {
|
bool SolveSpaceUI::PruneOrphans() {
|
||||||
|
|
|
@ -901,7 +901,6 @@ void GraphicsWindow::MenuEdit(Command id) {
|
||||||
|
|
||||||
// and regenerate as necessary.
|
// and regenerate as necessary.
|
||||||
SS.MarkGroupDirty(hg);
|
SS.MarkGroupDirty(hg);
|
||||||
SS.GenerateAll();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,7 +940,6 @@ void GraphicsWindow::MenuEdit(Command id) {
|
||||||
}
|
}
|
||||||
// Regenerate, with these points marked as dragged so that they
|
// Regenerate, with these points marked as dragged so that they
|
||||||
// get placed as close as possible to our snap grid.
|
// get placed as close as possible to our snap grid.
|
||||||
SS.GenerateAll();
|
|
||||||
SS.GW.ClearPending();
|
SS.GW.ClearPending();
|
||||||
|
|
||||||
SS.GW.ClearSelection();
|
SS.GW.ClearSelection();
|
||||||
|
@ -1053,7 +1051,6 @@ c:
|
||||||
SS.MarkGroupDirty(r->group);
|
SS.MarkGroupDirty(r->group);
|
||||||
}
|
}
|
||||||
SS.GW.ClearSelection();
|
SS.GW.ClearSelection();
|
||||||
SS.GenerateAll();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,6 @@ void Group::Activate() {
|
||||||
SS.GW.showFaces = false;
|
SS.GW.showFaces = false;
|
||||||
}
|
}
|
||||||
SS.MarkGroupDirty(h); // for good measure; shouldn't be needed
|
SS.MarkGroupDirty(h); // for good measure; shouldn't be needed
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
SS.ScheduleShowTW();
|
SS.ScheduleShowTW();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,8 +420,6 @@ void GraphicsWindow::MakeTangentArc() {
|
||||||
if(SS.tangentArcDeleteOld) {
|
if(SS.tangentArcDeleteOld) {
|
||||||
DeleteTaggedRequests();
|
DeleteTaggedRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hEntity GraphicsWindow::SplitLine(hEntity he, Vector pinter) {
|
hEntity GraphicsWindow::SplitLine(hEntity he, Vector pinter) {
|
||||||
|
@ -663,6 +661,5 @@ void GraphicsWindow::SplitLinesOrCurves() {
|
||||||
sbla.Clear();
|
sbla.Clear();
|
||||||
sblb.Clear();
|
sblb.Clear();
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -459,8 +459,6 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
||||||
case Pending::COMMAND:
|
case Pending::COMMAND:
|
||||||
ssassert(false, "Unexpected pending operation");
|
ssassert(false, "Unexpected pending operation");
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.GenerateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::ClearPending() {
|
void GraphicsWindow::ClearPending() {
|
||||||
|
@ -748,7 +746,6 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
||||||
}
|
}
|
||||||
r->extraPoints--;
|
r->extraPoints--;
|
||||||
SS.MarkGroupDirtyByEntity(gs.point[0]);
|
SS.MarkGroupDirtyByEntity(gs.point[0]);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -775,7 +772,6 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
||||||
Entity *p = SK.GetEntity(e->point[addAfterPoint + 1]);
|
Entity *p = SK.GetEntity(e->point[addAfterPoint + 1]);
|
||||||
p->PointForceTo(v);
|
p->PointForceTo(v);
|
||||||
SS.MarkGroupDirtyByEntity(gs.entity[0]);
|
SS.MarkGroupDirtyByEntity(gs.entity[0]);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
} else {
|
} else {
|
||||||
Error("Cannot add spline point: maximum number of points reached.");
|
Error("Cannot add spline point: maximum number of points reached.");
|
||||||
|
@ -1126,7 +1122,6 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
||||||
r->extraPoints -= 2;
|
r->extraPoints -= 2;
|
||||||
// And we're done.
|
// And we're done.
|
||||||
SS.MarkGroupDirty(r->group);
|
SS.MarkGroupDirty(r->group);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
ClearPending();
|
ClearPending();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1394,7 +1389,6 @@ void GraphicsWindow::EditControlDone(const char *s) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SS.MarkGroupDirty(c->group);
|
SS.MarkGroupDirty(c->group);
|
||||||
SS.GenerateAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1500,7 +1494,6 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
|
||||||
lastSpaceNavigatorTime = now;
|
lastSpaceNavigatorTime = now;
|
||||||
lastSpaceNavigatorGroup = g->h;
|
lastSpaceNavigatorGroup = g->h;
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
} else {
|
} else {
|
||||||
// Apply the transformation to the view of the everything. The
|
// Apply the transformation to the view of the everything. The
|
||||||
// x and y components are translation; but z component is scale,
|
// x and y components are translation; but z component is scale,
|
||||||
|
|
|
@ -734,7 +734,7 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
|
||||||
case Command::SHOW_DOF:
|
case Command::SHOW_DOF:
|
||||||
// This works like a normal solve, except that it calculates
|
// This works like a normal solve, except that it calculates
|
||||||
// which variables are free/bound at the same time.
|
// which variables are free/bound at the same time.
|
||||||
SS.GenerateAll(SolveSpaceUI::Generate::ALL, true);
|
SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::TRACE_PT:
|
case Command::TRACE_PT:
|
||||||
|
|
|
@ -870,7 +870,7 @@ public:
|
||||||
};
|
};
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
|
|
||||||
void MarkGroupDirty(hGroup hg);
|
void MarkGroupDirty(hGroup hg, bool onlyThis = false);
|
||||||
void MarkGroupDirtyByEntity(hEntity he);
|
void MarkGroupDirtyByEntity(hEntity he);
|
||||||
|
|
||||||
// Consistency checking on the sketch: stuff with missing dependencies
|
// Consistency checking on the sketch: stuff with missing dependencies
|
||||||
|
|
|
@ -154,6 +154,7 @@ void Style::AssignSelectionToStyle(uint32_t v) {
|
||||||
if(!c->IsStylable()) continue;
|
if(!c->IsStylable()) continue;
|
||||||
|
|
||||||
c->disp.style.v = v;
|
c->disp.style.v = v;
|
||||||
|
SS.MarkGroupDirty(c->group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(showError) {
|
if(showError) {
|
||||||
|
@ -163,7 +164,6 @@ void Style::AssignSelectionToStyle(uint32_t v) {
|
||||||
|
|
||||||
SS.GW.ClearSelection();
|
SS.GW.ClearSelection();
|
||||||
InvalidateGraphics();
|
InvalidateGraphics();
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
|
|
||||||
// And show that style's info screen in the text window.
|
// And show that style's info screen in the text window.
|
||||||
SS.TW.GoToScreen(TextWindow::Screen::STYLE_INFO);
|
SS.TW.GoToScreen(TextWindow::Screen::STYLE_INFO);
|
||||||
|
|
|
@ -218,7 +218,6 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.GenerateAll();
|
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +467,7 @@ void TextWindow::ScreenAllowRedundant(int link, uint32_t v) {
|
||||||
|
|
||||||
Group *g = SK.GetGroup(SS.TW.shown.group);
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
||||||
g->allowRedundant = true;
|
g->allowRedundant = true;
|
||||||
SS.GenerateAll();
|
SS.MarkGroupDirty(SS.TW.shown.group);
|
||||||
|
|
||||||
SS.TW.shown.screen = Screen::GROUP_INFO;
|
SS.TW.shown.screen = Screen::GROUP_INFO;
|
||||||
SS.TW.Show();
|
SS.TW.Show();
|
||||||
|
@ -683,7 +682,6 @@ void TextWindow::EditControlDone(const char *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -708,7 +706,6 @@ void TextWindow::EditControlDone(const char *s) {
|
||||||
Group *g = SK.GetGroup(edit.group);
|
Group *g = SK.GetGroup(edit.group);
|
||||||
g->scale = ev;
|
g->scale = ev;
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -723,7 +720,6 @@ void TextWindow::EditControlDone(const char *s) {
|
||||||
g->color = RGBf(rgb.x, rgb.y, rgb.z);
|
g->color = RGBf(rgb.x, rgb.y, rgb.z);
|
||||||
|
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
} else {
|
} else {
|
||||||
Error("Bad format: specify color as r, g, b");
|
Error("Bad format: specify color as r, g, b");
|
||||||
|
@ -740,7 +736,6 @@ void TextWindow::EditControlDone(const char *s) {
|
||||||
Group *g = SK.GetGroup(edit.group);
|
Group *g = SK.GetGroup(edit.group);
|
||||||
g->color.alpha = (int)(255.1f * alpha);
|
g->color.alpha = (int)(255.1f * alpha);
|
||||||
SS.MarkGroupDirty(g->h);
|
SS.MarkGroupDirty(g->h);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,7 +747,6 @@ void TextWindow::EditControlDone(const char *s) {
|
||||||
if(r) {
|
if(r) {
|
||||||
r->str = s;
|
r->str = s;
|
||||||
SS.MarkGroupDirty(r->group);
|
SS.MarkGroupDirty(r->group);
|
||||||
SS.ScheduleGenerateAll();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue