DrawSketchHandler: activation and deactivation via NVI pattern

==============================================================

With the introduction of overridable default behaviour for commands, it makes sense to keep control of the execution path of the activation and deactivation.

Non-virtual interface pattern enforces execution control of the virtual functions, while allowing the behaviour to be overriden in a case by case basis.
This commit is contained in:
Abdullah Tahiri
2022-02-17 19:30:14 +01:00
parent 16a2c559aa
commit f7741d4399
6 changed files with 375 additions and 328 deletions

View File

@@ -121,14 +121,25 @@ DrawSketchHandler::DrawSketchHandler() : sketchgui(0) {}
DrawSketchHandler::~DrawSketchHandler() {}
void DrawSketchHandler::preActivated(ViewProviderSketch* vp)
void DrawSketchHandler::activate(ViewProviderSketch * vp)
{
ViewProviderSketchDrawSketchHandlerAttorney::setConstraintSelectability(*vp, false);
sketchgui = vp;
this->preActivated();
this->activated();
}
void DrawSketchHandler::postDeactivatedAlwaysRun(ViewProviderSketch* vp)
void DrawSketchHandler::deactivate()
{
ViewProviderSketchDrawSketchHandlerAttorney::setConstraintSelectability(*vp, true);
this->deactivated();
this->postDeactivated();
ViewProviderSketchDrawSketchHandlerAttorney::setConstraintSelectability(*sketchgui, true);
unsetCursor();
}
void DrawSketchHandler::preActivated()
{
ViewProviderSketchDrawSketchHandlerAttorney::setConstraintSelectability(*sketchgui, false);
}
void DrawSketchHandler::quit(void)