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) bool ViewProvider::doubleClicked(void)
{ {
PartDesign::Body* body = PartDesign::Body::findBodyOf(getObject()); PartDesign::Body* body = PartDesign::Body::findBodyOf(getObject());
// TODO May be move to setEdit()? (2015-07-26, Fat-Zer)
if (body != NULL) { if (body != NULL) {
// Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree // 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 // 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 // always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench"); oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog // start the edit dialog if
if (featureDlg) { if (!featureDlg) {
Gui::Control().showDialog(featureDlg); featureDlg = this->getEditDialog();
} else { if (!featureDlg) { // Shouldn't generally happen
Gui::Control().showDialog(this->getEditDialog()); throw Base::Exception ("Failed to create new edit dialog.");
}
} }
Gui::Control().showDialog(featureDlg);
return true; return true;
} else { } else {
return PartGui::ViewProviderPart::setEdit(ModNum); return PartGui::ViewProviderPart::setEdit(ModNum);
} }
} }
TaskDlgFeatureParameters *ViewProvider::getEditDialog()
{ TaskDlgFeatureParameters *ViewProvider::getEditDialog() {
throw Base::Exception("getEditDialog() not implemented"); throw Base::Exception("getEditDialog() not implemented");
} }
void ViewProvider::unsetEdit(int ModNum) void ViewProvider::unsetEdit(int ModNum)
{ {
// return to the WB we were in before editing the PartDesign feature // 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> &); 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) * Returns a newly create dialog for the part to be placed in the task view
virtual TaskDlgFeatureParameters *getEditDialog()/* =0 */; * Must be reimplemented in subclasses.
*/
virtual TaskDlgFeatureParameters *getEditDialog();
std::string oldWb; std::string oldWb;
App::DocumentObject* oldTip; App::DocumentObject* oldTip;