/* File: Rtutor.Rez */
/* Rez source file for C version of resource tutorial */
/* Part 1:  starting up & shutting down the tools using a resource */
/* Part 2:  do Part 1 and insert a menubar with menus */

/* this gives use access to the "standard" pre-defined resource types */
#include "Types.rez"

/*---------------------- Startup Record ---------------------------*/
resource rToolStartup (1)
{
 $C080,       /* set master SCB to mode640 + fFastPortAware + fUseShadowing */
 {
  3,$0300,      /* misc tools */
  4,$0302,      /* quickdraw */
  5,$0302,      /* desk manager */
  6,$0300,      /* eventMgr */
/*  7,$0300,      /* scheduler */ /* not used by apps or DA's */
/*  8,$0301,      /* sound tools */ /* not used by this app */
/*  9,$0300,      /* ADB tools */ /* not used by this app */
/*  10,$0300,      /* SANE */ /* started already by pStart.obj */
  11,$0300,      /* int math */
  14,$0301,      /* Window Manager */
  15,$0301,      /* Menu Manager */
  16,$0300,      /* Control Manager */
  18,$0301,      /* QD Aux */
  19,$0300,      /* print manager */
  20,$0301,      /* LineEdit tool set */
  21,$0302,      /* Dialog Manager */
  22,$0300,      /* Scrap manager */
  23,$0301,      /* standard file */
  27,$0301,      /* Font manager */
  28,$0301,      /* list manager */
  34,$0101,      /* text edit */
/*  29,$0100,      /* ACE */ /* not used by this app */
/*  32,$0100,      /* Midi Tools */ /* not used by this app */
/*  25,$0100,      /* NoteSynth */ /* not used by this app */
/*  26,$0100      /* Note Seq */ /* not used by this app */
 }
};


/*---------------------- Menus & Menu Bars ---------------------------*/
    /* define the resource id of the menu bar itself */
#define    kMenuBarID1       1

    /* define all the menu id's */
#define    kAppleMID   1000
#define    kFileMID    2000
#define    kEditMID    3000

    /* now, define the menu item id's */
#define    kAboutBoxIID    1001 /* the "About..." box */
    
#define    kNewItem        2001 /* the "New" item */
#define    kOpenItem       2002 /* the "Open..." item */
#define    kCloseItem       255 /* the "Close" item */
#define    kSaveItem       2004 /* the "Save" item */
#define    kSaveAsItem     2005 /* the "Save As..." item */
#define    kQuitItem       2009 /* the "Quit" item */
      
#define    kUndoItem        250 /* the "Undo" item */
#define    kCutItem         251 /* the "Cut" item */
#define    kCopyItem        252 /* the "Copy" item */
#define    kPasteItem       253 /* the "Paste" item */
#define    kClearItem       254 /* the "Clear" item */
#define    kSelectItem     3001 /* the "Select All" item */
      
    /* now, define the menu bar */
resource rMenuBar (kMenuBarID1)
{
    {
        kAppleMID,
        kFileMID,
        kEditMID,
    };
};


/* lay out the Apple menu */
/* this takes several steps: */
/* 1)  define the menu itself in a resource of type "rMenu" */
/* 2)  define the rPString that will be used for the name of the menu */
/* 3)  define the first item in the menu in a resource of type "rMenuItem" */
/* 4)  define the rPString that will be used for the name of the first item */
/* 5)  repeat steps 3 and 4 for all remaining items in that menu */
/* 6)  repeat steps 1 through 5 for all remaining menus */
    
resource rMenu (kAppleMID, nocrossbank)
{
    kAppleMID,    /* ID of the menu this item belongs to */
    0xA008, /* flags => menu title is a resource, items are resources, menu */
            /* is enabled, XOR highlighting, std menu, caching ok */
    kAppleMID,    /* ref to menu's title */
    { kAboutBoxIID }; /* array of items in this menu (only 1 to start with) */
};

resource rPString (kAppleMID, nocrossbank)
{
    "@"                    /* this string is the title of the "Apple" menu */
};

/* see IIGS Toolbox Reference, Volume 3, menu item template */
resource rMenuItem (kAboutBoxIID, nocrossbank)
{
    kAboutBoxIID, /* item's ID */
    "",           /* no keyboard equivalent */
    "",           /* no keyboard equivalent (allowed 2, this is the 2nd) */
    0,            /* this item does not have a check mark by it */
    0x8040,       /* title is in a resource, enabled (bit 7=0), */
                  /* dividing line below (bit 6=1)  */
    kAboutBoxIID  /* ref of the item's title */
};

resource rPString (kAboutBoxIID, nocrossbank)
{
    "About rTutor" /* used as the title for the "About..." item */
};


    /* lay out the File menu */
    
resource rMenu (kFileMID, nocrossbank) /* leave out printing items for now */
{
    kFileMID,  /* ID of the menu this item belongs to */
    0xA008,    /* flags => menu title is a resource, items are resources, */
               /* menu is enabled, don't use XOR highlighting, std menu,  */
               /* caching ok */
    kFileMID,  /* ref to menu's title */
    {          /* array of items in this menu */
        kNewItem,
        kOpenItem,
        kCloseItem,
        kSaveItem,
        kSaveAsItem,
        kQuitItem
    };
};

resource rPString (kFileMID, nocrossbank)
{
    " File "   /* this string is the title of the "File" menu */
};

resource rMenuItem (kNewItem, nocrossbank)
{
    kNewItem,  /* item's ID */
    "N",       /* keyboard equivalent = "N" */
    "n",       /* or = "n" (either key will work) */
    0,         /* this item does not have a check mark by it */
    0x8000,    /* title is in a resource, enabled (bit 7 = 0)  */
    kNewItem   /* ref of the item's title */
};

resource rPString (kNewItem, nocrossbank)
{
    "New"      /* this string is used as the title for the "New" item */
};

resource rMenuItem (kOpenItem, nocrossbank)
{
    kOpenItem,
    "O",       /* that's an "OH" on this line, not a "zero" */
    "o",       /* that's an "OH" on this line, not a "zero" */
    0,         /* this one's a "zero" */
    0x8040,    /* the "4" means put a dividing line under this item */
    kOpenItem
};

resource rPString (kOpenItem, nocrossbank)
{
    "Open..."
};

resource rMenuItem (kCloseItem, nocrossbank)
{
    kCloseItem,
    "W",
    "w",
    0,
    0x8000,
    kCloseItem
};

resource rPString (kCloseItem, nocrossbank)
{
    "Close"
};

resource rMenuItem (kSaveItem, nocrossbank)
{
    kSaveItem,
    "S",
    "s",
    0,
    0x8000,
    kSaveItem
};

resource rPString (kSaveItem, nocrossbank)
{
    "Save"
};

resource rMenuItem (kSaveAsItem, nocrossbank)
{
    kSaveAsItem,
    "",        /* no key equivalents for this item */
    "",
    0,
    0x8000,
    kSaveAsItem    
};

resource rPString (kSaveAsItem, nocrossbank)
{
    "Save As..."
};

resource rMenuItem (kQuitItem, nocrossbank)
{
    kQuitItem,
    "Q",
    "q",
    0,
    0x8000,
    kQuitItem    
};

resource rPString (kQuitItem, nocrossbank)
{
    "Quit"
};


    /* lay out the Edit menu */
    
resource rMenu (kEditMID, nocrossbank)
{
    kEditMID,    /* ID of the menu this item belongs to */
    0xA008,
    kEditMID,    /* ref to menu's title */
    {            /* array of items in this menu */
        kUndoItem,
        kCutItem,
        kCopyItem,
        kPasteItem,
        kClearItem,
        kSelectItem
    };
};

resource rPString (kEditMID, nocrossbank)
{
    " Edit "   /* this string is the title of the "Edit" menu */
};

resource rMenuItem (kUndoItem, nocrossbank)
{
    kUndoItem,
    "Z",
    "z",
    0,
    0x8040,
    kUndoItem
};

resource rPString (kUndoItem, nocrossbank)
{
    "Undo"
};

resource rMenuItem (kCutItem, nocrossbank)
{
    kCutItem,
    "X",
    "x",
    0,
    0x8000,
    kCutItem
};

resource rPString (kCutItem, nocrossbank)
{
    "Cut"
};

resource rMenuItem (kCopyItem, nocrossbank)
{
    kCopyItem,
    "C",
    "c",
    0,
    0x8000,
    kCopyItem
};

resource rPString (kCopyItem, nocrossbank)
{
    "Copy"
};

resource rMenuItem (kPasteItem, nocrossbank)
{
    kPasteItem,
    "V",
    "v",
    0,
    0x8000,
    kPasteItem
};

resource rPString (kPasteItem, nocrossbank)
{
    "Paste"
};

resource rMenuItem (kClearItem, nocrossbank)
{
    kClearItem,
    "",
    "",
    0,
    0x8000,
    kClearItem
};

resource rPString (kClearItem, nocrossbank)
{
    "Clear"
};

resource rMenuItem (kSelectItem, nocrossbank)
{
    kSelectItem,
    "A",
    "a",
    0,
    0x8000,
    kSelectItem
};

resource rPString (kSelectItem, nocrossbank)
{
    "Select All"
};
