--- Sylvain Petreolle <spetreolle@yahoo.fr> wrote:> Ok, that's done.
> Now after this the should compile and run :
> in En.rc MAIN_MENU is defined now like this :
>
> MAIN_MENU MENU
> {
> POPUP "&File" {
> MENUITEM "&New...", 0x100
>
> En.rc is included by #include "En.rc" in rsrc.rc.
>
> And gcc complies about it when compiling :
> [syl@snoop notepad]$ make
> gcc -c -I. -I. -I../../include -I../../include -g
> -O2
> -Wall -mpreferred-stack-boundary=2 -fPIC -DSTRICT
> -DNONAMELESSUNION -DNONAMELESSSTRUCT -D_REENTRANT
> -I/usr/X11R6/include -o language.o language.c
> language.c: In function `LANGUAGE_LoadMenus':
> language.c:98: `MAIN_MENU' undeclared (first use in
> this function)
First - to your question.
MAIN_MENU is a name of the resource. If you have this
name, defined in a header file, included in the rc
file, like #define MAIN_MENU 100, then resource
compiler identifies the resource as number 100. If the
resource compiler can't resolve the name to a number,
it identifies the rthe name as an id. In this case the
resource will be identified by id "MAIN_MENU".
To load the resource you need to know the id. AFAICS
you did not define macro MAIN_MENU, resource compiler
identified the resource as "MAIN_MENU". You try to
load the resource by its id - MAIN_MENU, but C
compiler does not recognize it, because this id is not
defined anywhere.
If you lost in the middle of my description :-) here
is what you need to do:
1) use everywhere number id of the resource - define
the id in some .h file and include the header file in
the .rc and in .c files where you need it.
or
2) use everywhere string id of the resource. This
means loading the resource by its string id, like
"MAIN_MENU".
Now you do everything as in (1) but you forgot to
define the constant and the C compiler can not resolve
the name.
More general description:
Wine notepad used complex macros to generate the
numbers to identify the resources. Currently each
resource file starts with definition of LANGUAGE_ID,
LANGUAGE_NUMBER and then these defines are used to
generate resources number ids and resource names. Try
to trace how this works.
Dimitry's and my idea was to remove all this complex
macro processing, but instead specify language in the
resources. Wine will load resources, basing on
language and resource id.
Metacode (file names are imaginary):
notepad.h:
#define MAIN_MENU 100
#define COMMAND_1 100
notepad.c:
#include notepad.h
....
LoadString(MAIN_MENU, ...);
notepad_En.rc:
#include notepad.h
....
MAIN_MENU MENU LANG ENGLISH {
...
MENUITEM "File", COMMAND_1
}
notepad_En.rc:
#include notepad.h
....
MAIN_MENU MENU LANG FRENCH {
...
MENUITEM "Fichier", COMMAND_1
}
Look as an example how to do localization in
wineconsole. Compare English and French rc files. Try
to play with wineconsole, make it to load English and
French resources.
Look in the application winemine how to specify the
menus in the simple way, but *without* localization.
You need to do the same for wine notepad, but to add
localization, like in wineconsole.
Andriy Palamarchuk
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com