function editmenufcn(hfig, cmd)
%EDITMENUFCN Implements part of the figure edit menu.
%  EDITMENUFCN(H, CMD) invokes edit menu command CMD in figure H.
%  CMD can be one of the following:
%    EditPost
%    EditUndo (PC only)
%    EditCopyFigure (PC only)
%    EditCopyOptions (PC only)
         
%  Damian T. Packer, 11 June 1998
%  Copyright (c) 1984-98 by The MathWorks, Inc.
%  $Revision: 1.2 $  $Date: 1998/06/24 04:13:03 $

error(nargchk(2,2,nargin))
if ~ishandle(hfig) | ~strcmp(get(hfig, 'type'), 'figure')
  error('first argument must be a figure handle');
elseif ~isstr(cmd)
  error('second argument must be a string');
end

ispc = strcmp(computer, 'PCWIN');

if strcmp(cmd, 'EditPost')
  %
  % The first time the EditPost callback is called, hide any
  % non-functional items on Unix.
  % Also, if necessary, enable or disable any items on the editmenu
  % based on their context.
  %
  if ~ispc
    edit = findall(allchild(hfig),'type','uimenu','label','&Edit');
    set(findall(edit,'label','&Undo'),'visible','off');
    set(findall(edit,'label','Copy &Figure'),'visible','off');
    set(findall(edit,'label','Copy &Options...'),'visible','off');
    set(findall(edit,'label','Cu&t'),'separator','off');
    drawnow;
    % hide non-functional unix items
  end
  
else
  %
  % All other callbacks happen to be implemented built-in on the
  % PC, so just pass the input arguments through if we're on the
  % PC.  If we're on Unix, we need to implement the ones we can in
  % M.
  %
  if ispc
    uimenufcn(hfig, cmd);
  
  else % we're on UNIX:
    
    switch cmd
      case 'EditUndo'
	% do undo stuff
	
      case 'EditCopyFigure'
	% do copyfigure stuff
	
      case 'EditCopyOptions'
	% do copyoptions stuff

      otherwise
	error(['unrecognized argument ''',cmd,''''])
    
    end
  end
end
