+ fix undo/redo issues with ortho views
This commit is contained in:
parent
d8e0df9e97
commit
6c187572c7
|
@ -103,10 +103,11 @@ void CmdDrawingNewPage::activated(int iMsg)
|
|||
|
||||
QFileInfo tfi(a->property("Template").toString());
|
||||
if (tfi.isReadable()) {
|
||||
openCommand("Drawing create page");
|
||||
openCommand("Create page");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Drawing::FeaturePage','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.Template = '%s'",FeatName.c_str(), (const char*)tfi.filePath().toUtf8());
|
||||
doCommand(Doc,"App.activeDocument().recompute()");
|
||||
doCommand(Doc,"Gui.activeDocument().getObject('%s').show()",FeatName.c_str());
|
||||
commitCommand();
|
||||
}
|
||||
else {
|
||||
|
@ -231,7 +232,7 @@ void CmdDrawingNewA3Landscape::activated(int iMsg)
|
|||
{
|
||||
std::string FeatName = getUniqueObjectName("Page");
|
||||
|
||||
openCommand("Drawing create page");
|
||||
openCommand("Create page");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Drawing::FeaturePage','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.Template = 'A3_Landscape.svg'",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().recompute()");
|
||||
|
@ -361,7 +362,9 @@ void CmdDrawingOrthoViews::activated(int iMsg)
|
|||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgOrthoViews());
|
||||
TaskDlgOrthoViews* dlg = new TaskDlgOrthoViews();
|
||||
dlg->setDocumentName(this->getDocument()->getName());
|
||||
Gui::Control().showDialog(dlg);
|
||||
}
|
||||
|
||||
bool CmdDrawingOrthoViews::isActive(void)
|
||||
|
|
|
@ -268,11 +268,13 @@ OrthoViews::OrthoViews(const char * pagename, const char * partname)
|
|||
part_name = partname;
|
||||
|
||||
parent_doc = App::GetApplication().getActiveDocument();
|
||||
parent_doc->openTransaction("Create view");
|
||||
|
||||
part = parent_doc->getObject(partname);
|
||||
bbox.Add(static_cast<Part::Feature*>(part)->Shape.getBoundingBox());
|
||||
|
||||
page = parent_doc->getObject(pagename);
|
||||
Gui::Application::Instance->showViewProvider(page);
|
||||
load_page();
|
||||
|
||||
min_space = 15; // should be preferenced
|
||||
|
@ -1343,12 +1345,18 @@ void TaskDlgOrthoViews::clicked(int)
|
|||
bool TaskDlgOrthoViews::accept()
|
||||
{
|
||||
bool check = widget->user_input();
|
||||
App::Document* doc = App::GetApplication().getDocument(this->getDocumentName().c_str());
|
||||
if (doc)
|
||||
doc->commitTransaction();
|
||||
return !check;
|
||||
}
|
||||
|
||||
bool TaskDlgOrthoViews::reject()
|
||||
{
|
||||
widget->clean_up();
|
||||
App::Document* doc = App::GetApplication().getDocument(this->getDocumentName().c_str());
|
||||
if (doc)
|
||||
doc->abortTransaction();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user