www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/forceclose.m
function forceclose(h) %FORCECLOSE Close cgbrowser figure % % FORCECLOSE(CGB) closes the browser without saving the current project. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. if h.GUIExists try % Save size etc ap = mbcprefs('mbc'); p = getpref(ap,'cgbrowser'); sp = get(h.Hand.Figure.TreeSplit,'split'); p.treew = sp(1); sp = get(h.Hand.Figure.ListSplit,'split'); p.listh = sp(1); sp = get(h.Hand.Toolbar.Split,'split'); p.tbsplit = sp; setpref(ap,'cgbrowser',p); catch warning(message('mbc:cgtools:cgbrowser:InvalidState')); end try % clean up current view OK = h.HideNode; catch OK = 0; end if OK % Close the project without a save MP = h.RootNode.info; MP = setmodified(MP,0); try [MP,msg] = close(MP); catch msg = 'Unknown error during project close.'; end if ~isempty(msg) h.ShowNode; h.ViewNode; return else try deleteproject(MP); catch warning(message('mbc:cgtools:cgbrowser:InvalidState8')); end try % Close surface viewer cgsurfaceviewer('close'); catch warning(message('mbc:cgtools:cgbrowser:InvalidState9')); end try % Make sure registered figures close h.destroyallsubfigures; catch warning(message('mbc:cgtools:cgbrowser:InvalidState10')); end try delete(h.Figure); catch warning(message('mbc:cgtools:cgbrowser:InvalidState11')); end try % perform shutdown tasks cg_shutdown; catch warning(message('mbc:cgtools:cgbrowser:InvalidState12')); end end end end