diff options
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 67 |
1 files changed, 1 insertions, 66 deletions
@@ -66,8 +66,6 @@ static void InitializeMainWindow(HWND); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); /* Process main menu commands. */ static void HandleMainMenu(HWND, WORD); -/* Process context menu commands. */ -static void HandleContextMenu(HWND, WORD); /* Call Prolog predicate in other thread, if available. */ static void WaitFor(const char*, const char*); /* Handle messages to Help > About dialog. */ @@ -323,7 +321,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, HandleMainMenu(hWnd, command); return 0; case IDG_CTX: - HandleContextMenu(hWnd, command); + g_elv->HandleContextMenu(command); return 0; default: return 0; @@ -469,69 +467,6 @@ void HandleMainMenu(const HWND hWnd, const WORD command) } } -void HandleContextMenu(const HWND, const WORD command) -{ - int cNotFound = 0; - - /* Look through selected items, applying the - * selected command to each one. */ - - LVITEM lvi = {LVIF_PARAM, -1}; - while (g_elv->FindNextItem(&lvi, LVNI_SELECTED)) { - if (ID_SUBGROUP(command) == IDG_CTX_RATE) { - /* Process rate commands. */ - Pl("episode_data","rate_episode",lvi.lParam,ID_RATING(command)); - } else { - /* Process other commands. */ - switch (command) { - case IDM_WATCH_LOCALLY: - if (!Pl("local_episode","open_episode_locally",lvi.lParam)) - cNotFound++; - break; - - case IDM_WATCH_ONLINE: - Pl("local_episode","open_episode_online",lvi.lParam); - break; - - case IDM_TOGGLE: - Pl("track_episodes","toggle_episode",lvi.lParam); - break; - - case IDM_FORGET: - Pl("track_episodes","forget_episode",lvi.lParam); - Pl("track_episodes","update_tracked_episodes"); - break; - - case IDM_LOOKUP: /* TODO: Remove IDM_LOOKUP. */ - Pl("episode_data","retract_episode",lvi.lParam); - g_dlv->ShowEpisode(lvi.lParam); - break; - - case IDM_WIKI: - Pl("episode_data","open_episode_wiki",lvi.lParam); - break; - } - } - } - - g_elv->Redraw(); - - if (ID_SUBGROUP(command) == IDG_CTX_RATE) { - /* If ratings changed, the episodes may need to be resorted. */ - g_elv->Sort(); - g_elv->ShowFocus(); - } else if (cNotFound) { - /* Show warning if local episodes were not found. */ - if (cNotFound == 1) - EBMessageBox(L"Episode could not be opened locally.", L"Error", MB_ICONWARNING); - else { - wchar_t msg[64] = {0}; - Swprintf(msg, L"%d episodes could not be opened locally.", cNotFound); - EBMessageBox(msg, L"Error", MB_ICONWARNING); - } - } -} - void WaitFor(const char* mod, const char* pred) { /* WaitFor uses a thread on the Prolog side to execute a |