From dff7f7811f1b677e4217d1dedf2c8b5db95b7deb Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Fri, 12 Feb 2016 21:59:54 +1300 Subject: [PATCH] Fixed Save and Save As in MDI view --- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 37 +++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 205c79f5b0..5341a41e8f 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -717,42 +717,33 @@ void MDIViewPage::setRenderer(QAction *action) m_view->setRenderer(QGVPage::Image); } } -bool MDIViewPage::onMsg(const char* pMsg, const char** ppReturn) +bool MDIViewPage::onMsg(const char *pMsg, const char **ppReturn) { - if (strcmp("ViewFit",pMsg) == 0) { + auto doc(getGuiDocument()); + + if (!doc) { + return false; + } else if (strcmp("ViewFit", pMsg) == 0) { viewAll(); return true; - } else if (strcmp("Redo", pMsg) == 0 ) { - getAppDocument()->redo(); - Gui::Command::updateActive(); - return true; } else if (strcmp("Save", pMsg) == 0 ) { - getAppDocument()->save(); + doc->save(); Gui::Command::updateActive(); return true; } else if (strcmp("SaveAs", pMsg) == 0 ) { - getAppDocument()->saveAs(""); + doc->saveAs(); Gui::Command::updateActive(); return true; } else if (strcmp("Undo", pMsg) == 0 ) { - getAppDocument()->undo(); + doc->undo(1); + Gui::Command::updateActive(); + return true; + } else if (strcmp("Redo", pMsg) == 0 ) { + doc->redo(1); Gui::Command::updateActive(); return true; } - else if(strcmp("Undo",pMsg) == 0 ) { - Gui::Document *doc = getGuiDocument(); - if (doc) { - doc->undo(1); - return true; - } - } - else if(strcmp("Redo",pMsg) == 0 ) { - Gui::Document *doc = getGuiDocument(); - if (doc) { - doc->redo(1); - return true; - } - } + return false; }