aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp103
1 files changed, 41 insertions, 62 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 0c82aa0..a9625c3 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -310,71 +310,50 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
}
case WM_MENUSELECT:
{
- 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
+ /* Look up status bar help for menu command. The help
+ * strings are stored in arrays, whose indices
+ * correspond to the IDM_ values (see resources.h). */
+
+ static const wchar_t* aWszMenu[] = {
+ /*IDM_FILE_EXIT*/L"Close Episode Browser.",
+ /*IDM_FILE_REFRESH*/L"Quickly refresh episode list.",
+ /*IDM_FILE_FETCH_DATA*/L"Fetch episode data from the web (may take a few seconds).",
+ /*IDM_FILE_FETCH_SCREENWRITERS*/L"Fetch screenwriters from the web (may take a minute).",
+ /*IDM_FILE_ABOUT*/L"Show information about Episode Browser.",
+ /*IDM_VIEW_WATCHED*/(g_bViewWatched? L"Click to hide watched episodes.":
+ L"Click to show watched episodes."),
+ /*IDM_VIEW_TV_ORIGINAL*/(g_bViewTVOriginal?
+ L"Click to hide TV original episodes.":
+ L"Click to show TV original episodes."),
+ /*IDM_VIEW_OTHERS*/(g_szLimitScreenwriter?
+ L"Click to hide episodes by other screenwriters.":
+ L"Click to show episodes by other screenwriters.")
};
- 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."
+ static const wchar_t* aWszCtx[] = {
+ /*IDM_WATCH_LOCALLY*/L"Open local copy of episode, if available.",
+ /*IDM_WATCH_ONLINE*/L"Open episode in the web browser.",
+ /*IDM_TOGGLE*/L"Toggle watched/unwatched status.",
+ /*IDM_FORGET*/L"Reset watched/unwatched status.",
+ /*IDM_LOOKUP*/L"Fetch episode data from the web, such as date, source and hint.",
+ /*IDM_WIKI*/L"Show Detective Conan Wiki entry for episode.",
+ /*IDM_RATE0*/L"Remove episode rating.",
+ /*IDM_RATE1*/L"Rate episode 1/10.",
+ /*IDM_RATE2*/L"Rate episode 2/10.",
+ /*IDM_RATE3*/L"Rate episode 3/10.",
+ /*IDM_RATE4*/L"Rate episode 4/10.",
+ /*IDM_RATE5*/L"Rate episode 5/10.",
+ /*IDM_RATE6*/L"Rate episode 6/10.",
+ /*IDM_RATE7*/L"Rate episode 7/10.",
+ /*IDM_RATE8*/L"Rate episode 8/10.",
+ /*IDM_RATE9*/L"Rate episode 9/10.",
+ /*IDM_RATE10*/L"Rate episode 10/10."
};
+
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);
+ const unsigned short wGroup = ID_GROUP(wCommand);
+ if (!wGroup) break;
+ const wchar_t** aWsz = wGroup==IDG_MENU? aWszMenu: aWszCtx;
+ SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(0,0), (LPARAM)aWsz[ID_INDEX(wCommand)]);
break;
}
default: