home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / XDME / Src / Menu / MenuCom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  32.6 KB  |  1,606 lines

  1. /******************************************************************************
  2.  
  3.     MODUL
  4.     menucom.c
  5.  
  6.     DESCRIPTION
  7.     [X]DME command interface for menubase.c
  8.  
  9.     NOTES
  10.     experimental status
  11.  
  12.     in zukunft koennte es moeglich sein,
  13.     einen einzigen namensparameter zu akzeptieren,
  14.     der dann ueber split_menu_names in seine
  15.     komponenten aufgespalten wuerde
  16.  
  17.     BUGS
  18.     IMPORTANT
  19.         we cannot actually react on ERRORs !!
  20.  
  21.     TODO
  22.     include some error()-calls
  23.     support checks
  24.  
  25.     EXAMPLES
  26.  
  27.     description of the user-commands:
  28.  
  29.     the commands below might get other names;
  30.     if so, please update their descriptions according
  31.     to the names they are used in command.c
  32.  
  33. *!***************************************************************************
  34. *!
  35. *!  MENUES:
  36. *!  ******
  37. *!
  38. *!  the following commands allow access to [X]DME's menustructures
  39. *!  that way it is possible for each user to create an individual
  40. *!  GUI for "his" [X]DME, for "his" programming language and for
  41. *!  his wishes.
  42. *!
  43. *! >MENUDELHDR menuname
  44. *!
  45. *!    delete a menuheader and all associated items (and subitems)
  46. *!
  47. *!    menuheaders are created by using their names in item or
  48. *!    subitem definitions
  49. *!
  50. *! >MENUDEL    menuname itemname
  51. *! >MENUDELBAR menuname                 (obsolete)
  52. *!
  53. *!    delete a menuitem-entry
  54. *!    DELBAR deletes the first itembar in a menu's itemlist
  55. *!    DEL deletes the menuitem with the name itemname
  56. *!        if itemname is a subitem-carrier, all subs are deleted, too
  57. *!
  58. *!    You can delete all items of a menu, if You call MENUDELHDR
  59. *!
  60. *! >MENUDELSUB      menuname itemname subname        (obsolete)
  61. *! >MENUDELSUBBAR menuname itemname            (obsolete)
  62. *!
  63. *!    delete a submenu-entry
  64. *!    DELSUBBAR deletes the first submenubar in a menuitem's subitemlist
  65. *!    DELSUB deletes the submenu with the name subname
  66. *!
  67. *!    You can delete all an item's subitem if You MENUDEL the carrying item
  68. *!
  69. *! >MENUADD   menuname itemname subname command
  70. *! >MENUBAR   menuname itemname             (obsolete)
  71. *! >MENUCHECK menuname itemname subname command     (obsolete)
  72. *!
  73. *!    create a menuitem-entry
  74. *!    BAR simply appends an itembar to the item-list
  75. *!    ADD creates a full menuitem-entry, if not already one
  76. *!        of the same name exists
  77. *!    CHECK also sets the menutoggle flag to an entry created
  78. *!        like ADD
  79. *!
  80. *!    You cannot add subitems to items that were created with
  81. *!        MENUADD or MENUCHECK as these have commands added
  82. *!        while we expect subitem carrier to have no command added
  83. *!    You cannot redefine the type of an menuitem once created
  84. *!        normal items can't be redefined to checkitems
  85. *!        or subitem carriers and vice versa
  86. *!
  87. *!    Since 22 Jun 1994 MENUADD incorporates MENU*BAR, MENU*CHECK, MENU*ADD
  88. *!        so MENUSUB(ADD|BAR|CHECK) are not really necessary any more
  89. *!        SUBnames       are splitted at ^S,
  90. *!        AMIGAshortcuts are splitted at ^A,
  91. *!        CHECKitems       are leaded    by ^C (at subs the last/sub name),
  92. *!        BARitems       are called       ^B (at subs the last/sub name)
  93. *!
  94. *!
  95. *! >MENUSUBADD     menuname itemname subname command  (obsolete)
  96. *! >MENUSUBBAR     menuname itemname            (obsolete)
  97. *! >MENUSUBCHECK menuname itemname subname command  (obsolete)
  98. *!
  99. *!    create a submenu-entry
  100. *!    SUBBAR simply appends an itembar to the subitem-list
  101. *!    SUBADD creates a full subitem-entry, if not already one
  102. *!        of the same name exists
  103. *!    SUBCHECK also sets the menutoggle flag to an entry created
  104. *!        like SUBADD
  105. *!
  106. *!    You cannot add subitems to items that were created with
  107. *!        MENUADD or MENUCHECK as these are managed in a quite
  108. *!        different way, so You create subitem-carrier simply by
  109. *!        using their names in a subitem definition
  110. *!    You cannot redefine the type of an subitem once created
  111. *!        normal subs can't be redefined to subcheck and vice versa
  112. *!    Since 22 Jun 1994 MENU*ADD incorporates MENU*BAR, MENU*CHECK, MENU*ADD
  113. *!        so MENU*(BAR|CHECK) are not really necessary any more
  114. *!        since MENUADD also handles subs, MENUSUBADD is obsolete, too
  115. *!
  116. *! >MENUSETITEM menuname itemname      status
  117. *! >MENUSETSUB    menuname itemname subname status    (obsolete)
  118. *! >MENUCHKITEM menuname itemname      variablename
  119. *! >MENUCHKSUB    menuname itemname subname variablename    (obsolete)
  120. *!
  121. *!    these commands set or check the satus of the (/sub)item-checked
  122. *!    flags for (sub)items created with the MENU(SUB)CHECK commands
  123. *!    status is one of 0|1/on|off the value set into variable is also 0|1
  124. *!        (again, please note, "toggle" is not yet supported)
  125. *!    Since 22 Jun 1994 MENU???ITEM is able to split its itemname at
  126. *!        SUBBREAK=^S, so MENU???SUB are not really neccessary any more.
  127. *!
  128. *! >MENUCLEAR
  129. *!
  130. *!    clean up the menustrip, i.e. delete all of its
  131. *!    menuheaders
  132. *!
  133. *! >MENUSAVE filename
  134. *!
  135. *!    save the menustrip as a file that can be
  136. *!    read by MENULOAD
  137. *!
  138. *! >MENULOAD filename
  139. *!
  140. *!    clear the menustrip and instead build a new
  141. *!    contents out of the file filename
  142. *!
  143. *! >MENUON
  144. *! >MENUOFF
  145. *!
  146. *!    show or hide the whole menustrip
  147. *!    MENUOFF is stackable, i.e You need as many MENUON calls
  148. *!    to show the menustrip as previously MENUOFF calls
  149. *!
  150. *!
  151. *!  MENUSTRIPS:
  152. *!  **********
  153. *!
  154. *!  the following commands do only make sense, if
  155. *!  You are using multiple menustrips
  156. *!  at [X]DME's start a menustrip called "default" is created;
  157. *!  for "normal" usage, that single strip may suffer.
  158. *!
  159. *!  Please note that the above MENU... commands apply to the
  160. *!  CURRENT menustrip (and only to it)
  161. *!
  162. *! >USEMENUSTRIP name
  163. *!
  164. *!    search for a certain menustrip and use it as the current one
  165. *!
  166. *! >REMMENUSTRIP
  167. *!
  168. *!    delete the current menustrip, if it is not the only one
  169. *!
  170. *! >NEWMENUSTRIP name
  171. *!
  172. *!    if there is already a menustrip called name,
  173. *!        simply call USEMENUSTRIP name
  174. *!    else create a new menustrip called name and use it
  175. *!
  176. *! NOTES about Menus
  177. *! -----------------
  178. *!
  179. *! CHANGE at 22 Jun 1994
  180. *! some commands become obsolete, but stay accessible for some patchlevels
  181. *! (for compability reasons)
  182. *! MENUSUBADD  replaces MENUSUBCHECK, MENUSUBBAR by ^C, ^B
  183. *! MENUADD     replaces MENUCHECK,    MENUBAR     by ^C, ^B
  184. *! MENUDELSUB  replaces MENUDELSUBBAR         by    ^B
  185. *! MENUDEL     replaces MENUDELSUB         by    ^B
  186. *! MENUADD     replaces MENUSUBADD         by       ^S
  187. *! MENUDEL     replaces MENUDELSUB         by       ^S
  188. *! MENUSETITEM replaces MENUSETSUB         by       ^S
  189. *! MENUCHKITEM replaces MENUCHKSUB         by       ^S
  190. *! so MENUADD, MENUDEL, MENUSETITEM, MENUCHKITEM should be enough
  191. *! the other commands might stay usable for a while, however, but they
  192. *! are not supported any more.
  193. *! please note, that we are introducing another Specialkey ^A to identify
  194. *! Amiga-Shortcuts
  195. *! please note, that MENUCHECK will not support ^A
  196. *! also note, that ^A, ^C are not really part of an Item's name, so
  197. *! menuitems must be deleted with ^C/^A stripped off.
  198. *!
  199. *! Finally I have to mention, that the variable access to menuitems
  200. *! does currently not use the same break-symbols as menuadd does;
  201. *! in var-access we still use "-" to separate itemnames from
  202. *! menunames and from subnames (for compability reasons). (if that
  203. *! functionality changes, we'll have to note it)
  204. *!
  205. *! as soon, as these obsolete declared commands are dropped
  206. *! we will support a set of macros in order to emulate them
  207. *! with the remaining commands, which offer even more functionality
  208. *!
  209.  
  210.     SEE ALSO
  211.     menustrips.c menu_dme.c menucontrol.c command.c
  212.  
  213.  
  214.     INDEX
  215.     $Header : $
  216.  
  217.     HISTORY
  218.     18 Dec 1992 b_null created
  219.     20 Dec 1992 b_null rewritten & documented
  220.     23 Jan 1993 b_null added menutomacro
  221.     25 Jan 1993 b_null added do_delmenu, do_itemcheck, do_subcheck
  222.     22 Jun 1994 null added support of check_symbol, short_cut
  223.     05-08-94    null added STATIC Command Interface
  224.     $Date: 94/07/06 12:06:48 $ last update
  225.  
  226. ******************************************************************************/
  227.  
  228. /**************************************
  229.         Includes
  230. **************************************/
  231. #define  MENU_INTERNAL
  232. #include "defs.h"
  233. #include "menubase.h"
  234. #ifdef PATCH_NULL
  235. #include "COM.h"
  236. #endif
  237.  
  238.  
  239. /**************************************
  240.         Globale Variable
  241. **************************************/
  242. /* menu(item)management */
  243. Prototype void do_delmenu   (void);
  244. Prototype void do_delitem   (void);
  245. Prototype void do_delitembar(void);
  246. Prototype void do_delsub    (void);
  247. Prototype void do_delsubbar (void);
  248. Prototype void do_itembar   (void);
  249. Prototype void do_itemcheck (void);
  250. Prototype void do_itemadd   (void);
  251. Prototype void do_subadd    (void);
  252. Prototype void do_subcheck  (void);
  253. Prototype void do_subbar    (void);
  254. Prototype void do_menuoff   (void);
  255. Prototype void do_menuon    (void);
  256. Prototype void do_menuload  (void);
  257. Prototype void do_menusave  (void);
  258. Prototype char*menutomacro  (char*);
  259. Prototype void do_menuclear (void);
  260.  
  261. /* modification on checks */
  262. Prototype void do_getcheckitem (void);
  263. Prototype void do_getchecksub  (void);
  264. Prototype void do_setcheckitem (void);
  265. Prototype void do_setchecksub  (void);
  266.  
  267. /* management for menustrips */
  268. Prototype void do_new_menustrip (void);
  269. Prototype void do_del_menustrip (void);
  270. Prototype void do_use_menustrip (void);
  271.  
  272.  
  273. /**************************************
  274.       Interne Defines & Strukturen
  275. **************************************/
  276.  
  277. #define    SPLIT_CHECK_NAME(pn)     ((**pn==checkmark_Symbol) && ((*pn)++))
  278. #define SPLIT_SHORTCUT_NAME(pn,ps)  ((*ps=strchr(*pn,scutbreak_Symbol)) && ((**ps=0)||(*ps)++))
  279. #define  SPLIT_SUBITEM_NAME(pn,ps)  ((*ps=strchr(*pn, subbreak_Symbol)) && ((**ps=0)||(*ps)++))
  280. #define     IS_BAR_NAME(pn)     ((strcmp (*pn, barlabel_Symbol)==0)&&(*pn=BAR))
  281.  
  282.  
  283. /**************************************
  284.         Interne Variable
  285. **************************************/
  286.  
  287. /* fuer diese werte koennte ich sogar prefs-commandos basteln */
  288. char checkmark_Symbol = '\003'; /* in breakout: ^C for _C_heck    */
  289. char  subbreak_Symbol = '\023'; /* in breakout: ^S for _S_ub      */
  290. char scutbreak_Symbol = '\001'; /* in breakout: ^A for _A_miga    */
  291. char *barlabel_Symbol = "\002"; /* in breakout: ^B for _B_arlabel */
  292.  
  293. /**************************************
  294.        Interne Prototypes
  295. **************************************/
  296.  
  297.  
  298.  
  299. /*****************************************************************************
  300.  
  301.     NAME
  302.     do_delmenu
  303.  
  304.     PARAMETER
  305.     void
  306.  
  307.     RESULT
  308.     -/-
  309.  
  310.     RETURN
  311.     void
  312.  
  313.     DESCRIPTION
  314.     [X]DME command interface for
  315.  
  316.     NOTES
  317.  
  318.     BUGS
  319.  
  320.     EXAMPLES
  321.  
  322.     SEE ALSO
  323.  
  324.     INTERNALS
  325.  
  326.     HISTORY
  327.     25 Jan 1993 b_noll created
  328.  
  329. ******************************************************************************/
  330.  
  331. void do_delmenu (void)
  332. {
  333.     menuoff (currentmenu(), currentwindow());
  334.     menudel (currentmenu(), GetArg(1));
  335.     menuon  (currentmenu(), currentwindow());
  336. } /* do_delmenu */
  337.  
  338.  
  339.  
  340. /*****************************************************************************
  341.  
  342.     NAME
  343.     do_itemadd
  344.  
  345.     PARAMETER
  346.     void
  347.  
  348.     RESULT
  349.     -/-
  350.  
  351.     RETURN
  352.     void
  353.  
  354.     DESCRIPTION
  355.     [X]DME command interface for
  356.  
  357.     NOTES
  358.     major change due to suggestion of Karl ...
  359.  
  360.     BUGS
  361.  
  362.     EXAMPLES
  363.  
  364.     SEE ALSO
  365.  
  366.     INTERNALS
  367.  
  368.     HISTORY
  369.     20 Dec 1992 b_noll created
  370.     22 Jun 1994 b_noll enhanced functionality - is now also subadd, check, bar,...
  371.  
  372. ******************************************************************************/
  373.  
  374. void do_itemadd (void)
  375. {
  376.     char *iname, *sname, *scut;
  377.     int   chk;
  378.  
  379.     menuoff (currentmenu(), currentwindow());
  380.  
  381.     iname = GetArg(2);
  382.     SPLIT_SHORTCUT_NAME(&iname, &scut);
  383.  
  384.     if (SPLIT_SUBITEM_NAME(&iname, &sname)) {
  385.     chk = SPLIT_CHECK_NAME(&sname);
  386.     if (IS_BAR_NAME(&sname)) {
  387.         chk = 0;
  388.         scut = NULL;
  389.     } /* if */
  390.     subadd (currentmenu(), GetArg(1), iname, sname, GetArg(3), NULL, chk, scut);
  391.     } else {
  392.     chk = SPLIT_CHECK_NAME(&iname);
  393.     if (IS_BAR_NAME(&iname)) {
  394.         chk = 0;
  395.         scut = NULL;
  396.     } /* if */
  397.     itemadd (currentmenu(), GetArg(1), iname,       GetArg(3), NULL, chk, scut);
  398.     } /* if */
  399.  
  400.     menuon  (currentmenu(), currentwindow());
  401. } /* do_itemadd */
  402.  
  403.  
  404.  
  405. /*****************************************************************************
  406.  
  407.     NAME
  408.     do_itemcheck
  409.  
  410.     PARAMETER
  411.     void
  412.  
  413.     RESULT
  414.     -/-
  415.  
  416.     RETURN
  417.     void
  418.  
  419.     DESCRIPTION
  420.     [X]DME command interface for
  421.  
  422.     NOTES
  423.  
  424.     BUGS
  425.  
  426.     EXAMPLES
  427.  
  428.     SEE ALSO
  429.  
  430.     INTERNALS
  431.  
  432.     HISTORY
  433.     25 Jan 1993 b_noll created
  434.  
  435. ******************************************************************************/
  436.  
  437. void do_itemcheck (void)
  438. {
  439.     char *iname, *sname;
  440.  
  441.     menuoff (currentmenu(), currentwindow());
  442.  
  443.     iname = GetArg(2);
  444.     if (SPLIT_SUBITEM_NAME(&iname, &sname)) {
  445.     if (IS_BAR_NAME(&sname));
  446.     subadd    (currentmenu(), GetArg(1), iname, sname, GetArg(3), NULL, 1, NULL);
  447.     } else {
  448.     if (IS_BAR_NAME(&iname));
  449.     itemadd (currentmenu(), GetArg(1), iname,        GetArg(3), NULL, 1, NULL);
  450.     } /* if */
  451.     menuon  (currentmenu(), currentwindow());
  452. } /* do_itemcheck */
  453.  
  454.  
  455.  
  456. /*****************************************************************************
  457.  
  458.     NAME
  459.     do_itembar
  460.  
  461.     PARAMETER
  462.     void
  463.  
  464.     RESULT
  465.     -/-
  466.  
  467.     RETURN
  468.     void
  469.  
  470.     DESCRIPTION
  471.     [X]DME command interface for
  472.  
  473.     NOTES
  474.  
  475.     BUGS
  476.  
  477.     EXAMPLES
  478.  
  479.     SEE ALSO
  480.  
  481.     INTERNALS
  482.  
  483.     HISTORY
  484.     20 Dec 1992 b_noll created
  485.  
  486. ******************************************************************************/
  487.  
  488. void do_itembar (void)
  489. {
  490.     menuoff (currentmenu(), currentwindow());
  491.     itemadd (currentmenu(), GetArg(1), BAR, NULL, NULL, 0, NULL);
  492.     menuon  (currentmenu(), currentwindow());
  493. } /* do_itembar */
  494.  
  495.  
  496.  
  497. /*****************************************************************************
  498.  
  499.     NAME
  500.     do_subadd
  501.  
  502.     PARAMETER
  503.     void
  504.  
  505.     RESULT
  506.     -/-
  507.  
  508.     RETURN
  509.     void
  510.  
  511.     DESCRIPTION
  512.     [X]DME command interface for
  513.  
  514.     NOTES
  515.  
  516.     BUGS
  517.  
  518.     EXAMPLES
  519.  
  520.     SEE ALSO
  521.  
  522.     INTERNALS
  523.  
  524.     HISTORY
  525.     20 Dec 1992 b_noll created
  526.     22 Jun 1994 b_noll enhanced functionality
  527.  
  528. ******************************************************************************/
  529.  
  530. void do_subadd (void)
  531. {
  532.     int chk;
  533.     char *sname, *scut;
  534.     menuoff (currentmenu(), currentwindow());
  535.  
  536.     sname = GetArg(3);
  537.        SPLIT_SHORTCUT_NAME(&sname, &scut);
  538.     chk = SPLIT_CHECK_NAME(&sname);
  539.     if (IS_BAR_NAME(&sname)) {
  540.     chk = 0;
  541.     scut = NULL;
  542.     } /* if */
  543.     subadd  (currentmenu(), GetArg(1), GetArg(2), sname, GetArg(4), NULL, chk, scut);
  544.     menuon  (currentmenu(), currentwindow());
  545. } /* do_subadd */
  546.  
  547.  
  548.  
  549. /*****************************************************************************
  550.  
  551.     NAME
  552.     do_subcheck
  553.  
  554.     PARAMETER
  555.     void
  556.  
  557.     RESULT
  558.     -/-
  559.  
  560.     RETURN
  561.     void
  562.  
  563.     DESCRIPTION
  564.     [X]DME command interface for
  565.  
  566.     NOTES
  567.  
  568.     BUGS
  569.  
  570.     EXAMPLES
  571.  
  572.     SEE ALSO
  573.  
  574.     INTERNALS
  575.  
  576.     HISTORY
  577.     25 Jan 1993 b_noll created
  578.  
  579. ******************************************************************************/
  580.  
  581. void do_subcheck (void)
  582. {
  583.     menuoff (currentmenu(), currentwindow());
  584.     subadd  (currentmenu(), GetArg(1), GetArg(2), GetArg(3), GetArg(4), NULL, 1, NULL);
  585.     menuon  (currentmenu(), currentwindow());
  586. } /* do_subcheck */
  587.  
  588.  
  589.  
  590. /*****************************************************************************
  591.  
  592.     NAME
  593.     do_subbar
  594.  
  595.     PARAMETER
  596.     void
  597.  
  598.     RESULT
  599.     -/-
  600.  
  601.     RETURN
  602.     void
  603.  
  604.     DESCRIPTION
  605.     [X]DME command interface for
  606.  
  607.     NOTES
  608.  
  609.     BUGS
  610.  
  611.     EXAMPLES
  612.  
  613.     SEE ALSO
  614.  
  615.     INTERNALS
  616.  
  617.     HISTORY
  618.     20 Dec 1992 b_noll created
  619.  
  620. ******************************************************************************/
  621.  
  622. void do_subbar (void)
  623. {
  624.     menuoff (currentmenu(), currentwindow());
  625.     subadd  (currentmenu(), GetArg(1), GetArg(2), BAR, NULL, NULL, 0, NULL);
  626.     menuon  (currentmenu(), currentwindow());
  627. } /* do_subbar */
  628.  
  629.  
  630.  
  631. /*****************************************************************************
  632.  
  633.     NAME
  634.     do_delitem
  635.  
  636.     PARAMETER
  637.     void
  638.  
  639.     RESULT
  640.     -/-
  641.  
  642.     RETURN
  643.     void
  644.  
  645.     DESCRIPTION
  646.     [X]DME command interface for
  647.  
  648.     NOTES
  649.  
  650.     BUGS
  651.  
  652.     EXAMPLES
  653.  
  654.     SEE ALSO
  655.  
  656.     INTERNALS
  657.  
  658.     HISTORY
  659.     20 Dec 1992 b_noll created
  660.     22 Jun 1994 b_noll enhanced functionality
  661.  
  662. ******************************************************************************/
  663.  
  664. void do_delitem (void)
  665. {
  666.     char *iname, *sname;
  667.     menuoff (currentmenu(), currentwindow());
  668.     iname = GetArg(2);
  669.  
  670.     if (SPLIT_SUBITEM_NAME(&iname, &sname)) {
  671.     if (IS_BAR_NAME(&sname));
  672.     subdel    (currentmenu(), GetArg(1), iname, sname);
  673.     } else {
  674.     if (IS_BAR_NAME(&iname));
  675.     itemdel (currentmenu(), GetArg(1), iname);
  676.     } /* if */
  677.     menuon  (currentmenu(), currentwindow());
  678. } /* do_delitem */
  679.  
  680.  
  681.  
  682. /*****************************************************************************
  683.  
  684.     NAME
  685.     do_delitembar
  686.  
  687.     PARAMETER
  688.     void
  689.  
  690.     RESULT
  691.     -/-
  692.  
  693.     RETURN
  694.     void
  695.  
  696.     DESCRIPTION
  697.     [X]DME command interface for
  698.  
  699.     NOTES
  700.  
  701.     BUGS
  702.  
  703.     EXAMPLES
  704.  
  705.     SEE ALSO
  706.  
  707.     INTERNALS
  708.  
  709.     HISTORY
  710.     22 Dec 1992 b_noll created
  711.  
  712. ******************************************************************************/
  713.  
  714. void do_delitembar (void)
  715. {
  716.     menuoff (currentmenu(), currentwindow());
  717.     itemdel (currentmenu(), GetArg(1), BAR);
  718.     menuon  (currentmenu(), currentwindow());
  719. } /* do_delitembar */
  720.  
  721.  
  722.  
  723. /*****************************************************************************
  724.  
  725.     NAME
  726.     do_delsub
  727.  
  728.     PARAMETER
  729.     void
  730.  
  731.     RESULT
  732.     -/-
  733.  
  734.     RETURN
  735.     void
  736.  
  737.     DESCRIPTION
  738.     [X]DME command interface for
  739.  
  740.     NOTES
  741.  
  742.     BUGS
  743.  
  744.     EXAMPLES
  745.  
  746.     SEE ALSO
  747.  
  748.     INTERNALS
  749.  
  750.     HISTORY
  751.     20 Dec 1992 b_noll created
  752.     22 Jun 1994 b_noll enhanced functionality
  753.  
  754. ******************************************************************************/
  755.  
  756. void do_delsub (void)
  757. {
  758.     char *sname;
  759.     menuoff (currentmenu(), currentwindow());
  760.     sname = GetArg(3);
  761.     if (IS_BAR_NAME(&sname));
  762.     subdel  (currentmenu(), GetArg(1), GetArg(2), sname);
  763.     menuon  (currentmenu(), currentwindow());
  764. } /* do_del */
  765.  
  766.  
  767.  
  768. /*****************************************************************************
  769.  
  770.     NAME
  771.     do_delsubbar
  772.  
  773.     PARAMETER
  774.     void
  775.  
  776.     RESULT
  777.     -/-
  778.  
  779.     RETURN
  780.     void
  781.  
  782.     DESCRIPTION
  783.     [X]DME command interface for
  784.  
  785.     NOTES
  786.  
  787.     BUGS
  788.  
  789.     EXAMPLES
  790.  
  791.     SEE ALSO
  792.  
  793.     INTERNALS
  794.  
  795.     HISTORY
  796.     22 Dec 1992 b_noll created
  797.  
  798. ******************************************************************************/
  799.  
  800. void do_delsubbar (void)
  801. {
  802.     menuoff (currentmenu(), currentwindow());
  803.     subdel  (currentmenu(), GetArg(1), GetArg(2), BAR);
  804.     menuon  (currentmenu(), currentwindow());
  805. } /* do_delsubbar */
  806.  
  807.  
  808.  
  809. /*****************************************************************************
  810.  
  811.     NAME
  812.     do_menuclear
  813.  
  814.     PARAMETER
  815.     void
  816.  
  817.     RESULT
  818.     -/-
  819.  
  820.     RETURN
  821.     void
  822.  
  823.     DESCRIPTION
  824.     [X]DME command interface for
  825.  
  826.     NOTES
  827.  
  828.     BUGS
  829.  
  830.     EXAMPLES
  831.  
  832.     SEE ALSO
  833.  
  834.     INTERNALS
  835.  
  836.     HISTORY
  837.     20 Dec 1992 b_noll created
  838.  
  839. ******************************************************************************/
  840.  
  841. void do_menuclear (void)
  842. {
  843.     menuoff   (currentmenu(), currentwindow());
  844.     menuclear (currentmenu());
  845.     menuon    (currentmenu(), currentwindow());
  846. } /* do_menuclear */
  847.  
  848.  
  849.  
  850. /*****************************************************************************
  851.  
  852.     NAME
  853.     do_menuon
  854.  
  855.     PARAMETER
  856.     void
  857.  
  858.     RESULT
  859.     -/-
  860.  
  861.     RETURN
  862.     void
  863.  
  864.     DESCRIPTION
  865.     [X]DME command interface for
  866.  
  867.     NOTES
  868.  
  869.     BUGS
  870.  
  871.     EXAMPLES
  872.  
  873.     SEE ALSO
  874.  
  875.     INTERNALS
  876.  
  877.     HISTORY
  878.     20 Dec 1992 b_noll created
  879.  
  880. ******************************************************************************/
  881.  
  882. void do_menuon (void)
  883. {
  884.     menuon (currentmenu(), currentwindow());
  885. } /* do_menuon */
  886.  
  887.  
  888.  
  889. /*****************************************************************************
  890.  
  891.     NAME
  892.     do_menuoff
  893.  
  894.     PARAMETER
  895.     void
  896.  
  897.     RESULT
  898.     -/-
  899.  
  900.     RETURN
  901.     void
  902.  
  903.     DESCRIPTION
  904.     [X]DME command interface for
  905.  
  906.     NOTES
  907.  
  908.     BUGS
  909.  
  910.     EXAMPLES
  911.  
  912.     SEE ALSO
  913.  
  914.     INTERNALS
  915.  
  916.     HISTORY
  917.     20 Dec 1992 b_noll created
  918.  
  919. ******************************************************************************/
  920.  
  921. void do_menuoff (void)
  922. {
  923.     menuoff (currentmenu(), currentwindow());
  924. } /* do_menuoff */
  925.  
  926.  
  927.  
  928. /*****************************************************************************
  929.  
  930.     NAME
  931.     do_menusave
  932.  
  933.     PARAMETER
  934.     void
  935.  
  936.     RESULT
  937.     -/-
  938.  
  939.     RETURN
  940.     void
  941.  
  942.     DESCRIPTION
  943.     [X]DME command interface for
  944.  
  945.     NOTES
  946.  
  947.     BUGS
  948.  
  949.     EXAMPLES
  950.  
  951.     SEE ALSO
  952.  
  953.     INTERNALS
  954.  
  955.     HISTORY
  956.     20 Dec 1992 b_noll created
  957.  
  958. ******************************************************************************/
  959.  
  960. void do_menusave (void)
  961. {
  962.     menuoff   (currentmenu(), currentwindow());
  963.     menusave  (currentmenu(), GetArg(1));
  964.     menuon    (currentmenu(), currentwindow());
  965. } /* do_menusave */
  966.  
  967.  
  968.  
  969. /*****************************************************************************
  970.  
  971.     NAME
  972.     do_menuload
  973.  
  974.     PARAMETER
  975.     void
  976.  
  977.     RESULT
  978.     -/-
  979.  
  980.     RETURN
  981.     void
  982.  
  983.     DESCRIPTION
  984.     [X]DME command interface for
  985.  
  986.     NOTES
  987.  
  988.     BUGS
  989.  
  990.     EXAMPLES
  991.  
  992.     SEE ALSO
  993.  
  994.     INTERNALS
  995.  
  996.     HISTORY
  997.     20 Dec 1992 b_noll created
  998.  
  999. ******************************************************************************/
  1000.  
  1001. void do_menuload (void)
  1002. {
  1003.     menuoff   (currentmenu(), currentwindow());
  1004.     menuload  (currentmenu(), GetArg(1));
  1005.     menuon    (currentmenu(), currentwindow());
  1006. } /* do_menuload */
  1007.  
  1008.  
  1009.  
  1010. /*****************************************************************************
  1011.  
  1012.     NAME
  1013.     do_menutomacro
  1014.  
  1015.     PARAMETER
  1016.     char * str
  1017.  
  1018.     RESULT
  1019.     the command that is attached to the menu referred with str
  1020.  
  1021.     RETURN
  1022.     char *
  1023.  
  1024.     DESCRIPTION
  1025.     [X]DME vars interface for menu2macro
  1026.  
  1027.     NOTES
  1028.     that function was added 'cause in vars.c we use a
  1029.     table of all search-functions, and all the others
  1030.     do have only 1 argument
  1031.  
  1032.     BUGS
  1033.     never tested
  1034.  
  1035.     EXAMPLES
  1036.  
  1037.     SEE ALSO
  1038.  
  1039.     INTERNALS
  1040.  
  1041.     HISTORY
  1042.     22 Jan 1993 b_noll created
  1043.  
  1044. ******************************************************************************/
  1045.  
  1046. char * menutomacro (char * str)
  1047. {
  1048.     return (menu2macro (currentmenu(), str));
  1049. } /* menutomacro */
  1050.  
  1051.  
  1052.  
  1053. /*****************************************************************************
  1054.  
  1055.     NAME
  1056.     do_getcheckitem
  1057.  
  1058.     PARAMETER
  1059.     void
  1060.  
  1061.     RESULT
  1062.     -/-
  1063.  
  1064.     RETURN
  1065.     void
  1066.  
  1067.     DESCRIPTION
  1068.     [X]DME vars interface for
  1069.  
  1070.     NOTES
  1071.  
  1072.     BUGS
  1073.     never tested
  1074.  
  1075.     EXAMPLES
  1076.  
  1077.     SEE ALSO
  1078.  
  1079.     INTERNALS
  1080.  
  1081.     HISTORY
  1082.     25 Jan 1993 b_noll created
  1083.     22 Jun 1994 b_noll enhanced functionality
  1084.  
  1085. ******************************************************************************/
  1086.  
  1087. void do_getcheckitem (void)
  1088. {
  1089.     int  v;
  1090.     char vv[2] = "0";
  1091.     char *iname, *sname;
  1092.     if (SPLIT_SUBITEM_NAME(&iname, &sname))
  1093.     v = chksubcheck  (currentmenu(), iname, sname, GetArg(2));
  1094.     else
  1095.     v = chkitemcheck (currentmenu(), iname,        GetArg(2));
  1096.  
  1097.     if (v >= 0) {
  1098.     vv[0] = v+48;
  1099.     SetTypedVar (GetArg(3), vv, VAR_GV);
  1100.     } else {
  1101.     error ("%s:\n no check item of that name:\n %s-%s", CommandName(), GetArg(1), GetArg(2));
  1102.     } /* if */
  1103. } /* do_getcheckitem */
  1104.  
  1105.  
  1106.  
  1107. /*****************************************************************************
  1108.  
  1109.     NAME
  1110.     do_getchecksub
  1111.  
  1112.     PARAMETER
  1113.     void
  1114.  
  1115.     RESULT
  1116.     -/-
  1117.  
  1118.     RETURN
  1119.     void
  1120.  
  1121.     DESCRIPTION
  1122.     [X]DME vars interface for
  1123.  
  1124.     NOTES
  1125.  
  1126.     BUGS
  1127.     never tested
  1128.  
  1129.     EXAMPLES
  1130.  
  1131.     SEE ALSO
  1132.  
  1133.     INTERNALS
  1134.  
  1135.     HISTORY
  1136.     25 Jan 1993 b_noll created
  1137.  
  1138. ******************************************************************************/
  1139.  
  1140. void do_getchecksub (void)
  1141. {
  1142.     int  v;
  1143.     char vv[2] = "0";
  1144.  
  1145.     v = chksubcheck (currentmenu(), GetArg(1), GetArg(2), GetArg(3));
  1146.  
  1147.     if (v >= 0) {
  1148.     vv[0] = v+48;
  1149.     SetTypedVar (GetArg(4), vv, VAR_GV);
  1150.     } else {
  1151.     error ("%s:\n no check sub item of that name:\n %s-%s-%s", CommandName(), GetArg(1), GetArg(2), GetArg(3));
  1152.     } /* if */
  1153. } /* do_getchecksub */
  1154.  
  1155.  
  1156.  
  1157. /*****************************************************************************
  1158.  
  1159.     NAME
  1160.     do_setcheckitem
  1161.  
  1162.     PARAMETER
  1163.     void
  1164.  
  1165.     RESULT
  1166.     -/-
  1167.  
  1168.     RETURN
  1169.     void
  1170.  
  1171.     DESCRIPTION
  1172.     [X]DME vars interface for
  1173.  
  1174.     NOTES
  1175.  
  1176.     BUGS
  1177.     never tested
  1178.     toggle wont work
  1179.  
  1180.     EXAMPLES
  1181.  
  1182.     SEE ALSO
  1183.  
  1184.     INTERNALS
  1185.  
  1186.     HISTORY
  1187.     25 Jan 1993 b_noll created
  1188.     22 Jun 1994 b_noll enhanced functionality
  1189.  
  1190. ******************************************************************************/
  1191.  
  1192. void do_setcheckitem (void)
  1193. {
  1194.     int v;
  1195.  
  1196.     char *iname, *sname;
  1197.     if (SPLIT_SUBITEM_NAME(&iname, &sname))
  1198.     v = setsubcheck (currentmenu(), iname, sname, GetArg(2), test_arg(GetArg(3),1));
  1199.     else
  1200.     v = setitemcheck (currentmenu(), iname,       GetArg(2), test_arg(GetArg(3),1));
  1201.  
  1202.     if (v == RET_FAIL) {
  1203.     error ("%s:\n no check item of that name:\n %s-%s", CommandName(), GetArg(1), GetArg(2));
  1204.     } else {
  1205.     menu_strip (currentmenu(), Ep->win);
  1206.     } /* if */
  1207. } /* do_setcheckitem */
  1208.  
  1209.  
  1210.  
  1211. /*****************************************************************************
  1212.  
  1213.     NAME
  1214.     do_setchecksub
  1215.  
  1216.     PARAMETER
  1217.     void
  1218.  
  1219.     RESULT
  1220.     -/-
  1221.  
  1222.     RETURN
  1223.     void
  1224.  
  1225.     DESCRIPTION
  1226.     [X]DME vars interface for
  1227.  
  1228.     NOTES
  1229.  
  1230.     BUGS
  1231.     never tested
  1232.     toggle wont work
  1233.  
  1234.     EXAMPLES
  1235.  
  1236.     SEE ALSO
  1237.  
  1238.     INTERNALS
  1239.  
  1240.     HISTORY
  1241.     25 Jan 1993 b_noll created
  1242.  
  1243. ******************************************************************************/
  1244.  
  1245. void do_setchecksub (void)
  1246. {
  1247.     int v;
  1248.     v = setsubcheck (currentmenu(), GetArg(1), GetArg(2), GetArg(3), test_arg(GetArg(4),1));
  1249.     if (v == RET_FAIL) {
  1250.     error ("%s:\n no check sub item of that name:\n %s-%s-%s", CommandName(), GetArg(1), GetArg(2), GetArg(3));
  1251.     } else {
  1252.     menu_strip (currentmenu(), Ep->win);
  1253.     } /* if */
  1254. } /* do_setchecksub */
  1255.  
  1256.  
  1257. /*****************************************************************************
  1258.  
  1259.     NAME
  1260.     do_new_menustrip
  1261.  
  1262.     PARAMETER
  1263.     void
  1264.  
  1265.     RESULT
  1266.     -/-
  1267.  
  1268.     RETURN
  1269.     void
  1270.  
  1271.     DESCRIPTION
  1272.     command interface for keyaddes/qualifier
  1273.  
  1274.     NOTES
  1275.     <never tested>
  1276.  
  1277.     BUGS
  1278.     <none known>
  1279.  
  1280.     EXAMPLES
  1281.  
  1282.     SEE ALSO
  1283.  
  1284.     INTERNALS
  1285.  
  1286.     HISTORY
  1287.     28 Jan 1993  b_null created
  1288.  
  1289. ******************************************************************************/
  1290.  
  1291. void do_new_menustrip (void)
  1292. {
  1293.     MENUSTRIP * ms = new_menustrip (GetArg(1), 1);
  1294.  
  1295.     if (ms) {
  1296.     /* menuoff (currentmenu(), Ep->win); */
  1297.     Ep->menustrip = ms;
  1298.     menu_strip (currentmenu(), Ep->win);
  1299.     /* menuon  (currentmenu(), Ep->win); */
  1300.     } /* if */
  1301. } /* do_new_menustrip */
  1302.  
  1303.  
  1304.  
  1305. /*****************************************************************************
  1306.  
  1307.     NAME
  1308.     do_del_menustrip
  1309.  
  1310.     PARAMETER
  1311.     void
  1312.  
  1313.     RESULT
  1314.     -/-
  1315.  
  1316.     RETURN
  1317.     void
  1318.  
  1319.     DESCRIPTION
  1320.     command interface for keyaddes/qualifier
  1321.  
  1322.     NOTES
  1323.     <never tested>
  1324.     that function is highly dangerous!
  1325.  
  1326.  
  1327.     BUGS
  1328.     <none known>
  1329.  
  1330.     EXAMPLES
  1331.  
  1332.     SEE ALSO
  1333.  
  1334.     INTERNALS
  1335.  
  1336.     HISTORY
  1337.     28 Jan 1993  b_null created
  1338.  
  1339. ******************************************************************************/
  1340.  
  1341. void do_del_menustrip (void)
  1342. {
  1343.     MENUSTRIP * ms = currentmenu ();
  1344.     MENUSTRIP * ns;
  1345.     ED          * ep;
  1346.  
  1347.     menuoff (ms, Ep->win);          /* remove all strips */
  1348.  
  1349.     delete_menustrip (ms, 0);
  1350.     ns = get_menustrip (NULL);
  1351.  
  1352.     for (ep = GetHead (&DBase); ep; ep = GetSucc (ep)) {
  1353.     if (ep->menustrip == ms) {
  1354.         ep->menustrip = NULL; /* ns */
  1355.     } /* if */
  1356.     } /* for */
  1357.  
  1358.     menuoff (ns, Ep->win);          /* this is def_too != 0 since */
  1359.     menuon  (ns, Ep->win);          /* ns == get_menustrip(NULL)  */
  1360. } /* do_del_menustrip */
  1361.  
  1362.  
  1363.  
  1364. /*****************************************************************************
  1365.  
  1366.     NAME
  1367.     do_use_menustrip
  1368.  
  1369.     PARAMETER
  1370.     void
  1371.  
  1372.     RESULT
  1373.     -/-
  1374.  
  1375.     RETURN
  1376.     void
  1377.  
  1378.     DESCRIPTION
  1379.     command interface for keyaddes/qualifier
  1380.  
  1381.     NOTES
  1382.     <never tested>
  1383.  
  1384.     BUGS
  1385.     <none known>
  1386.  
  1387.     EXAMPLES
  1388.  
  1389.     SEE ALSO
  1390.  
  1391.     INTERNALS
  1392.  
  1393.     HISTORY
  1394.     28 Jan 1993  b_null created
  1395.  
  1396. ******************************************************************************/
  1397.  
  1398. void do_use_menustrip (void)
  1399. {
  1400.     MENUSTRIP * ms = get_menustrip (GetArg (1));
  1401.  
  1402.     if (ms) {
  1403.     Ep->menustrip = ms;
  1404.     menu_strip (ms, Ep->win);
  1405.     } /* if */
  1406. } /* do_use_menustrip */
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412. /*****************************************************************************
  1413.  
  1414.     NAME
  1415.     menufind
  1416.     menugethelp
  1417.     menusethelp
  1418.     menugetcommand
  1419.     menusetcommand
  1420.     menucall
  1421.  
  1422.     PARAMETER
  1423.  
  1424.     RESULT
  1425.  
  1426.     RETURN
  1427.  
  1428.     DESCRIPTION
  1429.     interfaces to support handles used by the
  1430.     STATIC Command Interface
  1431.     in order to enable use of COMTREE menu
  1432.     as well as VARTREE menucomm/menuhelp
  1433.  
  1434.     NOTES
  1435.     <never tested>
  1436.  
  1437.     BUGS
  1438.     <none known>
  1439.  
  1440.     EXAMPLES
  1441.  
  1442.     SEE ALSO
  1443.  
  1444.     INTERNALS
  1445.  
  1446.     HISTORY
  1447.     05-08-94 null created
  1448.  
  1449. ******************************************************************************/
  1450.  
  1451. #ifdef STATIC_COM
  1452.  
  1453.  
  1454. Prototype APTR menufind (char *name);
  1455. APTR menufind (char *name) {
  1456.     return findmenu(currentmenu(), name);
  1457. } /* menufind */
  1458.  
  1459. Prototype char *menugethelp(APTR handle);
  1460. char *menugethelp(APTR handle) {
  1461.     return ((XITEM *)handle)->help;
  1462. } /* menugethelp */
  1463.  
  1464. Prototype char *menugetcommand(APTR handle);
  1465. char *menugetcommand(APTR handle) {
  1466.     return ((XITEM *)handle)->com;
  1467. } /* menugetcommand */
  1468.  
  1469. Prototype char *menusetcommand(APTR handle, char *val);
  1470. char *menusetcommand(APTR handle, char *val) {
  1471.     char *ptr;
  1472.     if (ptr = DupFunc(val)) {
  1473.     DeallocFunc(((XITEM *)handle)->com);
  1474.     ((XITEM *)handle)->com = ptr;
  1475.     return TRUE;
  1476.     } /* if */
  1477.     nomemory();
  1478.     return FALSE;
  1479. } /* menusetcommand */
  1480.  
  1481. Prototype char *menusethelp (APTR handle, char *val);
  1482. char *menusethelp (APTR handle, char *val) {
  1483.     char *ptr;
  1484.     if (ptr = DupFunc(val)) {
  1485.     DeallocFunc(((XITEM *)handle)->help);
  1486.     ((XITEM *)handle)->help = ptr;
  1487.     return TRUE;
  1488.     } /* if */
  1489.     nomemory();
  1490.     return FALSE;
  1491. } /* menusethelp */
  1492.  
  1493. Prototype int menucall (APTR handle);
  1494. int menucall (APTR handle) {
  1495.     char *ptr;
  1496.     if (ptr = strdup(menugetcommand(handle))) {
  1497.     retval = do_command(ptr);
  1498.     free (ptr);
  1499.     return OK;
  1500.     } /* if */
  1501.     nomemory();
  1502.     return FALSE;
  1503. } /* menucall */
  1504.  
  1505. #endif STATIC_COM
  1506.  
  1507. #ifdef PATCH_NULL
  1508.  
  1509. /* **************************************************
  1510.     STATIC XDME Command Interface
  1511. ************************************************** //
  1512.  
  1513. //        Name      #Args Function          Flags
  1514. :FX:COMMAND menuadd      3 do_itemadd
  1515. :FX:COMMAND menubar      1 do_itembar
  1516. :FX:COMMAND menucheck      3 do_itemcheck
  1517. :FX:COMMAND menuclear      0 do_menuclear
  1518. :FX:COMMAND menudel      2 do_delitem
  1519. :FX:COMMAND menudelbar      1 do_delitembar
  1520. :FX:COMMAND menudelhdr      1 do_delmenu
  1521. :FX:COMMAND menudelsub      3 do_delsub
  1522. :FX:COMMAND menudelsubar  2 do_delsubbar
  1523. :FX:COMMAND menugetcheck  3 do_getcheckitem
  1524. :FX:COMMAND menugetscheck 4 do_getchecksub
  1525. :FX:COMMAND menuload      1 do_menuload
  1526. :FX:COMMAND menuoff      0 do_menuoff
  1527. :FX:COMMAND menuon      0 do_menuon
  1528. :FX:COMMAND menusave      1 do_menusave
  1529. :FX:COMMAND menusetcheck  3 do_setcheckitem
  1530. :FX:COMMAND menusetscheck 4 do_setchecksub
  1531. :FX:COMMAND menusubadd      4 do_subadd
  1532. :FX:COMMAND menusubbar      2 do_subbar
  1533. :FX:COMMAND menusubcheck  4 do_subcheck
  1534. :FX:COMMAND newmenustrip  1 do_new_menustrip
  1535. :FX:COMMAND usemenustrip  1 do_use_menustrip
  1536. //X:COMMAND remmenustrip  1 do_del_menustrip    // that function is not stable yet
  1537.  
  1538.  
  1539. //        Name   Pri Lock        Unlock   Call        NArgs
  1540. :FX:COMTREE menu     1 menufind     NULL     Call=menucall  NULL
  1541.  
  1542. //        Name   Pri Lock        Unlock   Get        Set            Unset
  1543. :FX:VARTREE menu     1 menufind     NULL     Get=menugetcommand Set=menusetcommand  Unset=NULL
  1544. :FX:VARTREE menuhelp 1 menufind     NULL     Get=menugethelp    Set=menusethelp     Unset=NULL
  1545.  
  1546. // **************************************************
  1547.     DYNAMIC XDME Command Interface
  1548. ************************************************** */
  1549.  
  1550. static const
  1551. struct CommandNode MENU_Commands[] = {
  1552.     {ENODE("menuadd"),       3,        CF_VWM|CF_ICO, (FPTR)do_itemadd  },
  1553.     {ENODE("menubar"),       1,        CF_VWM|CF_ICO, (FPTR)do_itembar  },
  1554.     {ENODE("menucheck"),     3,        CF_VWM|CF_ICO, (FPTR)do_itemcheck    },
  1555.     {ENODE("menuclear"),     0,        CF_VWM|CF_ICO, (FPTR)do_menuclear    },
  1556.     {ENODE("menudel"),       2,        CF_VWM|CF_ICO, (FPTR)do_delitem  },
  1557.     {ENODE("menudelbar"),    1,        CF_VWM|CF_ICO, (FPTR)do_delitembar   },
  1558.     {ENODE("menudelhdr"),    1,        CF_VWM|CF_ICO, (FPTR)do_delmenu  },
  1559.     {ENODE("menudelsub"),    3,        CF_VWM|CF_ICO, (FPTR)do_delsub   },
  1560.     {ENODE("menudelsubar"),  2,        CF_VWM|CF_ICO, (FPTR)do_delsubbar    },
  1561.     {ENODE("menugetcheck"),  3,        CF_VWM|CF_ICO, (FPTR)do_getcheckitem },
  1562.     {ENODE("menugetscheck"), 4,        CF_VWM|CF_ICO, (FPTR)do_getchecksub  },
  1563.     {ENODE("menuload"),      1,        CF_VWM|CF_ICO, (FPTR)do_menuload }, /* tester */
  1564.     {ENODE("menuoff"),       0,        CF_VWM|CF_ICO, (FPTR)do_menuoff  },
  1565.     {ENODE("menuon"),        0,        CF_VWM|CF_ICO, (FPTR)do_menuon   },
  1566.     {ENODE("menusave"),      1,        CF_VWM|CF_ICO, (FPTR)do_menusave }, /* tester */
  1567.     {ENODE("menusetcheck"),  3,        CF_VWM|CF_ICO, (FPTR)do_setcheckitem },
  1568.     {ENODE("menusetscheck"), 4,        CF_VWM|CF_ICO, (FPTR)do_setchecksub  },
  1569.     {ENODE("menusubadd"),    4,        CF_VWM|CF_ICO, (FPTR)do_subadd   },
  1570.     {ENODE("menusubbar"),    2,        CF_VWM|CF_ICO, (FPTR)do_subbar   },
  1571.     {ENODE("menusubcheck"),  4,        CF_VWM|CF_ICO, (FPTR)do_subcheck },
  1572.     {ENODE("newmenustrip"),  1, CF_VWM|CF_ICO|CF_COK, (FPTR)do_new_menustrip    },
  1573.  /* {ENODE("remmenustrip"),  1, CF_VWM|CF_ICO|CF_COK, (FPTR)do_del_menustrip    }, */ /* that function is not stable yet */
  1574.     {ENODE("usemenustrip"),  1, CF_VWM|CF_ICO|CF_COK, (FPTR)do_use_menustrip    },
  1575. };
  1576.  
  1577.  
  1578. MK_AUTOINIT( MENU_init )
  1579. {
  1580.     int i;
  1581.  
  1582.     for (i = sizeof (MENU_Commands)/sizeof (struct CommandNode) - 1;i >= 0; --i)
  1583.     COM_Add (&MENU_Commands[i]);
  1584.  
  1585.  /* COM_AddClass()   ->menutomacro */
  1586.  /* COM_AddVarClass()->menutomacro */
  1587. } /* MENU_init */
  1588.  
  1589.  
  1590. MK_AUTOEXIT( MENU_Exit )
  1591. {
  1592.     int  i;
  1593.     APTR lock;
  1594.  
  1595.     for (i = sizeof (MENU_Commands)/sizeof (struct CommandNode) - 1; (i >= 0); DEC(i))
  1596.     if ((lock = COM_Lock (MENU_Commands[i].cn_Name)))
  1597.         COM_Remove (lock);
  1598. } /* MENU_Exit */
  1599. #endif
  1600.  
  1601.  
  1602.  
  1603. /******************************************************************************
  1604. *****  ENDE menucom.c
  1605. ******************************************************************************/
  1606.