{
CWnd* pWndFocus = CWnd::GetFocus();
HWND hWndFocus = pWndFocus->GetSafeHwnd();
- HWND hWndDlg = pWndDlg->GetSafeHwnd();
UINT uMsg = lpMsg->message;
if (((uMsg >= WM_KEYFIRST) && (uMsg <= WM_KEYLAST)) ||
bool CShellContextMenu::HandleMenuMessage(UINT message, WPARAM wParam, LPARAM lParam, LRESULT& retval)
{
- HRESULT hr = E_FAIL;
+ //HRESULT hr = E_FAIL;
switch (message)
{
case WM_DRAWITEM:
case WM_MEASUREITEM:
if (m_pShellContextMenu3)
{
- if (FAILED(hr = m_pShellContextMenu3->HandleMenuMsg(message, wParam, lParam/*, &retval*/)))
+ if (FAILED(/*hr = */m_pShellContextMenu3->HandleMenuMsg(message, wParam, lParam/*, &retval*/)))
{
//TRACE(_T("HandleMenuMsg(%x) failed with error: %lx\n"), message, hr);
//if (message == WM_DRAWITEM)
}
else if (m_pShellContextMenu2)
{
- if (FAILED(hr = m_pShellContextMenu2->HandleMenuMsg(message, wParam, lParam)))
+ if (FAILED(/*hr = */m_pShellContextMenu2->HandleMenuMsg(message, wParam, lParam)))
{
//TRACE(_T("HandleMenuMsg(%x) failed with error: %lx\n"), message, hr);
//assert(0);
if (m_pShellContextMenu3)
{
retval = 0;
- if (FAILED(hr = m_pShellContextMenu3->HandleMenuMsg2(message, wParam, lParam, &retval)))
+ if (FAILED(/*hr = */m_pShellContextMenu3->HandleMenuMsg2(message, wParam, lParam, &retval)))
{
//TRACE(_T("HandleMenuMsg2(%x) failed with error: %lx\n"), message, hr);
//assert(0);
bool CShellContextMenu::QueryShellContextMenu()
{
- HRESULT hr = E_FAIL;
+ //HRESULT hr = E_FAIL;
IShellFolderPtr pDesktop;
- if (FAILED(hr = SHGetDesktopFolder(&pDesktop)))
+ if (FAILED(/*hr = */SHGetDesktopFolder(&pDesktop)))
return false;
String parentDir; // use it to track that all selected files are in the same parent directory
parentDir = currentDir;
LPITEMIDLIST dirPidl;
- if (FAILED(hr = pDesktop->ParseDisplayName(NULL, // hwnd
+ if (FAILED(/*hr = */pDesktop->ParseDisplayName(NULL, // hwnd
NULL, // pbc
CT2OLE(currentDir.c_str()), // pszDisplayName
NULL, // pchEaten
return false;
}
- if (FAILED(hr = pDesktop->BindToObject(dirPidl, // pidl
+ if (FAILED(/*hr = */pDesktop->BindToObject(dirPidl, // pidl
NULL, // pbc
IID_IShellFolder, // riid
reinterpret_cast<void**>(&pCurrFolder))))
}
LPITEMIDLIST pidl;
- if (FAILED(hr = pCurrFolder->ParseDisplayName(NULL,
+ if (FAILED(/*hr = */pCurrFolder->ParseDisplayName(NULL,
NULL,
CT2OLE(file.filename.c_str()),
NULL,
}
IContextMenuPtr pCMenu1;
- if (FAILED(hr = pCurrFolder->GetUIObjectOf(NULL,
+ if (FAILED(/*hr = */pCurrFolder->GetUIObjectOf(NULL,
static_cast<unsigned>(pidls.Size()),
pidls.GetList(),
IID_IContextMenu,
}
ASSERT(::IsMenu(m_hShellContextMenu));
- if (FAILED(hr = m_pPreferredMenu->QueryContextMenu(m_hShellContextMenu,
+ if (FAILED(/*hr = */m_pPreferredMenu->QueryContextMenu(m_hShellContextMenu,
0,
m_cmdFirst,
m_cmdLast,
UINT len = sizeof(*pffi);
BOOL bRetCode = VerQueryValue(
(LPVOID)m_pVffInfo.get(), _T("\\"), (LPVOID *)&pffi, &len);
- memcpy(&m_FixedFileInfo, pffi, sizeof(m_FixedFileInfo));
+ if (bRetCode)
+ memcpy(&m_FixedFileInfo, pffi, sizeof(m_FixedFileInfo));
+ else
+ memset(&m_FixedFileInfo, 0, sizeof(m_FixedFileInfo));
m_dvi.dwMajorVersion = HIWORD(m_FixedFileInfo.dwFileVersionMS);
m_dvi.dwMinorVersion = LOWORD(m_FixedFileInfo.dwFileVersionMS);
m_dvi.dwBuildNumber = HIWORD(m_FixedFileInfo.dwFileVersionLS);
*/
void CDirView::GetItemFileNames(int sel, PathContext * paths) const
{
- String strPath[3];
UINT_PTR diffpos = GetItemKey(sel);
if (diffpos == SPECIAL_ITEM_POS)
{
if (sel2 == -1)
{
// One item selected
- const DIFFITEM& di = GetDiffItem(sel1);
if (selectionType != SELECTIONTYPE_NORMAL)
{
pCmdUI->Enable(FALSE);
std::vector<String> files;
// Get the number of pathnames that have been dropped
UINT wNumFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, 0);
- UINT fileCount = 0;
// get all file names. but we'll only need the first one.
for (WORD x = 0; x < wNumFilesDropped; x++)
files.resize(3);
if (!files.empty())
m_callback(files);
- return S_OK;
+ return ok ? S_OK : E_FAIL;
}
if (FAILED(hr))
return hr;
- hr = pFileOperation->SetOperationFlags(0);
+ pFileOperation->SetOperationFlags(0);
IShellItemPtr pShellItemDest, pShellItem;
IEnumShellItemsPtr pEnumShellItems;
{
const int cd_dbegin = dr.dbegin;
const int cd_dend = dr.dend;
- int nBuffer;
-
- // Must ensure line number is in range before getting line flags
- if (cd_dend >= m_ptBuf[0]->GetLineCount())
- return false;
- DWORD dwLeftFlags = m_ptBuf[0]->GetLineFlags(cd_dend);
- // Must ensure line number is in range before getting line flags
- if (cd_dend >= m_ptBuf[1]->GetLineCount())
- return false;
- DWORD dwRightFlags = m_ptBuf[1]->GetLineFlags(cd_dend);
-
- // Optimization - check last line first so we don't need to
- // check whole diff for obvious cases
- for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
+ for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
{
+ // Must ensure line number is in range before getting line flags
+ if (cd_dend >= m_ptBuf[nBuffer]->GetLineCount())
+ return false;
+
+ // Optimization - check last line first so we don't need to
+ // check whole diff for obvious cases
DWORD dwFlags = m_ptBuf[nBuffer]->GetLineFlags(cd_dend);
if (!(dwFlags & LF_WINMERGE_FLAGS))
return false;
for (int line = cd_dbegin; line < cd_dend; line++)
{
- for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
+ for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
{
DWORD dwFlags = m_ptBuf[nBuffer]->GetLineFlags(cd_dend);
if (!(dwFlags & LF_WINMERGE_FLAGS))
for (int pane = 0; pane < m_nBuffers; pane++)
{
bRO[pane] = m_ptBuf[pane]->GetReadOnly();
- if ((pane == 0 && doLeft) ||
+ if (!bRO[pane] && (
+ (pane == 0 && doLeft) ||
(pane == 1 && doRight && m_nBuffers < 3) ||
(pane == 1 && doMiddle && m_nBuffers == 3) ||
- (pane == 2 && doRight && m_nBuffers == 3))
+ (pane == 2 && doRight && m_nBuffers == 3)
+ ))
{
m_ptBuf[pane]->setCodepage(nSaveCodepage);
m_ptBuf[pane]->SetModified();
}
/**
- * @brief Call ::AppendMenu, and if it fails get error string into local variable
- *
- * This only provides functionality for debugging.
- */
-static bool DoAppendMenu(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem)
-{
- bool ok = ::AppendMenu(hMenu, uFlags, uIDNewItem, lpNewItem) != false;
- if (!ok)
- {
- int nerr = GetLastError();
- String syserr = GetSysError(nerr);
- }
- return ok;
-}
-
-/**
* @brief Create the dynamic submenu for scripts
*/
HMENU CMergeEditView::createScriptsSubmenu(HMENU hMenu)
if (functionNamesList.size() == 0)
{
// no script : create a <empty> entry
- DoAppendMenu(hMenu, MF_STRING, ID_NO_EDIT_SCRIPTS, _("< Empty >").c_str());
+ AppendMenu(hMenu, MF_STRING, ID_NO_EDIT_SCRIPTS, _("< Empty >").c_str());
}
else
{
// or fill in the submenu with the scripts names
int ID = ID_SCRIPT_FIRST; // first ID in menu
for (i = 0 ; i < functionNamesList.size() ; i++, ID++)
- DoAppendMenu(hMenu, MF_STRING, ID, functionNamesList[i].c_str());
+ AppendMenu(hMenu, MF_STRING, ID, functionNamesList[i].c_str());
functionNamesList.clear();
}
if (!IsWindowsScriptThere())
- DoAppendMenu(hMenu, MF_STRING, ID_NO_SCT_SCRIPTS, _("WSH not found - .sct scripts disabled").c_str());
+ AppendMenu(hMenu, MF_STRING, ID_NO_SCT_SCRIPTS, _("WSH not found - .sct scripts disabled").c_str());
return hMenu;
}
ASSERT(pd);
// title
- DoAppendMenu(hMenu, MF_STRING, ID_NO_PREDIFFER, _("No prediffer (normal)").c_str());
+ AppendMenu(hMenu, MF_STRING, ID_NO_PREDIFFER, _("No prediffer (normal)").c_str());
// get the scriptlet files
PluginArray * piScriptArray =
// build the menu : first part, suggested plugins
// title
- DoAppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- DoAppendMenu(hMenu, MF_STRING, ID_SUGGESTED_PLUGINS, _("Suggested plugins").c_str());
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_STRING, ID_SUGGESTED_PLUGINS, _("Suggested plugins").c_str());
int ID = ID_PREDIFFERS_FIRST; // first ID in menu
int iScript;
if (plugin->m_disabled || !plugin->TestAgainstRegList(pd->m_strBothFilenames))
continue;
- DoAppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
+ AppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
}
for (iScript = 0 ; iScript < piScriptArray2->size() ; iScript++, ID ++)
{
if (plugin->m_disabled || !plugin->TestAgainstRegList(pd->m_strBothFilenames))
continue;
- DoAppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
+ AppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
}
// build the menu : second part, others plugins
// title
- DoAppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- DoAppendMenu(hMenu, MF_STRING, ID_NOT_SUGGESTED_PLUGINS, _("Other plugins").c_str());
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_STRING, ID_NOT_SUGGESTED_PLUGINS, _("Other plugins").c_str());
ID = ID_PREDIFFERS_FIRST; // first ID in menu
for (iScript = 0 ; iScript < piScriptArray->size() ; iScript++, ID ++)
if (plugin->m_disabled || plugin->TestAgainstRegList(pd->m_strBothFilenames) != false)
continue;
- DoAppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
+ AppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
}
for (iScript = 0 ; iScript < piScriptArray2->size() ; iScript++, ID ++)
{
if (plugin->m_disabled || plugin->TestAgainstRegList(pd->m_strBothFilenames) != false)
continue;
- DoAppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
+ AppendMenu(hMenu, MF_STRING, ID, plugin->m_name.c_str());
}
// compute the m_CurrentPredifferID (to set the radio button)
const HMENU hSubMenu = pCmdUI->m_pSubMenu->m_hMenu;
String name = theApp.LoadString(ID_COLORSCHEME_FIRST);
- DoAppendMenu(hSubMenu, MF_STRING, ID_COLORSCHEME_FIRST, name.c_str());
- DoAppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hSubMenu, MF_STRING, ID_COLORSCHEME_FIRST, name.c_str());
+ AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
for (int i = ID_COLORSCHEME_FIRST + 1; i <= ID_COLORSCHEME_LAST; ++i)
{
name = theApp.LoadString(i);
- DoAppendMenu(hSubMenu, MF_STRING, i, name.c_str());
+ AppendMenu(hSubMenu, MF_STRING, i, name.c_str());
}
pCmdUI->Enable(true);
retval = RegQueryValueEx(lmKey, valname, 0, &type, &buf[0], &len);
if (retval == ERROR_SUCCESS)
{
- retval = RegSetValueEx(cuKey, valname , 0, type,
+ RegSetValueEx(cuKey, valname , 0, type,
&buf[0], len);
}
}
UINT iValidFunc = 0;
if (piDispatch)
{
- HRESULT hr;
ITypeInfo *piTypeInfo=0;
unsigned iTInfo = 0; // 0 for type information of IDispatch itself
LCID lcid=0; // locale for localized method names (ignore if no localized names)
- if (SUCCEEDED(hr = piDispatch->GetTypeInfo(iTInfo, lcid, &piTypeInfo)))
+ if (SUCCEEDED(piDispatch->GetTypeInfo(iTInfo, lcid, &piTypeInfo)))
{
TYPEATTR *pTypeAttr=0;
- if (SUCCEEDED(hr = piTypeInfo->GetTypeAttr(&pTypeAttr)))
+ if (SUCCEEDED(piTypeInfo->GetTypeAttr(&pTypeAttr)))
{
// allocate arrays for the returned structures
// the names array is NULL terminated
{
UINT iFuncDesc = iMaxFunc - iFunc;
FUNCDESC *pFuncDesc;
- if (SUCCEEDED(hr = piTypeInfo->GetFuncDesc(iFuncDesc, &pFuncDesc)))
+ if (SUCCEEDED(piTypeInfo->GetFuncDesc(iFuncDesc, &pFuncDesc)))
{
// exclude properties
// exclude IDispatch inherited methods
{
BSTR bstrName;
UINT cNames;
- if (SUCCEEDED(hr = piTypeInfo->GetNames(pFuncDesc->memid,
+ if (SUCCEEDED(piTypeInfo->GetNames(pFuncDesc->memid,
&bstrName, 1, &cNames)))
{
IdArray[iValidFunc] = pFuncDesc->memid;
{
// find the path from that
TCHAR buf[MAX_PATH] = {0};
- HRESULT hres = psl->GetPath(buf, MAX_PATH, NULL, SLGP_UNCPRIORITY);
+ psl->GetPath(buf, MAX_PATH, NULL, SLGP_UNCPRIORITY);
outFile = buf;
}
ppf->Release();
#ifdef _UNICODE
if ((ch & 0xff00) == 0)
{
- TCHAR nextCh = str[index + 1];
+// TCHAR nextCh = str[index + 1];
// breakType==0 means whitespace only
if (!breakType)
return false;