// Sets up the sprite/flat search lists static void SetupLists(void) { // IWAD if (!SetupList(&iwad_flats, &iwad, "F_START", "F_END", NULL, NULL)) I_Error("Flats section not found in IWAD"); if (!SetupList(&iwad_sprites, &iwad, "S_START", "S_END", NULL, NULL)) I_Error("Sprites section not found in IWAD"); // PWAD SetupList(&pwad_flats, &pwad, "F_START", "F_END", "FF_START", "FF_END"); SetupList(&pwad_sprites, &pwad, "S_START", "S_END", "SS_START", "SS_END"); }
BOOL CFavoriteOrganizeDlg::OnInitDialog() { __super::OnInitDialog(); m_tab.InsertItem(0, ResStr(IDS_FAVFILES)); m_tab.InsertItem(1, ResStr(IDS_FAVDVDS)); // m_tab.InsertItem(2, ResStr(IDS_FAVDEVICES)); m_tab.SetCurSel(0); m_list.InsertColumn(0, _T("")); m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT); AfxGetCurrentSettings().GetFav(FAV_FILE, m_sl[0]); AfxGetCurrentSettings().GetFav(FAV_DVD, m_sl[1]); AfxGetCurrentSettings().GetFav(FAV_DEVICE, m_sl[2]); SetupList(false); AddAnchor(IDC_TAB1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_LIST2, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDC_BUTTON3, TOP_RIGHT); AddAnchor(IDC_BUTTON4, TOP_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CFavoriteOrganizeDlg::OnInitDialog() { __super::OnInitDialog(); AppSettings& s = AfxGetAppSettings(); m_tab.InsertItem(0, ResStr(IDS_FAVFILES)); m_tab.InsertItem(1, ResStr(IDS_FAVDVDS)); // m_tab.InsertItem(2, ResStr(IDS_FAVDEVICES)); m_tab.SetCurSel(0); m_list.InsertColumn(0, _T("")); m_list.InsertColumn(1, _T("")); m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_FULLROWSELECT); s.GetFav(FAV_FILE, m_sl[0]); s.GetFav(FAV_DVD, m_sl[1]); s.GetFav(FAV_DEVICE, m_sl[2]); SetupList(false); AddAnchor(IDC_TAB1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_LIST2, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDC_BUTTON3, TOP_RIGHT); AddAnchor(IDC_BUTTON4, TOP_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); EnableSaveRestore(IDS_R_DLG_ORGANIZE_FAV); return TRUE; }
void GUIAppListBox::DelItem ( int idx ) { if ( idx >=0 && idx < objects.Count()) { GUIAppObject *obj = objects[idx]; objects.Del(obj); } SetupList (); }
void CFavoriteOrganizeDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) { SetupList(false); m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); *pResult = 0; }
void SlaveDlg::SetupUI(HWND hWnd) { this->hWnd = hWnd; SetupList(); valid = FALSE; Update(); }
void CFavoriteOrganizeDlg::OnBnClickedOk() { SetupList(true); AfxGetCurrentSettings().SetFav(FAV_FILE, m_sl[0]); AfxGetCurrentSettings().SetFav(FAV_DVD, m_sl[1]); AfxGetCurrentSettings().SetFav(FAV_DEVICE, m_sl[2]); OnOK(); }
BOOL CPPageAccelTbl::OnInitDialog() { __super::OnInitDialog(); AppSettings& s = AfxGetAppSettings(); m_wmcmds.RemoveAll(); m_wmcmds.AddTail(&s.wmcmds); m_fWinLirc = s.fWinLirc; m_WinLircAddr = s.strWinLircAddr; m_fUIce = s.fUIce; m_UIceAddr = s.strUIceAddr; m_fGlobalMedia = s.fGlobalMedia; UpdateData(FALSE); CRect r; GetDlgItem(IDC_PLACEHOLDER)->GetWindowRect(r); ScreenToClient(r); m_list.CreateEx( WS_EX_CLIENTEDGE, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, r, this, IDC_LIST1); m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER|LVS_EX_GRIDLINES); for (int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) { m_list.DeleteColumn(0); } m_list.InsertColumn(COL_CMD, ResStr(IDS_AG_COMMAND), LVCFMT_LEFT, s.AccelTblColWidth.cmd); m_list.InsertColumn(COL_KEY, ResStr(IDS_AG_KEY), LVCFMT_LEFT, s.AccelTblColWidth.key); m_list.InsertColumn(COL_ID, _T("ID"), LVCFMT_LEFT, s.AccelTblColWidth.id); m_list.InsertColumn(COL_MOUSE, ResStr(IDS_AG_MOUSE), LVCFMT_LEFT, s.AccelTblColWidth.mwnd); m_list.InsertColumn(COL_MOUSE_FS, ResStr(IDS_AG_MOUSE_FS), LVCFMT_LEFT, s.AccelTblColWidth.mfs); m_list.InsertColumn(COL_APPCMD, ResStr(IDS_AG_APP_COMMAND), LVCFMT_LEFT, s.AccelTblColWidth.appcmd); m_list.InsertColumn(COL_RMCMD, _T("RemoteCmd"), LVCFMT_LEFT, s.AccelTblColWidth.remcmd); m_list.InsertColumn(COL_RMREPCNT, _T("RepCnt"), LVCFMT_CENTER, s.AccelTblColWidth.repcnt); POSITION pos = m_wmcmds.GetHeadPosition(); for (int i = 0; pos; i++) { int row = m_list.InsertItem(m_list.GetItemCount(), m_wmcmds.GetAt(pos).GetName(), COL_CMD); m_list.SetItemData(row, (DWORD_PTR)pos); m_wmcmds.GetNext(pos); } SetupList(); // subclass the keylist control OldControlProc = (WNDPROC) SetWindowLongPtr(m_list.m_hWnd, GWLP_WNDPROC, (LONG_PTR) ControlProc); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CFavoriteOrganizeDlg::OnBnClickedOk() { SetupList(true); CAppSettings& s = AfxGetAppSettings(); s.SetFav(FAV_FILE, m_sl[0]); s.SetFav(FAV_DVD, m_sl[1]); s.SetFav(FAV_DEVICE, m_sl[2]); OnOK(); }
void CPPageAccelTbl::OnBnClickedButton2() { m_list.SetFocus(); POSITION pos = m_list.GetFirstSelectedItemPosition(); if (!pos) { return; } while (pos) { int ni = m_list.GetNextSelectedItem(pos); POSITION pi = (POSITION)m_list.GetItemData(ni); wmcmd& wc = m_wmcmds.GetAt(pi); wc.Restore(); } AfxGetAppSettings().AccelTblColWidth.bEnable = false; SetupList(); SetModified(); }
void CFavoriteOrganizeDlg::OnTcnSelchangingTab1(NMHDR *pNMHDR, LRESULT *pResult) { SetupList(true); *pResult = 0; }
void GUIAppListBox::DelItem ( GUIAppObject *obj ) { if ( objects.Find(obj)) { objects.Del(obj); } SetupList (); }
void GUIAppListBox::AddItem ( GUIAppObject *obj ) { objects.Add(obj); SetupList (); }
void CPlayerPlaylistBar::Refresh() { SetupList(); ResizeListColumn(); }
void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p) { LVHITTESTINFO lvhti; lvhti.pt = p; m_list.ScreenToClient(&lvhti.pt); m_list.SubItemHitTest(&lvhti); POSITION pos = FindPos(lvhti.iItem); //bool fSelected = (pos == m_pl.GetPos()); bool fOnItem = !!(lvhti.flags & LVHT_ONITEM); CMenu m; m.CreatePopupMenu(); enum { M_OPEN = 1, M_ADD, M_REMOVE, M_CLEAR, M_CLIPBOARD, M_SAVEAS, M_SORTBYNAME, M_SORTBYPATH, M_RANDOMIZE, M_SORTBYID, M_SHUFFLE, M_HIDEFULLSCREEN }; CAppSettings& s = AfxGetAppSettings(); m.AppendMenu(MF_STRING | (!fOnItem ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_OPEN, ResStr(IDS_PLAYLIST_OPEN)); if (((CMainFrame*)AfxGetMainWnd())->GetPlaybackMode() == PM_CAPTURE) { m.AppendMenu(MF_STRING | MF_ENABLED, M_ADD, ResStr(IDS_PLAYLIST_ADD)); } m.AppendMenu(MF_STRING | (/*fSelected||*/!fOnItem ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_REMOVE, ResStr(IDS_PLAYLIST_REMOVE)); m.AppendMenu(MF_SEPARATOR); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_CLEAR, ResStr(IDS_PLAYLIST_CLEAR)); m.AppendMenu(MF_SEPARATOR); m.AppendMenu(MF_STRING | (!fOnItem ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_CLIPBOARD, ResStr(IDS_PLAYLIST_COPYTOCLIPBOARD)); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_SAVEAS, ResStr(IDS_PLAYLIST_SAVEAS)); m.AppendMenu(MF_SEPARATOR); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_SORTBYNAME, ResStr(IDS_PLAYLIST_SORTBYLABEL)); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_SORTBYPATH, ResStr(IDS_PLAYLIST_SORTBYPATH)); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_RANDOMIZE, ResStr(IDS_PLAYLIST_RANDOMIZE)); m.AppendMenu(MF_STRING | (!m_pl.GetCount() ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED), M_SORTBYID, ResStr(IDS_PLAYLIST_RESTORE)); m.AppendMenu(MF_SEPARATOR); m.AppendMenu(MF_STRING | MF_ENABLED | (s.bShufflePlaylistItems ? MF_CHECKED : MF_UNCHECKED), M_SHUFFLE, ResStr(IDS_PLAYLIST_SHUFFLE)); m.AppendMenu(MF_SEPARATOR); m.AppendMenu(MF_STRING | MF_ENABLED | (s.bHidePlaylistFullScreen ? MF_CHECKED : MF_UNCHECKED), M_HIDEFULLSCREEN, ResStr(IDS_PLAYLIST_HIDEFS)); CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd(); int nID = (int)m.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, this); switch (nID) { case M_OPEN: m_pl.SetPos(pos); m_list.Invalidate(); pMainFrm->OpenCurPlaylistItem(); break; case M_ADD: pMainFrm->AddCurDevToPlaylist(); m_pl.SetPos(m_pl.GetTailPosition()); break; case M_REMOVE: if (m_pl.RemoveAt(pos)) { pMainFrm->CloseMedia(); } m_list.DeleteItem(lvhti.iItem); SavePlaylist(); break; case M_CLEAR: if (Empty()) { pMainFrm->CloseMedia(); } break; case M_SORTBYID: m_pl.SortById(); SetupList(); SavePlaylist(); break; case M_SORTBYNAME: m_pl.SortByName(); SetupList(); SavePlaylist(); break; case M_SORTBYPATH: m_pl.SortByPath(); SetupList(); SavePlaylist(); break; case M_RANDOMIZE: m_pl.Randomize(); SetupList(); SavePlaylist(); break; case M_CLIPBOARD: if (OpenClipboard() && EmptyClipboard()) { CString str; CPlaylistItem& pli = m_pl.GetAt(pos); POSITION pos2 = pli.m_fns.GetHeadPosition(); while (pos2) { str += _T("\r\n") + pli.m_fns.GetNext(pos2); } str.Trim(); if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (str.GetLength() + 1) * sizeof(TCHAR))) { if (TCHAR* cp = (TCHAR*)GlobalLock(h)) { _tcscpy_s(cp, str.GetLength() + 1, str); GlobalUnlock(h); SetClipboardData(CF_UNICODETEXT, h); } } CloseClipboard(); } break; case M_SAVEAS: { CSaveTextFileDialog fd( CTextFile::ASCII, NULL, NULL, _T("Media Player Classic playlist (*.mpcpl)|*.mpcpl|Playlist (*.pls)|*.pls|Winamp playlist (*.m3u)|*.m3u|Windows Media playlist (*.asx)|*.asx||"), this); if (fd.DoModal() != IDOK) { break; } CTextFile::enc encoding = (CTextFile::enc)fd.GetEncoding(); if (encoding == CTextFile::ASCII) { encoding = CTextFile::ANSI; } int idx = fd.m_pOFN->nFilterIndex; CPath path(fd.GetPathName()); switch (idx) { case 1: path.AddExtension(_T(".mpcpl")); break; case 2: path.AddExtension(_T(".pls")); break; case 3: path.AddExtension(_T(".m3u")); break; case 4: path.AddExtension(_T(".asx")); break; default: break; } bool fRemovePath = true; CPath p(path); p.RemoveFileSpec(); CString base = (LPCTSTR)p; pos = m_pl.GetHeadPosition(); while (pos && fRemovePath) { CPlaylistItem& pli = m_pl.GetNext(pos); if (pli.m_type != CPlaylistItem::file) { fRemovePath = false; } else { POSITION pos; pos = pli.m_fns.GetHeadPosition(); while (pos && fRemovePath) { CString fn = pli.m_fns.GetNext(pos); CPath p(fn); p.RemoveFileSpec(); if (base != (LPCTSTR)p) { fRemovePath = false; } } pos = pli.m_subs.GetHeadPosition(); while (pos && fRemovePath) { CString fn = pli.m_subs.GetNext(pos); CPath p(fn); p.RemoveFileSpec(); if (base != (LPCTSTR)p) { fRemovePath = false; } } } } if (idx == 1) { SaveMPCPlayList(path, encoding, fRemovePath); break; } CTextFile f; if (!f.Save(path, encoding)) { break; } if (idx == 2) { f.WriteString(_T("[playlist]\n")); } else if (idx == 4) { f.WriteString(_T("<ASX version = \"3.0\">\n")); } pos = m_pl.GetHeadPosition(); CString str; int i; for (i = 0; pos; i++) { CPlaylistItem& pli = m_pl.GetNext(pos); if (pli.m_type != CPlaylistItem::file) { continue; } CString fn = pli.m_fns.GetHead(); /* if (fRemovePath) { CPath p(path); p.StripPath(); fn = (LPCTSTR)p; } */ switch (idx) { case 2: str.Format(_T("File%d=%s\n"), i + 1, fn); break; case 3: str.Format(_T("%s\n"), fn); break; case 4: str.Format(_T("<Entry><Ref href = \"%s\"/></Entry>\n"), fn); break; default: break; } f.WriteString(str); } if (idx == 2) { str.Format(_T("NumberOfEntries=%d\n"), i); f.WriteString(str); f.WriteString(_T("Version=2\n")); } else if (idx == 4) { f.WriteString(_T("</ASX>\n")); } } break; case M_SHUFFLE: s.bShufflePlaylistItems = !s.bShufflePlaylistItems; break; case M_HIDEFULLSCREEN: s.bHidePlaylistFullScreen = !s.bHidePlaylistFullScreen; break; default: break; } }
void SlaveDlg::WMCommand(int id, int notify, HWND hCtrl) { switch (id) { case IDC_LIST_NAME: { int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if (sel!=LB_ERR) { if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } break; } case IDC_LIST1: if (notify==LBN_SELCHANGE) { SetButtonStates(); } break; case IDC_LINK: { if (!cont->masterPresent) { MasterTrackViewFilter filter; TrackViewPick res; BOOL MasterOK = GetCOREInterface()->TrackViewPickDlg(hWnd,&res,&filter); if (MasterOK && (res.anim != NULL)) { cont->ReplaceReference(1,res.anim,FALSE); cont->propBlockID = -1; cont->propSubID = -1; int OK = DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_ADDNEWLINK), hWnd, NewLinkDlgProc, (LPARAM)cont); if ((OK) && (cont->propSubID != -1) && (cont->propSubID != -1)) { cont->AddControl(cont->propBlockID,cont->propSubID); SetupList(); } } int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { if (sel!=LB_ERR) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } } else { int OK = DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_ADDNEWLINK), hWnd, NewLinkDlgProc, (LPARAM)cont); if ( (OK) && (cont->propSubID != -1) && (cont->propSubID != -1)) { cont->AddControl(cont->propBlockID,cont->propSubID); SetupList(); } } Change(TRUE); break; } case IDC_REMOVE: { int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); cont->RemoveControl(sel); SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_DELETESTRING,sel,0); SetupList(); sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { if (sel!=LB_ERR) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } Change(TRUE); break; } case IDC_COLLAPSE: { SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); cont->CollapseControl(); EndDialog(hWnd,1); break; } case IDOK: EndDialog(hWnd,1); break; case IDCANCEL: EndDialog(hWnd,0); break; } }