home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / FACETV.ZIP / FACE_BOX.MEN < prev    next >
Text File  |  1994-01-05  |  30KB  |  1,184 lines

  1. /************************************************************************
  2. **
  3. ** @(#)face_box.men    01/05/94    Chris Ahlstrom
  4. **
  5. **    C/C++ compatible.  Consists of four sections:
  6. **
  7. **    0.  A bunch of include files for various dialog boxes added to
  8. **        help test the newest, truest, latest, greatest features.
  9. **
  10. **    1.  The DAC (D/A converter) Parameters dialog box, stolen from
  11. **        the mod_dac modules of MODAPP, used here purely as a test
  12. **        bed for dialog box control.  This is a good test of the
  13. **        general data scheme.
  14. **
  15. **    2.  We also provide a section showing how to use the MappedField
  16. **        elements of tv_menu.h.  Here, the setup is a little more
  17. **        complex and indirect.
  18. **
  19. **    3.  The experimental parameters dialog box copped from the 
  20. **        mod_exp modules of MODAPP.  Just includes a few more type
  21. **        of data than item 1.
  22. **
  23. **    Also see FACE_BOX.H please.
  24. **
  25. **    Each of the items here must have all of the following elements
  26. ** taken care of (placed somewhere below):
  27. **
  28. **    1.  The typedef
  29. **
  30. **    2.  Initialization data
  31. **
  32. **    3.  The menu specification array
  33. **
  34. **    4.  A place for the item in the equipmentList[], if
  35. **        desired.
  36. **
  37. *************************************************************************/
  38.  
  39. #if !defined(FACE_BOX_men)            /* { FACE_BOX_men    */
  40. #define FACE_BOX_men
  41.  
  42. #include "face_box.h"        /* define structures and #defines    */
  43.  
  44.  
  45. /************************************************************************
  46. ** Item 0:
  47. **
  48. **    DelayParameters
  49. **
  50. *************************************************************************/
  51.  
  52. #include "x_delay.h"        /* DelayParameters            */
  53.  
  54. DelayParameters delayData =
  55. {
  56.     "test mAFC tasks",                /* descriptive name    */
  57.     {
  58.      100,                /* delay before the interval    */
  59.     2000,                /* delay for the stimulus    */
  60.        0,                /* delay between intervals    */
  61.     1000,                /* delay showing feedback    */
  62.        0                /* extra delay            */
  63.     },
  64.     100,                    /* use 100% of delays    */
  65.     0                        /* base for timer set    */
  66. };
  67.  
  68. #include "x_delay.men"        /* DelayParameters dialog setup        */
  69.  
  70.  
  71. /************************************************************************
  72. ** Item 1:  DAC Parameters
  73. *************************************************************************/
  74.  
  75. #define XXX         0    /* program will fill this in        */
  76.  
  77. #define DAC_TOP         2    /* handy alignment row            */
  78. #define DAC_LEFT     4    /* left handy alignment column        */
  79. #define DAC_LEFT2     1    /* relative location of data boxes    */
  80. #define DAC_LEFT3    14    /* relative location on same line    */
  81. #define DAC_RIGHT    26    /* right handy alignment column        */
  82. #define DAC_RIGHT2    20    /* relative location of data boxes    */
  83. #define DAC_RIGHT3     6    /* relative location on same line    */
  84. #define DAC_RIGHT4    14    /* relative location on same line    */
  85. #define DAC_RIGHT5     1    /* relative location of data boxes    */
  86.  
  87.  
  88. /************************************************************************
  89. ** IGNORED
  90. **
  91. **    Defined to make it clear that the current entry refers to
  92. ** a ExtendedField, so that the four fields encapsulated herein are
  93. ** not used.
  94. **
  95. **    I wish there was a way to better do this without screwing up
  96. ** old code or making things seem more complex to the befuddled
  97. ** programmer who's reading Chris's code.
  98. **
  99. *************************************************************************/
  100.  
  101. #define IGNORED        NULL, 0.0, 0.0, NULL
  102.  
  103.  
  104. /************************************************************************
  105. ** DACParameters dacDialog
  106. *************************************************************************/
  107.  
  108. DACParameters dacDialog =    /* dialog-box (was DACmod)        */
  109. {
  110.     DT2801_DEVICE,    /* default signal generator            */
  111.     "Regular string!",    /* nickname for the signal generator        */
  112.     "Byte---string!",    /* bogus test string                */
  113.     10000.0,        /* DAC sampling rate                */
  114.     10000,        /* no number of points yet            */
  115.     YES,        /* testCode for testing the code        */
  116.  
  117.     "Scrollable string",/* a good test of the SCROLL_END feature    */
  118.     0,            /* default startpoint is first integer        */
  119.     0.0,        /* which corresponds to 0 usec            */
  120.     4096,        /* there is no default endpoint, but it will    */
  121.     100.0,        /* correspond to this ending time in usec    */
  122.     MIN_DAC_OUTPUT,    /* minimum integer represented            */
  123.     MIN_DAC_VOLTAGE,    /* it corrsponds to negative of the max        */
  124.     MAX_DAC_OUTPUT,    /* maximum integer, controls            */
  125.     MAX_DAC_VOLTAGE,    /* maximum is 10V peak                */
  126.  
  127.     1000.0,        /* calibration frequency            */
  128.       10.0        /* calibration voltage                */
  129. };
  130.  
  131.  
  132. /************************************************************************
  133. ** A couple of mouse/key/numeric mappings for demonstration
  134. *************************************************************************/
  135.  
  136. static MouseMap defaultMouse =
  137. {
  138.     LINEAR,                /* the type of mapping        */
  139.     24000,                /* highest mouse unit to use    */
  140.     1000,                /* highest key unit to use    */
  141.     showFloatInBox            /* sample control function    */
  142. };
  143.  
  144. static MouseMap fastMouse =
  145. {
  146.     LINEAR,                /* the type of mapping        */
  147.     1000,                /* get to the top faster!    */
  148.     100,                /* get to the top faster!    */
  149.     NULL                /* no control function        */
  150. };
  151.  
  152.  
  153. /************************************************************************
  154. ** The following array must parallel the DeviceType enum in face_box.h
  155. ** The size-#defines are no longer necessary, as the size of
  156. ** dacButtons can be calculated at run time.
  157. *************************************************************************/
  158.  
  159. static char *dacButtons[] =
  160. {
  161.     "~D~T-2801A",
  162.     "~N~ucleus [N/A]",
  163.     "~L~SPSS   [N/A]",
  164.     "~T~est Device",
  165.     "Device ~M~issing",
  166.     NULL
  167. };
  168.  
  169.  
  170. /************************************************************************
  171. ** The following ExtendedDescriptor array is a sample, intended for
  172. ** use in three of the dialog box fields described below.
  173. *************************************************************************/
  174.  
  175. ExtendedDescriptor dacByteList[] =
  176. {
  177.     {
  178.     DAC_FLOAT,            /* The ExtendedField involved    */
  179.     Float,                /* how to display/edit it    */
  180.     {    4.0,  40.0 }        /* range used by user        */
  181.     },
  182.     {
  183.     DAC_INTEGER,
  184.     Integer,
  185.     {    1.0,  20.0 }
  186.     },
  187.     {
  188.     DAC_UNSIGNED_BYTE,
  189.     UnsignedByte,
  190.     {    4.0,  40.0 }
  191.     }
  192. };
  193.  
  194.  
  195. /************************************************************************
  196. ** dacArray[]
  197. **
  198. **    A demonstration of how to set up a pretty complex dialog box
  199. ** that consists of MenuFields.
  200. **
  201. **    Each element (next-to-outermost curly brackets) in the following
  202. ** array must parallel each field in the DacParameters structure in
  203. ** face_box.h.
  204. **
  205. **    Note that some of the labels have a character bracketed by
  206. ** the "~" character, as in "~D~AC Device".  This makes the character
  207. ** a HOT-KEY for Turbo Vision; it can be accessed by pressing that
  208. ** character (if no other field has yet been entered) or by press that
  209. ** character with the Alt key (it is better to get used to doing this).
  210. **
  211. **    Let's discuss some of the elements (each is a MenuField, as
  212. ** described fully in tv_menu.h) used to build a dialog box.
  213. **
  214. ** [0] device
  215. **
  216. **    TextLabel
  217. **
  218. **        This structure-within-a-structure provides the string
  219. **    label for the dialog box [string] , the location of the label
  220. **    [location].  The label size is dictated by the string [see
  221. **    tbox.cpp] and both dimensions are calculated at run-time.
  222. **
  223. **        The TextLabels are of the same nature for the rest of the
  224. **    MenuFields, so we won't describe them any further.
  225. **
  226. **    TextData
  227. **
  228. **        This structure is more complex.  It has many fields, and
  229. **    a union that depends on the data-type.
  230. **
  231. **    dtmplate    A string that dictates the number of characters
  232. **            to be used for holding the data.  This string
  233. **    can also be used as a buffer, by a user routine.
  234. **
  235. **    location    Locates the data-box *relative* to the label.
  236. **            My habit is to locate button-boxes just below
  237. **    the label, left-aligned with the label.  Hence, I could have used
  238. **    location = {1, 1} [one character over, and one line down].  But,
  239. **    for some reason, I used a macro to help align it horizontally.
  240. **
  241. **    datatype    Here, we specify that the data is to be shown
  242. **            as a Turbo Vision radio button (TRadioButtons)
  243. **    box.  Since we used this datatype [Radiobox], the following
  244. **    field two fields are irrelevant, and the spec field must specify
  245. **    a list of strings.
  246. **
  247. **    format        Not relevant for buttons.
  248. **
  249. **    code        The range is determined by the number of items,
  250. **            so here, the code range is unnecessary.
  251. **
  252. **    spec.strings    This is a union member, specifying strings.
  253. **
  254. ** [1] name
  255. **
  256. **    The only new wrinkle here is that we don't need a list of
  257. **    strings, so the spec field is not present [actually, it is,
  258. **    but has a NULL value].
  259. **
  260. **    dtmplate totally determines the length of the string.  The format
  261. **    field better match dtmplate, or trouble [bad trouble] will brew!
  262. **
  263. ** [2] max
  264. **
  265. **    This field is a ByteString, which means it doesn't use a '\0'
  266. **    terminator.  This kind of string is necessary when the device
  267. **    supported has a strict format for any string data... that is,
  268. **    when the string is always the same size.
  269. **
  270. **    dtmplate totally determines the length of the string.  The format
  271. **    field better match dtmplate, or trouble [bad trouble] will brew!
  272. **
  273. ** [3] output_rate
  274. **
  275. **    This field is very special, in that it is Extended.  This means
  276. **    that the internal number is to be converted to a different
  277. **    format before being shown to the user.  Each program can set
  278. **    up one set of mapped data-types.
  279. **
  280. **    Two external things must be set up... first, a list of integers,
  281. **    one for each kind of conversion that could occur.  For an example,
  282. **    see the DacByte enum type in face_box.h.  Second, an *exactly*
  283. **    corresponding list of ExtendedDescriptor structures.  See
  284. **    dacByteList[] defined way above here.
  285. **
  286. **    So, we have a spec value which is an integer, DAC_FLOAT, taken
  287. **    from the DacByte enum type.  Since it indirectly points to
  288. **    a ExtendedDescriptor, no further information is necessary.
  289. **    Note that, since it is a union member, we have to cast it to the
  290. **    type of the first member of the union, in order to define it
  291. **    without getting a compiler error.
  292. **
  293. ** [4] nPoints
  294. **
  295. **    Very similar to output_rate, but using a mapping of integers.
  296. **    Note that there is a potential problem.  The code range is
  297. **    1000-20000, but the user range is only 1 to 20 (a factor of
  298. **    1000 less).  So, when an up- or down-arrow occurs, the code is
  299. **    incremented by, say, 25, to go from 10000 to 10025.  But, when
  300. **    converted back to user units, it stays at 10.  So you can't
  301. **    change the value with the keystroke.  The mouse code works fine.
  302. **    See tinpmous.cpp [TInputFloat::handleEvent()] for possible
  303. **    solutions.
  304. **
  305. **    Anyway, for integers, we would have to recommend not using
  306. **    such a large re-mapping factor [1000 is too big], unless
  307. **    you really only care about using the mouse.
  308. **
  309. ** [6] note
  310. **
  311. **    A test of the SCROLL_END feature... note the appearance of
  312. **    the SCROLL_END_CHAR (\xFF) code, which informs banner_size()
  313. **    [called from doDialog()] how short the box should be, without
  314. **    affecting the total length of the template string as determined
  315. **    by strlen().
  316. **
  317. ** THE FOLLOWING IS NO LONGER USED, because I want to test the SCROLL_END
  318. ** feature more at the moment.  However, the code still appears,
  319. ** commented out.
  320. **
  321. ** [6] dacRate
  322. **
  323. **    Very similar to output_rate, but using a mapping of bytes.
  324. **
  325. ** [7] pt_Start
  326. **
  327. **    Here, we have a simple integer field.  Note that all the formats,
  328. **    templates, and ranges must be consistent, otherwise weird
  329. **    crashes will occur.
  330. **
  331. ** [15] calibFreq
  332. **
  333. **    This field is of data-type FloatControl, which means the spec
  334. **    points to a MouseMap structure.  A FloatControl variable
  335. **    can be altered on the fly by using the mouse or the keyboard.
  336. **    For an example of a MouseMap structure, see defaultMouse above.
  337. **    Note that, since it is a union member, we have to cast it to the
  338. **    type of the first member of the union, in order to define it
  339. **    without getting a compiler error.
  340. **
  341. ** [16] calibVolt
  342. **
  343. **    Similar, but points to a different MouseMap structure.
  344. **
  345. *************************************************************************/
  346.  
  347. MenuField dacArray[] =
  348. {
  349.     {                        /* device        */
  350.     {                    /* TextLabel        */
  351.         "~D~AC Device",            /*    string        */
  352.         {   DAC_LEFT,   DAC_TOP    }    /*    location        */
  353.     },
  354.     {                    /* TextData        */
  355.         "0",                /*    dtmplate        */
  356.         {  DAC_LEFT2,      1    },    /*    location        */
  357.         Radiobox,                /*    datatype        */
  358.         "%-1s",                /*    format        */
  359.         { 0.0, 99999.0    },        /*    code (a range)    */
  360.         dacButtons                /*    spec (strings)    */
  361.     }
  362.     },
  363.     {                        /* name            */
  364.     {
  365.         "~N~ame",
  366.         {  DAC_RIGHT,   DAC_TOP    }
  367.     },
  368.     {                    /* here, length is 15    */
  369.         "DT-2801A       ",            /* chars + 1 for '\0'    */
  370.         {           6,      0    },
  371.         String,
  372.         "%-15s"
  373.     }
  374.     },
  375.     {                        /* max            */
  376.     {
  377.         "~B~yte",
  378.         {  DAC_RIGHT, DAC_TOP+1    }
  379.     },
  380.     {                    /* here, length is 15,    */
  381.         "Byte String----",            /* but still use 15 here*/
  382.         {           6,      0    },
  383.         ByteString,
  384.         "%-15s",
  385.     }
  386.     },
  387.     {                        /* output_rate        */
  388.     {
  389.         "~O~utput DAC Rate kHz",
  390.         {  DAC_RIGHT, DAC_TOP+2    }
  391.     },
  392.     {
  393.         "10.0",
  394.         { DAC_RIGHT2+1,      0    },
  395.         Extended,                /* use extended datatype*/
  396.         "%4.1f",
  397.         {  4000.0, 40000.0    },        /* code range        */
  398.         (char **) DAC_FLOAT            /* spec (ExtendedField)    */
  399.     }
  400.     },
  401.     {                        /* nPoints        */
  402.     {
  403.         "~K~ilo-Points",
  404.         {  DAC_RIGHT, DAC_TOP+3    }
  405.     },
  406.     {
  407.         "10",
  408.         { DAC_RIGHT2+1,      0    },
  409.         Extended,                /* use extended datatype*/
  410.         "%2d",
  411.         {  1000.0, 20000.0    },
  412.         (char **) DAC_INTEGER        /* special limited int    */
  413.     }
  414.     },
  415.     {                        /* savecode        */
  416.     {
  417.         "~S~ave to file?",
  418.         {  DAC_RIGHT, DAC_TOP+4    }
  419.     },
  420.     {
  421.         "Y",                /* irrelevant (Radiobox)*/
  422.         { DAC_RIGHT5,      1    },
  423.         Radiobox,
  424.         "%1s",                /* irrelevant (Radiobox)*/
  425.         { 0.0, 1.0    },
  426.         YesNoButtons
  427.     }
  428.     },
  429.  
  430.     /*------------------------------------------------------------------*/
  431.  
  432. #ifdef USE_DACRATE_CODE_INSTEAD
  433.  
  434.     {                        /* dacRate        */
  435.     {
  436.         "~i~nt rate kHz",
  437.         {   DAC_LEFT,   DAC_TOP+7    }
  438.     },
  439.     {
  440.         "00",
  441.         {  DAC_LEFT3,      0    },
  442.         Extended,                /* use extended datatype*/
  443.         "%2d",
  444.         {  4000.0, 40000.0    },
  445.         (char **) DAC_UNSIGNED_BYTE        /* special limited char    */
  446.     }
  447.     },
  448.  
  449. #else
  450.  
  451.     {                        /* dacRate        */
  452.     {
  453.         "~L~ong note",
  454.         {   DAC_LEFT,   DAC_TOP+7    }
  455.     },
  456.     {
  457.         /*
  458.         ** Each line here is 40 characters, for a total of 120.
  459.         */
  460.  
  461.         "Type anything of interest..." SCROLL_END_CHAR " Note that "
  462.         "we have 120 characters (NOTESIZE), but w"
  463.         "we only display up to SCROLL_END_CHAR!!!",
  464.         {  DAC_LEFT3,      0    },
  465.         String,                /* use extended datatype*/
  466.         "%-120s"                /* doesn't matter!!!    */
  467.     }
  468.     },
  469.  
  470. #endif
  471.  
  472.     {                        /* pt_start        */
  473.     {
  474.         "Start pt.",
  475.         {   DAC_LEFT,   DAC_TOP+8    }
  476.     },
  477.     {
  478.         "00000",
  479.         {  DAC_LEFT3,      0    },
  480.         Integer,
  481.         "%5d",
  482.         { 0.0, 16384.0    }
  483.     }
  484.     },
  485.     {                        /* us_start        */
  486.     {
  487.         "msec",
  488.         {  DAC_RIGHT,   DAC_TOP+8    }
  489.     },
  490.     {
  491.         "0000.0",
  492.         {  DAC_RIGHT3,      0    },
  493.         Float,
  494.         "%6.1f",
  495.         { 0.0, 16000.0    }
  496.     }
  497.     },
  498.     {                        /* pt_end        */
  499.     {
  500.         "End pt.",
  501.         {   DAC_LEFT,   DAC_TOP+9    }
  502.     },
  503.     {
  504.         "00000",
  505.         {  DAC_LEFT3,      0    },
  506.         Integer,
  507.         "%5d",
  508.         { 0.0, 16384.0    }
  509.     }
  510.     },
  511.     {                        /* us_end        */
  512.     {
  513.         "msec",
  514.         {  DAC_RIGHT,   DAC_TOP+9    }
  515.     },
  516.     {
  517.         "0000.0",
  518.         {  DAC_RIGHT3,      0    },
  519.         Float,
  520.         "%6.1f",
  521.         { 0.0, 16000.0    }
  522.     }
  523.     },
  524.     {                        /* dacMin        */
  525.     {
  526.         "Min level",
  527.         {   DAC_LEFT,   DAC_TOP+10    }
  528.     },
  529.     {
  530.         "-00000",
  531.         {  DAC_LEFT3,      0    },
  532.         Integer,
  533.         "%6d",
  534.         { -32767.0, 32767.0    }
  535.     }
  536.     },
  537.     {                        /* mVMin        */
  538.     {
  539.         "mV",
  540.         {  DAC_RIGHT,   DAC_TOP+10    }
  541.     },
  542.     {
  543.         "-00000.0",
  544.         {  DAC_RIGHT3,      0    },
  545.         Float,
  546.         "%8.1f",
  547.         { -10000.0, 10000.0    }
  548.     }
  549.     },
  550.     {                        /* dacMax        */
  551.     {
  552.         "Max level",
  553.         {   DAC_LEFT,   DAC_TOP+11    }
  554.     },
  555.     {
  556.         "-00000",
  557.         {  DAC_LEFT3,      0    },
  558.         Integer,
  559.         "%6d",
  560.         { -32767.0, 32767.0    }
  561.     }
  562.     },
  563.     {                        /* mVMax        */
  564.     {
  565.         "mV",
  566.         {  DAC_RIGHT,   DAC_TOP+11    }
  567.     },
  568.     {
  569.         "-00000.0",
  570.         {  DAC_RIGHT3,      0    },
  571.         Float,
  572.         "%8.1f",
  573.         { -10000.0, 10000.0    }
  574.     }
  575.     },
  576.     {                        /* calibFreq CONTROL    */
  577.     {
  578.         "~F~req CONTROL",
  579.         {   DAC_LEFT,   DAC_TOP+13    }
  580.     },
  581.     {
  582.         "10000.0",
  583.         {  DAC_LEFT3,      0    },
  584.         FloatControl,            /* datatype        */
  585.         "%7.1f",
  586.         { 0.0, 28000.0    },
  587.         (char **) &defaultMouse        /* spec (MouseMap *)    */
  588.     }
  589.     },
  590.     {                        /* calibVolts CONTROL    */
  591.     {
  592.         "~V~olt CONTROL",
  593.         {  DAC_RIGHT,   DAC_TOP+13    }
  594.     },
  595.     {
  596.         "00.0",
  597.         {  DAC_RIGHT4,      0    },
  598.         FloatControl,
  599.         "%4.1f",
  600.         { 0.0, 10.0    },
  601.         (char **) &fastMouse
  602.     }
  603.     }
  604. };
  605.  
  606. MainBox dacMenu =                /* the whole picture!    */
  607. {
  608.     {                        /* box            */
  609.     "Bogus Device Parameters",        /*    title        */
  610.     NULL,                    /*    string        */
  611.     {  11,   2    },            /*    location    */
  612.     {  56,  20    },            /*    size        */
  613.     {   2,   2    }            /*    labelloc    */
  614.     },
  615.     sizeof(dacArray)/sizeof(MenuField),        /* number of fields    */
  616.     dacArray                    /* the array of fields    */
  617. };
  618.  
  619.  
  620. /************************************************************************
  621. ** Item 2: MappedField test section
  622. *************************************************************************/
  623.  
  624. #define MID_TOP         2    /* handy alignment row            */
  625. #define MID_LEFT     4    /* left handy alignment column        */
  626. #define MID_LEFT2     1    /* relative location of data boxes    */
  627. #define MID_LEFT3    12    /* relative location on same line    */
  628.  
  629.  
  630. /************************************************************************
  631. ** MIDParameters midDialog
  632. *************************************************************************/
  633.  
  634. MIDParameters midDialog =
  635. {
  636.     "Test name\0",                /* name[10]        */
  637.     120,                    /* tempo        */
  638.     -64,                    /* pan            */
  639.     0                        /* part            */
  640. };
  641.  
  642.  
  643. /************************************************************************
  644. ** A sample list of labels for a button-box
  645. *************************************************************************/
  646.  
  647. char *partList[] = 
  648. {
  649.     "~1~",
  650.     "~2~",
  651.     "~3~",
  652.     "~4~",
  653.     "~5~",
  654.     "~6~",
  655.     "~7~",
  656.     "~8~",
  657.     NULL
  658. };
  659.  
  660.  
  661. /************************************************************************
  662. ** The following MappedFieldDescriptor array is a sample, intended for
  663. ** use in three of the dialog box fields described below.
  664. *************************************************************************/
  665.  
  666. MappedFieldDescriptor midByteList[] =
  667. {
  668.     {                        /* BYTE            */
  669.     MID_BYTE,                /*    type        */
  670.     "0xFE",                    /*    dtmplate        */
  671.     UnsignedByte,                /*    datatype        */
  672.     {   0.0, 240.0 },            /*    code        */
  673.     {   0.0, 120.0 },            /*    user        */
  674.     "0x%2.2x",                /*    format        */
  675.     NULL_STRING                /*    strings        */
  676.     },
  677.     {                        /* SBYTE        */
  678.     MID_SBYTE,
  679.     "-123",
  680.     SignedByte,
  681.     { -127.0, 127.0 },
  682.     {  -10.0,  10.0 },
  683.     "%4d",
  684.     NULL_STRING
  685.     },
  686.     {                        /* MString        */
  687.     MID_STRING,
  688.     "1234567890",
  689.     ByteString,
  690.     {   0.0,   0.0 },
  691.     {   0.0,   0.0 },
  692.     "%-10s",
  693.     NULL_STRING
  694.     },
  695.     {                        /* Part            */
  696.     MID_PART,
  697.     NULL,
  698.     Radiobyte,
  699.     {   0.0, 7.0 },
  700.     {   0.0, 7.0 },
  701.     NULL_FORMAT,
  702.     partList
  703.     }
  704. };
  705.  
  706.  
  707. /************************************************************************
  708. ** The following array must parallel midDialog
  709. *************************************************************************/
  710.  
  711. MappedField midArray[] =
  712. {
  713.     {                        /* name            */
  714.     "~N~ame",                /*    label_string    */
  715.     {   MID_LEFT,    MID_TOP    },    /*    label_location    */
  716.     {  MID_LEFT3,      0        },    /*    data_location    */
  717.     MID_STRING                /*    dtype        */
  718.     },
  719.     {                        /* tempo        */
  720.     "~T~empo",
  721.     {   MID_LEFT,    MID_TOP+1    },
  722.     {  MID_LEFT3,      0        },
  723.     MID_BYTE
  724.     },
  725.     {                        /* pan            */
  726.     "~P~an",
  727.     {   MID_LEFT,    MID_TOP+2    },
  728.     {  MID_LEFT3,      0        },
  729.     MID_SBYTE
  730.     },
  731.     {                        /* part            */
  732.     "Part",
  733.     {   MID_LEFT,    MID_TOP+4    },
  734.     {  MID_LEFT2,      1        },
  735.     MID_PART
  736.     }
  737. };
  738.  
  739. MappedBox midMenu =                /* the whole picture!    */
  740. {
  741.     {                        /* box            */
  742.     "Bogus MIDI Parameters",        /*    title        */
  743.     NULL,                    /*    string        */
  744.     {  11,   2    },            /*    location    */
  745.     {  32,  20    },            /*    size        */
  746.     {   2,   2    }            /*    labelloc    */
  747.     },
  748.     sizeof(midArray)/sizeof(MappedField),    /* number of fields    */
  749.     midArray                    /* the array of fields    */
  750. };
  751.  
  752.  
  753.  
  754. /************************************************************************
  755. ** Item 3:  EXP Parameters
  756. *************************************************************************/
  757.  
  758. #define EXP_TOP         2
  759. #define EXP_LEFT     2
  760. #define EXP_LEFT2     1
  761. #define EXP_RIGHT    33
  762. #define EXP_RIGHT2    18
  763. #define EXP_RIGHT3     1
  764.  
  765.  
  766. ExpParameters expDialog =
  767. {
  768.     MOD_DEPTH_EXP,
  769.     DISCRIMINATION_EXP,        /* discriminate the two waveforms    */
  770.     MOUSE_RESPONSE,        /* use mouse buttons as response device    */
  771.      3,                /* number of hits to cause a reduction    */
  772.      2,                /* number of intervals in the task    */
  773.     12,                /* number of reversals allowed        */
  774.     NUMB_OUT,            /* number of reversals for step change    */
  775.     10L,            /* need to test LongInteger problems!    */
  776.     0.0,            /* initial step size            */
  777.     0.0,            /* half-step step size            */
  778.     0.0,            /* floor value for signal parameter    */
  779.     0.0,            /* ceiling value for signal parameter    */
  780.     CHECK_NO,            /* tracking of stimulus values        */
  781.     CHECK_NO,            /* peeking at presentation intervals    */
  782.     CHECK_NO,            /* peeking at noise sample indexes    */
  783.     STEP_LINEAR,        /* stimulus levels linearity        */
  784.     STEP_LINEAR            /* step-size levels linearity        */
  785. };
  786.  
  787.  
  788. /************************************************************************
  789. ** Various buttons
  790. **
  791. **    Previously, the following fields were implemented as Yes/No
  792. ** RadioButtons.  These take up too much space.  Instead, I could have
  793. ** implemented these flags as one CheckBox.  But this would have
  794. ** required a lot of recoding.  So, I just converted these to one-line
  795. ** CheckBoxes.  Note that, just for good looks, I made each string
  796. ** exactly the same length... this creates the illusion that they
  797. ** are all part of one variable... the user doesn't care about this,
  798. ** but a second-generation programmer, maintaining this code, might
  799. ** have occasion to grumble!
  800. **
  801. **    allB_size and allB_L are old constructs, and could be removed.
  802. ** Sizes are now calculated on the fly by some boxtools.cpp routines.
  803. **
  804. *************************************************************************/
  805.  
  806. static char *stimButtons[]    = { "Stimulus peek   ",    NULL };
  807. static char *intvButtons[]    = { "Value tracking  ",    NULL };
  808. static char *noiseButtons[]    = { "Noise index peek",    NULL };
  809. #define allB_size (sizeof(stimButtons)/sizeof(char *)-1)
  810. #define allB_L    (16+6)
  811.  
  812.  
  813. /***********************************************************************
  814. ** ExperimentType values
  815. **
  816. ** The following three structures must all be edited in parallel, and
  817. ** must correspond to the ExperimentType enum in mod_type.h
  818. **
  819. ************************************************************************/
  820.  
  821. #if !defined(EXP_BUTTONS)
  822. #define EXP_BUTTONS
  823.  
  824. char *expButtons[] =
  825. {
  826.     "~I~ntensity",
  827.     "~F~requency",
  828.     "~D~uration",
  829.     "~P~ulse Duration",
  830.     "~G~ap Detection",
  831.     "~M~odulation Depth",
  832.     "Modulation F~r~eq",
  833.     "Modulation P~h~ase",
  834.     NULL
  835. };
  836. #define eB_size (sizeof(expButtons)/sizeof(char *)-1)
  837. #define eB_L    (16+6)
  838.  
  839. #endif
  840.  
  841.  
  842. char *expTitles[] =
  843. {
  844.     "Generic or User-defined Experiment",
  845.     "Intensity Discrimination",
  846.     "Frequency Discrimination"
  847.     "Duration Discrimination",
  848.     "Pulse Width Discrimination",
  849.     "Gap Discrimination",
  850.     "Modulation Discrimination",
  851.     "Modulation Frequency Discrimination",
  852.     "Modulation Phase Discrimination",
  853.     NULL
  854. };
  855.  
  856.  
  857. #if !defined(EXP_VARS)
  858. #define EXP_VARS
  859.  
  860. char *expVars[] =
  861. {
  862.     "   Generic Record (??): ",
  863.     " Intensity Record (dB): ",
  864.     " Frequency Record (Hz): ",
  865.     "  Duration Record (ms): ",
  866.     "   Pulse Width (us/ph): ",
  867.     "       Gap Record (ms): ",
  868.     " Modulation Record (%): ",
  869.     " Modulation Freq. (Hz): ",
  870.     "Modulation Phase (deg): ",
  871.  
  872.     NULL
  873. };
  874.  
  875. #endif
  876.  
  877.  
  878. /***********************************************************************
  879. ** ResponseDevice values
  880. ************************************************************************/
  881.  
  882. static char *responseButtons[] =
  883. {
  884.     "~M~ouse",
  885.     "~K~eyboard",
  886.     "K~o~ala Pad",
  887.     NULL
  888. };
  889. #define RB_size (sizeof(responseButtons)/sizeof(char *)-1)
  890. #define RB_L    (11+6)
  891.  
  892. static char *responseTypes[] =
  893. {
  894.     "~D~etection",
  895.     "D~i~scrimination",
  896.     NULL
  897. };
  898. #define RT_size (sizeof(responseTypes)/sizeof(char *)-1)
  899. #define RT_L    (18+6)
  900.  
  901.  
  902. /***********************************************************************
  903. ** Linearity values
  904. ************************************************************************/
  905.  
  906. static char *linearButtons[] =
  907. {
  908.     "~L~inear",
  909.     "~N~onlinear",
  910.     NULL
  911. };
  912. #define lB_size (sizeof(linearButtons)/sizeof(char *)-1)
  913. #define lB_L    (9+6)
  914.  
  915.  
  916. /***********************************************************************
  917. ** Array of fields
  918. ************************************************************************/
  919.  
  920. MenuField expArray[] =
  921. {
  922.     {                        /* expType        */
  923.     {
  924.         "~E~xperiment Type",
  925.         {   EXP_LEFT,   EXP_TOP    }
  926.     },
  927.     {
  928.         "5",
  929.         {  EXP_LEFT2,      1    },
  930.         Radiobox,
  931.         "%1d",
  932.         { 0.0,     (double) eB_size    },
  933.         expButtons
  934.     }
  935.     },
  936.     {                        /* expCode        */
  937.     {
  938.         "",
  939.         {   EXP_LEFT, EXP_TOP+eB_size+1 }
  940.     },
  941.     {
  942.         "0",
  943.         {  EXP_LEFT2,      1    },
  944.         Radiobox,
  945.         "%1s",
  946.         { 0.0,     (double) RT_size    },
  947.         responseTypes
  948.     }
  949.     },
  950.     {                        /* response_device    */
  951.     {
  952.         "~S~ubject Response Device",
  953.         {  EXP_LEFT, EXP_TOP+eB_size+RT_size+3 }
  954.     },
  955.     {
  956.         "0",
  957.         {  EXP_LEFT2,      1    },
  958.         Radiobox,
  959.         "%1s",
  960.         { 0.0,     (double) RT_size    },
  961.         responseButtons
  962.     }
  963.     },
  964.     {                        /* numbCorrect        */
  965.     {
  966.         "AFC No. Correct",
  967.         {  EXP_RIGHT, EXP_TOP    }
  968.     },
  969.     {
  970.         "3",
  971.         { EXP_RIGHT2,      0    },
  972.         Integer,
  973.         "%1d",
  974.         { 1.0, 3.0    }
  975.     }
  976.     },
  977.     {                        /* afcIntervals        */
  978.     {
  979.         "AFC ~I~ntervals",
  980.         {  EXP_RIGHT, EXP_TOP+1    }
  981.     },
  982.     {
  983.         "2",
  984.         { EXP_RIGHT2,      0    },
  985.         Integer,
  986.         "%1d",
  987.         { 2.0, 3.0    }
  988.     }
  989.     },
  990.     {                        /* numbReversals    */
  991.     {
  992.         "AFC ~R~eversals",
  993.         {  EXP_RIGHT, EXP_TOP+2    }
  994.     },
  995.     {
  996.         "12",
  997.         { EXP_RIGHT2,      0    },
  998.         Integer,
  999.         "%2d",
  1000.         { 1.0, 20.0    }
  1001.     }
  1002.     },
  1003.     {                        /* numb_reversals    */
  1004.     {
  1005.         "Reversals ignored",
  1006.         {  EXP_RIGHT, EXP_TOP+3    }
  1007.     },
  1008.     {
  1009.         "12",
  1010.         { EXP_RIGHT2,      0    },
  1011.         Integer,
  1012.         "%2d",
  1013.         { 0.0, 20.0    }
  1014.     }
  1015.     },
  1016.     {                        /* afcSpeed        */
  1017.     {
  1018.         "Run Speed [long]",
  1019.         {  EXP_RIGHT, EXP_TOP+4    }
  1020.     },
  1021.     {
  1022.         "1000",
  1023.         { EXP_RIGHT2,      0    },
  1024.         LongInteger,
  1025.         "%2ld",
  1026.         { 0.0, 1000.0    }
  1027.     }
  1028.     },
  1029.     {                        /* afcStep        */
  1030.     {
  1031.         "Initial Step",
  1032.         {  EXP_RIGHT, EXP_TOP+5    }
  1033.     },
  1034.     {
  1035.         " 0.0",
  1036.         { EXP_RIGHT2,      0    },
  1037.         Float,
  1038.         "%4.1f",
  1039.         { 0.0, 99.0    }
  1040.     }
  1041.     },
  1042.     {                        /* afcHalfStep        */
  1043.     {
  1044.         "Half Step",
  1045.         {  EXP_RIGHT, EXP_TOP+6    }
  1046.     },
  1047.     {
  1048.         " 0.0",
  1049.         { EXP_RIGHT2,      0    },
  1050.         Float,
  1051.         "%4.1f",
  1052.         { 0.0, 99.0    }
  1053.     }
  1054.     },
  1055.     {                        /* afcFloor        */
  1056.     {
  1057.         "~F~loor",
  1058.         {  EXP_RIGHT, EXP_TOP+7    }
  1059.     },
  1060.     {
  1061.         "   0.0",
  1062.         { EXP_RIGHT2-2,      0    },
  1063.         Float,
  1064.         "%6.1f",
  1065.         { MINUS_INFINITY_DB, 9999.0    }
  1066.     }
  1067.     },
  1068.     {                        /* afcCeiling        */
  1069.     {
  1070.         "Ceiling",
  1071.         {  EXP_RIGHT, EXP_TOP+8    }
  1072.     },
  1073.     {
  1074.         "   0.0",
  1075.         { EXP_RIGHT2-2,      0    },
  1076.         Float,
  1077.         "%6.1f",
  1078.         { MINUS_INFINITY_DB, 9999.0    }
  1079.     }
  1080.     },
  1081.     {                        /* valueTrack        */
  1082.     {
  1083.         NULL,
  1084.         {  EXP_RIGHT, EXP_TOP+10    }
  1085.     },
  1086.     {
  1087.         "N",
  1088.         {  EXP_LEFT2,      0    },
  1089.         Checkbox,
  1090.         "%1s",
  1091.         { 0.0, 1.0    },
  1092.         intvButtons
  1093.     }
  1094.     },
  1095.     {                        /* stimPeek        */
  1096.     {
  1097.         NULL,
  1098.         {EXP_RIGHT, EXP_TOP+11    }
  1099.     },
  1100.     {
  1101.         "N",
  1102.         {   EXP_LEFT2,      0    },
  1103.         Checkbox,
  1104.         "%1s",
  1105.         { 0.0, 2.0    },
  1106.         stimButtons
  1107.     }
  1108.     },
  1109.     {                        /* noisePeek        */
  1110.     {
  1111.         NULL,
  1112.         {EXP_RIGHT, EXP_TOP+12    }
  1113.     },
  1114.     {
  1115.         "N",
  1116.         {   EXP_LEFT2,      0    },
  1117.         Checkbox,
  1118.         "%1s",
  1119.         { 0.0, 2.0    },
  1120.         noiseButtons
  1121.     }
  1122.     },
  1123.     {                        /* stimLinearity    */
  1124.     {
  1125.         "Stimulus",
  1126.         {  EXP_RIGHT,   EXP_TOP+14    }
  1127.     },
  1128.     {
  1129.         "5",
  1130.         { EXP_RIGHT3,      1    },
  1131.         Radiobox,
  1132.         "%1d",
  1133.         { 0.0,     (double) lB_size    },
  1134.         linearButtons
  1135.     }
  1136.     },
  1137.     {                        /* stepLinearity    */
  1138.     {
  1139.         "Step",
  1140.         {EXP_RIGHT+lB_L+2, EXP_TOP+14  }
  1141.     },
  1142.     {
  1143.         "5",
  1144.         { EXP_RIGHT3,      1    },
  1145.         Radiobox,
  1146.         "%1d",
  1147.         { 0.0,     (double) lB_size    },
  1148.         linearButtons
  1149.     }
  1150.     }
  1151. };
  1152.  
  1153. MainBox expMenu =                /* the whole picture!    */
  1154. {
  1155.     {                        /* box            */
  1156.     "Experimental Parameters",        /*    title        */
  1157.     NULL,                    /*    string        */
  1158.     {   2,   0    },            /*    location    */
  1159.     {  70,  23    },            /*    size        */
  1160.     {   2,   2    }            /*    labelloc    */
  1161.     },
  1162.     sizeof(expArray)/sizeof(MenuField),        /* number of fields    */
  1163.     expArray                    /* the array of fields    */
  1164. };
  1165.  
  1166.  
  1167. /************************************************************************
  1168. ** Equipment configuration list
  1169. *************************************************************************/
  1170.  
  1171. #include "tv_confg.h"        /* SimpleConfiguration class        */
  1172.  
  1173. BasicConfiguration equipmentList[] =
  1174. {
  1175.     {     &dacDialog, sizeof(DACParameters)    },
  1176.     {     &midDialog, sizeof(MIDParameters)    },
  1177.     {     &expDialog, sizeof(ExpParameters)    },
  1178.     {     &delayData, sizeof(DelayParameters)    },
  1179.     {    0                    }   /*terminator*/
  1180. };
  1181.  
  1182.  
  1183. #endif
  1184.