home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
menustuf.sit
/
DemoteMenu.p
< prev
next >
Wrap
Text File
|
1990-04-16
|
1KB
|
66 lines
Program DemoteMenu;
{
This program is an MPW tool which removes a menu from the menu bar and
moves it into the hierarchical menu list. Call it from the MPW Shell
as follows:
DemoteMenu [menuName]
where menuName is the name of the menu to be demoted. If the argument
is omitted, a list of the names of all currently-demoted menus is
written to the standard output, as a list of DemoteMenu commands.
First working version by LDO 1989 January 4.
Modified 1989 January 6 to add listing function.
Modified 1989 January 9 to use nicer quoting function.
}
Uses
MemTypes,
QuickDraw,
OSIntf,
ToolIntf,
IntEnv,
MenuStuffCommon;
Var
TheMenu : MenuHandle;
ItemNo : LongInt;
Procedure ListDemoted
(
ThisMenu : MenuHandle;
var KeepGoing : Boolean;
Ignored : univ LongInt
);
{ handler which generates the list of demoted menus. }
Var
ThisMenuName : Str255;
Begin
ThisMenuName := ThisMenu^^.MenuData;
Writeln(Output, ArgV^[0]^, ' ', Quote(ThisMenuName))
End {ListDemoted};
Begin {DemoteMenu}
InitGraf(@ThePort);
If ArgC > 1 then
Begin
TheMenu := FindMenu(ArgV^[1]^);
If TheMenu <> Nil then
Begin
DeleteMenu(TheMenu^^.MenuID);
InsertMenu(TheMenu, HierMenu);
DrawMenuBar
End
else
Begin
Writeln(Diagnostic, '### ', ArgV^[0]^, ' - top-level menu "', ArgV^[1]^, '" not found');
IEExit(2)
End
End
else
TraverseSubMenus(@ListDemoted, Nil)
End {DemoteMenu}.