aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/episodelistview.cpp6
-rw-r--r--c/main.cpp122
2 files changed, 76 insertions, 52 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index 5aa8850..3b16a06 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -436,8 +436,8 @@ void EpisodeListView::UpdateItem(const LVITEM* const pLvi)
}
ListView_SetItemText(hWnd, pLvi->iItem, ELVSITITLE, wsName.data());
- int iRating;
-r: if (!Pl("episode_data","episode_rating",pLvi->lParam,&iRating)) {
+r: int iRating;
+ if (!Pl("episode_data","episode_rating",pLvi->lParam,&iRating)) {
ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, (wchar_t*)L"");
return;
}
@@ -456,7 +456,7 @@ LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
/* For the episode list view, the Enter key should not
* be handled by the dialog manager, but instead be sent
* along to the main window procedure, so that it may be
- * handled by the NM_RETURN case in ElvHandleNotify. */
+ * handled by the NM_RETURN case in HandleNotify. */
const LRESULT lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam);
if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN
diff --git a/c/main.cpp b/c/main.cpp
index c3c555b..0c82aa0 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -296,63 +296,87 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
}
break;
case WM_COMMAND:
- switch (ID_GROUP((LOWORD(wParam)))) {
+ {
+ const unsigned short wCommand = LOWORD(wParam);
+ switch (ID_GROUP(wCommand)) {
case IDG_MENU:
- WndProcMainMenu(hWnd, LOWORD(wParam));
+ WndProcMainMenu(hWnd, wCommand);
break;
case IDG_CTX:
- WndProcContextMenu(hWnd, LOWORD(wParam));
+ WndProcContextMenu(hWnd, wCommand);
break;
}
break;
+ }
case WM_MENUSELECT:
- switch (LOWORD(wParam)) {
-#define TIP(s) SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(0,0), (LPARAM)(s));
-#define OF(m, s) IDM_##m: TIP(s); break;
- case OF(FILE_EXIT, L"Close Episode Browser.");
- case OF(FILE_REFRESH, L"Quickly refresh episode list.");
- case OF(FILE_FETCH_DATA, L"Fetch episode data from the web (may take a few seconds).");
- case OF(FILE_FETCH_SCREENWRITERS, L"Fetch screenwriter data from the web (may take a minute).");
- case OF(FILE_ABOUT, L"Show information about Episode Browser.");
- case OF(WATCH_LOCALLY, L"Open local copy of episode, if available.");
- case OF(WATCH_ONLINE, L"Open episode in the web browser.");
- case OF(TOGGLE, L"Toggle watched/unwatched status.");
- case OF(FORGET, L"Reset watched/unwatched status.");
- case OF(LOOKUP, L"Fetch episode data from the web, such as date, source and hint.");
- case OF(WIKI, L"Show Detective Conan Wiki entry for episode.");
- case OF(RATE10, L"Rate episode 10/10.");
- case OF(RATE9, L"Rate episode 9/10.");
- case OF(RATE8, L"Rate episode 8/10.");
- case OF(RATE7, L"Rate episode 7/10.");
- case OF(RATE6, L"Rate episode 6/10.");
- case OF(RATE5, L"Rate episode 5/10.");
- case OF(RATE4, L"Rate episode 4/10.");
- case OF(RATE3, L"Rate episode 3/10.");
- case OF(RATE2, L"Rate episode 2/10.");
- case OF(RATE1, L"Rate episode 1/10.");
- case OF(RATE0, L"Remove episode rating.");
- case IDM_VIEW_WATCHED:
- TIP(g_bViewWatched?
- L"Click to hide watched episodes.":
- L"Click to show watched episodes.");
- break;
- case IDM_VIEW_TV_ORIGINAL:
- TIP(g_bViewTVOriginal?
- L"Click to hide TV original episodes.":
- L"Click to show TV original episodes.");
- break;
- case IDM_VIEW_OTHERS:
- TIP(g_szLimitScreenwriter?
- L"Click to hide episodes by other screenwriters.":
- L"Click to show episodes by other screenwriters.");
- break;
- default:
- TIP(L"");
- break;
-#undef OF
-#undef TIP
- }
+ {
+ static const int aId[] = {
+ /*01*/IDM_FILE_EXIT,
+ /*02*/IDM_FILE_REFRESH,
+ /*03*/IDM_FILE_FETCH_DATA,
+ /*04*/IDM_FILE_FETCH_SCREENWRITERS,
+ /*05*/IDM_FILE_ABOUT,
+ /*06*/IDM_WATCH_LOCALLY,
+ /*07*/IDM_WATCH_ONLINE,
+ /*08*/IDM_TOGGLE,
+ /*09*/IDM_FORGET,
+ /*10*/IDM_LOOKUP,
+ /*11*/IDM_WIKI,
+ /*12*/IDM_RATE10,
+ /*13*/IDM_RATE9,
+ /*14*/IDM_RATE8,
+ /*15*/IDM_RATE7,
+ /*16*/IDM_RATE6,
+ /*17*/IDM_RATE5,
+ /*18*/IDM_RATE4,
+ /*19*/IDM_RATE3,
+ /*20*/IDM_RATE2,
+ /*21*/IDM_RATE1,
+ /*22*/IDM_RATE0,
+ /*23*/IDM_VIEW_WATCHED,
+ /*24*/IDM_VIEW_TV_ORIGINAL,
+ /*25*/IDM_VIEW_OTHERS
+ };
+ static const wchar_t* aWsz[] = {
+ /*01*/L"Close Episode Browser.",
+ /*02*/L"Quickly refresh episode list.",
+ /*03*/L"Fetch episode data from the web (may take a few seconds).",
+ /*04*/L"Fetch screenwriter data from the web (may take a minute).",
+ /*05*/L"Show information about Episode Browser.",
+ /*06*/L"Open local copy of episode, if available.",
+ /*07*/L"Open episode in the web browser.",
+ /*08*/L"Toggle watched/unwatched status.",
+ /*09*/L"Reset watched/unwatched status.",
+ /*10*/L"Fetch episode data from the web, such as date, source and hint.",
+ /*11*/L"Show Detective Conan Wiki entry for episode.",
+ /*12*/L"Rate episode 10/10.",
+ /*13*/L"Rate episode 9/10.",
+ /*14*/L"Rate episode 8/10.",
+ /*15*/L"Rate episode 7/10.",
+ /*16*/L"Rate episode 6/10.",
+ /*17*/L"Rate episode 5/10.",
+ /*18*/L"Rate episode 4/10.",
+ /*19*/L"Rate episode 3/10.",
+ /*20*/L"Rate episode 2/10.",
+ /*21*/L"Rate episode 1/10.",
+ /*22*/L"Remove episode rating.",
+ /*23*/g_bViewWatched? L"Click to hide watched episodes.":
+ L"Click to show watched episodes.",
+ /*24*/g_bViewTVOriginal? L"Click to hide TV original episodes.":
+ L"Click to show TV original episodes.",
+ /*25*/g_szLimitScreenwriter? L"Click to hide episodes by other screenwriters.":
+ L"Click to show episodes by other screenwriters."
+ };
+ const unsigned short wCommand = LOWORD(wParam);
+ const wchar_t* wsz = L"";
+ for (size_t i = 0; i < sizeof(aId)/sizeof(*aId); i++)
+ if (aId[i] == wCommand) {
+ wsz = aWsz[i];
+ break;
+ }
+ SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(0,0), (LPARAM)wsz);
break;
+ }
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}