function A = updatemenu(A)
%EDITLINE/UPDATEMENU  Update context menus for editline objects

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.5 $  $Date: 2000/06/01 02:52:38 $

menu = get(A,'UIContextMenu');

% update style selection
lineStyle = get(A,'LineStyle');
% menu children are listed in reverse order!
styles = {...
   '-.','dashdot',
   ':','dot',
   '--','dash',
   '-','solid',
   };

styleMenu = findall(menu,'Tag','ScribeEditlineObjStyleMenu');
submenus = allchild(styleMenu);
whichStyle = find(strcmp(lineStyle,styles(:,1)));

set(submenus,'Checked','off');
set(submenus(whichStyle),'Checked','on');


% update size selection
lineSize = get(A,'LineWidth');
% menu children are listed in reverse order!
% first entry is a placeholder for the "more" option
sizes = [...
   0
   10
   9
   8
   7
   6
   5
   4
   3
   2
   1
   0.5
   ];

sizeMenu = findall(menu,'Tag','ScribeEditlineObjSizeMenu');
submenus = allchild(sizeMenu);
whichSize = find(lineSize==sizes);

set(submenus,'Checked','off');
set(submenus(whichSize),'Checked','on');
