Hi katahiromz,
> I'm using your resource compiler "windres".
> I found that windres cannot compile BITMAP or OWNERDRAW menu items.
Thank you for reporting this. In the future, please could you
report any binutils bugs via the bugzilla system here:
https://sourceware.org/bugzilla/enter_bug.cgi?product=binutils
In the meantime I have checked in the attached patch to fix the problem.
Cheers
Nick
binutils/ChangeLog
2020-07-09 Nick Clifton
* rclex.c: Add OWNERDRAW keyword.
* rcparse.y: Add OWNERDRAW token.
(menuitem_flag) Add BITMAP and OWNERDRAW entries.
* rcparse.c: Regenerate.
* resrc.c (write_rc_menuitems): Add support for OWNERDRAW and
BITMAP flags.
* windres.c (extended_menuitems): Likewise.
* testsuite/binutils-all/windres/menuitem_flags.rc: New test.
diff --git a/binutils/rclex.c b/binutils/rclex.c
index d6a0f91c7d..fac74b0491 100644
--- a/binutils/rclex.c
+++ b/binutils/rclex.c
@@ -94,7 +94,7 @@ static const struct rclex_keywords keywds[] =
K(LANGUAGE), K(LISTBOX), K(LOADONCALL), K(LTEXT),
K(MANIFEST), K(MENU), K(MENUBARBREAK), K(MENUBREAK),
K(MENUEX), K(MENUITEM), K(MESSAGETABLE), K(MOVEABLE),
- K(NOINVERT), K(NOT),
+ K(NOINVERT), K(NOT), K(OWNERDRAW),
K(PLUGPLAY), K(POPUP), K(PRELOAD), K(PRODUCTVERSION),
K(PURE), K(PUSHBOX), K(PUSHBUTTON),
K(RADIOBUTTON), K(RCDATA), K(RTEXT),
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index 78ce917e23..c0ed338ed0 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -124,7 +124,7 @@ static const rc_res_id res_null_text = { 1, {{0, _unichar}}};
%token ICON
%token ANICURSOR ANIICON DLGINCLUDE DLGINIT FONTDIR HTML MANIFEST PLUGPLAY VXD TOOLBAR BUTTON
%token LANGUAGE CHARACTERISTICS VERSIONK
-%token MENU MENUEX MENUITEM SEPARATOR POPUP CHECKED GRAYED HELP INACTIVE
+%token MENU MENUEX MENUITEM SEPARATOR POPUP CHECKED GRAYED HELP INACTIVE OWNERDRAW
%token MENUBARBREAK MENUBREAK
%token MESSAGETABLE
%token RCDATA
@@ -1088,6 +1088,14 @@ menuitem_flag:
{
$$ = MENUITEM_MENUBREAK;
}
+ | BITMAP
+ {
+ $$ = MENUITEM_BITMAP;
+ }
+ | OWNERDRAW
+ {
+ $$ = MENUITEM_OWNERDRAW;
+ }
;
/* Menuex resources. */
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a875c3a4ac..5a6336ee6c 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -2841,6 +2841,10 @@ write_rc_menuitems (FILE *e, const rc_menuitem *menuitems, int menuex,
fprintf (e, ", MENUBARBREAK");
if ((mi->type & MENUITEM_MENUBREAK) != 0)
fprintf (e, ", MENUBREAK");
+ if ((mi->type & MENUITEM_OWNERDRAW) != 0)
+ fprintf (e, ", OWNERDRAW");
+ if ((mi->type & MENUITEM_BITMAP) != 0)
+ fprintf (e, ", BITMAP");
}
else
{
diff --git a/binutils/windres.c b/binutils/windres.c
index 427e9823ce..5c83dab8fc 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -527,6 +527,8 @@ extended_menuitems (const rc_menuitem *menuitems)
| MENUITEM_HELP
| MENUITEM_INACTIVE
| MENUITEM_MENUBARBREAK
+ | MENUITEM_BITMAP
+ | MENUITEM_OWNERDRAW
| MENUITEM_MENUBREAK))
!= 0)
return 1;
--- /dev/null 2020-07-09 07:00:33.444572683 +0100
+++ binutils/testsuite/binutils-all/windres/menuitem_flags.rc 2020-07-09 12:22:15.647286406 +0100
@@ -0,0 +1,16 @@
+// parse-only
+
+1 MENU
+{
+POPUP ""
+{
+MENUITEM "This is a test #1", 100, BITMAP
+MENUITEM "This is a test #2", 101, OWNERDRAW
+MENUITEM "This is a test #3", 102, CHECKED
+MENUITEM "This is a test #4", 103, GRAYED
+MENUITEM "This is a test #5", 104, HELP
+MENUITEM "This is a test #6", 105, INACTIVE
+MENUITEM "This is a test #7", 106, MENUBARBREAK
+MENUITEM "This is a test #8", 107, MENUBREAK
+}
+}