RcDocument#
Provides access to the content of a RC file (MFC resource file). More...
import Script
Properties#
| Name | |
|---|---|
| array<string> | acceleratorIds |
| array<Asset> | actions |
| array<Asset> | assets |
| array<string> | dialogIds |
| string | language |
| array<string> | languages |
| array<string> | menuIds |
| array<Menu> | menus |
| array<string> | stringIds |
| array<string> | strings |
| array<string> | toolbarIds |
| array<ToolBar> | toolbars |
| bool | valid |
Methods#
| Name | |
|---|---|
| ToolBar | action(string id) |
| array<Action> | actionsFromMenu(string menuId) |
| array<Action> | actionsFromToolbar(string toolBarId) |
| void | convertActions(int flags) |
| convertAssets(int flags) | |
| string | convertLanguageToCode(string language) |
| Widget | dialog(string id, int flags, real scaleX, real scaleY) |
| Menu | menu(string id) |
| bool | mergeAllLanguages(string language = "[default]") |
| bool | mergeLanguages() |
| bool | previewDialog(Widget dialog) |
| Menu | ribbon(string id) |
| string | stringForDialog(string dialogId, string id) |
| string | stringForDialogAndLanguage(string language, string dialogId, string id) |
| string | stringForLanguage(string language, string id) |
| array<String> | stringsForLanguage(string language) |
| string | text(string id) |
| ToolBar | toolBar(string id) |
| bool | writeAssetsToImage(int flags) |
| bool | writeAssetsToQrc(string fileName) |
| bool | writeDialogToUi(Widget dialog, string fileName) |
Property Documentation#
array<string> acceleratorIds#
This read-only property holds the list of accelerator's ids in the RC file.
array<Asset> actions#
This read-only property holds the list of actions in the RC file.
array<Asset> assets#
This read-only property holds the list of assets in the RC file.
array<string> dialogIds#
This read-only property holds the list of dialog's ids in the RC file.
string language#
This property holds the current language used for the data in the RC file. All other properties or method will work on the data for this specific language.
array<string> languages#
This read-only property holds the list of languages available in the file.
array<string> menuIds#
This read-only property holds the list of menu's ids in the RC file.
array<Menu> menus#
This read-only property holds the list of menus in the RC file.
array<string> stringIds#
This read-only property holds the list of string's ids in the RC file.
array<string> strings#
This read-only property holds the list of strings in the RC file.
array<string> toolbarIds#
This read-only property holds the list of toolbar's ids in the RC file.
array<ToolBar> toolbars#
This read-only property holds the list of toolbars in the RC file.
bool valid#
This read-only property defines if the RC file is valid for our parser.
Note that the RC file may be valid, and our parser needs to be updated.
Method Documentation#
ToolBar action(string id)#
Returns the action for the given id.
array<Action> actionsFromMenu(string menuId)#
Returns all actions used in the menu menuId.
array<Action> actionsFromToolbar(string toolBarId)#
Returns all actions used in the toolbar toolBarId.
void convertActions(int flags)#
Experimental API
The API here is still experimental, and may change in follow-up release. Use it at your own risk.
Convert all actions using the flags.
The flags are used to fill the iconPath of the action:
RcDocument.RemoveUnknown: remove the unknown assetsRcDocument.SplitToolBar: split toolbar's strips into individual icon, one per actionRcDocument.ConvertToPng: convert BMPs to PNGs, needed if we want to also change the transparencyRcDocument.AllFlags: combination of all above
convertAssets(int flags)#
Convert all assets using the flags.
RcDocument.RemoveUnknown: remove the unknown assetsRcDocument.SplitToolBar: split toolbars strip into individual icon, one per actionRcDocument.ConvertToPng: convert BMPs to PNGs, needed if we want to also change the transparencyRcDocument.AllFlags: combination of all above
string convertLanguageToCode(string language)#
Returns language code as defined by the ISO 639 for language name
Widget dialog(string id, int flags, real scaleX, real scaleY)#
Returns the dialog for the given id.
To do the conversion, the flags and scale factor scaleX and scaleY are used. Default
values are coming from the project settings.
Flags could be:
RcDocument.UpdateHierarchy: create a hierarchy of parent-children, by default there are none in MFCRcDocument.UpdateGeometry: use the scale factor to change the dialog sizeRcDocument.UseIdForPixmap: use the id as a resource value for the pixmaps in labelsRcDocument.AllFlags: combination of all above
Menu menu(string id)#
Returns the menu for the given id.
bool mergeAllLanguages(string language = "[default]")#
Merges all languages data into one.
bool mergeLanguages()#
Merges languages based on the language map in the settings.
The language map gives for each language a resulting language, and if multiple source languages have the same resulting language they will be merged together.
bool previewDialog(Widget dialog)#
Preview the result of the conversion RC->UI
Menu ribbon(string id)#
Returns the ribbon for the given id.
string stringForDialog(string dialogId, string id)#
Return the string for the given dialogid and id.
string stringForDialogAndLanguage(string language, string dialogId, string id)#
Return the string for the given language, dialogid and id.
string stringForLanguage(string language, string id)#
Return the string for the given id in language language.
array<String> stringsForLanguage(string language)#
Returns translated string for specific language.
string text(string id)#
Return the string for the given id.
ToolBar toolBar(string id)#
Returns the toolbar for the given id.
bool writeAssetsToImage(int flags)#
Writes the assets to images, using flags for transparency settings. Returns true if no issues.
Before writing the assets to disk, you first need to convert them using RcDocument::convertAssets.
BMPs assets don't have transparency, but some specific colors are used for that in MFC. When
writing the assets to PNGs, the flags define how to handle transparency:
RcDocument.NoColors: no transparent colorRcDocument.Gray: rgb(192, 192, 192) is used as a transparent colorRcDocument.Magenta: rgb(255, 0, 255) is used as a transparent colorRcDocument.BottomLeftPixel: the color of the bottom left pixel is used as transparentRcDocument.AllColors: combination of all above
bool writeAssetsToQrc(string fileName)#
Writes a qrc file with the given fileName. Returns true if no issues.
Before writing the qrc file, you first need to convert them using RcDocument::convertAssets.
bool writeDialogToUi(Widget dialog, string fileName)#
Writes a ui file for the given dialog, to the given fileName. Return true if no issues.