NO

Author Topic: Some wishes on resource editor  (Read 4177 times)

andi.martin

  • Guest
Some wishes on resource editor
« on: March 08, 2006, 09:15:19 PM »
Hi Pelle,

some annotations:
- The rc compiler doesn't use the preprocessor. Is it possible to make it doing?
- After saving a resource with the rc editor. All my comments are deleted... Is this a "must" behaviour?
- The rc editor changes _all_ symbols, the non-touched dialogs too...
Example: I've a symbol defined: #define IDC_MYICON 1
Each time I save the resource file, all OK-Buttons (IDOK) now named IDC_MYICON. So the dialog works anyway, but the editor makes changes on parts I didn't change, that's confusing. Are symbols sharing the same value illegal?

Kindly regards,
Andreas

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Some wishes on resource editor
« Reply #1 on: March 09, 2006, 09:43:15 PM »
Quote from: "andi.martin"
- The rc compiler doesn't use the preprocessor. Is it possible to make it doing?

Not sure I understand...

Quote from: "andi.martin"

- After saving a resource with the rc editor. All my comments are deleted... Is this a "must" behaviour?
- The rc editor changes _all_ symbols, the non-touched dialogs too...

The IDE can load/handle resource scripts (.RC), binary resource files (.RES), and resources in executable files. The only common, and generally useful, internal format is the binary resource format. The IDE uses the resource compiler when it loads a script - so it's actually compiled to the binary resource format. When saving again, as a resource script, the script is fabricated from the internal binary format.

This approach saves a lot of code - the IDE don't have to duplicate all code from the resource compiler, and don't have to keep track of comments, file offset of a certain resource, and so on. (I do this for the resource symbol include file (.h), so I know what a royal pain this is).

The only problem with the above approach is that resource identifiers are mapped by number - so they have to be unique within the resource (script). When you create a script from scratch, through the IDE, it will work hard to try and make all identifiers unique. If you create a resource script manually, or through other means, you can get into trouble. But I don't think this is reason enough to change the current approach - it would be almost impossible to maintain this bloated code...

Quote from: "andi.martin"

Are symbols sharing the same value illegal?

Normally OK if unique within a certain resource type, but see above...

Pelle
/Pelle

andi.martin

  • Guest
Re: Some wishes on resource editor
« Reply #2 on: March 11, 2006, 12:14:39 PM »
Quote from: "Pelle"
Quote from: "andi.martin"
- The rc compiler doesn't use the preprocessor. Is it possible to make it doing?

Not sure I understand...

Sorry bad description. I meant the macro replacement:

Code: [Select]

#define VER_MAJOR 2
#define VER_MINOR 3
#define VAL2STR_(x) #x
#define VAL2STR(x) VAL2STR_(x)
#define AppVersion "V"VAL2STR(VER_MAJOR)"."VAL2STR(VER_MINOR)


The following resource is then not accepted:

Code: [Select]

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK 0x3F
FILEFLAGS 0x0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "04070000"
    BEGIN
      VALUE "FileVersion", AppVersion"\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x407, 0x0
  END
END


Kindly regards,
Andreas