AppLib.r

/*------------------------------------------------------------------------------------------
 
    Program:    CPlusTESample 2.0
    File:       AppLib.r
    Uses:       AppLib.h
 
    by Andrew Shebanow
    of Apple Macintosh Developer Technical Support
 
    Copyright © 1989-1990 Apple Computer, Inc.
    All rights reserved.
 
------------------------------------------------------------------------------------------*/
 
 
#include "SysTypes.r"
#include "Types.r"
 
#include "AppLib.h"
 
/* this ALRT and DITL are used as an error screen */
resource 'ALRT' (rUserAlert) {
    {40, 20, 150, 260},
    rUserAlert,
    { /* array: 4 elements */
        /* [1] */
        OK, visible, silent,
        /* [2] */
        OK, visible, silent,
        /* [3] */
        OK, visible, silent,
        /* [4] */
        OK, visible, silent
    }
};
 
resource 'DITL' (rUserAlert) {
    { /* array DITLarray: 3 elements */
        /* [1] */
        {80, 150, 100, 230},
        Button {
            enabled,
            "OK"
        },
        /* [2] */
        {10, 60, 60, 230},
        StaticText {
            disabled,
            "^0"
        },
        /* [3] */
        {8, 8, 40, 40},
        Icon {
            disabled,
            2
        }
    }
};
 
resource 'ALRT' (rSaveAlert, purgeable) {
    {147, 110, 275, 355},
    rSaveAlert,
    {   /* array: 4 elements */
        /* [1] */
        OK, visible, sound1,
        /* [2] */
        OK, visible, sound1,
        /* [3] */
        OK, visible, sound1,
        /* [4] */
        OK, visible, sound1
    }
};
 
resource 'DITL' (rSaveAlert, purgeable) {
    {   /* array DITLarray: 4 elements */
        /* [1] */
        {77, 14, 95, 81},
        Button {
            enabled,
            "Yes"
        },
        /* [2] */
        {102, 14, 120, 80},
        Button {
            enabled,
            "No"
        },
        /* [3] */
        {102, 160, 120, 228},
        Button {
            enabled,
            "Cancel"
        },
        /* [4] */
        {4, 14, 73, 230},
        StaticText {
            disabled,
            "Save changes to \"^0\" before ^1?"
        }
    }
};
 
resource 'STR#' (kErrStrings, purgeable) {
    {
    "This application requires a 512Ke or later Macintosh.";
    "Application memory size too small.";
    "Unable to open document.";
    "Error reading document."
    }
};
 
resource 'STR#' (kBuzzwordStrings, purgeable) {
    {
    "quitting";
    "closing"
    }
};
 
/*
 * errs resource:
 *
 *  this is lifted from MacApp 2.0. It maps an error code into
 * a meaningful error string. Of course, if I had written this
 * sample in MacApp, I wouldn't be forced to reinvent the wheel,
 * right?
 */
 
type 'errs' {
    wide array {                        // Error list
        integer     whichList = 0,
                    minErr = -32768;    // Low error number; 0 specifies STR#
        integer     maxErr = 32767;     // High error number
        integer;                        // Index in STR# of string
    };
};
resource 'errs' (kSysErrStrings, purgeable) {
    {   whichList, 0, kSysErrStrings;
        -117, -108, 4;      // Memory Manager errors
        -42, -42, 16;       // too many files are open
        -47, -47, 7;        // files are open
        -49, -49, 7;        // can't have > 1 writer to a file
        -54, -54, 6;        // can't open locked file for writing
        -45, -45, 6;        // file locked
        -46, -44, 3;        // volumes locked
        -34, -33, 2;        // disk full
        -53, -53, 15;       // volume offline
        -84, -33, 5;        // other File Manager / disk errors
        -124, -124, 10;     // Lost volume on AppleTalk
        -127, -120, 5;      // HFS errors
        -27, -27, 9;        // printer I/O error
        -192, -192, 17;     // Resource not found
        -4101, -4101, 8;    // printer not found (PAP)
        -4100, -4096, 9;    // printer comm error
        -5000, -5000, 11;   // AFP access error
        -5006, -5006, 7;    // AFP: deny conflict
        -5029, -5000, 10;   // AFP errors
        -95, -91, 12;       // AppleTalk operation errors
        -98, -97, 13;       // AppleTalk could not be opened
        minErr, maxErr, 1
    }
};
 
resource 'STR#' (kSysErrStrings, purgeable) {
    {   /* [1] */   "A program error occurred.";                        // catch-all
        /* [2] */   "The disk is full.";
        /* [3] */   "The disk is locked.";
        /* [4] */   "Out of memory.";
        /* [5] */   "A disk error occurred.";
        /* [6] */   "The file is locked.";
        /* [7] */   "The file is already in use or was left open.";
        /* [8] */   "The printer could not be found.";
        /* [9] */   "There is a problem communicating with the printer.";
        /* [10] */  "There is a problem with the file server.";         // catch-all AFP error
        /* [11] */  "You do not have the necessary access privileges."; // AFP: access denied
        /* [12] */  "There is a problem with AppleTalk.";               // AppleTalk operation errors
        /* [13] */  "AppleTalk is not connected.";                      // AppleTalk open errors
        /* [14] */  "The disk is not available.";
        /* [15] */  "There are too many files open.";                   // Resource not found
        /* [16] */  "The required resource(s) were not found."
    }
};