Runs WinMerge with given paths
| 338 | |
| 339 | /// Runs WinMerge with given paths |
| 340 | HRESULT WinMergeContextMenu::InvokeCommand(DWORD verb) |
| 341 | { |
| 342 | CRegKeyEx reg; |
| 343 | String strWinMergePath; |
| 344 | BOOL bCompare = FALSE; |
| 345 | BOOL bAlterSubFolders = FALSE; |
| 346 | |
| 347 | // Read WinMerge location from registry |
| 348 | if (!GetWinMergeDir(strWinMergePath)) |
| 349 | return S_FALSE; |
| 350 | |
| 351 | // Check that file we are trying to execute exists |
| 352 | if (!PathFileExists(strWinMergePath.c_str())) |
| 353 | return S_FALSE; |
| 354 | |
| 355 | if (verb == CMD_COMPARE || verb == CMD_COMPARE_AS) |
| 356 | { |
| 357 | bCompare = TRUE; |
| 358 | switch (m_dwMenuState) |
| 359 | { |
| 360 | case MENU_ONESEL_PREV: |
| 361 | m_strPaths.resize(2); |
| 362 | m_strPaths[1] = m_strPaths[0]; |
| 363 | m_strPaths[0] = m_strPreviousPaths[0]; |
| 364 | |
| 365 | // Forget previous selection |
| 366 | if (reg.Open(HKEY_CURRENT_USER, f_RegDir) == ERROR_SUCCESS) |
| 367 | { |
| 368 | reg.WriteString(f_FirstSelection, _T("")); |
| 369 | reg.WriteString(f_SecondSelection, _T("")); |
| 370 | } |
| 371 | break; |
| 372 | |
| 373 | case MENU_ONESEL_TWO_PREV: |
| 374 | m_strPaths.resize(3); |
| 375 | m_strPaths[2] = m_strPaths[0]; |
| 376 | m_strPaths[0] = m_strPreviousPaths[0]; |
| 377 | m_strPaths[1] = m_strPreviousPaths[1]; |
| 378 | |
| 379 | // Forget previous selection |
| 380 | if (reg.Open(HKEY_CURRENT_USER, f_RegDir) == ERROR_SUCCESS) |
| 381 | { |
| 382 | reg.WriteString(f_FirstSelection, _T("")); |
| 383 | reg.WriteString(f_SecondSelection, _T("")); |
| 384 | } |
| 385 | break; |
| 386 | |
| 387 | case MENU_TWOSEL: |
| 388 | case MENU_THREESEL: |
| 389 | // "Compare" - compare m_strPaths |
| 390 | m_strPreviousPaths[0].erase(); |
| 391 | m_strPreviousPaths[1].erase(); |
| 392 | break; |
| 393 | } |
| 394 | } |
| 395 | else if (verb == CMD_COMPARE_ELLIPSIS) |
| 396 | { |
| 397 | // "Compare..." - user wants to compare this single item and open WinMerge |
no test coverage detected