From dc3ebfb502378dd3e0ff9b885f65259363b6ddc1 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 7 Aug 2014 10:39:33 -0300 Subject: [PATCH] Fix in Drawing page object - fixes #1540 * Changing the editable texts updates the page automatically * Added a doc.recompute() after creating a new page --- src/Mod/Drawing/App/FeaturePage.cpp | 8 ++++++-- src/Mod/Drawing/Gui/Command.cpp | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Mod/Drawing/App/FeaturePage.cpp b/src/Mod/Drawing/App/FeaturePage.cpp index e8c78797f3..79a1b3478c 100644 --- a/src/Mod/Drawing/App/FeaturePage.cpp +++ b/src/Mod/Drawing/App/FeaturePage.cpp @@ -76,8 +76,12 @@ void FeaturePage::onChanged(const App::Property* prop) if (!fi.exists()) return; } - } - if (prop == &Template) { + } else if (prop == &EditableTexts) { + if (!this->isRestoring()) { + this->execute(); + return; + } + } else if (prop == &Template) { if (!this->isRestoring()) { EditableTexts.setValues(getEditableTextsFromTemplate()); } diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index 45415285c8..d8d4be7f4f 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -104,6 +104,7 @@ void CmdDrawingNewPage::activated(int iMsg) openCommand("Drawing 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()"); commitCommand(); } else { @@ -231,6 +232,7 @@ void CmdDrawingNewA3Landscape::activated(int iMsg) openCommand("Drawing 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()"); commitCommand(); }