iigs resource compiler
Go to file
Kelvin Sherlock 3de5be69e4 commentary.
2020-08-02 17:29:12 -04:00
examples rSoundSample fixes 2020-08-02 17:28:59 -04:00
.gitignore git ignore 2020-08-01 21:59:38 -04:00
base.py fix bug with rResName generation 2020-08-02 17:26:37 -04:00
cli.py rVersion resource. 2020-08-02 15:45:00 -04:00
colors.py re-arrange a bit to make cli scope management easier. 2020-08-01 12:47:48 -04:00
constants.py constants. 2020-08-01 20:39:39 -04:00
control.py adjust rObject constructor parameters 2020-08-01 20:39:02 -04:00
menu.py adjust rObject constructor parameters 2020-08-01 20:39:02 -04:00
open_rfork.py resource writing code from resound 2020-08-01 21:57:38 -04:00
README.md update readme 2020-08-01 23:12:52 -04:00
rect.py add rectangle example and fix a couple rectangle bugs. 2020-08-02 10:43:26 -04:00
resource_writer.py fixes. 2020-08-01 23:00:19 -04:00
rezpy.py clean up string formatting code 2020-08-01 15:33:19 -04:00
sound.py rSoundSample fixes 2020-08-02 17:28:59 -04:00
test.prez update test file 2020-08-01 23:00:50 -04:00
Types.rez add a couple more system 6 flags 2020-07-30 01:07:47 -04:00
utils.py clean up string formatting code 2020-08-01 15:33:19 -04:00
version.py commentary. 2020-08-02 17:29:12 -04:00
window.py adjust rObject constructor parameters 2020-08-01 20:39:02 -04:00

prez

iigs resource compiler

An experimental alternative to rez.

Example:

rMenuBar(
  rMenu(" @ ",
    rMenuItem("About My App…", export="kAboutMenuItem"),
    rMenuItem("Preferences…", ",", export="kPreferencesMenuItem")
  ),
  rMenu(" File ",
    rMenuItem("New ", "Nn", export="kNewMenuItem"),
    rMenuItem("Open…", "Oo", export="kOpenMenuItem"),
    rMenuItem("Save", "Ss", disabled=True, export="kSaveMenuItem"),
    DividerMenuItem(),
    rMenuItem("Close", "Ww", id=0xff, export="kCloseMenuItem"),
    export = "kFileMenu"
  ),
  rMenu(" Edit ",
    UndoMenuItem(), # shortcut for doing it manually,
    DividerMenuItem(),
    CutMenuItem(),
    CopyMenuItem(),
    PasteMenuItem(),
    ClearMenuItem(),
    export = "kEditMenu"
  ),
  export = "kMenuBar"
)

This will generate rMenuBar, rMenu, rMenuItem, and rPString resources.

Note that the input file is actually a python program that generates a resource fork as a side effect.

resource rMenuItem($00000101) {
  0x0100, /* id */
  "", "", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0001 /* title ref (rPString) */
}

resource rMenuItem($00000103) {
  0x0102, /* id */
  ",", ",", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0002 /* title ref (rPString) */
}

resource rMenuItem($00000105) {
  0x0104, /* id */
  "N", "n", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0003 /* title ref (rPString) */
}

resource rMenuItem($00000107) {
  0x0106, /* id */
  "O", "o", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0004 /* title ref (rPString) */
}

resource rMenuItem($00000109) {
  0x0108, /* id */
  "S", "s", /* chars */
  0x0000, /* check */
  0x8080, /* flags */
  0x0005 /* title ref (rPString) */
}

resource rMenuItem($0000010b) {
  0x010a, /* id */
  "", "", /* chars */
  0x0000, /* check */
  0x8080, /* flags */
  0x0006 /* title ref (rPString) */
}

resource rMenuItem($000000ff) {
  0x00ff, /* id */
  "W", "w", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0007 /* title ref (rPString) */
}

resource rMenuItem($0000010c) {
  0x00fa, /* id */
  "Z", "z", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x0008 /* title ref (rPString) */
}

resource rMenuItem($0000010e) {
  0x010d, /* id */
  "", "", /* chars */
  0x0000, /* check */
  0x8080, /* flags */
  0x0009 /* title ref (rPString) */
}

resource rMenuItem($0000010f) {
  0x00fb, /* id */
  "X", "x", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x000a /* title ref (rPString) */
}

resource rMenuItem($00000110) {
  0x00fc, /* id */
  "C", "c", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x000b /* title ref (rPString) */
}

resource rMenuItem($00000111) {
  0x00fd, /* id */
  "V", "v", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x000c /* title ref (rPString) */
}

resource rMenuItem($00000112) {
  0x00fe, /* id */
  "", "", /* chars */
  0x0000, /* check */
  0x8000, /* flags */
  0x000d /* title ref (rPString) */
}

resource rPString($0000000e) {
  "About My App\$c9"
}

resource rPString($0000000f) {
  "Preferences\$c9"
}

resource rPString($00000010) {
  " @ "
}

resource rPString($00000011) {
  "New "
}

resource rPString($00000012) {
  "Open\$c9"
}

resource rPString($00000013) {
  "Save"
}

resource rPString($00000014) {
  "-"
}

resource rPString($00000015) {
  "Close"
}

resource rPString($00000016) {
  " File "
}

resource rPString($00000017) {
  "Undo"
}

resource rPString($00000018) {
  "-"
}

resource rPString($00000019) {
  "Cut"
}

resource rPString($0000001a) {
  "Copy"
}

resource rPString($0000001b) {
  "Paste"
}

resource rPString($0000001c) {
  "Clear"
}

resource rPString($0000001d) {
  " Edit "
}

resource rMenu($00000002) {
  0x0001, /* menu ID */
  0xa000, /* flags */
  0x0000001e, /* title ref (rPString) */
  {
    0x00000113,
    0x00000114
  }
}

resource rMenu($00000004) {
  0x0003, /* menu ID */
  0xa000, /* flags */
  0x0000001f, /* title ref (rPString) */
  {
    0x00000115,
    0x00000116,
    0x00000117,
    0x00000118,
    0x000000ff
  }
}

resource rMenu($00000006) {
  0x0005, /* menu ID */
  0xa000, /* flags */
  0x00000020, /* title ref (rPString) */
  {
    0x00000119,
    0x0000011a,
    0x0000011b,
    0x0000011c,
    0x0000011d,
    0x0000011e
  }
}

resource rMenuBar($00000001) {
  {
    0x00000007,
    0x00000008,
    0x00000009
  }
}
#define kAboutMenuItem 0x0000011f
#define kPreferencesMenuItem 0x00000120
#define kNewMenuItem 0x00000121
#define kOpenMenuItem 0x00000122
#define kSaveMenuItem 0x00000123
#define kCloseMenuItem 0x000000ff
#define kFileMenu 0x0000000a
#define kEditMenu 0x0000000b
#define kMenuBar 0x00000002