/*                      */
/*  abCalcNDA.h         */
/*      By: Jeremy Rand */
/*                      */


#include "types.rez"
#include "nda/abCalcNda.h"


resource rWindParam1 (abCalcWinNum) {
   $C0A5,                      /* wFrameBits */
   nil,                        /* wTitle */
   0,                          /* wRefCon */
   {0,0,0,0},                  /* ZoomRect */
   abCalcLinedColors,          /* wColor ID */
   {0,0},                      /* Origin */
   {0,0},                      /* data size */
   {0,0},                      /* max height-width */
   {0,0},                      /* scroll ver hors */
   {0,0},                      /* page ver horiz */
   0,                          /* winfoRefcon */
   0,                          /* wInfoHeight */
   {abCalcWinY,abCalcWinX,abCalcWinY+abCalcWinHeight,abCalcWinX+abCalcWinWidth}, /* wposition */
   infront,                    /* wPlane */
   abCalcControlList,          /* wStorage */
   $0809                       /* wInVerb */
};


resource rWindColor (abCalcLinedColors) {
   0x0000,                     /* frameColor */
   0x0F00,                     /* titleColor */
   0x020F,                     /* tbarColor */
   0xF0F0,                     /* growColor */
   0x00F0,                     /* infoColor */
};


resource rControlList (abCalcControlList) {
    {
        abCalcBtn0,
        abCalcBtn1,
        abCalcBtn2,
        abCalcBtn3,
        abCalcBtn4,
        abCalcBtn5,
        abCalcBtn6,
        abCalcBtn7,
        abCalcBtn8,
        abCalcBtn9,
        abCalcBtnEnter,
        abCalcBtnDot,
        abCalcBtnNum,
        abCalcBtnAdd,
        abCalcBtnSub,
        abCalcBtnMult,
        abCalcBtnDiv,
        abCalcBtnPow,
        abCalcBtnA,
        abCalcBtnB,
        abCalcBtnC,
        abCalcBtnD,
        abCalcBtnE,
        abCalcBtnF,
        abCalcEntryBox,
        abCalcStackList,
        abCalcOpList
    }
};


resource rControlTemplate (abCalcBtn0) {
    abCalcBtn0,
    {abCalcBtnRow0, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn0Str,
        0,
        {"0","",0,0}
    }};
};
resource rPString (abCalcBtn0Str, noCrossBank) { "0" };
    
resource rControlTemplate (abCalcBtnDot) {
    abCalcBtnDot,
    {abCalcBtnRow0, abCalcBtnCol1, abCalcBtnRow0+abCalcBtnHeight, abCalcBtnCol1+abCalcBtnWidth},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnDotStr,
        0,
        {".","",0,0}
    }};
};
resource rPString (abCalcBtnDotStr, noCrossBank) { "." };

resource rControlTemplate (abCalcBtnNum) {
    abCalcBtnNum,
    {abCalcBtnRow0, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnNumStr,
        0,
        {"#","",0,0}
    }};
};
resource rPString (abCalcBtnNumStr, noCrossBank) { "#" };
    
resource rControlTemplate (abCalcBtn1) {
    abCalcBtn1,
    {abCalcBtnRow1, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn1Str,
        0,
        {"1","",0,0}
    }};
};
resource rPString (abCalcBtn1Str, noCrossBank) { "1" };
    
resource rControlTemplate (abCalcBtn2) {
    abCalcBtn2,
    {abCalcBtnRow1, abCalcBtnCol1, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn2Str,
        0,
        {"2","",0,0}
    }};
};
resource rPString (abCalcBtn2Str, noCrossBank) { "2" };
    
resource rControlTemplate (abCalcBtn3) {
    abCalcBtn3,
    {abCalcBtnRow1, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn3Str,
        0,
        {"3","",0,0}
    }};
};
resource rPString (abCalcBtn3Str, noCrossBank) { "3" };
    
resource rControlTemplate (abCalcBtn4) {
    abCalcBtn4,
    {abCalcBtnRow2, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn4Str,
        0,
        {"4","",0,0}
    }};
};
resource rPString (abCalcBtn4Str, noCrossBank) { "4" };
    
resource rControlTemplate (abCalcBtn5) {
    abCalcBtn5,
    {abCalcBtnRow2, abCalcBtnCol1, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn5Str,
        0,
        {"5","",0,0}
    }};
};
resource rPString (abCalcBtn5Str, noCrossBank) { "5" };
    
resource rControlTemplate (abCalcBtn6) {
    abCalcBtn6,
    {abCalcBtnRow2, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn6Str,
        0,
        {"6","",0,0}
    }};
};
resource rPString (abCalcBtn6Str, noCrossBank) { "6" };
    
resource rControlTemplate (abCalcBtn7) {
    abCalcBtn7,
    {abCalcBtnRow3, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn7Str,
        0,
        {"7","",0,0}
    }};
};
resource rPString (abCalcBtn7Str, noCrossBank) { "7" };
    
resource rControlTemplate (abCalcBtn8) {
    abCalcBtn8,
    {abCalcBtnRow3, abCalcBtnCol1, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn8Str,
        0,
        {"8","",0,0}
    }};
};
resource rPString (abCalcBtn8Str, noCrossBank) { "8" };
    
resource rControlTemplate (abCalcBtn9) {
    abCalcBtn9,
    {abCalcBtnRow3, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtn9Str,
        0,
        {"9","",0,0}
    }};
};
resource rPString (abCalcBtn9Str, noCrossBank) { "9" };

resource rControlTemplate (abCalcBtnEnter) {
    abCalcBtnEnter,
    {abCalcBtnRow4, abCalcBtnCol0, abCalcBtnRow4+abCalcBtnHeight, abCalcBtnCol2+abCalcBtnWidth},
    SimpleButtonControl {{
        $0003,
        $3002,
        0,
        abCalcBtnEnterStr,
        0,
        {"\n","",0,0}
    }};
};
resource rPString (abCalcBtnEnterStr, noCrossBank) { "Enter" };
    
resource rControlTemplate (abCalcBtnPow) {
    abCalcBtnPow,
    {abCalcBtnRow4, abCalcBtnCol3, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnPowStr,
        0,
        {"^","",0,0}
    }};
};
resource rPString (abCalcBtnPowStr, noCrossBank) { "^" };
    
resource rControlTemplate (abCalcBtnAdd) {
    abCalcBtnAdd,
    {abCalcBtnRow0, abCalcBtnCol3, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnAddStr,
        0,
        {"+","",0,0}
    }};
};
resource rPString (abCalcBtnAddStr, noCrossBank) { "+" };
    
resource rControlTemplate (abCalcBtnSub) {
    abCalcBtnSub,
    {abCalcBtnRow1, abCalcBtnCol3, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnSubStr,
        0,
        {"-","",0,0}
    }};
};
resource rPString (abCalcBtnSubStr, noCrossBank) { "-" };
    
resource rControlTemplate (abCalcBtnMult) {
    abCalcBtnMult,
    {abCalcBtnRow2, abCalcBtnCol3, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnMultStr,
        0,
        {"*","",0,0}
    }};
};
resource rPString (abCalcBtnMultStr, noCrossBank) { "x" };
    
resource rControlTemplate (abCalcBtnDiv) {
    abCalcBtnDiv,
    {abCalcBtnRow3, abCalcBtnCol3, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnDivStr,
        0,
        {"/","",0,0}
    }};
};
resource rPString (abCalcBtnDivStr, noCrossBank) { "/" };
    
resource rControlTemplate (abCalcBtnA) {
    abCalcBtnA,
    {abCalcBtnRow5, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnAStr,
        0,
        {"A","",0,0}
    }};
};
resource rPString (abCalcBtnAStr, noCrossBank) { "A" };
    
resource rControlTemplate (abCalcBtnB) {
    abCalcBtnB,
    {abCalcBtnRow5, abCalcBtnCol1, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnBStr,
        0,
        {"B","",0,0}
    }};
};
resource rPString (abCalcBtnBStr, noCrossBank) { "B" };
    
resource rControlTemplate (abCalcBtnC) {
    abCalcBtnC,
    {abCalcBtnRow5, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnCStr,
        0,
        {"C","",0,0}
    }};
};
resource rPString (abCalcBtnCStr, noCrossBank) { "C" };
    
resource rControlTemplate (abCalcBtnD) {
    abCalcBtnD,
    {abCalcBtnRow6, abCalcBtnCol0, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnDStr,
        0,
        {"D","",0,0}
    }};
};
resource rPString (abCalcBtnDStr, noCrossBank) { "D" };
    
resource rControlTemplate (abCalcBtnE) {
    abCalcBtnE,
    {abCalcBtnRow6, abCalcBtnCol1, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnEStr,
        0,
        {"E","",0,0}
    }};
};
resource rPString (abCalcBtnEStr, noCrossBank) { "E" };
    
resource rControlTemplate (abCalcBtnF) {
    abCalcBtnF,
    {abCalcBtnRow6, abCalcBtnCol2, 0, 0},
    SimpleButtonControl {{
        $0002,
        $3002,
        0,
        abCalcBtnFStr,
        0,
        {"F","",0,0}
    }};
};
resource rPString (abCalcBtnFStr, noCrossBank) { "F" };

resource rControlTemplate (abCalcStackList) {
   abCalcStackList,                     /* control ID */
   {1, abCalcBtnSpaceX, 41, abCalcWinWidth-abCalcBtnSpaceX}, /* control rect */
   ListControl {{
      $0000,                            /* flags */
      $1400,                            /* more flags */
      0,                                /* refcon */
      0,                                /* list size */
      4,                                /* List View */
      $0007,                            /* List Type */
      0,                                /* List Start */
      10,                               /* ListMemHeight */
      5,                                /* List Mem Size */
      0,                                /* List Ref */
      0                                 /* Color Ref */
      }};
   };

resource rControlTemplate (abCalcOpList) {
   abCalcOpList,                     /* control ID */
   {abCalcBtnRow7, abCalcOpCol, abCalcWinHeight-(3*abCalcBtnSpaceY), abCalcWinWidth-abCalcBtnSpaceX}, /* control rect */
   ListControl {{
      $0000,                            /* flags */
      $1400,                            /* more flags */
      0,                                /* refcon */
      0,                                /* list size */
      12,                               /* List View */
      $0007,                            /* List Type */
      0,                                /* List Start */
      10,                               /* ListMemHeight */
      5,                                /* List Mem Size */
      0,                                /* List Ref */
      0                                 /* Color Ref */
      }};
   };

resource rControlTemplate (abCalcEntryBox) {
   abCalcEntryBox,                      /* control ID */
   {abCalcBtnRow7, abCalcBtnCol0, abCalcBtnRow7+abCalcBtnHeight, abCalcBtnCol3+abCalcBtnWidth}, /* control rect */
   editLineControl {{
      $0000,                            /* flags */
      $7000,                            /* more flags */
      0,                                /* refcon */
      34,                               /* Max size */
      0                                 /* text Ref */
      }};
   };

resource rAlertString (abCalcErrorAlert) {
    "23/"
    "*0"
    "/^#0\$00"
};

