Esempio n. 1
0
void CFavoriteOrganizeDlg::SetupList(bool fSave)
{
    int i = m_tab.GetCurSel();

    if (fSave) {
        CAtlList<CString> sl;

        for (int j = 0; j < m_list.GetItemCount(); j++) {
            CAtlList<CString> args;
            ExplodeEsc(m_sl[i].GetAt((POSITION)m_list.GetItemData(j)), args, _T(';'));
            args.RemoveHead();
            args.AddHead(m_list.GetItemText(j, 0));
            sl.AddTail(ImplodeEsc(args, _T(';')));
        }

        m_sl[i].RemoveAll();
        m_sl[i].AddTailList(&sl);
    } else {
        m_list.DeleteAllItems();

        POSITION pos = m_sl[i].GetHeadPosition(), tmp;
        while (pos) {
            tmp = pos;

            CAtlList<CString> sl;
            ExplodeEsc(m_sl[i].GetNext(pos), sl, _T(';'), 3);

            int n = m_list.InsertItem(m_list.GetItemCount(), sl.RemoveHead());
            m_list.SetItemData(n, (DWORD_PTR)tmp);

            if (!sl.IsEmpty()) {
                REFERENCE_TIME rt = 0;
                if (1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) {
                    DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt);

                    CString str;
                    str.Format(_T("[%02d:%02d:%02d]"), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
                    m_list.SetItemText(n, 1, str);
                }
            }
        }

        UpdateColumnsSizes();
    }
}
Esempio n. 2
0
void CFavoriteOrganizeDlg::OnLvnGetInfoTipList(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMLVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMLVGETINFOTIP>(pNMHDR);

    CAtlList<CString> args;
    ExplodeEsc(m_sl[m_tab.GetCurSel()].GetAt((POSITION)m_list.GetItemData(pGetInfoTip->iItem)), args, _T(';'));
    CString path = args.RemoveTail();
    // Relative to drive value is always third. If less args are available that means it is not included.
    int rootLength = (args.GetCount() == 3 && args.RemoveTail() != _T("0")) ? CPath(path).SkipRoot() : 0;

    StringCchCopy(pGetInfoTip->pszText, pGetInfoTip->cchTextMax, path.Mid(rootLength));

    *pResult = 0;
}