PartDesign/ViewProvider: minor enhancements

This commit is contained in:
Alexander Golubev 2015-07-26 13:22:32 +03:00 committed by Stefan Tröger
parent e28aaf4592
commit da1fb99dc5
2 changed files with 16 additions and 11 deletions

View File

@ -55,7 +55,7 @@ ViewProvider::~ViewProvider()
bool ViewProvider::doubleClicked(void)
{
PartDesign::Body* body = PartDesign::Body::findBodyOf(getObject());
// TODO May be move to setEdit()? (2015-07-26, Fat-Zer)
if (body != NULL) {
// Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree
// Also, this way the user won't be tempted to use future geometry as external references for the sketch
@ -113,24 +113,27 @@ bool ViewProvider::setEdit(int ModNum)
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (featureDlg) {
Gui::Control().showDialog(featureDlg);
} else {
Gui::Control().showDialog(this->getEditDialog());
// start the edit dialog if
if (!featureDlg) {
featureDlg = this->getEditDialog();
if (!featureDlg) { // Shouldn't generally happen
throw Base::Exception ("Failed to create new edit dialog.");
}
}
Gui::Control().showDialog(featureDlg);
return true;
} else {
return PartGui::ViewProviderPart::setEdit(ModNum);
}
}
TaskDlgFeatureParameters *ViewProvider::getEditDialog()
{
TaskDlgFeatureParameters *ViewProvider::getEditDialog() {
throw Base::Exception("getEditDialog() not implemented");
}
void ViewProvider::unsetEdit(int ModNum)
{
// return to the WB we were in before editing the PartDesign feature

View File

@ -53,9 +53,11 @@ protected:
virtual bool onDelete(const std::vector<std::string> &);
/// Returns a newly create dialog for the part to be placed in the task view
// TODO make it pure virtual when finish implementation for all view providers (2015-07-24, Fat-Zer)
virtual TaskDlgFeatureParameters *getEditDialog()/* =0 */;
/**
* Returns a newly create dialog for the part to be placed in the task view
* Must be reimplemented in subclasses.
*/
virtual TaskDlgFeatureParameters *getEditDialog();
std::string oldWb;
App::DocumentObject* oldTip;