| 1209 | } |
| 1210 | |
| 1211 | LRESULT CRegistryManagerView::OnEditPaste(WORD, WORD, HWND, BOOL&){ |
| 1212 | if (m_Clipboard.Items.empty()) { |
| 1213 | return 0; |
| 1214 | } |
| 1215 | ATLASSERT(!m_Clipboard.Items.empty()); |
| 1216 | auto cb = [this](auto& cmd, bool) { |
| 1217 | RefreshItem(m_Tree.GetSelectedItem()); |
| 1218 | UpdateList(); |
| 1219 | return TRUE; |
| 1220 | }; |
| 1221 | |
| 1222 | auto list = std::make_shared<AppCommandList>(nullptr, cb); |
| 1223 | auto path = GetFullNodePath(m_Tree.GetSelectedItem()); |
| 1224 | for (auto& item : m_Clipboard.Items) { |
| 1225 | std::shared_ptr<AppCommand> cmd; |
| 1226 | if (item.Key) |
| 1227 | cmd = std::make_shared<CopyKeyCommand>(item.Path, item.Name, path); |
| 1228 | else |
| 1229 | cmd = std::make_shared<CopyValueCommand>(item.Path, item.Name, path); |
| 1230 | list->AddCommand(cmd); |
| 1231 | if (m_Clipboard.Operation == ClipboardOperation::Cut) { |
| 1232 | if (item.Key) |
| 1233 | cmd = std::make_shared<DeleteKeyCommand>(item.Path, item.Name, GetDeleteKeyCommandCallback()); |
| 1234 | else |
| 1235 | cmd = std::make_shared<DeleteValueCommand>(item.Path, item.Name); |
| 1236 | list->AddCommand(cmd); |
| 1237 | } |
| 1238 | } |
| 1239 | if (list->GetCount() == 1) |
| 1240 | list->SetCommandName(list->GetCommand(0)->GetCommandName()); |
| 1241 | else |
| 1242 | list->SetCommandName(L"Paste"); |
| 1243 | if (!m_CmdMgr.AddCommand(list)) |
| 1244 | DisplayError(L"Paste failed"); |
| 1245 | return 0; |
| 1246 | } |
| 1247 | |
| 1248 | LRESULT CRegistryManagerView::OnEditRename(WORD, WORD, HWND, BOOL&){ |
| 1249 | if (::GetFocus() == m_Tree) { |
nothing calls this directly
no test coverage detected