/* LockObj.pvrx
   Copyright © 1991 by Stylus, Inc.
   Author - Jeff Blume

To run from its own User Menu item, add this line to
	ProVector.pvrx:  'Define "LockObj" "LockObj MENU"'

To run from User/Rexxecute type "MENU" after the filename in the
	macro file requester.  Thus 'File' text gadget
	should read "LockObj  MENU".

*************** ROSS ************************************
Will lock out most operations, but not ReLayer Obj..., Align
	by Points...
Can't "CHANGE Anyway" even if it did parse the 8th and 9th args.
	So should trap "CHANGE Anyway" and say can't!
*************** ROSS ************************************

*/

options results 

/* Get the argument list to see whether this is a MENU, or a CallBack */
arg arglist
Cmd = word(arglist,1)
Obj = word(arglist,2)

/* Always do this for a ProVector AREXX macro */
/* This waits its turn to execute */
'Lock Wait'

if Cmd = 'MENU' then do		/* This was called from the menu */
				/* "Lock" all selected objs with callback */
	'SelectList' Sel; SelN = Result
	do i = 0 to SelN-1
		'Rexx' Sel.i LockObj UnGroup Clone Move Rotate Size Change Delete Cut Copy
	end
end

else if Cmd = 'UNGROUP' then do
	'GetBool "Unlock object?" "Yes" "No"'
	if RC = 0 then do
		/* Decrement the lock counter */
		'UnGroup Obj'
	end
end

else do				/* This was a CallBack */
	Prompt = '"Object Locked! '||Cmd||' Anyway?"'
	'GetBool'  Prompt Yes No
	if RC = 0 then do
		/*interpret arglist*/
		/*neg value in args evaluated as expression (breaks)*/
		command = '"'||word(arglist,1)||'" "'||word(arglist,2)||'" "'||word(arglist,3)||'" "'||word(arglist,4)||'" "'||word(arglist,5)||'" "'||word(arglist,6)||'"'
		interpret command
		'Repair'
		'GetBool "Still Locked! UnGroup to UnLock." OK OK'
	end
	else 'GetBool "Use UnGroup tool to UnLock." OK OK'
end

/* All done!  Unlock ProVector */
'UnLock'
