www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/saveproject.m

    function msg = saveproject(h,SaveAs)
%SAVEPROJECT Save current project
%
%  SAVEPROJECT(CGB, SaveAs) where SaveAs = true/false will save the current
%  project.  If the project has not yet been saved, a SaveAs operation will
%  always be performed.

%  Copyright 2000-2016 The MathWorks, Inc. and Ford Global Technologies, Inc.


if h.GUIExists
    MP = h.RootNode.info;

    msgID = h.addStatusMsg('Saving project...');
    cnode = h.CurrentNode;
    csubitem = h.CurrentSubItem;
    h.setnewnode(xregpointer, xregpointer);
    if ~isempty(cnode) && ~isnull(cnode)
        LastNode = [cnode csubitem];
    else
        LastNode = [];
    end
    
    [MP,msg] = save(MP,SaveAs,LastNode);

    h.setnewnode(cnode, csubitem);
    if SaveAs
        doDrawTree(h,h.RootNode,'update')
    end
    if isnull(cnode)
        % Need to force an update of title bar
        h.doDrawText;
    end
    if isempty(msg)
        % add a new reference to File List
        h.addToFileList(MP);
    elseif strcmp(msg,'Cancel')
        msg = '';
    end
    h.removeStatusMsg(msgID);
end