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