home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 611.lha / AlgoRhythms_v2.0 / Source.LZH / Source / Menus.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-22  |  21.0 KB  |  574 lines

  1. /* Menus.c
  2.    Copyright (c) 1990,1991,1992 by Thomas E. Janzen
  3.    All Rights Reserved
  4.  
  5.    THIS SOFTWARE IS FURNISHED FREE OF CHARGE FOR STUDY AND USE AND MAY
  6.    BE COPIED ONLY FOR PERSONAL USE OR COMPLETELY AS OFFERED WITH NO
  7.    CHANGES FOR FREE DISTRIBUTION.  NO TITLE TO AND OWNERSHIP OF THE
  8.    SOFTWARE IS HEREBY TRANSFERRED.  THOMAS E. JANZEN ASSUMES NO 
  9.    RESPONSBILITY FOR THE USE OR RELIABILITY OF THIS SOFTWARE.
  10.    
  11.    Thomas E. Janzen
  12.    58A School St. Apt. 2-L
  13.    Hudson, MA 01749
  14.    (508)562-1295
  15. */
  16. /*
  17. **  FACILITY:
  18. **
  19. **    AlgoRhythms music improviser on Commodore (TM) Amiga (TM)
  20. **    compiled with SAS/C V5.10b
  21. **
  22. **  ABSTRACT:
  23. **
  24. **    Menus.c manages menu set-up and interaction.
  25. **
  26. **  AUTHORS: Thomas E. Janzen
  27. **
  28. **  CREATION DATE:    26-MAR-1990
  29. **
  30. **  MODIFICATION HISTORY:
  31. **    DATE    NAME    DESCRIPTION
  32. **    19 OCT 91 T. Janzen add menu name niceties.
  33. **  4 Jan 92 TEJ  last changes for 2.0
  34. **--
  35. */
  36.  
  37. #include <stdio.h>
  38. #include <intuition/intuition.h>
  39. #include <graphics/text.h>
  40. #include <proto/dos.h>
  41. #include <proto/graphics.h>
  42. #include <proto/exec.h>
  43. #include <proto/mathffp.h>
  44. #include <proto/intuition.h>
  45. #include "Window.h"
  46. #include "AlgoRhythms.h"
  47.  
  48. #define PROJTITLWID  68 /* width of project menu header                 */
  49. #define FORMTITLWID  48 /* width of form menu header                    */
  50. #define SCALETITLWID 48 /* width of scale title header                  */
  51. #define PROJECTWIDTH (105 + COMMWIDTH)    /* width of project menu items*/
  52. #define FORMWIDTH    (108 + COMMWIDTH)   /* width of form menu items    */
  53. #define SCALEWIDTH   125 /* width of scale menu items                   */
  54. #define SUBWIDTH     106 /* width of form sub-menu items                */
  55. #define VOICEWIDTH   87
  56.  
  57. /*Voice items*/
  58.  
  59. static char voice_string[MAXVOICE][16];
  60. static struct IntuiText voice_txt[MAXVOICE];
  61. static struct MenuItem voice_item[MAXVOICE];
  62.  
  63. const char ChannelMenuString[16] = "Voices";
  64. static struct Menu ChannelMenu  =
  65.     {NULL, PROJTITLWID + FORMTITLWID + SCALETITLWID, 0, 
  66.     80, 0, MIDRAWN | MENUENABLED, 
  67.     ChannelMenuString, &voice_item[0]};
  68.  
  69. /*
  70. ** Scale Menu 
  71. */
  72.  
  73. const char QuintalString[16] = "Quintal"; /* 19 */
  74. const static struct IntuiText QuintalTxt = 
  75.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, QuintalString, NULL};
  76. static struct MenuItem QuintalItem = 
  77.     {NULL, 0, 160, CHECKWIDTH + 129, 8, 
  78.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  79.    ~(0xFFE00001 + (1 << 20)), 
  80.     (APTR)&QuintalTxt, NULL, 0, NULL, 0};
  81.  
  82. const char QuartalString[16] = "Quartal"; /* 18 */
  83. const static struct IntuiText QuartalTxt = 
  84.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, QuartalString, NULL};
  85. static struct MenuItem QuartalItem = 
  86.     {&QuintalItem, 0, 152, CHECKWIDTH + 129, 8, 
  87.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  88.    ~(0xFFE00001 + (1 << 19)), 
  89.     (APTR)&QuartalTxt, NULL, 0, NULL, 0};
  90.  
  91. const char M3m2String[16] = "M 3rd m 2nd"; /* 18 */
  92. const static struct IntuiText M3m2Txt = 
  93.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, M3m2String, NULL};
  94. static struct MenuItem M3m2Item = 
  95.     {&QuartalItem, 0, 144, CHECKWIDTH + 129, 8, 
  96.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  97.    ~(0xFFE00001 + (1 << 18)), 
  98.     (APTR)&M3m2Txt, NULL, 0, NULL, 0};
  99.  
  100. const char MTSString[16] = "m 3rd M 2nd"; /* 17 */
  101. const static struct IntuiText MTSTxt = 
  102.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, MTSString, NULL};
  103. static struct MenuItem MTSItem = 
  104.     {&M3m2Item, 0, 136, CHECKWIDTH + 129, 8, 
  105.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  106.    ~(0xFFE00001 + (1 << 17)), 
  107.     (APTR)&MTSTxt, NULL, 0, NULL, 0};
  108.  
  109. const char Mode7String[16] = "Mode 7"; /* 16 */
  110. const static struct IntuiText Mode7Txt = 
  111.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, Mode7String, NULL};
  112. static struct MenuItem Mode7Item = 
  113.     {&MTSItem, 0, 128, CHECKWIDTH + 129, 8, 
  114.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  115.    ~(0xFFE00001 + (1 << 16)), 
  116.     (APTR)&Mode7Txt, NULL, 0, NULL, 0};
  117.  
  118. const char Mode6String[16] = "Mode 6"; /* 15 */
  119. const static struct IntuiText Mode6Txt = 
  120.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, Mode6String, NULL};
  121. static struct MenuItem Mode6Item = 
  122.     {&Mode7Item, 0, 120, CHECKWIDTH + 129, 8, 
  123.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), 
  124.    ~(0xFFE00001 + (1 << 15)), 
  125.     (APTR)&Mode6Txt, NULL, 0, NULL, 0};
  126.  
  127. const char Mode5String[16] = "Mode 5"; /* 14 */
  128. const static struct IntuiText Mode5Txt = 
  129.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, Mode5String, NULL};
  130. static struct MenuItem Mode5Item = 
  131.     {&Mode6Item, 0, 112, CHECKWIDTH + 129, 8, 
  132.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 16384), 
  133.     (APTR)&Mode5Txt, NULL, 0, NULL, 0};
  134.  
  135. const char Mode4String[16] = "Mode 4"; /* 13 */
  136. const static struct IntuiText Mode4Txt = 
  137.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, Mode4String, NULL};
  138. static struct MenuItem Mode4Item = 
  139.     {&Mode5Item, 0, 104, CHECKWIDTH + 129, 8, 
  140.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 8192), 
  141.     (APTR)&Mode4Txt, NULL, 0, NULL, 0};
  142.  
  143. const char Mode3String[16] = "Mode 3"; /* 12 */
  144. const static struct IntuiText Mode3Txt = 
  145.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, Mode3String, NULL};
  146. static struct MenuItem Mode3Item = 
  147.     {&Mode4Item, 0, 96, CHECKWIDTH + 129, 8, 
  148.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 4096), 
  149.     (APTR)&Mode3Txt, NULL, 0, NULL, 0};
  150.  
  151. const char LongPentaString[16] = "Long Pentatonic"; /* 11 */
  152. const static struct IntuiText LongPentaTxt = 
  153.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, LongPentaString, NULL};
  154. static struct MenuItem LongPentaItem = 
  155.     {&Mode3Item, 0, 88, CHECKWIDTH + 129, 8, 
  156.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 2048), 
  157.     (APTR)&LongPentaTxt, NULL, 0, NULL, 0};
  158.  
  159. const char DiminishedString[16] = "Diminished"; /* 10 */
  160. const static struct IntuiText DiminishedTxt = 
  161.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, DiminishedString, NULL};
  162. static struct MenuItem DiminishedItem = 
  163.     {&LongPentaItem, 0, 80, CHECKWIDTH + 129, 8, 
  164.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 1024), 
  165.     (APTR)&DiminishedTxt, NULL, 0, NULL, 0};
  166.  
  167. const char HungarianString[16] = "Hungarian Minor"; /* 9 */
  168. const static struct IntuiText HungarianTxt = 
  169.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, HungarianString, NULL};
  170. static struct MenuItem HungarianItem = {&DiminishedItem, 0, 72, 
  171.         CHECKWIDTH + 129, 8, 
  172.         (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 512), 
  173.     (APTR)&HungarianTxt, NULL, 0, NULL, 0};
  174.  
  175. const char HarmonicString[16] = "Harmonic Minor"; /* 8 */
  176. const static struct IntuiText HarmonicTxt = 
  177.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, HarmonicString, NULL};
  178. static struct MenuItem HarmonicItem = {&HungarianItem, 0, 64, 
  179.     CHECKWIDTH + 129, 8, 
  180.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 256), 
  181.     (APTR)&HarmonicTxt, NULL, 0, NULL, 0};
  182.  
  183. const char DiatonicString[16] = "Diatonic"; /* 7 */
  184. const static struct IntuiText DiatonicTxt = 
  185.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, DiatonicString, NULL};
  186. static struct MenuItem DiatonicItem = {&HarmonicItem, 0, 56, 
  187.     CHECKWIDTH + 129, 8, 
  188.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 128), 
  189.     (APTR)&DiatonicTxt, NULL, 0, NULL, 0};
  190.  
  191. const char WholeToneString[16] = "Whole Tone"; /* 6 */
  192. const static struct IntuiText WholeToneTxt = 
  193.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, WholeToneString, NULL};
  194. static struct MenuItem WholeToneItem = 
  195.    {&DiatonicItem, 0, 48, CHECKWIDTH + 129, 8, 
  196.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 64), 
  197.     (APTR)&WholeToneTxt, NULL, 0, NULL, 0};
  198.  
  199. const char KokinString[16] = "kokin joshi"; /* 5 */
  200. const static struct IntuiText KokinTxt = 
  201.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, KokinString, NULL};
  202. static struct MenuItem KokinItem = 
  203.    {&WholeToneItem, 0, 40, CHECKWIDTH + 129, 8, 
  204.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 32), 
  205.     (APTR)&KokinTxt, NULL, 0, NULL, 0};
  206.  
  207. const char KumoiString[16] = "kumoi joshi"; /* 4 */
  208. const static struct IntuiText KumoiTxt = 
  209.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, KumoiString, NULL};
  210. static struct MenuItem KumoiItem = 
  211.    {&KokinItem, 0, 32, CHECKWIDTH + 129, 8, 
  212.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 16), 
  213.     (APTR)&KumoiTxt, NULL, 0, NULL, 0};
  214.  
  215. const char HiraString[16] = "hira joshi"; /* 3 */
  216. const static struct IntuiText HiraTxt = 
  217.     {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, HiraString, NULL};
  218. static struct MenuItem HiraItem = {&KumoiItem, 0, 24, CHECKWIDTH + 129, 8, 
  219.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 8), 
  220.     (APTR)&HiraTxt, NULL, 0, NULL, 0};
  221.  
  222. const char ShortPentaString[32] = "Short Pentatonic"; /* 2 */
  223. const static struct IntuiText ShortPentaTxt = 
  224.    {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, ShortPentaString, NULL};
  225. static struct MenuItem ShortPentaItem = 
  226.    {&HiraItem, 0, 16, CHECKWIDTH + 129, 
  227.     8, (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 4), 
  228.     (APTR)&ShortPentaTxt, NULL, 0, NULL, 0};
  229.  
  230. const char ChromaticString[16] = "Chromatic"; /* 1 */
  231. const static struct IntuiText ChromaticTxt = 
  232.    {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, ChromaticString, NULL};
  233. static struct MenuItem ChromaticItem = 
  234.    {&ShortPentaItem, 0, 8, CHECKWIDTH + 129, 8, 
  235.     (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED), ~(0xFFE00001 + 2), 
  236.     (APTR)&ChromaticTxt, NULL, 0, NULL, 0};
  237.  
  238. const char TransposeString[16] = "Transpose..."; /* 0 */
  239. const static struct IntuiText TransposeTxt = 
  240.     {2, 1, JAM1, 0, 0, &font_choice, TransposeString, NULL};
  241. static struct MenuItem TransposeItem = 
  242.     {&ChromaticItem, 0, 0, CHECKWIDTH + 129, 8, 
  243.         (ITEMTEXT | HIGHCOMP | COMMSEQ | ITEMENABLED), 
  244.         0, (APTR)&TransposeTxt, NULL, (BYTE)'T', NULL, 0};
  245.  
  246. const char ScaleString[16] = "Scale";
  247. static struct Menu ScaleMenu  =
  248.     {&ChannelMenu, PROJTITLWID + FORMTITLWID, 0,
  249.     SCALETITLWID, 0, MIDRAWN | MENUENABLED,
  250.     ScaleString, &TransposeItem};
  251.  
  252. /*End of Scales*/
  253.  
  254. /* 
  255. ** Character menus 
  256. */
  257.  
  258. const char MeanPeriodString[16] = "Mean Period...";
  259. static struct IntuiText MeanPeriodTxt = 
  260.     {2, 1, JAM1, 0, 0, &font_choice, MeanPeriodString, NULL};
  261. static struct MenuItem MeanPeriodItem = {NULL, 
  262.     FORMWIDTH - 2, 0, SUBWIDTH, 8, 
  263.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&MeanPeriodTxt, 
  264.     NULL, 0, NULL, 0};
  265.  
  266. const char MeanPhaseString[16] = "Mean Phase...";
  267. const static struct IntuiText MeanPhaseTxt = 
  268.     {2, 1, JAM1, 0, 0, &font_choice, MeanPhaseString, NULL};
  269. static struct MenuItem MeanPhaseItem = {&MeanPeriodItem, 
  270.     FORMWIDTH - 2, 8, SUBWIDTH, 8, 
  271.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&MeanPhaseTxt, 
  272.     NULL, 0, NULL, 0};
  273.  
  274. const char SpreadPeriodString[18] = "Spread Period...";
  275. const static struct IntuiText SpreadPeriodTxt = 
  276.     {2, 1, JAM1, 0, 0, &font_choice, SpreadPeriodString, NULL};
  277. static struct MenuItem SpreadPeriodItem = {&MeanPhaseItem, 
  278.     FORMWIDTH - 2, 16, SUBWIDTH, 8, 
  279.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, 
  280.     (APTR)&SpreadPeriodTxt, NULL, 0, NULL, 0};
  281.  
  282. const char SpreadPhaseString[16] = "Spread Phase...";
  283. const static struct IntuiText SpreadPhaseTxt = 
  284.     {2, 1, JAM1, 0, 0, &font_choice, SpreadPhaseString, NULL};
  285. static struct MenuItem SpreadPhaseItem = {&SpreadPeriodItem, 
  286.     FORMWIDTH - 2, 24, SUBWIDTH, 8, 
  287.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&SpreadPhaseTxt, 
  288.     NULL, 0, NULL, 0};
  289.  
  290. const char RandomizeString[16] = "Randomize";
  291. const static struct IntuiText RandomizeTxt = 
  292.     {2, 1, JAM1, 0, 0, &font_choice, RandomizeString, NULL};
  293. static struct MenuItem RandomizeItem = {&SpreadPhaseItem, 
  294.     FORMWIDTH - 2, 32, SUBWIDTH, 8, 
  295.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&RandomizeTxt, 
  296.     NULL, 0, NULL, 0};
  297.  
  298. const char MaxVoicesString[] = "Max Voices...";
  299. const static struct IntuiText MaxVoicesTxt = {2, 1, JAM1, 0,0,&font_choice,
  300.     MaxVoicesString, NULL};
  301. static struct MenuItem MaxVoicesItem = {NULL, 0, 0, FORMWIDTH, 8, 
  302.     (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, 
  303.     (APTR)&MaxVoicesTxt, NULL, (BYTE)'V', NULL, 0};
  304.  
  305. const char ReDrawString[10] = "Redraw...";
  306. const static struct IntuiText ReDrawTxt = 
  307.    {2, 1, JAM1, 0, 0, &font_choice, ReDrawString, NULL};
  308. static struct MenuItem ReDrawItem = {&MaxVoicesItem, 0, 8, FORMWIDTH, 8, 
  309.     (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, (APTR)&ReDrawTxt, 
  310.     NULL, (BYTE)'R', NULL, 0};
  311.  
  312. const char PulseString[16] = "Pulse...";
  313. const static struct IntuiText PulseTxt = 
  314.    {2, 1, JAM1, 0, 0, &font_choice, PulseString, NULL};
  315. static struct MenuItem PulseItem = {&ReDrawItem, 0, 16, FORMWIDTH, 8, 
  316.     (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, 
  317.    (APTR)&PulseTxt, NULL, (BYTE)'N', NULL, 0};
  318.  
  319. const char DurationString[16] = "Duration...";
  320. const static struct IntuiText DurationTxt = 
  321.     {2, 1, JAM1, 0, 0, &font_choice, DurationString, NULL};
  322. static struct MenuItem DurationItem = {&PulseItem, 0, 24, FORMWIDTH, 8, 
  323.     (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, (APTR)&DurationTxt, 
  324.     NULL, (BYTE)'D', NULL, 0};
  325.  
  326. const char PitchString[16] = "Pitch         \273";
  327. const static struct IntuiText PitchTxt = 
  328.    {2, 1, JAM1, 0, 0, &font_choice, PitchString, NULL};
  329. static struct MenuItem PitchItem = {&DurationItem, 0, 32, FORMWIDTH, 8, 
  330.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&PitchTxt, NULL, 0, 
  331.     &RandomizeItem, 0};
  332.  
  333. const char RhythmString[16] = "Rhythm        \273";
  334. const static struct IntuiText RhythmTxt = 
  335.    {2, 1, JAM1, 0, 0, &font_choice, RhythmString, NULL};
  336. static struct MenuItem RhythmItem = {&PitchItem, 0, 40, FORMWIDTH, 8, 
  337.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&RhythmTxt, NULL, 0, 
  338.     &RandomizeItem, 0};
  339.  
  340. const char DynamicString[16] = "Dynamic       \273";
  341. const static struct IntuiText DynamicTxt = 
  342.    {2, 1, JAM1, 0, 0, &font_choice, DynamicString, NULL};
  343. static struct MenuItem DynamicItem = {&RhythmItem, 0, 48, FORMWIDTH, 8, 
  344.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&DynamicTxt, NULL, 0, 
  345.     &RandomizeItem, 0};
  346.  
  347. const static struct IntuiText TSpreadPhaseTxt = 
  348.     {2, 1, JAM1, 0, 0, &font_choice, SpreadPhaseString, NULL};
  349. static struct MenuItem TSpreadPhaseItem = {NULL, 
  350.     FORMWIDTH - 5, 0, SUBWIDTH, 8, 
  351.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&TSpreadPhaseTxt, 
  352.         NULL, 0, NULL, 0};
  353.  
  354. const static struct IntuiText TSpreadPeriodTxt = 
  355.     {2, 1, JAM1, 0, 0, &font_choice, SpreadPeriodString, NULL};
  356. static struct MenuItem TSpreadPeriodItem = {&TSpreadPhaseItem, 
  357.     FORMWIDTH - 5, 8, SUBWIDTH, 8, 
  358.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, 
  359.     (APTR)&TSpreadPeriodTxt, NULL, 0, NULL, 0};
  360.  
  361. const static struct IntuiText TRandomizeTxt = 
  362.     {2, 1, JAM1, 0, 0, &font_choice, RandomizeString, NULL};
  363. static struct MenuItem TRandomizeItem = {&TSpreadPeriodItem, 
  364.     FORMWIDTH - 2, 16, SUBWIDTH, 8, 
  365.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&TRandomizeTxt, 
  366.     NULL, 0, NULL, 0};
  367.  
  368. const char TextureString[16] = "Texture       \273";
  369. const static struct IntuiText TextureTxt = 
  370.    {2, 1, JAM1, 0, 0, &font_choice, TextureString, NULL};
  371. static struct MenuItem TextureItem = {&DynamicItem, 0, 56, FORMWIDTH, 8, 
  372.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&TextureTxt, NULL, 0, 
  373.     &TRandomizeItem, 0};
  374.  
  375. const char MaximumString[16] = "Maximum...";
  376. const static struct IntuiText MaximumTxt = 
  377.    {2, 1, JAM1, 0, 0, &font_choice, MaximumString, NULL};
  378. static struct MenuItem MaximumItem = {NULL, FORMWIDTH - 2, 8, SUBWIDTH, 8, 
  379.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&MaximumTxt, NULL, 0, 
  380.     NULL, 0};
  381.  
  382. const char MinimumString[16] = "Minimum...";
  383. const static struct IntuiText MinimumTxt = {2, 1, JAM1, 0, 0, &font_choice,
  384.     MinimumString, NULL};
  385. static struct MenuItem MinimumItem = {&MaximumItem, 
  386.     FORMWIDTH - 2, 0, SUBWIDTH, 8, 
  387.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&MinimumTxt, NULL, 0, 
  388.     NULL, 0};
  389.  
  390. const char NoteLenString[16] = "Note Length   \273";
  391. const static struct IntuiText NoteLenTxt = {2, 1, JAM1, 0, 0, &font_choice,
  392.     NoteLenString, NULL};
  393. static struct MenuItem NoteLenItem = {&TextureItem, 0, 64, FORMWIDTH, 8, 
  394.     (ITEMTEXT | HIGHCOMP | ITEMENABLED), 0, (APTR)&NoteLenTxt, NULL, 0, 
  395.     &MinimumItem, 0};
  396.  
  397. const char FormString[16] = "Form";
  398. static struct Menu FormMenu  =  {&ScaleMenu, 
  399.     PROJTITLWID, 0, FORMTITLWID, 
  400.     0, (MIDRAWN | MENUENABLED), FormString, &NoteLenItem};
  401.  
  402. /*
  403. ** Project Menu
  404. */
  405.  
  406. const char PlayString[16] = "Play";
  407. const static struct IntuiText PlayTxt = 
  408.    {2, 1, JAM1, 0, 0, &font_choice, PlayString, NULL};
  409. static struct MenuItem PlayItem = {NULL, 0, 0, CHECKWIDTH + PROJECTWIDTH, 
  410.    8, (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, (APTR)&PlayTxt, 
  411.    NULL, (BYTE)'P', NULL, 0};
  412.     
  413. const char StopString[16] = "Stop";
  414. const static struct IntuiText StopTxt =
  415.    {2, 1, JAM1, 0, 0, &font_choice, StopString, NULL};
  416. static struct MenuItem StopItem = {&PlayItem, 0, 8, 
  417.    CHECKWIDTH + PROJECTWIDTH, 8,
  418.    (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, (APTR)&StopTxt, NULL,
  419.    (BYTE)'S', NULL, 0};
  420.  
  421. const char ContinueString[16] = "Continue";
  422. const static struct IntuiText ContinueTxt = {2, 1, JAM1, 0,0, &font_choice,
  423.     ContinueString, NULL};
  424. static struct MenuItem ContinueItem = {&StopItem, 0, 16, 
  425.    CHECKWIDTH + PROJECTWIDTH, 8, 
  426.    (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, (APTR)&ContinueTxt, 
  427.    NULL, (BYTE)'C', NULL, 0};
  428.  
  429. const char LoadString[16] = "Load Form...";
  430. const static struct IntuiText LoadTxt = 
  431.    {2, 1, JAM1, 0, 0, &font_choice, LoadString, NULL};
  432. static struct MenuItem LoadItem = {&ContinueItem, 0, 24, 
  433.    CHECKWIDTH + PROJECTWIDTH, 8, 
  434.    (ITEMTEXT | HIGHCOMP | COMMSEQ | ITEMENABLED), 0, (APTR)&LoadTxt, NULL, 
  435.    (BYTE)'L', NULL, 0};
  436.  
  437. const char SaveString[16] = "Save Form...";
  438. const static struct IntuiText SaveTxt = 
  439.    {2, 1, JAM1, 0, 0, &font_choice, SaveString, NULL};
  440. static struct MenuItem SaveItem = {&LoadItem, 0, 32, 
  441.    CHECKWIDTH + PROJECTWIDTH, 8, 
  442.    (ITEMTEXT | HIGHCOMP | COMMSEQ | ITEMENABLED), 0, (APTR)&SaveTxt, NULL, 
  443.    (BYTE)'F', NULL, 0};
  444.  
  445. const char RecordString[16] = "Record";
  446. const static struct IntuiText RecordTxt = 
  447.    {2, 1, JAM1, CHECKWIDTH, 0, &font_choice, RecordString, NULL};
  448. static struct MenuItem RecordItem = {&SaveItem, 0, 40, 
  449.    CHECKWIDTH + PROJECTWIDTH, 8, 
  450.    (CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED | COMMSEQ | MENUTOGGLE), 
  451.    0, (APTR)&RecordTxt, NULL, (BYTE)'I', NULL, 0};
  452.  
  453. const char EraseString[16] = "Erase";
  454. const static struct IntuiText EraseTxt = 
  455.    {2, 1, JAM1, 0, 0, &font_choice, EraseString, NULL};
  456. static struct MenuItem EraseItem = {&RecordItem, 0, 48, 
  457.    CHECKWIDTH + PROJECTWIDTH, 8, 
  458.    (ITEMTEXT | HIGHCOMP | ITEMENABLED | COMMSEQ), 
  459.    0, (APTR)&EraseTxt, NULL, (BYTE)'E', NULL, 0};
  460.  
  461. const char SaveMIDIString[16] = "Save MIDI...";
  462. const static struct IntuiText SaveMIDITxt = 
  463.    {2, 1, JAM1, 0, 0, &font_choice, SaveMIDIString, NULL};
  464. static struct MenuItem SaveMIDIItem = {&EraseItem, 0, 56, 
  465.    CHECKWIDTH + PROJECTWIDTH, 8,
  466.    (ITEMTEXT | HIGHCOMP | COMMSEQ | ITEMENABLED), 0, (APTR)&SaveMIDITxt, 
  467.    NULL, (BYTE)'M', NULL, 0};
  468.  
  469. const char AboutString[16] = "About...";
  470. const static struct IntuiText AboutTxt = 
  471.     {2, 1, JAM1, 0, 0, &font_choice, AboutString, NULL};
  472. static struct MenuItem AboutItem = {&SaveMIDIItem, 0, 64, 
  473.    CHECKWIDTH + PROJECTWIDTH, 8, 
  474.    (ITEMTEXT | HIGHCOMP | COMMSEQ | ITEMENABLED), 0, (APTR)&AboutTxt, 
  475.    NULL, (BYTE)'A', NULL, 0};
  476.  
  477. const char QuitString[16] = "Quit";
  478. const static struct IntuiText QuitTxt = 
  479.    {2, 1, JAM1, 0, 0, &font_choice, QuitString, NULL};
  480. static struct MenuItem QuitItem = {&AboutItem, 0, 72, 
  481.    CHECKWIDTH + PROJECTWIDTH, 8, 
  482.    (ITEMTEXT | COMMSEQ | HIGHCOMP | ITEMENABLED), 0, 
  483.    (APTR)&QuitTxt, NULL, (BYTE)'Q', NULL, 0};
  484.  
  485. const char ProjectString[16] = "Project";
  486. static struct Menu ProjectMenu  =  {&FormMenu, 0, 0, PROJTITLWID, 0, 
  487.     MIDRAWN | MENUENABLED, ProjectString, &QuitItem};
  488.  
  489. extern void Init_Menu (void)
  490. {
  491.    auto int voice = 0;
  492.    
  493.    for (voice = 0; voice < MAXVOICE; voice++)
  494.    {
  495.       sprintf (voice_string[voice], "Voice %2d...", voice);
  496.       voice_txt[voice].FrontPen = 2;
  497.       voice_txt[voice].BackPen = 1;
  498.       voice_txt[voice].DrawMode = JAM1;
  499.       voice_txt[voice].LeftEdge = 0;
  500.       voice_txt[voice].TopEdge = 0;
  501.       voice_txt[voice].ITextFont = NULL;
  502.       voice_txt[voice].IText = voice_string[voice];
  503.       voice_txt[voice].NextText = NULL;
  504.       if (voice == (MAXVOICE - 1))
  505.       {
  506.          voice_item[voice].NextItem = NULL;
  507.       }
  508.       else
  509.       {
  510.          voice_item[voice].NextItem = &voice_item[voice + 1];
  511.       }
  512.       voice_item[voice].LeftEdge = 0;
  513.       voice_item[voice].TopEdge = voice * 8;
  514.       voice_item[voice].Width = VOICEWIDTH;
  515.       voice_item[voice].Height = 8;
  516.       voice_item[voice].Flags = (ITEMTEXT | HIGHCOMP | ITEMENABLED);
  517.       voice_item[voice].MutualExclude = 0;
  518.       voice_item[voice].ItemFill = (APTR)&voice_txt[voice];
  519.       voice_item[voice].SelectFill = NULL;
  520.       voice_item[voice].Command = 0;
  521.       voice_item[voice].SubItem = NULL;
  522.       voice_item[voice].NextSelect = 0;
  523.      
  524.    }
  525.     SetMenuStrip (w, &ProjectMenu);
  526.     OnMenu (w, 0);
  527. }
  528.  
  529. extern int CheckMenu (int *class, int *code)
  530. {
  531.     register int TakeAction = 0; /* This should just be a macro = TRUE */
  532.     struct IntuiMessage *message;
  533.  
  534.     TakeAction = 0;
  535.     *class = 0;
  536.     *code = 0;
  537.  
  538.     message = (struct IntuiMessage *) GetMsg (w->UserPort);
  539.     if (message !=  NULL) 
  540.    {
  541.         *class  =  message->Class;
  542.         *code   =  message->Code;
  543.         ReplyMsg ((struct Message *)message);
  544.       if ((*class == MENUPICK) && (*code == MENUNULL))
  545.       {
  546.          TakeAction = 0;
  547.       }
  548.       else
  549.       {
  550.          TakeAction = 1;
  551.       }
  552.     }
  553.    return TakeAction;
  554. }
  555.  
  556. extern void CloseMenu (void) 
  557. {
  558.     ClearMenuStrip (w);
  559.    return;
  560. }
  561.  
  562. extern void Clear_Record (void)
  563. {
  564.    RecordItem.Flags &= ~CHECKED;
  565.    return;
  566. }
  567.  
  568. extern void Set_Record (void)
  569. {
  570.    RecordItem.Flags |= CHECKED;
  571.    return;
  572. }
  573.  
  574.