Commit 82f910eb authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Merge the menu and menuex structures.

parent 1b305dd2
...@@ -48,7 +48,6 @@ const char *get_typename(const resource_t* r) ...@@ -48,7 +48,6 @@ const char *get_typename(const resource_t* r)
case res_ico: return "ICON"; case res_ico: return "ICON";
case res_icog: return "GROUP_ICON"; case res_icog: return "GROUP_ICON";
case res_men: return "MENU"; case res_men: return "MENU";
case res_menex: return "MENUEX";
case res_rdt: return "RCDATA"; case res_rdt: return "RCDATA";
case res_stt: return "STRINGTABLE"; case res_stt: return "STRINGTABLE";
case res_usr: return "UserResource"; case res_usr: return "UserResource";
...@@ -676,24 +675,6 @@ static void dump_menu(const menu_t *men) ...@@ -676,24 +675,6 @@ static void dump_menu(const menu_t *men)
/* /*
***************************************************************************** *****************************************************************************
* Function : dump_menuex
* Syntax : void dump_menuex(const menuex_t *menex)
* Input :
* menex - MenuEx resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
static void dump_menuex(const menuex_t *menex)
{
dump_memopt(menex->memopt);
dump_lvc(&(menex->lvc));
dump_menu_item(menex->items);
}
/*
*****************************************************************************
* Function : dump_ver_value * Function : dump_ver_value
* Syntax : void dump_ver_value(const ver_value_t *val) * Syntax : void dump_ver_value(const ver_value_t *val)
* Input : * Input :
...@@ -909,9 +890,6 @@ void dump_resources(const resource_t *top) ...@@ -909,9 +890,6 @@ void dump_resources(const resource_t *top)
case res_men: case res_men:
dump_menu(top->res.men); dump_menu(top->res.men);
break; break;
case res_menex:
dump_menuex(top->res.menex);
break;
case res_rdt: case res_rdt:
dump_rcdata(top->res.rdt); dump_rcdata(top->res.rdt);
break; break;
......
...@@ -780,37 +780,6 @@ static void menuitem2res(res_t *res, menu_item_t *menitem, const language_t *lan ...@@ -780,37 +780,6 @@ static void menuitem2res(res_t *res, menu_item_t *menitem, const language_t *lan
/* /*
***************************************************************************** *****************************************************************************
* Function : menu2res
* Syntax : res_t *menu2res(name_id_t *name, menu_t *men)
* Input :
* name - Name/ordinal of the resource
* men - The menu descriptor
* Output : New .res format structure
* Description :
* Remarks :
*****************************************************************************
*/
static res_t *menu2res(name_id_t *name, menu_t *men)
{
int restag;
res_t *res;
assert(name != NULL);
assert(men != NULL);
res = new_res();
restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, win32 ? &(men->lvc) : NULL);
put_dword(res, 0); /* Menuheader: Version and HeaderSize */
menuitem2res(res, men->items, win32 ? men->lvc.language : NULL);
/* Set ResourceSize */
SetResSize(res, restag);
if(win32)
put_pad(res);
return res;
}
/*
*****************************************************************************
* Function : menuexitem2res * Function : menuexitem2res
* Syntax : void menuexitem2res(res_t *res, menuex_item_t *item) * Syntax : void menuexitem2res(res_t *res, menuex_item_t *item)
* Input : * Input :
...@@ -846,8 +815,8 @@ static void menuexitem2res(res_t *res, menu_item_t *menitem, const language_t *l ...@@ -846,8 +815,8 @@ static void menuexitem2res(res_t *res, menu_item_t *menitem, const language_t *l
/* /*
***************************************************************************** *****************************************************************************
* Function : menuex2res * Function : menu2res
* Syntax : res_t *menuex2res(name_id_t *name, menuex_t *menex) * Syntax : res_t *menu2res(name_id_t *name, menu_t *men)
* Input : * Input :
* name - Name/ordinal of the resource * name - Name/ordinal of the resource
* menex - The menuex descriptor * menex - The menuex descriptor
...@@ -856,33 +825,43 @@ static void menuexitem2res(res_t *res, menu_item_t *menitem, const language_t *l ...@@ -856,33 +825,43 @@ static void menuexitem2res(res_t *res, menu_item_t *menitem, const language_t *l
* Remarks : * Remarks :
***************************************************************************** *****************************************************************************
*/ */
static res_t *menuex2res(name_id_t *name, menuex_t *menex) static res_t *menu2res(name_id_t *name, menu_t *men)
{ {
int restag; int restag;
res_t *res; res_t *res;
assert(name != NULL); assert(name != NULL);
assert(menex != NULL); assert(men != NULL);
res = new_res(); res = new_res();
if(win32) if(win32)
{ {
restag = put_res_header(res, WRC_RT_MENU, NULL, name, menex->memopt, &(menex->lvc)); restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, &(men->lvc));
put_word(res, 1); /* Menuheader: Version */ if (men->is_ex)
put_word(res, 4); /* Offset */ {
put_dword(res, 0); /* HelpId */ put_word(res, 1); /* Menuheader: Version */
put_pad(res); put_word(res, 4); /* Offset */
menuexitem2res(res, menex->items, menex->lvc.language); put_dword(res, 0); /* HelpId */
put_pad(res);
menuexitem2res(res, men->items, men->lvc.language);
}
else
{
put_dword(res, 0); /* Menuheader: Version and HeaderSize */
menuitem2res(res, men->items, men->lvc.language);
}
/* Set ResourceSize */ /* Set ResourceSize */
SetResSize(res, restag); SetResSize(res, restag);
put_pad(res); put_pad(res);
} }
else /* win16 */ else /* win16 */
{ {
/* Do not generate anything in 16-bit mode */ restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, NULL);
free(res->data);
free(res); put_dword(res, 0); /* Menuheader: Version and HeaderSize */
return NULL; menuitem2res(res, men->items, NULL);
/* Set ResourceSize */
SetResSize(res, restag);
} }
return res; return res;
} }
...@@ -1807,8 +1786,7 @@ const char *get_c_typename(enum res_e type) ...@@ -1807,8 +1786,7 @@ const char *get_c_typename(enum res_e type)
case res_fntdir:return "FntDir"; case res_fntdir:return "FntDir";
case res_ico: return "Ico"; case res_ico: return "Ico";
case res_icog: return "IcoGrp"; case res_icog: return "IcoGrp";
case res_men: case res_men: return "Men";
case res_menex: return "Men";
case res_rdt: return "RCDat"; case res_rdt: return "RCDat";
case res_stt: return "StrTab"; case res_stt: return "StrTab";
case res_usr: return "Usr"; case res_usr: return "Usr";
...@@ -1877,10 +1855,6 @@ void resources2res(resource_t *top) ...@@ -1877,10 +1855,6 @@ void resources2res(resource_t *top)
if(!top->binres) if(!top->binres)
top->binres = menu2res(top->name, top->res.men); top->binres = menu2res(top->name, top->res.men);
break; break;
case res_menex:
if(!top->binres)
top->binres = menuex2res(top->name, top->res.menex);
break;
case res_html: case res_html:
if(!top->binres) if(!top->binres)
top->binres = html2res(top->name, top->res.html); top->binres = html2res(top->name, top->res.html);
......
...@@ -49,7 +49,6 @@ typedef struct ...@@ -49,7 +49,6 @@ typedef struct
__NEW_STRUCT_FUNC(dialog) __NEW_STRUCT_FUNC(dialog)
__NEW_STRUCT_FUNC(name_id) __NEW_STRUCT_FUNC(name_id)
__NEW_STRUCT_FUNC(menu) __NEW_STRUCT_FUNC(menu)
__NEW_STRUCT_FUNC(menuex)
__NEW_STRUCT_FUNC(menu_item) __NEW_STRUCT_FUNC(menu_item)
__NEW_STRUCT_FUNC(control) __NEW_STRUCT_FUNC(control)
__NEW_STRUCT_FUNC(icon) __NEW_STRUCT_FUNC(icon)
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
__NEW_STRUCT_PROTO(dialog); __NEW_STRUCT_PROTO(dialog);
__NEW_STRUCT_PROTO(name_id); __NEW_STRUCT_PROTO(name_id);
__NEW_STRUCT_PROTO(menu); __NEW_STRUCT_PROTO(menu);
__NEW_STRUCT_PROTO(menuex);
__NEW_STRUCT_PROTO(menu_item); __NEW_STRUCT_PROTO(menu_item);
__NEW_STRUCT_PROTO(control); __NEW_STRUCT_PROTO(control);
__NEW_STRUCT_PROTO(icon); __NEW_STRUCT_PROTO(icon);
......
...@@ -237,7 +237,6 @@ static int rsrcid_to_token(int lookahead); ...@@ -237,7 +237,6 @@ static int rsrcid_to_token(int lookahead);
font_t *fnt; font_t *fnt;
fontdir_t *fnd; fontdir_t *fnd;
menu_t *men; menu_t *men;
menuex_t *menex;
html_t *html; html_t *html;
rcdata_t *rdt; rcdata_t *rdt;
stringtable_t *stt; stringtable_t *stt;
...@@ -315,9 +314,8 @@ static int rsrcid_to_token(int lookahead); ...@@ -315,9 +314,8 @@ static int rsrcid_to_token(int lookahead);
%type <verw> ver_words %type <verw> ver_words
%type <blk> ver_blocks ver_block %type <blk> ver_blocks ver_block
%type <val> ver_values ver_value %type <val> ver_values ver_value
%type <men> menu %type <men> menu menuex
%type <menitm> item_definitions menu_body itemex_definitions menuex_body %type <menitm> item_definitions menu_body itemex_definitions menuex_body
%type <menex> menuex
%type <exopt> itemex_p_options itemex_options %type <exopt> itemex_p_options itemex_options
%type <msg> messagetable %type <msg> messagetable
%type <usr> userres %type <usr> userres
...@@ -636,7 +634,7 @@ resource_definition ...@@ -636,7 +634,7 @@ resource_definition
| menu { $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); } | menu { $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); }
| menuex { | menuex {
if(win32) if(win32)
$$ = new_resource(res_menex, $1, $1->memopt, $1->lvc.language); $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language);
else else
$$ = NULL; $$ = NULL;
} }
...@@ -1295,7 +1293,8 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body { ...@@ -1295,7 +1293,8 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body {
parser_warning("MENUEX not supported in 16-bit mode\n"); parser_warning("MENUEX not supported in 16-bit mode\n");
if(!$4) if(!$4)
yyerror("MenuEx must contain items"); yyerror("MenuEx must contain items");
$$ = new_menuex(); $$ = new_menu();
$$->is_ex = TRUE;
if($2) if($2)
{ {
$$->memopt = *($2); $$->memopt = *($2);
......
...@@ -57,8 +57,6 @@ static language_t get_language(resource_t *resource) { ...@@ -57,8 +57,6 @@ static language_t get_language(resource_t *resource) {
return *resource->res.icog->lvc.language; return *resource->res.icog->lvc.language;
case res_men: case res_men:
return *resource->res.men->lvc.language; return *resource->res.men->lvc.language;
case res_menex:
return *resource->res.menex->lvc.language;
case res_rdt: case res_rdt:
return *resource->res.rdt->data->lvc.language; return *resource->res.rdt->data->lvc.language;
case res_stt: case res_stt:
...@@ -535,18 +533,6 @@ static int compare_menu(menu_t *menu1, menu_t *menu2) { ...@@ -535,18 +533,6 @@ static int compare_menu(menu_t *menu1, menu_t *menu2) {
return different; return different;
} }
static int compare_menuex(menuex_t *menuex1, menuex_t *menuex2) {
int different = 0;
if(!different &&
((menuex1->memopt != menuex2->memopt) ||
(menuex1->lvc.version != menuex2->lvc.version) ||
(menuex1->lvc.characts != menuex2->lvc.characts)))
different = 1;
if(!different)
different = compare_menu_item(menuex1->items, menuex2->items);
return different;
}
static int compare_rcdata(rcdata_t *rcdata1, rcdata_t *rcdata2) { static int compare_rcdata(rcdata_t *rcdata1, rcdata_t *rcdata2) {
int different = 0; int different = 0;
if(!different && if(!different &&
...@@ -860,8 +846,6 @@ static int compare(resource_t *resource1, resource_t *resource2) { ...@@ -860,8 +846,6 @@ static int compare(resource_t *resource1, resource_t *resource2) {
return compare_icon_group(resource1->res.icog, resource2->res.icog); return compare_icon_group(resource1->res.icog, resource2->res.icog);
case res_men: case res_men:
return compare_menu(resource1->res.men, resource2->res.men); return compare_menu(resource1->res.men, resource2->res.men);
case res_menex:
return compare_menuex(resource1->res.menex, resource2->res.menex);
case res_rdt: case res_rdt:
return compare_rcdata(resource1->res.rdt, resource2->res.rdt); return compare_rcdata(resource1->res.rdt, resource2->res.rdt);
case res_stt: case res_stt:
...@@ -963,7 +947,6 @@ static void setup_tabs(void) ...@@ -963,7 +947,6 @@ static void setup_tabs(void)
case res_ico: case res_ico:
case res_icog: case res_icog:
case res_men: case res_men:
case res_menex:
case res_rdt: case res_rdt:
case res_stt: case res_stt:
case res_usr: case res_usr:
......
...@@ -183,8 +183,7 @@ enum res_e { ...@@ -183,8 +183,7 @@ enum res_e {
res_dlginit = WRC_RT_DLGINIT, /* 240 */ res_dlginit = WRC_RT_DLGINIT, /* 240 */
res_toolbar = WRC_RT_TOOLBAR, /* 241 */ res_toolbar = WRC_RT_TOOLBAR, /* 241 */
res_menex = 256 + 4, res_usr = 256 + 6
res_usr
}; };
/* Raw bytes in a row... */ /* Raw bytes in a row... */
...@@ -254,15 +253,10 @@ typedef struct menu_item { ...@@ -254,15 +253,10 @@ typedef struct menu_item {
typedef struct menu { typedef struct menu {
DWORD memopt; DWORD memopt;
lvc_t lvc; lvc_t lvc;
int is_ex;
menu_item_t *items; menu_item_t *items;
} menu_t; } menu_t;
typedef struct menuex {
DWORD memopt;
lvc_t lvc;
menu_item_t *items;
} menuex_t;
typedef struct itemex_opt typedef struct itemex_opt
{ {
int id; int id;
...@@ -588,7 +582,6 @@ typedef struct resource { ...@@ -588,7 +582,6 @@ typedef struct resource {
icon_t *ico; icon_t *ico;
icon_group_t *icog; icon_group_t *icog;
menu_t *men; menu_t *men;
menuex_t *menex;
messagetable_t *msg; messagetable_t *msg;
html_t *html; html_t *html;
rcdata_t *rdt; rcdata_t *rdt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment