www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/doDrawMenus.m
function doDrawMenus(h) %DODRAWMENUS Update recent-file menu of browser % % DODRAWMENUS(CGB) updates the recent-file menu in the browser so that it % matches the current list in the preferences. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. % Update the recent file list in the File Menu AP = mbcprefs('mbc'); cgbprefs = getpref(AP,'cgbrowser'); if isempty(cgbprefs.FileList) set(h.Hand.Menubar.File.recentFiles,'Visible','off'); else n = length(cgbprefs.FileList); lbls = cell(n, 1); cbs = cell(n, 1); for i = n:-1:1 file = cgbprefs.FileList(i).File; if length(file)>25 lbls(i)={sprintf('&%d %s...%s',i, file(1:3), file(end-18:end))}; else lbls(i)={sprintf('&%d %s',i, file)}; end cbs(i) = {{@i_openfile,h,file}}; end set(h.Hand.Menubar.File.recentFiles(1:n), ... 'Visible','on', ... {'Label'},lbls(:), ... {'Callback'},cbs(:)); set(h.Hand.Menubar.File.recentFiles(n+1:end), 'Visible', 'off'); end function i_openfile(srcobj, evt, h, file) PR = xregGui.PointerRepository; PR.stackSetPointer(h.Figure,'watch'); h.openproject(file); PR.stackClearAndReset(h.Figure);