| 494 | } |
| 495 | |
| 496 | static void copyTemplateParameters( |
| 497 | Base::Reference<ParameterGrp> templateGroup, |
| 498 | const std::string& path, |
| 499 | Base::Reference<ParameterGrp> outputGroup |
| 500 | ) |
| 501 | { |
| 502 | auto userParameterHandle = App::GetApplication().GetParameterGroupByPath(path.c_str()); |
| 503 | |
| 504 | // Ensure that the DockWindowManager has saved its current state: |
| 505 | Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); |
| 506 | pDockMgr->saveState(); |
| 507 | |
| 508 | // Do the same for ToolBars |
| 509 | Gui::ToolBarManager* pToolbarMgr = Gui::ToolBarManager::getInstance(); |
| 510 | pToolbarMgr->saveState(); |
| 511 | |
| 512 | auto boolMap = templateGroup->GetBoolMap(); |
| 513 | for (const auto& kv : boolMap) { |
| 514 | auto currentValue = userParameterHandle->GetBool(kv.first.c_str(), kv.second); |
| 515 | outputGroup->SetBool(kv.first.c_str(), currentValue); |
| 516 | } |
| 517 | |
| 518 | auto intMap = templateGroup->GetIntMap(); |
| 519 | for (const auto& kv : intMap) { |
| 520 | auto currentValue = userParameterHandle->GetInt(kv.first.c_str(), kv.second); |
| 521 | outputGroup->SetInt(kv.first.c_str(), currentValue); |
| 522 | } |
| 523 | |
| 524 | auto uintMap = templateGroup->GetUnsignedMap(); |
| 525 | for (const auto& kv : uintMap) { |
| 526 | auto currentValue = userParameterHandle->GetUnsigned(kv.first.c_str(), kv.second); |
| 527 | outputGroup->SetUnsigned(kv.first.c_str(), currentValue); |
| 528 | } |
| 529 | |
| 530 | auto floatMap = templateGroup->GetFloatMap(); |
| 531 | for (const auto& kv : floatMap) { |
| 532 | auto currentValue = userParameterHandle->GetFloat(kv.first.c_str(), kv.second); |
| 533 | outputGroup->SetFloat(kv.first.c_str(), currentValue); |
| 534 | } |
| 535 | |
| 536 | auto asciiMap = templateGroup->GetASCIIMap(); |
| 537 | for (const auto& kv : asciiMap) { |
| 538 | auto currentValue = userParameterHandle->GetASCII(kv.first.c_str(), kv.second.c_str()); |
| 539 | outputGroup->SetASCII(kv.first.c_str(), currentValue.c_str()); |
| 540 | } |
| 541 | |
| 542 | // Recurse... |
| 543 | auto templateSubgroups = templateGroup->GetGroups(); |
| 544 | for (auto& templateSubgroup : templateSubgroups) { |
| 545 | std::string sgName = templateSubgroup->GetGroupName(); |
| 546 | auto outputSubgroupHandle = outputGroup->GetGroup(sgName.c_str()); |
| 547 | copyTemplateParameters(templateSubgroup, path + "/" + sgName, outputSubgroupHandle); |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | static void copyTemplateParameters( |
| 552 | /*const*/ ParameterManager& templateParameterManager, |
no test coverage detected