Skip to content

Commit 6b0de61

Browse files
authored
Merge pull request #42 from GRAPHISOFT/addon-defines
Document and use new macro definitions
2 parents e201a5e + 7635f6b commit 6b0de61

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ The build script reads the config.json file for required build parameters:
3838

3939
See the example [config.json](https://github.com/GRAPHISOFT/archicad-addon-cmake/blob/master/config.json).
4040

41+
### Definitions in C++ code
42+
43+
The following macro definitions are set to string literals (they expand to `"a C string"`) with values based on the above:
44+
45+
- `ADDON_NAME`: This is the `addOnName` field as is.
46+
- `ADDON_DESCRIPTION`: This is the `description` field as is.
47+
- `ADDON_VERSION`: This is the 3 component version number derived from `version`.
48+
- Example: this macro definition expands to `"123.0.0"` if the value of `version` is `"123"`.
49+
4150
## Detailed instructions
4251

4352
If the provided build script doesn't work for you, you can set up your environment manually.

RINT/AddOn.grc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* [ 1] */ "Example AddOn Command... ^E3 ^ES ^EE ^EI ^ED ^ET ^10001"
1010
}
1111

12-
'GDLG' ID_ADDON_DLG Modal | grow 40 40 345 128 "Example Dialog" {
12+
'GDLG' ID_ADDON_DLG Modal | grow 40 40 345 128 "" {
1313
/* [ 1] */ Button 245 95 90 23 LargePlain "OK"
1414
/* [ 2] */ Button 145 95 90 23 LargePlain "Cancel"
1515
/* [ 3] */ Separator 10 83 325 2

Src/AddOnMain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ExampleDialog : public DG::ModalDialog,
3131
cancelButton (GetReference (), CancelButtonId),
3232
separator (GetReference (), SeparatorId)
3333
{
34+
SetTitle (ADDON_NAME " " ADDON_VERSION);
3435
AttachToAllItems (*this);
3536
Attach (*this);
3637
}

Tools

0 commit comments

Comments
 (0)