void playlist_act(u32 act_type) { u32 idx, count; char entry[MAX_PATH]; const char *url; /*reset all*/ if (act_type == 3) { count = gf_cfg_get_key_count(cfg, "Playlist"); while (count) { url = gf_cfg_get_key_name(cfg, "Playlist", 0); gf_cfg_set_key(cfg, "Playlist", url, NULL); count--; } refresh_playlist(); return; } count = SendMessage(hList, LB_GETSELCOUNT, 0, 0); if (!count) return; idx = SendMessage(hList, LB_GETCURSEL, 0, 0); if ((act_type==1) && !idx) return; else if ((act_type==2) && (idx+1==count)) return; url = gf_cfg_get_key_name(cfg, "Playlist", idx); if (!url) return; strcpy(entry, url); /*remove from playlist*/ gf_cfg_set_key(cfg, "Playlist", url, NULL); switch (act_type) { /*remove*/ case 0: if (idx+1==count) idx--; break; /*up*/ case 1: gf_cfg_insert_key(cfg, "Playlist", entry, "", idx-1); idx--; break; /*down*/ case 2: gf_cfg_insert_key(cfg, "Playlist", entry, "", idx+1); idx++; break; } refresh_playlist(); SendMessage(hList, LB_SETCURSEL, idx, 0); SetFocus(hList); }
void repaint_windows() { int begin_pos = 0; begin_pos = (p_b / (browser_win->_maxy - 1)) * (browser_win->_maxy - 1); refresh_browser(NULL, begin_pos); begin_pos = (p_p / (playlist_win->_maxy - 1)) * (playlist_win->_maxy - 1); refresh_playlist(begin_pos); }
BOOL InitFileDialog(const HWND hWnd) { TCHAR psz[80]; ZeroMemory(psz, sizeof(psz)); SHINITDLGINFO sid; ZeroMemory(&sid, sizeof(sid)); sid.dwMask = SHIDIM_FLAGS; sid.dwFlags = SHIDIF_SIZEDLGFULLSCREEN; sid.hDlg = hWnd; if (FALSE == SHInitDialog(&sid)) return FALSE; SHMENUBARINFO mbi; ZeroMemory(&mbi, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU_OPEN; mbi.hInstRes = g_hInst; if (FALSE == SHCreateMenuBar(&mbi)) { return FALSE; } g_hWndMenuBar = mbi.hwndMB; ShowWindow(g_hWndMenuBar, SW_SHOW); the_wnd = hWnd; hDirTxt = GetDlgItem(hWnd, IDC_DIRNAME); hList = GetDlgItem(hWnd, IDC_FILELIST); g_hMenuView = (HMENU)SendMessage(g_hWndMenuBar, SHCMBM_GETSUBMENU, 0, ID_OF_VIEW); RECT rc; GetClientRect(hWnd, &rc); u32 caption_h = GetSystemMetrics(SM_CYCAPTION) - 3; MoveWindow(hDirTxt, 0, 0, rc.right - rc.left, caption_h, 1); MoveWindow(hList, 0, caption_h, rc.right - rc.left, rc.bottom - rc.top - caption_h, 1); if (playlist_mode) { refresh_playlist(); } else { if (!strcmp((const char *) current_dir, "\\")) { char *opt = (char *) gf_cfg_get_key(cfg, "General", "LastWorkingDir"); if (opt) CE_CharToWide(opt, (u16 *) w_current_dir); } set_directory(w_current_dir); } switch_menu_pl(); return TRUE; }
BOOL CALLBACK FileDialogProc(const HWND hWnd, const UINT Msg, const WPARAM wParam, const LPARAM lParam) { BOOL bProcessedMsg = TRUE; switch (Msg) { case WM_INITDIALOG: if (FALSE == InitFileDialog(hWnd)) EndDialog(hWnd, -1); break; case WM_ACTIVATE: if (WA_INACTIVE != LOWORD(wParam)) SetFocus(hWnd); break; case WM_CLOSE: EndDialog(hWnd, 0); break; case WM_COMMAND: if (LOWORD(wParam) == IDC_FILELIST) { if (HIWORD(wParam) == LBN_DBLCLK) { process_list_change(hWnd, GF_FALSE); } else { bProcessedMsg = FALSE; } } else { switch (LOWORD(wParam)) { case IDOK: process_list_change(hWnd, GF_FALSE); break; case IDCANCEL: EndDialog(hWnd, 0); break; case IDM_OF_VIEW_ALL: bViewUnknownTypes = (Bool) !bViewUnknownTypes; refresh_menu_states(); set_directory(w_current_dir); break; case IDM_OF_PLAYLIST: playlist_mode = (Bool) !playlist_mode; if (playlist_mode) refresh_playlist(); else set_directory(w_current_dir); switch_menu_pl(); break; case IDM_OF_PL_ACT: if (playlist_mode) { playlist_act(0); } else { process_list_change(hWnd, GF_TRUE); } break; case IDM_OF_PL_UP: playlist_act(1); break; case IDM_OF_PL_DOWN: playlist_act(2); break; case IDM_OF_PL_CLEAR: playlist_act(3); break; default: bProcessedMsg = FALSE; break; } } break; case WM_KEYDOWN: switch (wParam) { case VK_LEFT: case '1': playlist_act(1); break; case VK_RIGHT: case '2': playlist_act(2); break; default: bProcessedMsg = FALSE; break; } break; default: bProcessedMsg = FALSE; } return bProcessedMsg; }