Index: src/ch/ShortcutsDlg.cpp =================================================================== diff -u -r9352ed0c4fe447a36bc728640c307be6d41455fd -r8068e0c351055554340ac9755d1bc846893bf2b8 --- src/ch/ShortcutsDlg.cpp (.../ShortcutsDlg.cpp) (revision 9352ed0c4fe447a36bc728640c307be6d41455fd) +++ src/ch/ShortcutsDlg.cpp (.../ShortcutsDlg.cpp) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) @@ -21,6 +21,7 @@ #include "ShortcutsDlg.h" #include "dialogs.h" #include "shortcuts.h" +#include "resource.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -31,17 +32,11 @@ ///////////////////////////////////////////////////////////////////////////// // CShortcutsDlg dialog - -CShortcutsDlg::CShortcutsDlg(CWnd* pParent /*=NULL*/) - :ictranslate::CLanguageDialog(CShortcutsDlg::IDD, pParent) +CShortcutsDlg::CShortcutsDlg(CWnd* pParent /*=nullptr*/) + :ictranslate::CLanguageDialog(IDD_SHORTCUTEDIT_DIALOG, pParent) { - //{{AFX_DATA_INIT(CShortcutsDlg) - m_strName = _T(""); - //}}AFX_DATA_INIT - m_bActualisation=false; } - void CShortcutsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); @@ -52,7 +47,6 @@ //}}AFX_DATA_MAP } - BEGIN_MESSAGE_MAP(CShortcutsDlg,ictranslate::CLanguageDialog) //{{AFX_MSG_MAP(CShortcutsDlg) ON_NOTIFY(LVN_ITEMCHANGED, IDC_SHORTCUT_LIST, OnItemchangedShortcutList) @@ -112,7 +106,7 @@ for(size_t stIndex = 0; stIndex < m_pcvRecent->size(); ++stIndex) { cbi.iItem = stIndex; - cbi.pszText = m_pcvRecent->at(stIndex); + cbi.pszText = const_cast((PCTSTR)m_pcvRecent->at(stIndex)); sfi.iIcon = -1; SHGetFileInfo(cbi.pszText, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); cbi.iImage = sfi.iIcon; @@ -139,7 +133,7 @@ CShortcut sc; for(size_t stIndex = 0; stIndex < m_cvShortcuts.size(); ++stIndex) { - sc = CString(m_cvShortcuts.at(stIndex)); + sc = CShortcut(m_cvShortcuts.at(stIndex)); sfi.iIcon = -1; SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); m_ctlShortcuts.InsertItem(boost::numeric_cast(stIndex), sc.m_strName, sfi.iIcon); @@ -242,7 +236,7 @@ m_ctlPath.GetWindowText(sc.m_strPath); // add to an array - m_cvShortcuts.push_back((const PTSTR)(LPCTSTR)(CString)sc, true); + m_cvShortcuts.push_back((CString)sc); // add with an icon SHFILEINFO sfi; @@ -268,7 +262,7 @@ m_ctlPath.GetWindowText(sc.m_strPath); // array update - m_cvShortcuts.replace(m_cvShortcuts.begin()+iPos, (const PTSTR)(LPCTSTR)(CString)sc, true, true); + m_cvShortcuts[iPos] = (CString)sc; // list SHFILEINFO sfi; @@ -289,7 +283,7 @@ while (pos) { iPos=m_ctlShortcuts.GetNextSelectedItem(pos); - m_cvShortcuts.erase(m_cvShortcuts.begin()+iPos, true); + m_cvShortcuts.erase(m_cvShortcuts.begin() + iPos); m_ctlShortcuts.DeleteItem(iPos); } @@ -307,31 +301,33 @@ void CShortcutsDlg::OnUpButton() { POSITION pos=m_ctlShortcuts.GetFirstSelectedItemPosition(); - int iPos=-1; CShortcut sc; while (pos) { // get current selected item - iPos=m_ctlShortcuts.GetNextSelectedItem(pos); + int iPos=m_ctlShortcuts.GetNextSelectedItem(pos); // if the first element is trying to go up to nowhere if (iPos == 0) break; // swap data in m_ascShortcuts - m_cvShortcuts.swap_items(m_cvShortcuts.begin()+iPos-1, m_cvShortcuts.begin()+iPos); + std::vector::iterator iterOne = m_cvShortcuts.begin() + iPos - 1; + std::vector::iterator iterTwo = m_cvShortcuts.begin()+iPos; + std::swap(iterOne, iterTwo); + //m_cvShortcuts.swap(); // do the same with list SHFILEINFO sfi; sfi.iIcon=-1; - sc=CString(m_cvShortcuts.at(iPos-1)); + sc=CShortcut(m_cvShortcuts.at(iPos-1)); SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); m_ctlShortcuts.SetItem(iPos-1, -1, LVIF_TEXT | LVIF_IMAGE , sc.m_strName, sfi.iIcon, 0, 0, 0); m_ctlShortcuts.SetItem(iPos-1, 1, LVIF_TEXT, sc.m_strPath, 0, 0, 0, 0); sfi.iIcon=-1; - sc=CString(m_cvShortcuts.at(iPos)); + sc=CShortcut(m_cvShortcuts.at(iPos)); SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); m_ctlShortcuts.SetItem(iPos, -1, LVIF_TEXT | LVIF_IMAGE, sc.m_strName, sfi.iIcon, 0, 0, 0); m_ctlShortcuts.SetItem(iPos, 1, LVIF_TEXT, sc.m_strPath, 0, 0, 0, 0); @@ -344,31 +340,32 @@ void CShortcutsDlg::OnDownButton() { POSITION pos=m_ctlShortcuts.GetFirstSelectedItemPosition(); - int iPos=-1; - CShortcut sc; while (pos) { // get current selected item - iPos=m_ctlShortcuts.GetNextSelectedItem(pos); + int iPos=m_ctlShortcuts.GetNextSelectedItem(pos); // if the last element is trying to go down to nowhere if (iPos == m_ctlShortcuts.GetItemCount()-1) break; // swap data in m_ascShortcuts - m_cvShortcuts.swap_items(m_cvShortcuts.begin()+iPos, m_cvShortcuts.begin()+iPos+1); + std::vector::iterator iterOne = m_cvShortcuts.begin() + iPos; + std::vector::iterator iterTwo = m_cvShortcuts.begin() + iPos + 1; + std::swap(iterOne, iterTwo); + // do the same with list SHFILEINFO sfi; sfi.iIcon=-1; - sc=CString(m_cvShortcuts.at(iPos)); + CShortcut sc=CShortcut(m_cvShortcuts.at(iPos)); SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); m_ctlShortcuts.SetItem(iPos, -1, LVIF_TEXT | LVIF_IMAGE , sc.m_strName, sfi.iIcon, 0, 0, 0); m_ctlShortcuts.SetItem(iPos, 1, LVIF_TEXT, sc.m_strPath, 0, 0, 0, 0); sfi.iIcon=-1; - sc=CString(m_cvShortcuts.at(iPos+1)); + sc=CShortcut(m_cvShortcuts.at(iPos+1)); SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); m_ctlShortcuts.SetItem(iPos+1, -1, LVIF_TEXT | LVIF_IMAGE, sc.m_strName, sfi.iIcon, 0, 0, 0); m_ctlShortcuts.SetItem(iPos+1, 1, LVIF_TEXT, sc.m_strPath, 0, 0, 0, 0);