home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
menustuf.sit
/
PromoteMenu.p
< prev
next >
Wrap
Text File
|
1990-04-16
|
1KB
|
66 lines
Program PromoteMenu;
{
This program is an MPW tool which removes a menu from the hierarchical
portion of the menu list and adds it onto the end of the menu bar.
Call it from the MPW Shell as follows:
PromoteMenu [menuName]
where menuName is the name of the menu to be promoted. If the argument
is omitted, a list of all the current top-level menus is written to
the standard output, as a sequence of PromoteMenu 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 ListTopLevel
(
ThisMenu : MenuHandle;
var KeepGoing : Boolean;
Ignored : univ LongInt
);
{ handler which generates the list of promoted menus. }
Var
ThisMenuName : Str255;
Begin
ThisMenuName := ThisMenu^^.MenuData;
Writeln(Output, ArgV^[0]^, ' ', Quote(ThisMenuName))
End {ListTopLevel};
Begin {PromoteMenu}
InitGraf(@ThePort);
If ArgC > 1 then
Begin
TheMenu := FindSubMenu(ArgV^[1]^);
If TheMenu <> Nil then
Begin
DeleteMenu(TheMenu^^.MenuID);
InsertMenu(TheMenu, 0);
DrawMenuBar
End
else
Begin
Writeln(Diagnostic, '### ', ArgV^[0]^, ' - submenu "', ArgV^[1]^, '" not found');
IEExit(2)
End
End
else
TraverseMenus(@ListTopLevel, Nil)
End {PromoteMenu}.