|
From: creedon <icr...@us...> - 2005-10-02 18:19:37
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19562 Modified Files: shellmenu.c menu.c Log Message: make shellupdateopenrecentmenu less Mac specific, created functions deletemenuitems and disableallmenuitems, also when no files are listed in the menu, disable al menu items Index: shellmenu.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/shellmenu.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shellmenu.c 1 Oct 2005 17:34:33 -0000 1.5 --- shellmenu.c 2 Oct 2005 18:19:29 -0000 1.6 *************** *** 2312,2316 **** static boolean openrecentmenuitemsvisit (bigstring bs, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) { ! /* 2005-09-24 creedon */ register hdlmenu hmenu; --- 2312,2318 ---- static boolean openrecentmenuitemsvisit (bigstring bs, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) { ! /* ! 2005-09-24 creedon: created ! */ register hdlmenu hmenu; *************** *** 2330,2334 **** void shellupdateopenrecentmenu (void) { ! /* 2005-09-22 creedon */ bigstring bs; --- 2332,2341 ---- void shellupdateopenrecentmenu (void) { ! /* ! 2005-10-01 creedon: when no files are listed in the menu, disable al menu items ! made more accessible to windows platform ! ! 2005-09-22 creedon: created ! */ bigstring bs; *************** *** 2339,2343 **** hmenu = shellmenuhandle (openrecentmenu); ! DeleteMenuItems (hmenu, 1, CountMenuItems (hmenu) - 2); getsystemtablescript (idopenrecentmenutable, bs); // "user.prefs.openrecentmenu.items" --- 2346,2350 ---- hmenu = shellmenuhandle (openrecentmenu); ! deletemenuitems (hmenu, 1, countmenuitems (hmenu) - 2); getsystemtablescript (idopenrecentmenutable, bs); // "user.prefs.openrecentmenu.items" *************** *** 2355,2358 **** --- 2362,2368 ---- if (fl) hashsortedinversesearch (htable, &openrecentmenuitemsvisit, nil); + + if (countmenuitems (hmenu) == 2) + disableallmenuitems (hmenu); } Index: menu.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/menu.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** menu.c 11 Jan 2005 22:48:09 -0000 1.4 --- menu.c 2 Oct 2005 18:19:29 -0000 1.5 *************** *** 1671,1674 **** --- 1671,1724 ---- + boolean deletemenuitems (hdlmenu hmenu, short firstitem, short itemcount) { + + /* + 2005-10-01 creedon: created, delete menu items starting at firstitem for itemcount + */ + + boolean fl = true; + + #ifdef MACVERSION + fl = DeleteMenuItems (hmenu, firstitem, itemcount) == noErr; + #endif + + #ifdef WIN95VERSION + register short ctitems = countmenuitems (hmenu); + register short i; + + if (itemcount > ctitems) + itemcount = ctitems; + + for (i = itemcount; i >= firstitem; i--) + if (!deletemenuitem (hmenu, i)) { + fl = false; + break; + } + #endif + + return (fl); + + } /* deletemenuitems */ + + + void disableallmenuitems (hdlmenu hmenu) { + /* + 2005-10-01 creedon: created + */ + + #ifdef MACVERSION + DisableAllMenuItems (hmenu); + #endif + + #ifdef WIN95VERSION + register short ct = countmenuitems (hmenu); + register short i; + + for (i = ct; i > 0; i--) + disablemenuitem (hmenu, i); + + #endif + + } /* disableallmenuitems */ |