As I'm beginning work on the 2nd edition of the O'Reilly book, I've decided
that the current fragmentation between CW and GCC is a real pain. Having
projects that'll compile easily with both systems is my goal. Additionally,
an easy way to transfer CW projects between Mac and Windows would be nice
(currently, Constructor resource files are the only problem preventing such
easy transfer).
Thus, I've ported PilRC (version 2.5a) as a CW plugin:
Windows: <ftp://ftp.calliopeinc.com/PilRC.DLL>
Mac: <ftp://ftp.calliopeinc.com/PilRC.sit>
I'm quite willing to give up using Constructor in exchange for easy
cross-platform/cross-dev-env compatability.
Here's how the PilRC plugin functions:
Rather than emitting a bunch of binary files as PilRC normally does, it
instead generates Rez output (a .r file).
The Rez plugin will then automatically be run during the build process,
compiling the .r file. The resulting Rez output matches the format of the
resources that Constructor generates.
Then, PalmRez takes these Constructor-compatible resources and converts them
to Palm resources (just as it does with Constructor .rsrc files).
In an ideal world, PilRC would just directly generate Palm-compatible
resources, which PalmRez would include in the resulting application.
However, since PalmRez expects its resource files to be generated by
Constructor, it does processing on these resources. For example,
Constructor generates 3 resources for a menubar that has two menus: two MENU
resources, and an MBAR resource that references those menus.
Then, PalmRez puts those 3 resources together to generate a self-contained
Palm MBAR resource.
The PilRC plugin must create the 3 resources just as Constructor does,
rather than creating a self-contained MBAR resource (otherwise, PalmRez will
try and post-process the MBAR resource, and havoc will ensue).
A similar problem occurs with forms, where Constructor generates one
resource for every form object.
There are a couple of limitations due to this requirement of being PalmRez
compatible:
No frames/lines in forms
Menu IDs must be consecutive within a menu
Known bugs:
Windows PalmRez byte-swaps the first three words of a bitmap, making it
bogus.
Status:
I'd love to have people try this and iron the bugs out of it. I'll soon
update it to the latest version of PilRC (2.5b1). I'll also make sources
available.
Usage:
On Mac, unstuff PilRC.sit, and drag the PilRC plugin to CW For Palm OS
R6:Metrowkers CodeWarrior:CodeWarrior Plugins:Compilers.
On Windows: drag PilRC.DLL to C:\Program Files\Metrowerks\CW for Palm OS
R6\bin\plugins\compiler:
On both platforms:
In the file Mappings panel of the Project Settings dialog, add a new entry:
File Type: TEXT Extension: .rcp Compiler: PilRC
Make sure the UIResDefs.r file (from the Palm OS 3.5 headers) is part of
your access path.
Create a text file containing PilRC input, save it as a .rcp file, and add
it to your project.
Here's example input:
#include "StarterRsc.h"
ICON "x.bmp"
APPLICATIONICONNAME 1000 "Library"
ALERT ID RomIncompatibleAlert
CONFIRMATION
BEGIN
TITLE "System Incompatible"
MESSAGE "System Version 3.0 or greater is required to run this
application."
BUTTONS "OK"
END
MENU ID MainForm
BEGIN
PULLDOWN "Record"
BEGIN
MENUITEM "Beam Book" ID MainRecordBeam "B"
MENUITEM "Beam Category" ID MainRecordBeamCategory
END
PULLDOWN "Edit"
BEGIN
MENUITEM "Undo" ID 10000 "U"
MENUITEM "Cut" ID 10001 "X"
MENUITEM "Copy" ID 10002 "C"
MENUITEM "Paste" ID 10003 "P"
MENUITEM "Select All" ID 10004 "S"
MENUITEM "-" ID 10005
MENUITEM "Keyboard" ID 10006 "K"
MENUITEM "Graffiti Help" ID 10007 "G"
END
PULLDOWN "Options"
BEGIN
MENUITEM "Font\030" ID MainOptionsFont "F"
MENUITEM "Preferences\030" ID MainOptionsPreferences "R"
MENUITEM "About Library" ID MainOptionsAboutHomeLibrary
END
END
FORM ID MainForm AT (0 0 160 160)
USABLE
MENUID MainForm
BEGIN
TITLE "Home Library List"
POPUPTRIGGER "All" ID 5001 AT (143 1 17 AUTO) RIGHTANCHOR
LIST "All" "Business" "Personal" "Unfiled" "Edit Categories..." ID 5002 AT
(86 1 72 0) VISIBLEITEMS 4 NONUSABLE
POPUPLIST ID 5001 5002
LABEL "Look Up:" ID 5003 AT (0 149)
FIELD ID 5004 AT (36 149 55 11) USABLE UNDERLINED SINGLELINE MAXCHARS 8
BUTTON "New" ID MainNewButton AT (96 147 26 12)
GRAFFITISTATEINDICATOR AT (135 150)
SCROLLBAR ID MainRecordsScrollbar AT (153 18 7 121) VALUE 0 MIN 0 MAX 15
PAGESIZE 3
LABEL "Card, Orson Scott" AUTOID AT (0 18)
LABEL "Card, Orson Scott" AUTOID AT (0 PrevBottom)
LABEL "Rand, Ayn" AUTOID AT (0 PrevBottom)
LABEL "Ender's Game" AUTOID AT (RIGHT@148 18)
LABEL "Ender's Shadow" AUTOID AT (RIGHT@148 PrevBottom)
LABEL "Atlas Shrugged" AUTOID AT (RIGHT@148 PrevBottom)
END
STRING ID DeleteConfirmHelpString "The Save Archive Copy option will store
deleted records in an archive file on your Desktop at the next HotSync
operation.\n"
and here's the resulting .r file:
// Generated automatically from PalmRC, decompiling the prc file
"Starter.rcp"
#include "UIResDefs.r"
type 'tSLT' {
integer; /* Button ID */
integer; /* Left */
integer; /* Top */
integer; /* Width */
integer; /* Height */
byte notUsable=0, usable=1; /* Usable */
fill byte;
byte rightAnchor=0, leftAnchor=1; /* Left Anchor */
fill byte;
byte palmFont; /* Font ID */
cstring; /* Button Label */
}; /* end tSLT */
data 'tAIB' (1000) {
$"0020 0020 0004 0000 0101 0000 0000 0000"
$"0FFFFFFFFF FFFFFFFFFFFFFFFF 0FFFFFFFFF FFFFFFFFFFFFFFFF 0FFFFFFFFF
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFB FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFD FFFFFFFFFFFFFFF7 FFFFFFFFFFFFFFFE FFFFFFFFFFFFFFEF"
$"FFFFFFFFFFFFFFFE FFFFFFFFFFFFFFDF FFFFFFFFFFFFFFFF 7FFFFFFFBF
FFFFFFFFFFFFFFFF FFFFFFBF7F FFFFFFFFFFFFFFFF FFFFFFBEFFFFFFFF"
$"FFFFFFFFFFFFFFFF FFFFFFDDFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFEBFFFFFFFF
FFFFFFFFFFFFFFFF FFFFFFE7FFFFFFFF FFFFFFFFFFFFFFFF FFFFFFE7FFFFFFFF"
$"FFFFFFFFFFFFFFFF FFFFFFDBFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFBBFFFFFFFF
FFFFFFFFFFFFFFFF 7DFFFFFFFF FFFFFFFFFFFFFFFE FFFFFFFEFFFFFFFF"
$"FFFFFFFFFFFFFFFD FFFFFFFEFFFFFFFF FFFFFFFFFFFFFFFB FFFFFFFF7F
FFFFFFFFFFFFFFE7 FFFFFFFFFFFFFFBF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFBF"
$"FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 0FFFFFFFFF FFFFFFFFFFFFFFFF 0FFFFFFFFF
FFFFFFFFFFFFFFFF 0FFFFFFFFF FFFFFFFFFFFFFFFF"
};
resource 'tAIN' (1000) {
"Library"
};
resource 'Talt' (1001) {
confirmationAlert,
0, // help Rsc ID
1, // # Buttons
0, // Default Button Index
"System Incompatible",
"System Version 3.0 or greater is required to run this application.",
{
"OK",
}
};
data 'MENU' (2000) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 FFFFFFFFFFFFFFFF 0000 0000 0003 0000 0000"
$"0000 0000 0006 000E 0056 0016 0000 0000"
$"0004 0000 002B 000C 0000 00FFFFFFEE 0002 0000"
$"00FFFFFF86 0000 0000 0031 000E 0062 0052 0000"
$"0000 002F 0000 001B 000C 0000 010D 0008"
$"0000 00FFFFFF96 0000 0000 003A 000E 0064 0021"
$"0000 0000 004A 0000 002F 000C 0000 014A"
$"0003 0000 00FFFFFFD6 03FFFFFFE8 4200 0000 00FFFFFFF5 03FFFFFFE9"
$"0000 0000 00FFFFFFFF 2710 5500 0000 0112 2711"
$"5800 0000 0117 2712 4300 0000 011B 2713"
$"5000 0000 0120 2714 5300 0000 0126 2715"
$"0000 0000 0131 2716 4B00 0000 0133 2717"
$"4700 0000 013C 03FFFFFFF2 4600 0000 0152 03FFFFFFF3"
$"5200 0000 0158 03FFFFFFF4 0000 0000 0165 5265"
$"636F 7264 0042 6561 6D20 426F 6F6B 0042"
$"6561 6D20 4361 7465 676F 7279 0045 6469"
$"7400 556E 646F 0043 7574 0043 6F70 7900"
$"5061 7374 6500 5365 6C65 6374 2041 6C6C"
$"002D 004B 6579 626F 6172 6400 4772 6166"
$"6669 7469 2048 656C 7000 4F70 7469 6F6E"
$"7300 466F 6E74 1800 5072 6566 6572 656E"
$"6365 7318 0041 626F 7574 204C 6962 7261"
$"7279 00"
};offsetof(numMenus) = 26
num menus = 3, swapped = 3
resource 'MENU' (1000) {
1000, // menu resource ID (ID of first menu item)
textMenuProc,
allEnabled,
enabled,
"Record",
{
"Beam Book", noIcon, "B", noMark, plain;
"Beam Category", noIcon, noKey, noMark, plain;
}
};
resource 'MENU' (1001) {
10000, // menu resource ID (ID of first menu item)
textMenuProc,
allEnabled,
enabled,
"Edit",
{
"Undo", noIcon, "U", noMark, plain;
"Cut", noIcon, "X", noMark, plain;
"Copy", noIcon, "C", noMark, plain;
"Paste", noIcon, "P", noMark, plain;
"Select All", noIcon, "S", noMark, plain;
"-", noIcon, noKey, noMark, plain;
"Keyboard", noIcon, "K", noMark, plain;
"Graffiti Help", noIcon, "G", noMark, plain;
}
};
resource 'MENU' (1002) {
1010, // menu resource ID (ID of first menu item)
textMenuProc,
allEnabled,
enabled,
"Options",
{
"Font", noIcon, "F", noMark, plain;
"Preferences", noIcon, "R", noMark, plain;
"About Library", noIcon, noKey, noMark, plain;
}
};
resource 'MBAR' (2000) {
{1000, 1001, 1002}
};
resource 'tTTL' (30000) {
"Home Library List"
};
resource 'tPUT' (5001) {
5001, // controlID
143, // left
1, // top
17, // width
12, // height
usable,
rightAnchor,
stdFont, // font ID
"All"
};
resource 'tLST' (5002) {
5002, //listID
86, //left
1, //top
72, //width
notUsable,
stdFont,
3, //visibleItems
{
"All",
"Business",
"Personal",
"Unfiled",
"Edit Categories...",
}
};
resource 'tPUL' (30001) {
5001,
5002
};
resource 'tLBL' (5003) {
5003, // labelID
0, // left
149, // top
usable,
stdFont,
"Look Up:"
};
resource 'tFLD' (5004) {
5004, // fieldID
36, // left
149, // top
55, // width
11, // height
usable,
editable,
underlined,
singleLine,
notDynamicSize,
leftJustified,
8, //maxChars
stdFont,
notAutoShift,
notHasScrollbar,
notNumeric,
};
resource 'tBTN' (2007) {
2007, // controlID
96, // left
147, // top
26, // width
12, // height
usable,
rightAnchor,
frame,
nonBoldFrame,
stdFont, // font ID
"New"
};
resource 'tGSI' (30002) {
135,
150
};
resource 'tSCL' (2006) {
2006, // scrollbarID
153, // left
18, // top
7, // width
121, // height
usable,
0, // value
0, // minValue
15, // maxValue
3 // pageSize
};
resource 'tLBL' (9999) {
9999, // labelID
0, // left
18, // top
usable,
stdFont,
"Card, Orson Scott"
};
resource 'tLBL' (9998) {
9998, // labelID
0, // left
30, // top
usable,
stdFont,
"Card, Orson Scott"
};
resource 'tLBL' (9997) {
9997, // labelID
0, // left
42, // top
usable,
stdFont,
"Rand, Ayn"
};
resource 'tLBL' (9996) {
9996, // labelID
93, // left
18, // top
usable,
stdFont,
"Ender's Game"
};
resource 'tLBL' (9995) {
9995, // labelID
86, // left
30, // top
usable,
stdFont,
"Ender's Shadow"
};
resource 'tLBL' (9994) {
9994, // labelID
87, // left
42, // top
usable,
stdFont,
"Atlas Shrugged"
};
resource 'tFRM' (2000) {
0, // left
0, // top
160, // width
160, // height
usable,
notModal,
saveBehind,
2000, // formID
0, // helpID
2000, // menuRsrcID
0, // default button ID
{
30000, "tTTL";
5001, "tPUT";
5002, "tLST";
30001, "tPUL";
5003, "tLBL";
5004, "tFLD";
2007, "tBTN";
30002, "tGSI";
2006, "tSCL";
9999, "tLBL";
9998, "tLBL";
9997, "tLBL";
9996, "tLBL";
9995, "tLBL";
9994, "tLBL";
}
};
resource 'tSTR' (2200) {
"The Save Archive Copy option will store deleted records in an archive fi"
\
"le on your Desktop at the next HotSync operation.\n"
};
--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA 92374
(909) 793-5995 [EMAIL PROTECTED] fax: (909) 793-2545
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html