From 63a79631a1a070db670b4d0b9d5ccb8e14511acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 25 Jul 2022 18:51:53 +0200 Subject: Reorganize resource IDs, message handling. The resource IDs have been changed such that * the first (least significant) half byte represents the "group", * the second half byte represents the "subgroup", and * the third and fourth half bytes uniquely identify the resource within the group. Combined with the use of a few helper macros, this makes the message handling code a lot simpler. --- c/resource.h | 86 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 33 deletions(-) (limited to 'c/resource.h') diff --git a/c/resource.h b/c/resource.h index 9b2a1ae..b968282 100644 --- a/c/resource.h +++ b/c/resource.h @@ -1,38 +1,58 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define ID_STATUS 11 -#define IDT_TIMER 21 -#define IDR_MENU 101 -#define IDR_POPUPMENU 102 -#define IDD_ABOUT 201 -#define IDC_ABOUTTEXT 301 -#define IDC_EPISODELISTVIEW 302 -#define IDC_DATALISTVIEW 303 -#define IDM_FILE_EXIT 401 -#define IDM_FILE_REFRESH 402 -#define IDM_FILE_FETCH_DATA 403 -#define IDM_FILE_FETCH_SCREENWRITERS 404 -#define IDM_FILE_ABOUT 411 -#define IDM_VIEW_WATCHED 421 -#define IDM_VIEW_TV_ORIGINAL 422 -#define IDM_VIEW_OTHERS 423 -#define IDM_WATCH_LOCALLY 501 -#define IDM_WATCH_ONLINE 502 -#define IDM_TOGGLE 503 -#define IDM_FORGET 504 -#define IDM_LOOKUP 505 -#define IDM_WIKI 506 -#define IDM_RATE10 525 -#define IDM_RATE9 526 -#define IDM_RATE8 527 -#define IDM_RATE7 528 -#define IDM_RATE6 529 -#define IDM_RATE5 530 -#define IDM_RATE4 531 -#define IDM_RATE3 532 -#define IDM_RATE2 533 -#define IDM_RATE1 534 -#define IDM_RATE0 535 +/* Resource groups. */ +#define ID_GROUP(i) ((i) & 0x000f) +#define IDG_RES 0x1 +#define IDG_CTL 0x2 +#define IDG_MENU 0x3 +#define IDG_CTX 0x4 + +/* Subgroups. */ +#define ID_SUBGROUP(i) ((i) & 0x00f0) +#define IDG_CTX_RATE 0x10 + +/* Resources, timers, menus. */ +#define IDR_STATUS 0x0001 +#define IDR_TIMER 0x0101 +#define IDR_MENU 0x0201 +#define IDR_POPUPMENU 0x0301 + +/* Dialogs, controls, child windows. */ +#define IDD_ABOUT 0x0002 +#define IDC_ABOUTTEXT 0x0102 +#define IDC_EPISODELISTVIEW 0x0202 +#define IDC_DATALISTVIEW 0x0302 + +/* Main menu items. */ +#define IDM_FILE_EXIT 0x0003 +#define IDM_FILE_REFRESH 0x0103 +#define IDM_FILE_FETCH_DATA 0x0203 +#define IDM_FILE_FETCH_SCREENWRITERS 0x0303 +#define IDM_FILE_ABOUT 0x0403 +#define IDM_VIEW_WATCHED 0x0503 +#define IDM_VIEW_TV_ORIGINAL 0x0603 +#define IDM_VIEW_OTHERS 0x0703 + +/* Context menu items. */ +#define IDM_WATCH_LOCALLY 0x0004 +#define IDM_WATCH_ONLINE 0x0104 +#define IDM_TOGGLE 0x0204 +#define IDM_FORGET 0x0304 +#define IDM_LOOKUP 0x0404 +#define IDM_WIKI 0x0504 +#define IDM_RATE0 0x0614 +#define IDM_RATE1 0x0714 +#define IDM_RATE2 0x0814 +#define IDM_RATE3 0x0914 +#define IDM_RATE4 0x0a14 +#define IDM_RATE5 0x0b14 +#define IDM_RATE6 0x0c14 +#define IDM_RATE7 0x0d14 +#define IDM_RATE8 0x0e14 +#define IDM_RATE9 0x0f14 +#define IDM_RATE10 0x1014 + +#define ID_RATING(i) (((i) - IDM_RATE0) >> 8) #endif -- cgit v1.2.3